agentv 4.12.0 → 4.12.2-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,4 +62,4 @@ Error generating stack: `+s.message+`
62
62
  *
63
63
  * This source code is licensed under the MIT license found in the
64
64
  * LICENSE file in the root directory of this source tree.
65
- */var Ky;function PS(){if(Ky)return df;Ky=1;var n=Xi(),l=$S();function i(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var r=typeof Object.is=="function"?Object.is:i,o=l.useSyncExternalStore,d=n.useRef,h=n.useEffect,g=n.useMemo,p=n.useDebugValue;return df.useSyncExternalStoreWithSelector=function(m,x,v,S,j){var N=d(null);if(N.current===null){var E={hasValue:!1,value:null};N.current=E}else E=N.current;N=g(function(){function w(ee){if(!$){if($=!0,X=ee,ee=S(ee),j!==void 0&&E.hasValue){var P=E.value;if(j(P,ee))return L=P}return L=ee}if(P=L,r(X,ee))return P;var F=S(ee);return j!==void 0&&j(P,F)?(X=ee,P):(X=ee,L=F)}var $=!1,X,L,Z=v===void 0?null:v;return[function(){return w(x())},Z===null?void 0:function(){return w(Z())}]},[x,v,S,j]);var C=o(m,N[0],N[1]);return h(function(){E.hasValue=!0,E.value=C},[C]),p(C),C},df}var Vy;function FS(){return Vy||(Vy=1,ff.exports=PS()),ff.exports}var JS=FS();function IS(n,l){return n===l}function dt(n,l,i=IS){const r=Q.useCallback(h=>{if(!n)return()=>{};const{unsubscribe:g}=n.subscribe(h);return g},[n]),o=Q.useCallback(()=>n==null?void 0:n.get(),[n]);return JS.useSyncExternalStoreWithSelector(r,o,o,l,i)}var WS={state:void 0,get:()=>{},subscribe:()=>()=>{}};function vs(n){const l=gt(),i=Q.useContext(n.from?QS:zu),r=n.from??i,o=r?n.from?l.stores.getMatchStoreByRouteId(r):l.stores.activeMatchStoresById.get(r):void 0,d=Q.useRef(void 0);return dt(o??WS,h=>{if((n.shouldThrow??!0)&&!h&&Va(),h===void 0)return;const g=n.select?n.select(h):h;if(n.structuralSharing??l.options.defaultStructuralSharing){const p=Ka(d.current,g);return d.current=p,p}return g})}function Gg(n){return vs({from:n.from,strict:n.strict,structuralSharing:n.structuralSharing,select:l=>n.select?n.select(l.loaderData):l.loaderData})}function Kg(n){const{select:l,...i}=n;return vs({...i,select:r=>l?l(r.loaderDeps):r.loaderDeps})}function Vg(n){return vs({from:n.from,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,strict:n.strict,select:l=>{const i=n.strict===!1?l.params:l._strictParams;return n.select?n.select(i):i}})}function Xg(n){return vs({from:n.from,strict:n.strict,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,select:l=>n.select?n.select(l.search):l.search})}function Du(n){const l=gt();return Q.useCallback(i=>l.navigate({...i,from:i.from??(n==null?void 0:n.from)}),[n==null?void 0:n.from,l])}function Zg(n){return vs({...n,select:l=>n.select?n.select(l.context):l.context})}var e1=dg();function t1(n,l){const i=gt(),r=Lb(l),{activeProps:o,inactiveProps:d,activeOptions:h,to:g,preload:p,preloadDelay:m,hashScrollIntoView:x,replace:v,startTransition:S,resetScroll:j,viewTransition:N,children:E,target:C,disabled:w,style:$,className:X,onClick:L,onBlur:Z,onFocus:ee,onMouseEnter:P,onMouseLeave:F,onTouchStart:J,ignoreBlocker:K,params:I,search:se,hash:le,state:ue,mask:te,reloadDocument:D,unsafeRelative:V,from:ae,_fromLocation:he,...fe}=n,T=Ug(),Y=Q.useMemo(()=>n,[i,n.from,n._fromLocation,n.hash,n.to,n.search,n.params,n.state,n.mask,n.unsafeRelative]),q=dt(i.stores.location,Se=>Se,(Se,ht)=>Se.href===ht.href),W=Q.useMemo(()=>{const Se={_fromLocation:q,...Y};return i.buildLocation(Se)},[i,q,Y]),me=W.maskedLocation?W.maskedLocation.publicHref:W.publicHref,xe=W.maskedLocation?W.maskedLocation.external:W.external,be=Q.useMemo(()=>r1(me,xe,i.history,w),[w,xe,me,i.history]),Pe=Q.useMemo(()=>{if(be!=null&&be.external)return Ru(be.href,i.protocolAllowlist)?void 0:be.href;if(!u1(g)&&!(typeof g!="string"||g.indexOf(":")===-1))try{return new URL(g),Ru(g,i.protocolAllowlist)?void 0:g}catch{}},[g,be,i.protocolAllowlist]),He=Q.useMemo(()=>{if(Pe)return!1;if(h!=null&&h.exact){if(!Wb(q.pathname,W.pathname,i.basepath))return!1}else{const Se=_u(q.pathname,i.basepath),ht=_u(W.pathname,i.basepath);if(!(Se.startsWith(ht)&&(Se.length===ht.length||Se[ht.length]==="/")))return!1}return((h==null?void 0:h.includeSearch)??!0)&&!ms(q.search,W.search,{partial:!(h!=null&&h.exact),ignoreUndefined:!(h!=null&&h.explicitUndefined)})?!1:h!=null&&h.includeHash?T&&q.hash===W.hash:!0},[h==null?void 0:h.exact,h==null?void 0:h.explicitUndefined,h==null?void 0:h.includeHash,h==null?void 0:h.includeSearch,q,Pe,T,W.hash,W.pathname,W.search,i.basepath]),ra=He?wn(o,{})??a1:yf,va=He?yf:wn(d,{})??yf,Ss=[X,ra.className,va.className].filter(Boolean).join(" "),Ml=($||ra.style||va.style)&&{...$,...ra.style,...va.style},[xa,js]=Q.useState(!1),Ns=Q.useRef(!1),ka=n.reloadDocument||Pe?!1:p??i.options.defaultPreload,Rs=m??i.options.defaultPreloadDelay??0,ta=Q.useCallback(()=>{i.preloadRoute({...Y,_builtLocation:W}).catch(Se=>{console.warn(Se),console.warn(DS)})},[i,Y,W]);Db(r,Q.useCallback(Se=>{Se!=null&&Se.isIntersecting&&ta()},[ta]),i1,{disabled:!!w||ka!=="viewport"}),Q.useEffect(()=>{Ns.current||!w&&ka==="render"&&(ta(),Ns.current=!0)},[w,ta,ka]);const Cl=Se=>{const ht=Se.currentTarget.getAttribute("target"),ua=C!==void 0?C:ht;if(!w&&!c1(Se)&&!Se.defaultPrevented&&(!ua||ua==="_self")&&Se.button===0){Se.preventDefault(),e1.flushSync(()=>{js(!0)});const $i=i.subscribe("onResolved",()=>{$i(),js(!1)});i.navigate({...Y,replace:v,resetScroll:j,hashScrollIntoView:x,startTransition:S,viewTransition:N,ignoreBlocker:K})}};if(Pe)return{...fe,ref:r,href:Pe,...E&&{children:E},...C&&{target:C},...w&&{disabled:w},...$&&{style:$},...X&&{className:X},...L&&{onClick:L},...Z&&{onBlur:Z},...ee&&{onFocus:ee},...P&&{onMouseEnter:P},...F&&{onMouseLeave:F},...J&&{onTouchStart:J}};const _s=Se=>{if(w||ka!=="intent")return;if(!Rs){ta();return}const ht=Se.currentTarget;if(Mi.has(ht))return;const ua=setTimeout(()=>{Mi.delete(ht),ta()},Rs);Mi.set(ht,ua)},Lu=Se=>{w||ka!=="intent"||ta()},ki=Se=>{if(w||!ka||!Rs)return;const ht=Se.currentTarget,ua=Mi.get(ht);ua&&(clearTimeout(ua),Mi.delete(ht))};return{...fe,...ra,...va,href:be==null?void 0:be.href,ref:r,onClick:ol([L,Cl]),onBlur:ol([Z,ki]),onFocus:ol([ee,_s]),onMouseEnter:ol([P,_s]),onMouseLeave:ol([F,ki]),onTouchStart:ol([J,Lu]),disabled:!!w,target:C,...Ml&&{style:Ml},...Ss&&{className:Ss},...w&&n1,...He&&s1,...T&&xa&&l1}}var yf={},a1={className:"active"},n1={role:"link","aria-disabled":!0},s1={"data-status":"active","aria-current":"page"},l1={"data-transitioning":"transitioning"},Mi=new WeakMap,i1={rootMargin:"100px"},ol=n=>l=>{for(const i of n)if(i){if(l.defaultPrevented)return;i(l)}};function r1(n,l,i,r){if(!r)return l?{href:n,external:!0}:{href:i.createHref(n)||"/",external:!1}}function u1(n){if(typeof n!="string")return!1;const l=n.charCodeAt(0);return l===47?n.charCodeAt(1)!==47:l===46}var Me=Q.forwardRef((n,l)=>{const{_asChild:i,...r}=n,{type:o,...d}=t1(r,l),h=typeof r.children=="function"?r.children({isActive:d["data-status"]==="active"}):r.children;if(!i){const{disabled:g,...p}=d;return Q.createElement("a",p,h)}return Q.createElement(i,d,h)});function c1(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}var o1=class extends Lg{constructor(l){super(l),this.useMatch=i=>vs({select:i==null?void 0:i.select,from:this.id,structuralSharing:i==null?void 0:i.structuralSharing}),this.useRouteContext=i=>Zg({...i,from:this.id}),this.useSearch=i=>Xg({select:i==null?void 0:i.select,structuralSharing:i==null?void 0:i.structuralSharing,from:this.id}),this.useParams=i=>Vg({select:i==null?void 0:i.select,structuralSharing:i==null?void 0:i.structuralSharing,from:this.id}),this.useLoaderDeps=i=>Kg({...i,from:this.id}),this.useLoaderData=i=>Gg({...i,from:this.id}),this.useNavigate=()=>Du({from:this.fullPath}),this.Link=Oi.forwardRef((i,r)=>f.jsx(Me,{ref:r,from:this.fullPath,...i}))}};function f1(n){return new o1(n)}var d1=class extends LS{constructor(n){super(n),this.useMatch=l=>vs({select:l==null?void 0:l.select,from:this.id,structuralSharing:l==null?void 0:l.structuralSharing}),this.useRouteContext=l=>Zg({...l,from:this.id}),this.useSearch=l=>Xg({select:l==null?void 0:l.select,structuralSharing:l==null?void 0:l.structuralSharing,from:this.id}),this.useParams=l=>Vg({select:l==null?void 0:l.select,structuralSharing:l==null?void 0:l.structuralSharing,from:this.id}),this.useLoaderDeps=l=>Kg({...l,from:this.id}),this.useLoaderData=l=>Gg({...l,from:this.id}),this.useNavigate=()=>Du({from:this.fullPath}),this.Link=Oi.forwardRef((l,i)=>f.jsx(Me,{ref:i,from:this.fullPath,...l}))}};function h1(n){return new d1(n)}function pa(n){return typeof n=="object"?new Xy(n,{silent:!0}).createRoute(n):new Xy(n,{silent:!0}).createRoute}var Xy=class{constructor(n,l){this.path=n,this.createRoute=i=>{const r=f1(i);return r.isRoot=!1,r},this.silent=l==null?void 0:l.silent}};function m1(n){const l=gt(),i=`not-found-${dt(l.stores.location,r=>r.pathname)}-${dt(l.stores.status,r=>r)}`;return f.jsx(kf,{getResetKey:()=>i,onCatch:(r,o)=>{var d;if(St(r))(d=n.onCatch)==null||d.call(n,r,o);else throw r},errorComponent:({error:r})=>{var o;if(St(r))return(o=n.fallback)==null?void 0:o.call(n,r);throw r},children:n.children})}function y1(){return f.jsx("p",{children:"Not Found"})}function fl(n){return f.jsx(f.Fragment,{children:n.children})}function kg(n,l,i){return l.options.notFoundComponent?f.jsx(l.options.notFoundComponent,{...i}):n.options.defaultNotFoundComponent?f.jsx(n.options.defaultNotFoundComponent,{...i}):f.jsx(y1,{})}function g1(n){return null}function p1(){return g1(gt()),null}var $g=Q.memo(function({matchId:l}){const i=gt(),r=i.stores.activeMatchStoresById.get(l);r||Va();const o=dt(i.stores.loadedAt,h=>h),d=dt(r,h=>h);return f.jsx(v1,{router:i,matchId:l,resetKey:o,matchState:Q.useMemo(()=>{var p;const h=d.routeId,g=(p=i.routesById[h].parentRoute)==null?void 0:p.id;return{routeId:h,ssr:d.ssr,_displayPending:d._displayPending,parentRouteId:g}},[d._displayPending,d.routeId,d.ssr,i.routesById])})});function v1({router:n,matchId:l,resetKey:i,matchState:r}){var N,E;const o=n.routesById[r.routeId],d=o.options.pendingComponent??n.options.defaultPendingComponent,h=d?f.jsx(d,{}):null,g=o.options.errorComponent??n.options.defaultErrorComponent,p=o.options.onCatch??n.options.defaultOnCatch,m=o.isRoot?o.options.notFoundComponent??((N=n.options.notFoundRoute)==null?void 0:N.options.component):o.options.notFoundComponent,x=r.ssr===!1||r.ssr==="data-only",v=(!o.isRoot||o.options.wrapInSuspense||x)&&(o.options.wrapInSuspense??d??(((E=o.options.errorComponent)==null?void 0:E.preload)||x))?Q.Suspense:fl,S=g?kf:fl,j=m?m1:fl;return f.jsxs(o.isRoot?o.options.shellComponent??fl:fl,{children:[f.jsx(zu.Provider,{value:l,children:f.jsx(v,{fallback:h,children:f.jsx(S,{getResetKey:()=>i,errorComponent:g||$f,onCatch:(C,w)=>{if(St(C))throw C;p==null||p(C,w)},children:f.jsx(j,{fallback:C=>{if(!m||C.routeId&&C.routeId!==r.routeId||!C.routeId&&!o.isRoot)throw C;return Q.createElement(m,C)},children:x||r._displayPending?f.jsx(qS,{fallback:h,children:f.jsx(Zy,{matchId:l})}):f.jsx(Zy,{matchId:l})})})})}),r.parentRouteId===ys?f.jsxs(f.Fragment,{children:[f.jsx(x1,{resetKey:i}),n.options.scrollRestoration&&_g?f.jsx(p1,{}):null]}):null]})}function x1({resetKey:n}){const l=gt(),i=Q.useRef(void 0);return wi(()=>{const r=l.latestLocation.href;(i.current===void 0||i.current!==r)&&(l.emit({type:"onRendered",...dl(l.stores.location.state,l.stores.resolvedLocation.state)}),i.current=r)},[l.latestLocation.state.__TSR_key,n,l]),null}var Zy=Q.memo(function({matchId:l}){var m,x,v,S;const i=gt(),r=i.stores.activeMatchStoresById.get(l);r||Va();const o=dt(r,j=>j),d=o.routeId,h=i.routesById[d],g=Q.useMemo(()=>{var N;const j=(N=i.routesById[d].options.remountDeps??i.options.defaultRemountDeps)==null?void 0:N({routeId:d,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return j?JSON.stringify(j):void 0},[d,o.loaderDeps,o._strictParams,o._strictSearch,i.options.defaultRemountDeps,i.routesById]),p=Q.useMemo(()=>{const j=h.options.component??i.options.defaultComponent;return j?f.jsx(j,{},g):f.jsx(Pg,{})},[g,h.options.component,i.options.defaultComponent]);if(o._displayPending)throw(m=i.getMatch(o.id))==null?void 0:m._nonReactive.displayPendingPromise;if(o._forcePending)throw(x=i.getMatch(o.id))==null?void 0:x._nonReactive.minPendingPromise;if(o.status==="pending"){const j=h.options.pendingMinMs??i.options.defaultPendingMinMs;if(j){const N=i.getMatch(o.id);if(N&&!N._nonReactive.minPendingPromise){const E=El();N._nonReactive.minPendingPromise=E,setTimeout(()=>{E.resolve(),N._nonReactive.minPendingPromise=void 0},j)}}throw(v=i.getMatch(o.id))==null?void 0:v._nonReactive.loadPromise}if(o.status==="notFound")return St(o.error)||Va(),kg(i,h,o.error);if(o.status==="redirected")throw wt(o.error)||Va(),(S=i.getMatch(o.id))==null?void 0:S._nonReactive.loadPromise;if(o.status==="error")throw o.error;return p}),Pg=Q.memo(function(){const l=gt(),i=Q.useContext(zu);let r,o=!1,d;{const m=i?l.stores.activeMatchStoresById.get(i):void 0;[r,o]=dt(m,x=>[x==null?void 0:x.routeId,(x==null?void 0:x.globalNotFound)??!1]),d=dt(l.stores.matchesId,x=>x[x.findIndex(v=>v===i)+1])}const h=r?l.routesById[r]:void 0,g=l.options.defaultPendingComponent?f.jsx(l.options.defaultPendingComponent,{}):null;if(o)return h||Va(),kg(l,h,void 0);if(!d)return null;const p=f.jsx($g,{matchId:d});return r===ys?f.jsx(Q.Suspense,{fallback:g,children:p}):p});function b1(){const n=gt(),l=Q.useRef({router:n,mounted:!1}),[i,r]=Q.useState(!1),o=dt(n.stores.isLoading,v=>v),d=dt(n.stores.hasPendingMatches,v=>v),h=af(o),g=o||i||d,p=af(g),m=o||d,x=af(m);return n.startTransition=v=>{r(!0),Q.startTransition(()=>{v(),r(!1)})},Q.useEffect(()=>{const v=n.history.subscribe(n.load),S=n.buildLocation({to:n.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Dn(n.latestLocation.publicHref)!==Dn(S.publicHref)&&n.commitLocation({...S,replace:!0}),()=>{v()}},[n,n.history]),wi(()=>{if(typeof window<"u"&&n.ssr||l.current.router===n&&l.current.mounted)return;l.current={router:n,mounted:!0},(async()=>{try{await n.load()}catch(S){console.error(S)}})()},[n]),wi(()=>{h&&!o&&n.emit({type:"onLoad",...dl(n.stores.location.state,n.stores.resolvedLocation.state)})},[h,n,o]),wi(()=>{x&&!m&&n.emit({type:"onBeforeRouteMount",...dl(n.stores.location.state,n.stores.resolvedLocation.state)})},[m,x,n]),wi(()=>{if(p&&!g){const v=dl(n.stores.location.state,n.stores.resolvedLocation.state);n.emit({type:"onResolved",...v}),Hg(()=>{n.stores.status.setState(()=>"idle"),n.stores.resolvedLocation.setState(()=>n.stores.location.state)}),v.hrefChanged&&US(n)}},[g,p,n]),null}function S1(){const n=gt(),l=n.routesById[ys].options.pendingComponent??n.options.defaultPendingComponent,i=l?f.jsx(l,{}):null,r=f.jsxs(typeof document<"u"&&n.ssr?fl:Q.Suspense,{fallback:i,children:[f.jsx(b1,{}),f.jsx(j1,{})]});return n.options.InnerWrap?f.jsx(n.options.InnerWrap,{children:r}):r}function j1(){const n=gt(),l=dt(n.stores.firstMatchId,o=>o),i=dt(n.stores.loadedAt,o=>o),r=l?f.jsx($g,{matchId:l}):null;return f.jsx(zu.Provider,{value:l,children:n.options.disableGlobalCatchBoundary?r:f.jsx(kf,{getResetKey:()=>i,errorComponent:$f,onCatch:void 0,children:r})})}function Fg(){const n=gt();return dt(n.stores.matchRouteReactivity,l=>l),Q.useCallback(l=>{const{pending:i,caseSensitive:r,fuzzy:o,includeSearch:d,...h}=l;return n.matchRoute(h,{pending:i,caseSensitive:r,fuzzy:o,includeSearch:d})},[n])}function N1(n){const l=gt(),i=Q.useRef(void 0);return dt(l.stores.activeMatchesSnapshot,r=>{const o=r;if(l.options.defaultStructuralSharing){const d=Ka(i.current,o);return i.current=d,d}return o})}var R1=n=>({createMutableStore:Qy,createReadonlyStore:Qy,batch:Hg}),_1=n=>new E1(n),E1=class extends TS{constructor(n){super(n,R1)}};function T1({router:n,children:l,...i}){Object.keys(i).length>0&&n.update({...n.options,...i,context:{...n.options.context,...i.context}});const r=f.jsx(Bg.Provider,{value:n,children:l});return n.options.Wrap?f.jsx(n.options.Wrap,{children:r}):r}function M1({router:n,...l}){return f.jsx(T1,{router:n,...l,children:f.jsx(S1,{})})}function Jg(n){const i=gt();return Q.useRef(void 0),dt(i.stores.__store,r=>r)}function C1(n){const l=gt(),i=Q.useRef(void 0);return dt(l.stores.location,r=>{const o=r;if(l.options.defaultStructuralSharing){const d=Ka(i.current,o);return i.current=d,d}return o})}const Ig=Q.createContext({isOpen:!1,toggle:()=>{},close:()=>{}});function A1({children:n}){const[l,i]=Q.useState(!1);return f.jsx(Ig.Provider,{value:{isOpen:l,toggle:()=>i(r=>!r),close:()=>i(!1)},children:n})}function Wg(){return Q.useContext(Ig)}function gf(n){if(!n)return"Run";const[,l]=n.split("::");return l||n}function w1(n){const l=[];for(let i=1;i<n.length;i++){const r=n[i],o=r.routeId??r.id,d=r.params;o==="/"||o==="/_layout"||(o.includes("/runs/$runId/category/$category")?(l.some(h=>h.label===d.runId)||l.push({label:gf(d.runId),to:`/runs/${encodeURIComponent(d.runId)}`}),l.push({label:d.category??"Category",to:r.pathname})):o.includes("/runs/$runId/suite/$suite")?l.push({label:d.suite??"Suite",to:r.pathname}):o.includes("/runs/$runId")?l.push({label:gf(d.runId),to:r.pathname}):o.includes("/evals/$runId/$evalId")?(l.some(h=>h.label===d.runId)||l.push({label:gf(d.runId),to:`/runs/${encodeURIComponent(d.runId)}`}),l.push({label:d.evalId??"Eval",to:r.pathname})):o.includes("/experiments/$experimentName")?l.push({label:d.experimentName??"Experiment",to:r.pathname}):(o==="/index"||o==="/")&&l.push({label:"Home",to:"/"}))}return l}function O1(){const n=N1(),l=w1(n);return l.length===0?null:f.jsxs("div",{className:"flex items-center gap-2 border-b border-gray-800 bg-gray-950 px-6 py-2 text-sm",children:[f.jsx(Me,{to:"/",className:"text-cyan-400 hover:text-cyan-300 hover:underline",children:"Home"}),l.map((i,r)=>{const o=r===l.length-1;return f.jsxs("span",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-gray-600",children:">"}),o?f.jsx("span",{className:"text-gray-400",children:i.label}):f.jsx(Me,{to:i.to??"/",className:"text-cyan-400 hover:text-cyan-300 hover:underline",children:i.label})]},`${i.label}-${r}`)})]})}async function Xe(n){const l=await fetch(n);if(!l.ok)throw new Error(`API error: ${l.status} ${l.statusText}`);return l.json()}const z1={queryKey:["runs"],queryFn:()=>Xe("/api/runs"),refetchInterval:5e3};function D1(n){return{queryKey:["runs",n],queryFn:()=>Xe(`/api/runs/${encodeURIComponent(n)}`),enabled:!!n}}const L1={queryKey:["feedback"],queryFn:()=>Xe("/api/feedback")},U1={queryKey:["experiments"],queryFn:()=>Xe("/api/experiments")},B1={queryKey:["compare"],queryFn:()=>Xe("/api/compare")},q1={queryKey:["targets"],queryFn:()=>Xe("/api/targets")};function H1(n,l){return{queryKey:["runs",n,"evals",l,"files"],queryFn:()=>Xe(`/api/runs/${encodeURIComponent(n)}/evals/${encodeURIComponent(l)}/files`),enabled:!!n&&!!l}}function Q1(n,l,i){return{queryKey:["runs",n,"evals",l,"files",i],queryFn:()=>Xe(`/api/runs/${encodeURIComponent(n)}/evals/${encodeURIComponent(l)}/files/${i}`),enabled:!!n&&!!l&&!!i}}function Y1(n,l){return{queryKey:["runs",n,"categories",l,"suites"],queryFn:()=>Xe(`/api/runs/${encodeURIComponent(n)}/categories/${encodeURIComponent(l)}/suites`),enabled:!!n&&!!l}}const G1={queryKey:["config"],queryFn:()=>Xe("/api/config"),staleTime:5e3};function K1(n){const l=n?`${Gt(n)}/remote/status`:"/api/remote/status";return{queryKey:["remote-status",n??""],queryFn:()=>Xe(l),staleTime:5e3}}function Ff(){return Ve(z1)}function Zi(n){return Ve(D1(n))}function V1(){return Ve(L1)}function Jf(){return Ve(U1)}function X1(){return Ve(B1)}function Z1(){return Ve(q1)}function k1(n,l){return Ve(H1(n,l))}function $1(n,l,i){return Ve(Q1(n,l,i))}function ep(n,l){return Ve(Y1(n,l))}function pt(){return Ve(G1)}function tp(n){return Ve(K1(n))}const Uf=.8;function Za(n,l=Uf){return n>=l}const P1={queryKey:["benchmarks"],queryFn:()=>Xe("/api/benchmarks"),refetchInterval:1e4};function If(){return Ve(P1)}const F1={queryKey:["benchmarks","all-runs"],queryFn:()=>Xe("/api/benchmarks/all-runs"),refetchInterval:5e3};function J1(){return Ve(F1)}async function I1(n){const l=await fetch("/api/benchmarks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});if(!l.ok){const i=await l.json();throw new Error(i.error||`Failed to add project: ${l.status}`)}return l.json()}async function W1(n){const l=await fetch("/api/benchmarks/discover",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});if(!l.ok){const r=await l.json();throw new Error(r.error||`Failed to discover: ${l.status}`)}return(await l.json()).discovered}function Gt(n){return`/api/benchmarks/${encodeURIComponent(n)}`}function ej(n){return{queryKey:["benchmarks",n,"runs"],queryFn:()=>Xe(`${Gt(n)}/runs`),enabled:!!n,refetchInterval:5e3}}function ap(n){return Ve(ej(n))}function tj(n,l){return{queryKey:["benchmarks",n,"runs",l],queryFn:()=>Xe(`${Gt(n)}/runs/${encodeURIComponent(l)}`),enabled:!!n&&!!l}}function Wf(n,l){return Ve(tj(n,l))}function aj(n,l,i){return{queryKey:["benchmarks",n,"runs",l,"evals",i,"files"],queryFn:()=>Xe(`${Gt(n)}/runs/${encodeURIComponent(l)}/evals/${encodeURIComponent(i)}/files`),enabled:!!n&&!!l&&!!i}}function nj(n,l,i,r){return{queryKey:["benchmarks",n,"runs",l,"evals",i,"files",r],queryFn:()=>Xe(`${Gt(n)}/runs/${encodeURIComponent(l)}/evals/${encodeURIComponent(i)}/files/${r}`),enabled:!!n&&!!l&&!!i&&!!r}}function sj(n){return{queryKey:["benchmarks",n,"experiments"],queryFn:()=>Xe(`${Gt(n)}/experiments`),enabled:!!n}}function lj(n){return{queryKey:["benchmarks",n,"compare"],queryFn:()=>Xe(`${Gt(n)}/compare`),enabled:!!n}}function ij(n){return{queryKey:["benchmarks",n,"targets"],queryFn:()=>Xe(`${Gt(n)}/targets`),enabled:!!n}}async function np(n){const l=n?`${Gt(n)}/remote/sync`:"/api/remote/sync",i=await fetch(l,{method:"POST"});if(!i.ok)throw new Error(`Failed to sync remote results: ${i.status}`);return i.json()}async function rj(n){const l=await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok)throw new Error(`Failed to save config: ${l.status}`);return l.json()}function uj(n){const l=n?`${Gt(n)}/eval/discover`:"/api/eval/discover";return{queryKey:["eval-discover",n??""],queryFn:()=>Xe(l),staleTime:3e4}}function cj(n){return Ve(uj(n))}function oj(n){const l=n?`${Gt(n)}/eval/targets`:"/api/eval/targets";return{queryKey:["eval-targets",n??""],queryFn:()=>Xe(l),staleTime:3e4}}function fj(n){return Ve(oj(n))}async function dj(n,l){const i=l?`${Gt(l)}/eval/run`:"/api/eval/run",r=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const o=await r.json().catch(()=>({error:r.statusText}));throw new Error(o.error??`Failed: ${r.status}`)}return r.json()}function hj(n){return{queryKey:["eval-status",n],queryFn:()=>Xe(`/api/eval/status/${n}`),enabled:!!n,refetchInterval:l=>{var r;const i=(r=l.state.data)==null?void 0:r.status;return i==="finished"||i==="failed"?!1:2e3}}}function mj(n){return Ve(hj(n))}async function yj(n,l){const i=l?`${Gt(l)}/eval/preview`:"/api/eval/preview",r=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`Preview failed: ${r.status}`);return r.json()}function xs({children:n}){const{isOpen:l,close:i}=Wg(),r=C1();return Q.useEffect(()=>{i()},[i,r.pathname]),f.jsxs(f.Fragment,{children:[l&&f.jsx("div",{className:"fixed inset-0 z-30 bg-black/50 md:hidden",onClick:i,onKeyDown:o=>o.key==="Escape"&&i(),role:"button",tabIndex:-1,"aria-label":"Close navigation"}),f.jsx("aside",{className:`fixed inset-y-0 left-0 z-40 flex w-64 flex-col border-r border-gray-800 bg-gray-900/50 transition-transform duration-200 ease-in-out md:static md:z-auto md:translate-x-0 ${l?"translate-x-0":"-translate-x-full"}`,children:n})]})}function gj(){const n=Fg(),l=n({to:"/projects/$benchmarkId/evals/$runId/$evalId",fuzzy:!0}),i=n({to:"/projects/$benchmarkId/runs/$runId",fuzzy:!0}),r=n({to:"/projects/$benchmarkId",fuzzy:!0});if(l&&typeof l=="object"&&"benchmarkId"in l){const{benchmarkId:p,runId:m,evalId:x}=l;return f.jsx(Sj,{benchmarkId:p,runId:m,currentEvalId:x})}if(i&&typeof i=="object"&&"benchmarkId"in i){const{benchmarkId:p,runId:m}=i;return f.jsx(ky,{benchmarkId:p,currentRunId:m})}if(r&&typeof r=="object"&&"benchmarkId"in r){const{benchmarkId:p}=r;return f.jsx(ky,{benchmarkId:p})}const o=n({to:"/evals/$runId/$evalId",fuzzy:!0}),d=n({to:"/runs/$runId/category/$category",fuzzy:!0}),h=n({to:"/runs/$runId/suite/$suite",fuzzy:!0}),g=n({to:"/experiments/$experimentName",fuzzy:!0});if(d&&typeof d=="object"&&"runId"in d){const{runId:p,category:m}=d;return f.jsx(bj,{runId:p,category:m})}if(h&&typeof h=="object"&&"runId"in h){const{runId:p,suite:m}=h;return f.jsx(xj,{runId:p,suite:m})}if(o&&typeof o=="object"&&"runId"in o){const{runId:p,evalId:m}=o;return f.jsx(vj,{runId:p,currentEvalId:m})}if(g&&typeof g=="object"&&"experimentName"in g){const{experimentName:p}=g;return f.jsx(jj,{currentExperiment:p})}return f.jsx(pj,{})}function pj(){const n=Fg(),{data:l}=If(),i=((l==null?void 0:l.projects.length)??0)>0,r=n({to:"/"}),o=n({to:"/runs/$runId",fuzzy:!0}),d=i&&r!==!1,{data:h}=Ff(),{data:g}=J1(),p=d?g:h;return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Runs"}),p==null?void 0:p.runs.map(m=>{const x=r===!1&&o&&typeof o=="object"&&"runId"in o&&o.runId===m.filename;return m.project_id?f.jsx(Me,{to:"/projects/$benchmarkId/runs/$runId",params:{benchmarkId:m.project_id,runId:m.filename},className:"mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",title:m.project_name,children:m.display_name??m.filename},`${m.project_id}/${m.filename}`):f.jsx(Me,{to:"/runs/$runId",params:{runId:m.filename},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${x?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:m.display_name??m.filename},m.filename)})]}),f.jsx("div",{className:"border-t border-gray-800 px-4 py-3",children:f.jsx(Me,{to:"/settings",className:"flex items-center gap-2 text-sm text-gray-400 hover:text-cyan-400",children:"Settings"})})]})}function vj({runId:n,currentEvalId:l}){const{data:i}=Zi(n),{data:r}=pt(),o=(r==null?void 0:r.threshold)??(r==null?void 0:r.pass_threshold)??.8;return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Me,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),i==null?void 0:i.results.map(d=>{const h=d.testId===l,g=Za(d.score,o);return f.jsxs(Me,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:d.testId},className:`mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors ${h?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:[f.jsx("span",{className:`text-xs ${g?"text-emerald-400":"text-red-400"}`,children:g?"✓":"✗"}),f.jsx("span",{className:"truncate",children:d.testId})]},d.testId)})]})]})}function xj({runId:n,suite:l}){const{data:i}=Zi(n),{data:r}=pt(),o=(r==null?void 0:r.threshold)??(r==null?void 0:r.pass_threshold)??.8,d=((i==null?void 0:i.results)??[]).filter(h=>(h.suite??"Uncategorized")===l);return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Me,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n}),f.jsx("p",{className:"truncate text-xs text-gray-500",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),d.map(h=>{const g=Za(h.score,o);return f.jsxs(Me,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:h.testId},className:"mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",children:[f.jsx("span",{className:`text-xs ${g?"text-emerald-400":"text-red-400"}`,children:g?"✓":"✗"}),f.jsx("span",{className:"truncate",children:h.testId})]},h.testId)})]})]})}function bj({runId:n,category:l}){const{data:i}=ep(n,l),r=(i==null?void 0:i.suites)??[];return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Me,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n}),f.jsx("p",{className:"truncate text-xs text-gray-500",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Suites"}),r.map(o=>f.jsxs(Me,{to:"/runs/$runId/suite/$suite",params:{runId:n,suite:o.name},className:"mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",children:[f.jsx("span",{className:`text-xs ${o.passed===o.total?"text-emerald-400":"text-red-400"}`,children:o.passed===o.total?"✓":"✗"}),f.jsx("span",{className:"truncate",children:o.name})]},o.name))]})]})}function ky({benchmarkId:n,currentRunId:l}){const{data:i}=ap(n);return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Me,{to:"/",className:"text-xs text-gray-400 hover:text-cyan-400",children:"← All Benchmarks"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Runs"}),i==null?void 0:i.runs.map(r=>{const o=l===r.filename;return f.jsx(Me,{to:"/projects/$benchmarkId/runs/$runId",params:{benchmarkId:n,runId:r.filename},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${o?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:r.display_name??r.filename},r.filename)})]})]})}function Sj({benchmarkId:n,runId:l,currentEvalId:i}){const{data:r}=Wf(n,l),{data:o}=pt(),d=(o==null?void 0:o.threshold)??(o==null?void 0:o.pass_threshold)??.8;return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Me,{to:"/projects/$benchmarkId/runs/$runId",params:{benchmarkId:n,runId:l},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),r==null?void 0:r.results.map(h=>{const g=h.testId===i,p=Za(h.score,d);return f.jsxs(Me,{to:"/projects/$benchmarkId/evals/$runId/$evalId",params:{benchmarkId:n,runId:l,evalId:h.testId},className:`mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors ${g?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:[f.jsx("span",{className:`text-xs ${p?"text-emerald-400":"text-red-400"}`,children:p?"✓":"✗"}),f.jsx("span",{className:"truncate",children:h.testId})]},h.testId)})]})]})}function jj({currentExperiment:n}){const{data:l}=Jf(),i=(l==null?void 0:l.experiments)??[];return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsx("div",{className:"border-b border-gray-800 px-4 py-2",children:f.jsx(Me,{to:"/",search:{tab:"experiments"},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← All experiments"})}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Experiments"}),i.map(r=>{const o=r.name===n;return f.jsx(Me,{to:"/experiments/$experimentName",params:{experimentName:r.name},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${o?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:r.name},r.name)})]})]})}function Nj(){return f.jsx(A1,{children:f.jsx(Rj,{})})}function Rj(){const{toggle:n}=Wg();return f.jsxs("div",{className:"flex h-screen overflow-hidden",children:[f.jsx(gj,{}),f.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[f.jsxs("header",{className:"flex items-center gap-3 border-b border-gray-800 bg-gray-900/50 px-4 py-3 md:hidden",children:[f.jsx("button",{type:"button",onClick:n,className:"text-gray-400 hover:text-gray-200","aria-label":"Toggle navigation",children:f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":"Toggle navigation",children:[f.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),f.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),f.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),f.jsx("span",{className:"text-sm font-semibold text-white",children:"AgentV Studio"})]}),f.jsx(O1,{}),f.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:f.jsx(Pg,{})})]})]})}const ia=h1({component:Nj}),_j=pa("/settings")({component:Ej});function Ej(){const{data:n,isLoading:l}=pt(),i=Un(),[r,o]=Q.useState(""),[d,h]=Q.useState(!1),[g,p]=Q.useState(null),m=(n==null?void 0:n.threshold)??Uf,x=r||String(m),v=(n==null?void 0:n.read_only)===!0,S=async()=>{const j=Number.parseFloat(r||String(m));if(Number.isNaN(j)||j<0||j>1){p({type:"error",text:"Threshold must be a number between 0 and 1"});return}h(!0),p(null);try{await rj({threshold:j}),await i.invalidateQueries({queryKey:["config"]}),o(""),p({type:"success",text:"Settings saved"}),setTimeout(()=>p(null),3e3)}catch{p({type:"error",text:"Failed to save settings"})}finally{h(!1)}};return l?f.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[f.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-40 animate-pulse rounded-lg bg-gray-900"})]}):f.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Settings"}),f.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Configure your AgentV Studio dashboard"})]}),f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6",children:[f.jsx("h2",{className:"text-lg font-medium text-white",children:"Evaluation"}),f.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Configure how evaluation results are classified"}),f.jsx("div",{className:"mt-6 space-y-4",children:f.jsxs("div",{children:[f.jsx("label",{htmlFor:"pass-threshold",className:"block text-sm font-medium text-gray-300",children:"Pass Threshold"}),f.jsxs("p",{className:"mt-1 text-xs text-gray-500",children:["Score at or above this value is considered passing. Default: ",Uf]}),f.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[f.jsx("input",{id:"pass-threshold",type:"number",min:"0",max:"1",step:"0.05",value:x,onChange:j=>o(j.target.value),disabled:v,className:"w-32 rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500"}),f.jsxs("span",{className:"text-sm text-gray-400",children:["(",Math.round((Number.parseFloat(x)||0)*100),"%)"]})]})]})}),f.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[!v&&f.jsx("button",{type:"button",onClick:S,disabled:d,className:"rounded-md bg-cyan-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-cyan-500 disabled:opacity-50",children:d?"Saving...":"Save Settings"}),v&&f.jsx("span",{className:"text-sm text-gray-400",children:"Read-only mode is enabled."}),g&&f.jsx("span",{className:`text-sm ${g.type==="success"?"text-emerald-400":"text-red-400"}`,children:g.text})]})]}),f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:f.jsxs("p",{className:"text-xs text-gray-500",children:["Settings are stored in ",f.jsx("code",{className:"text-gray-400",children:".agentv/config.yaml"})]})})]})}function sp({data:n,isLoading:l,isError:i,error:r}){if(l)return f.jsx(Oj,{});if(i&&r)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load comparison data: ",r.message]});if(!n||n.cells.length===0)return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No comparison data available"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Run evaluations with different experiment and target combinations to see a comparison matrix."})]});const{experiments:o,targets:d,cells:h}=n;if(o.length<=1&&d.length<=1)return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"Not enough variation to compare"}),f.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["The comparison matrix requires at least 2 experiments or 2 targets. Currently there"," ",o.length===1?"is 1 experiment":`are ${o.length} experiments`," ","and ",d.length===1?"1 target":`${d.length} targets`,"."]})]});const g=new Map;for(const p of h)g.set(JSON.stringify([p.experiment,p.target]),p);return f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-400",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"inline-block h-3 w-3 rounded-sm bg-gray-800/60 ring-1 ring-emerald-500/60"}),f.jsx("span",{className:"text-emerald-400",children:"80%+"})]}),f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"inline-block h-3 w-3 rounded-sm bg-gray-800/60 ring-1 ring-amber-500/60"}),f.jsx("span",{className:"text-amber-400",children:"50–80%"})]}),f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"inline-block h-3 w-3 rounded-sm bg-gray-800/60 ring-1 ring-red-500/60"}),f.jsx("span",{className:"text-red-400",children:"<50%"})]}),f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"inline-block h-3 w-3 rounded-sm border border-dashed border-gray-700"}),"No data"]})]}),f.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),o.map(p=>f.jsx("th",{className:"px-4 py-3 text-center font-medium text-gray-400",children:p},p))]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:d.map(p=>f.jsx(Tj,{target:p,experiments:o,cellMap:g},p))})]})})]})}function Tj({target:n,experiments:l,cellMap:i}){return f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:n}),l.map(r=>{const o=i.get(JSON.stringify([r,n]));return f.jsx("td",{className:"px-2 py-2",children:o?f.jsx(Aj,{cell:o}):f.jsx("div",{className:"flex items-center justify-center rounded-lg border border-dashed border-gray-700 px-3 py-4 text-gray-600",children:"--"})},r)})]})}function Mj(n){return n>=.8?"ring-emerald-500/60":n>=.5?"ring-amber-500/60":"ring-red-500/60"}function Cj(n){return n>=.8?"text-emerald-400":n>=.5?"text-amber-400":"text-red-400"}function Aj({cell:n}){const[l,i]=Q.useState(!1),r=Math.round(n.pass_rate*100),o=Math.round(n.avg_score*100);return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("button",{type:"button",onClick:()=>i(!l),"aria-expanded":l,className:`w-full rounded-lg bg-gray-800/60 px-3 py-3 text-center ring-1 transition-colors hover:bg-gray-700/60 ${Mj(n.pass_rate)}`,children:[f.jsx("div",{className:"flex items-center justify-center",children:f.jsxs("span",{className:`text-lg font-semibold tabular-nums ${Cj(n.pass_rate)}`,children:[r,"%"]})}),f.jsxs("div",{className:"mt-0.5 text-xs text-gray-400",children:[n.passed_count,"/",n.eval_count," pass | avg ",o,"%"]})]}),l&&f.jsx(wj,{tests:n.tests})]})}function wj({tests:n}){return f.jsxs("div",{className:"mt-1 max-h-48 overflow-y-auto rounded-md border border-gray-800 bg-gray-950/80 p-2",children:[f.jsx("div",{className:"mb-1 text-xs font-medium text-gray-500",children:"Test Cases"}),f.jsx("div",{className:"space-y-0.5",children:n.map(l=>f.jsxs("div",{className:"flex items-center gap-2 rounded px-1.5 py-0.5 text-xs",children:[f.jsx("span",{className:l.passed?"text-emerald-400":"text-red-400",children:l.passed?"✓":"✗"}),f.jsx("span",{className:"flex-1 truncate text-gray-300",title:l.test_id,children:l.test_id}),f.jsxs("span",{className:"tabular-nums text-gray-500",children:[Math.round(l.score*100),"%"]})]},l.test_id))})]})}function Oj(){return f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3"].map(n=>f.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-6",children:[f.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"}),f.jsx("div",{className:"h-16 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-16 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-16 w-32 rounded bg-gray-800"})]},n))]})})}function Hi({rate:n}){const l=Math.round(n*100);return f.jsxs("div",{className:"relative h-5 w-20 overflow-hidden rounded-full bg-gray-800",children:[f.jsx("div",{className:"absolute inset-y-0 left-0 bg-gradient-to-r from-blue-400 to-blue-600",style:{width:`${l}%`}}),f.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-semibold tabular-nums text-white",children:[l,"%"]})]})}function zj(){const{data:n,isLoading:l}=Jf();if(l)return f.jsx(Dj,{});const i=(n==null?void 0:n.experiments)??[];return i.length===0?f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Experiments will appear here once evaluations are run with experiment labels."})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Targets"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Last Run"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:i.map(r=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:f.jsx(Me,{to:"/experiments/$experimentName",params:{experimentName:r.name},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:r.name})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.run_count}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.target_count}),f.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[f.jsx("span",{className:"text-emerald-400",children:r.passed_count}),f.jsx("span",{className:"text-gray-600",children:" / "}),r.eval_count]}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Hi,{rate:r.pass_rate})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",title:$y(r.last_run).full,children:$y(r.last_run).date})]},r.name))})]})})}function $y(n){if(!n)return{date:"N/A",full:"N/A"};try{const l=new Date(n);if(Number.isNaN(l.getTime()))return{date:"N/A",full:"N/A"};const i=l.toLocaleString(),r=Date.now()-l.getTime(),o=Math.floor(r/6e4),d=Math.floor(r/36e5);let h;return o<1?h="just now":o<60?h=`${o} min ago`:d<24?h=`${d} hour${d===1?"":"s"} ago`:h=l.toLocaleDateString(),{date:h,full:i}}catch{return{date:"N/A",full:"N/A"}}}function Dj(){return f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(n=>f.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[f.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},n))]})})}function Lj(n){if(!n)return"No runs";const l=new Date(n);if(Number.isNaN(l.getTime()))return"N/A";const i=Date.now()-l.getTime(),r=Math.floor(i/6e4);if(r<1)return"Just now";if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Uj({project:n}){const l=Math.round(n.pass_rate*100);return f.jsxs(Me,{to:"/projects/$benchmarkId",params:{benchmarkId:n.id},className:"group block rounded-lg border border-gray-800 bg-gray-900/50 p-5 transition-colors hover:border-cyan-800 hover:bg-gray-900",children:[f.jsx("div",{className:"flex items-start justify-between",children:f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("h3",{className:"truncate text-lg font-semibold text-white group-hover:text-cyan-400",children:n.name}),f.jsx("p",{className:"mt-1 truncate text-xs text-gray-500",children:n.path})]})}),f.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-3",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Runs"}),f.jsx("p",{className:"text-lg font-semibold text-white",children:n.run_count})]}),f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Pass Rate"}),f.jsx("p",{className:`text-lg font-semibold ${n.run_count===0?"text-gray-500":l>=80?"text-emerald-400":l>=50?"text-yellow-400":"text-red-400"}`,children:n.run_count>0?`${l}%`:"--"})]}),f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Last Run"}),f.jsx("p",{className:"text-sm text-gray-300",children:Lj(n.last_run)})]})]})]})}function bs({open:n,onClose:l,benchmarkId:i,prefill:r}){const o=Un(),[d,h]=Q.useState((r==null?void 0:r.suiteFilter)??""),[g,p]=Q.useState(""),[m,x]=Q.useState((r==null?void 0:r.testIds)??[]),[v,S]=Q.useState((r==null?void 0:r.target)??""),[j,N]=Q.useState(""),[E,C]=Q.useState(""),[w,$]=Q.useState(!1),[X,L]=Q.useState(!1),[Z,ee]=Q.useState(null),[P,F]=Q.useState(null),[J,K]=Q.useState(!1),[I,se]=Q.useState(null),{data:le}=cj(i),{data:ue}=fj(i),{data:te}=mj(Z),D=Q.useMemo(()=>(le==null?void 0:le.eval_files)??[],[le]),V=Q.useMemo(()=>(ue==null?void 0:ue.targets)??[],[ue]);Q.useEffect(()=>{n&&(h((r==null?void 0:r.suiteFilter)??""),x((r==null?void 0:r.testIds)??[]),S((r==null?void 0:r.target)??""),p(""),N(""),C(""),$(!1),L(!1),ee(null),F(null),K(!1),se(null))},[n,r]),Q.useEffect(()=>{((te==null?void 0:te.status)==="finished"||(te==null?void 0:te.status)==="failed")&&(o.invalidateQueries({queryKey:["runs"]}),o.invalidateQueries({queryKey:["projects"]}))},[te==null?void 0:te.status,o]);const ae=Q.useCallback(()=>{const q={};return d.trim()&&(q.suite_filter=d.trim()),m.length>0&&(q.test_ids=m),v&&(q.target=v),j&&(q.threshold=Number.parseFloat(j)),E&&(q.workers=Number.parseInt(E,10)),w&&(q.dry_run=!0),q},[d,m,v,j,E,w]);Q.useEffect(()=>{const q=ae();if(!q.suite_filter&&(!q.test_ids||q.test_ids.length===0)){se(null);return}yj(q,i).then(W=>se(W.command)).catch(()=>se(null))},[ae,i]);function he(){const q=g.trim();q&&!m.includes(q)&&x([...m,q]),p("")}function fe(q){x(m.filter(W=>W!==q))}async function T(){F(null),K(!0);try{const q=ae(),W=await dj(q,i);ee(W.id)}catch(q){F(q.message)}finally{K(!1)}}if(!n)return null;if(Z&&te)return f.jsx(Py,{onClose:l,title:"Eval Run",children:f.jsx(Bj,{status:te,onClose:l})});const Y=!!(d.trim()||m.length>0);return f.jsx(Py,{onClose:l,title:"Run Eval",children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx("label",{htmlFor:"suite-filter",className:"mb-1 block text-sm font-medium text-gray-300",children:"Suite Filter"}),f.jsx("input",{id:"suite-filter",type:"text",value:d,onChange:q=>h(q.target.value),placeholder:"evals/**/*.eval.yaml",className:"w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),D.length>0&&!d&&f.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[D.slice(0,5).map(q=>f.jsx("button",{type:"button",onClick:()=>h(W=>W?`${W}, ${q.relative_path}`:q.relative_path),className:"rounded bg-gray-800 px-2 py-0.5 text-xs text-gray-400 hover:bg-gray-700 hover:text-gray-200",children:q.relative_path},q.relative_path)),D.length>5&&f.jsxs("span",{className:"px-1 text-xs text-gray-500",children:["+",D.length-5," more"]})]})]}),f.jsxs("div",{children:[f.jsx("label",{htmlFor:"test-id-input",className:"mb-1 block text-sm font-medium text-gray-300",children:"Test ID Filter"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx("input",{id:"test-id-input",type:"text",value:g,onChange:q=>p(q.target.value),onKeyDown:q=>{q.key==="Enter"&&(q.preventDefault(),he())},placeholder:"auth-*, retrieval-basic",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),f.jsx("button",{type:"button",onClick:he,disabled:!g.trim(),className:"rounded-md bg-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-600 disabled:opacity-50",children:"Add"})]}),m.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:m.map(q=>f.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-cyan-900/40 px-2.5 py-0.5 text-xs text-cyan-300",children:[q,f.jsx("button",{type:"button",onClick:()=>fe(q),className:"text-cyan-400 hover:text-white",children:"×"})]},q))})]}),f.jsxs("div",{children:[f.jsx("label",{htmlFor:"target-override",className:"mb-1 block text-sm font-medium text-gray-300",children:"Target Override"}),f.jsxs("select",{id:"target-override",value:v,onChange:q=>S(q.target.value),className:"w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white focus:border-cyan-600 focus:outline-none",children:[f.jsx("option",{value:"",children:"Use eval's configured target"}),V.map(q=>f.jsx("option",{value:q,children:q},q))]})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>L(!X),className:"text-sm text-gray-400 hover:text-gray-200",children:[X?"▾":"▸"," Advanced Options"]}),X&&f.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-3",children:[f.jsxs("div",{children:[f.jsx("label",{htmlFor:"threshold-input",className:"mb-1 block text-xs text-gray-400",children:"Threshold (0–1)"}),f.jsx("input",{id:"threshold-input",type:"number",value:j,onChange:q=>N(q.target.value),min:"0",max:"1",step:"0.1",placeholder:"0.8",className:"w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"})]}),f.jsxs("div",{children:[f.jsx("label",{htmlFor:"workers-input",className:"mb-1 block text-xs text-gray-400",children:"Workers"}),f.jsx("input",{id:"workers-input",type:"number",value:E,onChange:q=>C(q.target.value),min:"1",max:"50",placeholder:"3",className:"w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"})]}),f.jsx("div",{className:"col-span-2",children:f.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-400",children:[f.jsx("input",{type:"checkbox",checked:w,onChange:q=>$(q.target.checked),className:"rounded border-gray-600 bg-gray-800"}),"Dry run (mock provider responses)"]})})]})]}),I&&f.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:[f.jsx("div",{className:"mb-1 text-xs text-gray-500",children:"CLI Preview"}),f.jsx("code",{className:"block break-all text-xs text-cyan-300",children:I})]}),P&&f.jsx("div",{className:"rounded-md border border-red-900/50 bg-red-950/20 p-2 text-sm text-red-400",children:P}),f.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[f.jsx("button",{type:"button",onClick:l,className:"rounded-md bg-gray-700 px-4 py-2 text-sm text-white hover:bg-gray-600",children:"Cancel"}),f.jsx("button",{type:"button",onClick:T,disabled:!Y||J,className:"rounded-md bg-cyan-600 px-4 py-2 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:J?"Launching…":"Run Now"})]})]})})}function Py({children:n,onClose:l,title:i}){return f.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/60 pt-[10vh]",children:f.jsxs("div",{className:"w-full max-w-lg rounded-lg border border-gray-700 bg-gray-900 shadow-xl",children:[f.jsxs("div",{className:"flex items-center justify-between border-b border-gray-800 px-5 py-3",children:[f.jsx("h2",{className:"text-lg font-semibold text-white",children:i}),f.jsx("button",{type:"button",onClick:l,className:"text-gray-400 hover:text-white",children:"✕"})]}),f.jsx("div",{className:"px-5 py-4",children:n})]})})}function Bj({status:n,onClose:l}){const i=n.status==="finished"||n.status==="failed",r={starting:"text-yellow-400",running:"text-cyan-400",finished:"text-emerald-400",failed:"text-red-400"};return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("span",{className:`text-sm font-medium ${r[n.status]??"text-gray-400"}`,children:[n.status==="running"&&"●"," ",n.status.charAt(0).toUpperCase()+n.status.slice(1)]}),!i&&f.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent"})]}),f.jsx("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:f.jsx("code",{className:"block break-all text-xs text-cyan-300",children:n.command})}),n.stdout&&f.jsx("div",{className:"max-h-48 overflow-y-auto rounded-md bg-gray-950 p-3",children:f.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-300",children:n.stdout.slice(-3e3)})}),n.stderr&&f.jsx("div",{className:"max-h-24 overflow-y-auto rounded-md bg-red-950/20 p-3",children:f.jsx("pre",{className:"whitespace-pre-wrap text-xs text-red-300",children:n.stderr.slice(-2e3)})}),i&&f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("span",{className:"text-xs text-gray-500",children:["Exit code: ",n.exit_code,n.finished_at&&` · ${new Date(n.finished_at).toLocaleTimeString()}`]}),f.jsx("button",{type:"button",onClick:l,className:"rounded-md bg-gray-700 px-4 py-2 text-sm text-white hover:bg-gray-600",children:"Close"})]})]})}function qj(n){if(!n)return{date:"N/A",full:"N/A"};try{const l=new Date(n);if(Number.isNaN(l.getTime()))return{date:"N/A",full:"N/A"};const i=l.toLocaleString(),r=Date.now()-l.getTime(),o=Math.floor(r/6e4),d=Math.floor(r/36e5);let h;return o<1?h="just now":o<60?h=`${o} min ago`:d<24?h=`${d} hour${d===1?"":"s"} ago`:h=l.toLocaleDateString(),{date:h,full:i}}catch{return{date:"N/A",full:"N/A"}}}function Hj(n){const l=[n.target,n.experiment].filter(i=>i&&i!=="default"&&i!=="-");return l.length>0?l.join(" · "):n.target?n.target:n.display_name??n.filename}function ed({runs:n,benchmarkId:l,emptyMessage:i}){return n.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:i??f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluation runs found."}),f.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Run an evaluation first:"," ",f.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"agentv eval <eval-file>"})]})]})}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"w-8 px-4 py-3"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Run"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Passed"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Failed"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Total"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"When"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(r=>{const o=qj(r.timestamp),d=r.pass_rate>=.8,h=Hj(r),g=Math.round(r.pass_rate*r.test_count),p=r.test_count-g;return f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3 text-center",children:f.jsx("span",{className:`text-base font-bold ${d?"text-emerald-400":"text-red-400"}`,children:d?"✓":"✗"})}),f.jsx("td",{className:"px-4 py-3",children:l?f.jsx(Me,{to:"/projects/$benchmarkId/runs/$runId",params:{benchmarkId:l,runId:r.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:h}):f.jsx(Me,{to:"/runs/$runId",params:{runId:r.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:h})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-emerald-300",children:g}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:p>0?p:f.jsx("span",{className:"text-gray-600",children:"0"})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.test_count}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Hi,{rate:r.pass_rate})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",title:o.full,children:o.date})]},r.filename)})})]})})}function Qj(n){if(!n)return"Never synced";const l=new Date(n);return Number.isNaN(l.getTime())?"Never synced":`Last synced ${l.toLocaleString()}`}function lp({filter:n,onFilterChange:l,remoteStatus:i,syncInFlight:r,onSync:o}){const d=(i==null?void 0:i.configured)===!0,h=d&&(i==null?void 0:i.available)!==!0;return f.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-4",children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[f.jsx("div",{className:"flex flex-wrap items-center gap-2",children:["all","local","remote"].map(g=>{const p=g==="remote"&&!d;return f.jsx("button",{type:"button",onClick:()=>l(g),title:p?"Remote results are not configured":void 0,className:`rounded-full px-3 py-1 text-sm font-medium transition-colors ${n===g?"bg-cyan-500/20 text-cyan-300":p?"bg-gray-800 text-gray-600":"bg-gray-800 text-gray-400 hover:text-gray-200"}`,children:g==="all"?"All Sources":g==="local"?"Local Only":"Remote Only"},g)})}),d&&o?f.jsx("button",{type:"button",onClick:o,disabled:r,className:"rounded-md border border-cyan-800 bg-cyan-950/40 px-3 py-1.5 text-sm font-medium text-cyan-300 transition-colors hover:bg-cyan-900/50 disabled:cursor-not-allowed disabled:opacity-60",children:r?"Syncing…":"Sync Remote Results"}):null]}),d?f.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-gray-400",children:[f.jsx("span",{children:Qj(i==null?void 0:i.last_synced_at)}),i!=null&&i.repo?f.jsxs("span",{children:["Repo: ",i.repo]}):null,h?f.jsx("span",{className:"text-yellow-400",children:"Remote cache unavailable"}):null]}):n==="all"?f.jsxs("p",{className:"text-sm text-gray-500",children:["Remote results are not configured. Add"," ",f.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:"results.export"})," to"," ",f.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:".agentv/config.yaml"})," to enable."]}):null,i!=null&&i.last_error?f.jsx("div",{className:"rounded-md border border-yellow-900/50 bg-yellow-950/20 px-3 py-2 text-sm text-yellow-300",children:i.last_error}):null]})}function Cu({score:n,className:l=""}){const i=Math.round(Math.max(0,Math.min(1,n))*100);return f.jsxs("div",{className:`flex items-center gap-3 ${l}`,children:[f.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-gray-800",children:f.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-cyan-400 to-blue-500 transition-all duration-300",style:{width:`${i}%`}})}),f.jsxs("span",{className:"w-12 text-right text-sm font-medium tabular-nums text-gray-300",children:[i,"%"]})]})}function Yj(){const{data:n,isLoading:l}=Z1();if(l)return f.jsx(Gj,{});const i=(n==null?void 0:n.targets)??[];return i.length===0?f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Targets will appear here once evaluations are run with target labels."})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Experiments"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:i.map(r=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:r.name}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.run_count}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.experiment_count}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Cu,{score:r.pass_rate})}),f.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[f.jsx("span",{className:"text-emerald-400",children:r.passed_count}),f.jsx("span",{className:"text-gray-600",children:"/"}),f.jsx("span",{children:r.eval_count})]})]},r.name))})]})})}function Gj(){return f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(n=>f.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[f.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-20 rounded bg-gray-800"})]},n))]})})}const Fy=[{id:"runs",label:"🏃 Recent Runs"},{id:"experiments",label:"🧪 Experiments"},{id:"compare",label:"📊 Compare"},{id:"targets",label:"🤖 Targets"}],Kj=pa("/")({component:Vj});function Vj(){const{data:n,isLoading:l}=If(),{data:i,isLoading:r}=pt(),o=((n==null?void 0:n.projects.length)??0)>0,d=i==null?void 0:i.multi_project_dashboard;return l||r?f.jsx(ip,{}):d===!0||d===void 0&&o?f.jsx(Xj,{}):f.jsx(Zj,{})}function Xj(){const{data:n}=If(),{data:l}=pt(),i=Un(),[r,o]=Q.useState(""),[d,h]=Q.useState(""),[g,p]=Q.useState(null),[m,x]=Q.useState(!1),[v,S]=Q.useState(!1),j=(n==null?void 0:n.projects)??[],N=(l==null?void 0:l.read_only)===!0;async function E(w){if(w.preventDefault(),!!r.trim()){p(null);try{await I1(r.trim()),o(""),x(!1),i.invalidateQueries({queryKey:["benchmarks"]})}catch($){p($.message)}}}async function C(w){if(w.preventDefault(),!!d.trim()){p(null);try{const $=await W1(d.trim());h(""),$.length===0&&p("No projects with .agentv/ found in that directory."),i.invalidateQueries({queryKey:["benchmarks"]})}catch($){p($.message)}}}return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Benchmarks"}),f.jsx("div",{className:"flex gap-2",children:!N&&f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button",onClick:()=>S(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"}),f.jsx("button",{type:"button",onClick:()=>x(!m),className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:m?"Cancel":"Add Benchmark"})]})})]}),g&&f.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-3 text-sm text-red-400",children:g}),!N&&m&&f.jsxs("div",{className:"space-y-3 rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[f.jsx("input",{type:"text",value:r,onChange:w=>o(w.target.value),placeholder:"Benchmark path (e.g., /home/user/projects/my-evals)",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),f.jsx("button",{type:"submit",className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:"Add"})]}),f.jsxs("form",{onSubmit:C,className:"flex gap-2",children:[f.jsx("input",{type:"text",value:d,onChange:w=>h(w.target.value),placeholder:"Discover benchmarks in directory...",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),f.jsx("button",{type:"submit",className:"rounded-md bg-gray-700 px-3 py-1.5 text-sm font-medium text-white hover:bg-gray-600",children:"Discover"})]})]}),f.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:j.map(w=>f.jsx(Uj,{project:w},w.id))}),!N&&f.jsx(bs,{open:v,onClose:()=>S(!1)})]})}function Zj(){const i=Jg().location.search.tab,r=Du(),o=Un(),{data:d,isLoading:h,error:g}=Ff(),{data:p}=tp(),{data:m}=pt(),[x,v]=Q.useState(!1),[S,j]=Q.useState("all"),[N,E]=Q.useState(!1),C=(m==null?void 0:m.read_only)===!0,w=Fy.some(L=>L.id===i)?i:"experiments",$=S==="all"?(d==null?void 0:d.runs)??[]:((d==null?void 0:d.runs)??[]).filter(L=>L.source===S);async function X(){E(!0);try{await np(),await Promise.all([o.invalidateQueries({queryKey:["runs"]}),o.invalidateQueries({queryKey:["experiments"]}),o.invalidateQueries({queryKey:["compare"]}),o.invalidateQueries({queryKey:["targets"]}),o.invalidateQueries({queryKey:["remote-status",""]})])}finally{E(!1)}}return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Evaluation Runs"}),(m==null?void 0:m.project_name)&&f.jsx("p",{className:"mt-0.5 text-sm text-gray-500",children:m.project_name})]}),!C&&f.jsx("button",{type:"button",onClick:()=>v(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"})]}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1",children:Fy.map(L=>f.jsx("button",{type:"button",onClick:()=>r({to:"/",search:{tab:L.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${w===L.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:L.label},L.id))})}),w==="runs"&&f.jsx($j,{runs:$,isLoading:h,error:g,sourceFilter:S,onSourceFilterChange:j,remoteStatus:p,syncInFlight:N,onSyncRemote:X}),w==="experiments"&&f.jsx(zj,{}),w==="compare"&&f.jsx(kj,{}),w==="targets"&&f.jsx(Yj,{}),!C&&f.jsx(bs,{open:x,onClose:()=>v(!1)})]})}function kj(){const{data:n,isLoading:l,isError:i,error:r}=X1();return f.jsx(sp,{data:n,isLoading:l,isError:i,error:r})}function $j({runs:n,isLoading:l,error:i,sourceFilter:r,onSourceFilterChange:o,remoteStatus:d,syncInFlight:h,onSyncRemote:g}){return l?f.jsx(ip,{}):i?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",i.message]}):f.jsxs("div",{className:"space-y-4",children:[f.jsx(lp,{filter:r,onFilterChange:o,remoteStatus:d,syncInFlight:h,onSync:g}),f.jsx(ed,{runs:n,emptyMessage:r==="remote"?d!=null&&d.configured?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No remote runs found."}),f.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Sync remote results or run an eval with"," ",f.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"auto_push: true"})," ","in your config."]})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"text-lg text-gray-400",children:"Remote results are not configured."}),f.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Add"," ",f.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"results.export"})," ","to"," ",f.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:".agentv/config.yaml"})," ","to enable remote result syncing."]})]}):void 0})]})}function ip(){return f.jsx("div",{className:"space-y-2",children:["s1","s2","s3","s4","s5"].map(n=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},n))})}function Au({total:n,passed:l,failed:i,passRate:r,totalCost:o}){const d=Math.round(r*100),h=d>=80?"text-cyan-400":d>=60?"text-amber-400":"text-red-400";return f.jsxs("div",{className:"flex flex-wrap items-center gap-6 rounded-lg border border-gray-800 bg-gray-900/60 px-5 py-3",children:[f.jsx(Ci,{label:"Pass Rate",value:`${d}%`,accent:h,large:!0}),f.jsx("div",{className:"h-6 w-px bg-gray-700"}),f.jsx(Ci,{label:"Passed",value:String(l),accent:"text-emerald-400"}),f.jsx(Ci,{label:"Failed",value:String(i),accent:"text-red-400"}),f.jsx(Ci,{label:"Total",value:String(n)}),o!==void 0&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"h-6 w-px bg-gray-700"}),f.jsx(Ci,{label:"Cost",value:`$${o.toFixed(4)}`,accent:"text-amber-400"})]})]})}function Ci({label:n,value:l,accent:i,large:r}){return f.jsxs("div",{className:"flex flex-col",children:[f.jsx("span",{className:"text-xs text-gray-500",children:n}),f.jsx("span",{className:`tabular-nums font-semibold ${r?"text-2xl":"text-lg"} ${i??"text-white"}`,children:l})]})}function Pj(n,l){const i=new Map;for(const r of n){const o=r.category??"Uncategorized",d=r.suite??"Uncategorized";i.has(o)||i.set(o,new Map);const h=i.get(o),g=h.get(d)??{passed:0,failed:0,total:0,scoreSum:0};g.total+=1,g.scoreSum+=r.score,Za(r.score,l)?g.passed+=1:g.failed+=1,h.set(d,g)}return Array.from(i.entries()).map(([r,o])=>{const d=Array.from(o.entries()).map(([x,v])=>({name:x,...v,avgScore:v.total>0?v.scoreSum/v.total:0})).sort((x,v)=>x.name.localeCompare(v.name)),h=d.reduce((x,v)=>x+v.total,0),g=d.reduce((x,v)=>x+v.passed,0),p=d.reduce((x,v)=>x+v.failed,0),m=d.reduce((x,v)=>x+v.avgScore*v.total,0);return{name:r,suites:d,total:h,passed:g,failed:p,avgScore:h>0?m/h:0}}).sort((r,o)=>r.name.localeCompare(o.name))}function rp({results:n,runId:l,benchmarkId:i}){const{data:r}=pt(),o=(r==null?void 0:r.threshold)??(r==null?void 0:r.pass_threshold)??.8,d=n.length,h=n.filter(v=>Za(v.score,o)).length,g=d-h,p=d>0?h/d:0,m=n.reduce((v,S)=>v+(S.costUsd??0),0),x=Pj(n,o);return d===0?f.jsxs("div",{className:"space-y-6",children:[f.jsx(Au,{total:0,passed:0,failed:0,passRate:0}),f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This run has no results yet."})]})]}):f.jsxs("div",{className:"space-y-6",children:[f.jsx(Au,{total:d,passed:h,failed:g,passRate:p,totalCost:m>0?m:void 0}),f.jsxs("div",{children:[f.jsx("h3",{className:"mb-3 text-sm font-medium text-gray-400",children:"Category Breakdown"}),f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Category"}),f.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Passed"}),f.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Failed"}),f.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Total"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:x.map(v=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-2.5 font-medium text-gray-200",children:v.name}),f.jsx("td",{className:"px-4 py-2.5",children:f.jsx(Hi,{rate:v.total>0?v.passed/v.total:0})}),f.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-emerald-400",children:v.passed}),f.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-red-400",children:v.failed>0?v.failed:f.jsx("span",{className:"text-gray-600",children:"0"})}),f.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-gray-400",children:v.total})]},v.name))})]})})]}),f.jsxs("div",{children:[f.jsx("h3",{className:"mb-3 text-sm font-medium text-gray-400",children:"All Evals"}),f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"w-8 px-4 py-3"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map((v,S)=>{const j=v.executionStatus==="execution_error",N=Za(v.score,o);return f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3 text-center",children:j?f.jsx("span",{className:"text-base font-bold text-red-400",children:"!"}):f.jsx("span",{className:`text-base font-bold ${N?"text-emerald-400":"text-red-400"}`,children:N?"✓":"✗"})}),f.jsx("td",{className:"px-4 py-3",children:i?f.jsx(Me,{to:"/projects/$benchmarkId/evals/$runId/$evalId",params:{benchmarkId:i,runId:l,evalId:v.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:v.testId}):f.jsx(Me,{to:"/evals/$runId/$evalId",params:{runId:l,evalId:v.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:v.testId})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:v.target??"-"}),f.jsx("td",{className:"px-4 py-3",children:j?f.jsx("span",{className:"inline-flex rounded-full bg-red-900/50 px-2 py-0.5 text-xs font-medium text-red-400",children:"ERR"}):f.jsx(Hi,{rate:v.score})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:v.durationMs!=null?`${(v.durationMs/1e3).toFixed(1)}s`:"-"}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:v.costUsd!=null?`$${v.costUsd.toFixed(4)}`:"-"})]},`${v.testId}-${S}`)})})]})})]})]})}const up=pa("/runs/$runId")({component:Fj});function Fj(){var E;const{runId:n}=up.useParams(),{data:l,isLoading:i,error:r}=Zi(n),{data:o}=pt(),[d,h]=Q.useState(!1),g=(o==null?void 0:o.read_only)===!0;if(i)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(C=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},C))})]});if(r)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",r.message]});const p=(E=l==null?void 0:l.results)==null?void 0:E[0],m=p==null?void 0:p.target,x=p==null?void 0:p.experiment,v=p==null?void 0:p.timestamp,S=m?{target:m}:void 0,j=(()=>{const C=[x,m].filter(w=>w&&w!=="default");return C.length>0?C.join(" · "):n})(),N=[m,x&&x!=="default"?x:null,v?new Date(v).toLocaleString():null,l==null?void 0:l.source].filter(Boolean).join(" · ");return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:j}),f.jsx("p",{className:"mt-1 text-sm text-gray-500",children:N})]}),!g&&f.jsx("button",{type:"button",onClick:()=>h(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Re-run with Filters"})]}),f.jsx(rp,{results:(l==null?void 0:l.results)??[],runId:n}),!g&&f.jsx(bs,{open:d,onClose:()=>h(!1),prefill:S})]})}const Jy=[{id:"runs",label:"Recent Runs"},{id:"experiments",label:"Experiments"},{id:"compare",label:"Compare"},{id:"targets",label:"Targets"}],cp=pa("/projects/$benchmarkId")({component:Jj});function Jj(){const{benchmarkId:n}=cp.useParams(),r=Jg().location.search.tab,o=Du(),[d,h]=Q.useState(!1),{data:g}=pt(),p=(g==null?void 0:g.read_only)===!0,m=Jy.some(x=>x.id===r)?r:"experiments";return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:n}),!p&&f.jsx("button",{type:"button",onClick:()=>h(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"})]}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1",children:Jy.map(x=>f.jsx("button",{type:"button",onClick:()=>o({to:"/projects/$benchmarkId",params:{benchmarkId:n},search:{tab:x.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${m===x.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:x.label},x.id))})}),m==="runs"&&f.jsx(Ij,{benchmarkId:n}),m==="experiments"&&f.jsx(Wj,{benchmarkId:n}),m==="compare"&&f.jsx(eN,{benchmarkId:n}),m==="targets"&&f.jsx(tN,{benchmarkId:n}),!p&&f.jsx(bs,{open:d,onClose:()=>h(!1),benchmarkId:n})]})}function Ij({benchmarkId:n}){const l=Un(),{data:i,isLoading:r,error:o}=ap(n),{data:d}=tp(n),[h,g]=Q.useState("all"),[p,m]=Q.useState(!1),x=h==="all"?(i==null?void 0:i.runs)??[]:((i==null?void 0:i.runs)??[]).filter(S=>S.source===h);async function v(){m(!0);try{await np(n),await Promise.all([l.invalidateQueries({queryKey:["benchmarks",n,"runs"]}),l.invalidateQueries({queryKey:["benchmarks",n,"experiments"]}),l.invalidateQueries({queryKey:["benchmarks",n,"compare"]}),l.invalidateQueries({queryKey:["benchmarks",n,"targets"]}),l.invalidateQueries({queryKey:["remote-status",n]})])}finally{m(!1)}}return r?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(S=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},S))}):o?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",o.message]}):f.jsxs("div",{className:"space-y-4",children:[f.jsx(lp,{filter:h,onFilterChange:g,remoteStatus:d,syncInFlight:p,onSync:v}),f.jsx(ed,{runs:x,benchmarkId:n})]})}function Wj({benchmarkId:n}){const{data:l,isLoading:i}=Ve(sj(n)),r=(l==null?void 0:l.experiments)??[];return i?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(o=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},o))}):r.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"})}):f.jsx("div",{className:"space-y-2",children:r.map(o=>f.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("div",{children:[f.jsx("p",{className:"font-medium text-white",children:o.name}),f.jsxs("p",{className:"text-sm text-gray-400",children:[o.run_count," run",o.run_count!==1?"s":""]})]}),f.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(o.pass_rate*100),"%"]})]},o.name))})}function eN({benchmarkId:n}){const{data:l,isLoading:i,isError:r,error:o}=Ve(lj(n));return f.jsx(sp,{data:l,isLoading:i,isError:r,error:o})}function tN({benchmarkId:n}){const{data:l,isLoading:i}=Ve(ij(n)),r=(l==null?void 0:l.targets)??[];return i?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(o=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},o))}):r.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"})}):f.jsx("div",{className:"space-y-2",children:r.map(o=>f.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("div",{children:[f.jsx("p",{className:"font-medium text-white",children:o.name}),f.jsxs("p",{className:"text-sm text-gray-400",children:[o.run_count," run",o.run_count!==1?"s":""," · ",o.experiment_count," ","experiment",o.experiment_count!==1?"s":""]})]}),f.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(o.pass_rate*100),"%"]})]},o.name))})}const op=pa("/experiments/$experimentName")({component:aN});function aN(){var v;const{experimentName:n}=op.useParams(),{data:l,isLoading:i}=Jf(),{data:r,isLoading:o}=Ff();if(i||o)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-4 gap-4",children:["s1","s2","s3","s4"].map(S=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},S))})]});const h=(v=l==null?void 0:l.experiments)==null?void 0:v.find(S=>S.name===n),g=(r==null?void 0:r.runs)??[],p=(h==null?void 0:h.pass_rate)??0,m=(h==null?void 0:h.run_count)??0,x=(h==null?void 0:h.target_count)??0;return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:n}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[m," run",m!==1?"s":""," · ",x," target",x!==1?"s":"",(h==null?void 0:h.last_run)&&f.jsxs("span",{className:"ml-2",children:["· Last run: ",Iy(h.last_run)]})]})]}),h&&f.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-4",children:[f.jsx(gu,{label:"Runs",value:String(m)}),f.jsx(gu,{label:"Targets",value:String(x)}),f.jsx(gu,{label:"Pass Rate",value:`${Math.round(p*100)}%`,accent:"text-cyan-400"}),f.jsx(gu,{label:"Last Run",value:Iy(h.last_run)})]}),f.jsxs("div",{children:[f.jsx("h2",{className:"mb-4 text-lg font-medium text-gray-200",children:"All Runs"}),f.jsx(ed,{runs:g})]})]})}function gu({label:n,value:l,accent:i}){return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("p",{className:"text-sm text-gray-400",children:n}),f.jsx("p",{className:`mt-1 text-2xl font-semibold tabular-nums ${i??"text-white"}`,children:l})]})}function Iy(n){if(!n)return"N/A";try{const l=new Date(n);return Number.isNaN(l.getTime())?"N/A":l.toLocaleString()}catch{return"N/A"}}async function nN(n,l){const i=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviews:[{test_id:n,comment:l}]})});if(!i.ok)throw new Error(`Failed to save feedback: ${i.status}`);return i.json()}function sN({testId:n}){var x;const{data:l}=V1(),i=Un(),r=(x=l==null?void 0:l.reviews)==null?void 0:x.find(v=>v.test_id===n),[o,d]=Q.useState((r==null?void 0:r.comment)??""),[h,g]=Q.useState(!1);Q.useEffect(()=>{d((r==null?void 0:r.comment)??""),g(!1)},[r==null?void 0:r.comment]);const p=zb({mutationFn:()=>nN(n,o),onSuccess:()=>{i.invalidateQueries({queryKey:["feedback"]}),g(!0),setTimeout(()=>g(!1),2e3)}}),m=Q.useCallback(()=>{p.mutate()},[p]);return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("h4",{className:"mb-2 text-sm font-medium text-gray-400",children:"Feedback"}),f.jsx("textarea",{value:o,onChange:v=>{d(v.target.value),g(!1)},placeholder:"Add feedback for this test...",className:"w-full rounded-md border border-gray-700 bg-gray-800 p-3 text-sm text-gray-200 placeholder-gray-500 focus:border-cyan-400 focus:outline-none",rows:3}),f.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[f.jsx("button",{type:"button",onClick:m,disabled:p.isPending,className:"rounded-md bg-cyan-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:p.isPending?"Saving...":"Save Feedback"}),h&&f.jsx("span",{className:"text-sm text-emerald-400",children:"Saved"}),p.isError&&f.jsx("span",{className:"text-sm text-red-400",children:"Error saving feedback"})]})]})}function lN(n){var i;switch((i=n.split(".").pop())==null?void 0:i.toLowerCase()){case"ts":case"tsx":return"📘";case"json":return"📋";case"log":case"txt":return"📜";case"md":return"📝";default:return"📄"}}function fp(n){const l=[];for(const i of n)i.type==="dir"&&(l.push(i.path),i.children&&l.push(...fp(i.children)));return l}function dp({node:n,selectedPath:l,onSelect:i,openFolders:r,toggleFolder:o,depth:d=0}){const h=n.type==="dir",g=r.has(n.path),p=l===n.path;return f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>{h?o(n.path):i(n.path)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors ${p?"bg-cyan-400/20 text-cyan-400":"text-gray-300 hover:bg-gray-800/50 hover:text-gray-200"}`,style:{paddingLeft:`${d*16+8}px`},children:[f.jsx("span",{className:"flex-shrink-0 text-xs",children:h?g?"📂":"📁":lN(n.name)}),f.jsx("span",{className:"truncate",children:n.name})]}),h&&g&&n.children&&f.jsx("div",{children:n.children.map(m=>f.jsx(dp,{node:m,selectedPath:l,onSelect:i,openFolders:r,toggleFolder:o,depth:d+1},m.path))})]})}function iN({files:n,selectedPath:l,onSelect:i}){const[r,o]=Q.useState(()=>new Set(fp(n))),d=h=>{o(g=>{const p=new Set(g);return p.has(h)?p.delete(h):p.add(h),p})};return f.jsxs("div",{className:"w-64 overflow-y-auto rounded-lg border border-gray-800 bg-gray-900 py-2",children:[n.length===0&&f.jsx("p",{className:"px-4 py-2 text-sm text-gray-500",children:"No files."}),n.map(h=>f.jsx(dp,{node:h,selectedPath:l,onSelect:i,openFolders:r,toggleFolder:d},h.path))]})}const rN="modulepreload",uN=function(n){return"/"+n},Wy={},cN=function(l,i,r){let o=Promise.resolve();if(i&&i.length>0){let h=function(m){return Promise.all(m.map(x=>Promise.resolve(x).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const g=document.querySelector("meta[property=csp-nonce]"),p=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(i.map(m=>{if(m=uN(m),m in Wy)return;Wy[m]=!0;const x=m.endsWith(".css"),v=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const S=document.createElement("link");if(S.rel=x?"stylesheet":rN,x||(S.as="script"),S.crossOrigin="",S.href=m,p&&S.setAttribute("nonce",p),document.head.appendChild(S),x)return new Promise((j,N)=>{S.addEventListener("load",j),S.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function d(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return o.then(h=>{for(const g of h||[])g.status==="rejected"&&d(g.reason);return l().catch(d)})},oN=Q.lazy(()=>cN(()=>import("./index-CkXzhDmw.js"),[]));function fN({value:n,language:l="json",height:i="400px"}){return f.jsx(Q.Suspense,{fallback:f.jsx("div",{className:"flex items-center justify-center rounded-lg bg-gray-900 p-8 text-gray-500",children:"Loading editor..."}),children:f.jsx(oN,{height:i,language:l,value:n,theme:"vs-dark",options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:"on",wordWrap:"on",padding:{top:12}}})})}function hp(n){for(const l of n){if(l.type==="file")return l.path;if(l.children){const i=hp(l.children);if(i)return i}}return null}function mp({eval:n,runId:l,benchmarkId:i}){const[r,o]=Q.useState("checks"),{data:d}=pt(),h=(d==null?void 0:d.read_only)===!0,g=[{id:"checks",label:"Checks"},{id:"files",label:"Files"},...h?[]:[{id:"feedback",label:"Feedback"}]];return f.jsxs("div",{className:"flex min-h-full flex-col",children:[f.jsx("div",{className:"flex items-start justify-between border-b border-gray-800 px-4 py-3",children:f.jsxs("div",{children:[f.jsx("h3",{className:"text-lg font-medium",children:n.testId}),f.jsxs("p",{className:"mt-0.5 text-sm text-gray-400",children:[n.target&&f.jsxs("span",{children:["Target: ",n.target]}),n.durationMs!=null&&f.jsxs("span",{className:"ml-4",children:[(n.durationMs/1e3).toFixed(1),"s"]}),n.costUsd!=null&&f.jsxs("span",{className:"ml-4",children:["$",n.costUsd.toFixed(4)]})]})]})}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1 px-4",children:g.map(p=>f.jsx("button",{type:"button",onClick:()=>o(p.id),className:`px-4 py-2 text-sm font-medium transition-colors ${r===p.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:p.label},p.id))})}),f.jsxs("div",{className:"min-h-0 flex-1",children:[r==="checks"&&f.jsx("div",{className:"overflow-auto p-4",children:f.jsx(hN,{result:n})}),r==="files"&&f.jsx("div",{className:"h-full p-4",children:f.jsx(mN,{result:n,runId:l,benchmarkId:i})}),!h&&r==="feedback"&&f.jsx("div",{className:"p-4",children:f.jsx(sN,{testId:n.testId})})]})]})}function dN({label:n}){return f.jsx("span",{className:"inline-flex items-center rounded-full border border-gray-700 bg-gray-800 px-2 py-0.5 text-xs font-medium text-gray-400",children:n})}function eg({assertion:n,graderLabel:l}){return f.jsxs("div",{className:`flex items-start gap-3 rounded-lg border p-3 ${n.passed?"border-emerald-900/50 bg-emerald-950/20":"border-red-900/50 bg-red-950/20"}`,children:[f.jsx("span",{className:`mt-0.5 text-lg ${n.passed?"text-emerald-400":"text-red-400"}`,children:n.passed?"✓":"✗"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsxs("p",{className:"text-sm text-gray-200",children:[n.text,n.durationMs!=null&&f.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",(n.durationMs/1e3).toFixed(1),"s)"]})]}),l&&f.jsx(dN,{label:l})]}),n.evidence&&f.jsx("p",{className:"mt-1 text-xs text-gray-400",children:n.evidence})]})]})}function hN({result:n}){const{data:l}=pt(),i=(l==null?void 0:l.threshold)??(l==null?void 0:l.pass_threshold)??.8,r=!Za(n.score,i)||n.executionStatus==="error"||n.executionStatus==="failed",o=(n.scores??[]).filter(m=>Array.isArray(m.assertions)&&m.assertions.length>0),d=o.length>0,h=n.assertions??[],g=[];n.error&&g.push(n.error),(n.executionStatus==="error"||n.executionStatus==="failed")&&g.push(`Execution status: ${n.executionStatus}`);const p=d?o.flatMap(m=>m.assertions):h;for(const m of p.filter(x=>!x.passed)){const x=m.evidence?`${m.text}: ${m.evidence}`:m.text;g.push(x)}if(n.scores){for(const m of n.scores)if(!Za(m.score,i)&&m.details){const x=typeof m.details=="string"?m.details:JSON.stringify(m.details,null,2);g.push(`[${m.name??m.type??"evaluator"}] ${x}`)}}return f.jsxs("div",{className:"space-y-6",children:[f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("span",{className:"text-sm font-medium text-gray-400",children:"Overall score"}),f.jsx("div",{className:"flex-1",children:f.jsx(Cu,{score:n.score})})]})}),n.scores&&n.scores.length>0&&f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-400",children:"Evaluator Scores"}),f.jsx("div",{className:"space-y-3",children:n.scores.map((m,x)=>f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("span",{className:"w-40 truncate text-sm text-gray-300",children:m.name??m.type??`Score ${x+1}`}),f.jsx("div",{className:"flex-1",children:f.jsx(Cu,{score:m.score})})]},`${m.name??m.type??x}`))})]}),d?f.jsx("div",{className:"space-y-6",children:o.map((m,x)=>{const v=m.name??m.type??`Evaluator ${x+1}`;return f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500",children:v}),m.assertions.map((S,j)=>f.jsx(eg,{assertion:S,graderLabel:m.type??void 0},`${S.text}-${j}`))]},`${m.name??m.type??x}`)})}):h.length>0?f.jsx("div",{className:"space-y-2",children:h.map((m,x)=>f.jsx(eg,{assertion:m},`${m.text}-${x}`))}):f.jsx("p",{className:"text-sm text-gray-500",children:"No assertion steps recorded."}),r&&g.length>0&&f.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[f.jsx("h4",{className:"mb-2 text-sm font-medium text-red-400",children:"Failure Reason"}),f.jsx("div",{className:"space-y-2",children:g.map(m=>f.jsx("p",{className:"text-sm text-gray-300",children:m},m))})]})]})}function mN({result:n,runId:l,benchmarkId:i}){const r=n.testId,{data:o}=i?Ve(aj(i,l,r)):k1(l,r),d=(o==null?void 0:o.files)??[],[h,g]=Q.useState(null),p=h??(d.length>0?hp(d):null),{data:m,isLoading:x}=i?Ve(nj(i,l,r,p??"")):$1(l,r,p??"");if(d.length===0)return f.jsx("p",{className:"text-sm text-gray-500",children:"No artifact files available."});const v=p?x?"Loading...":(m==null?void 0:m.content)??"":"",S=p?(m==null?void 0:m.language)??"plaintext":"plaintext";return f.jsxs("div",{className:"flex h-full min-h-[400px] gap-4",children:[f.jsx(iN,{files:d,selectedPath:p,onSelect:g}),f.jsx("div",{className:"flex-1",children:f.jsx(fN,{value:v,language:S,height:"100%"})})]})}const yp=pa("/evals/$runId/$evalId")({component:yN});function yN(){const{runId:n,evalId:l}=yp.useParams(),{data:i,isLoading:r,error:o}=Zi(n),{data:d}=pt(),[h,g]=Q.useState(!1),p=(d==null?void 0:d.read_only)===!0;if(r)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",o.message]});const m=i==null?void 0:i.results.find(x=>x.testId===l);return m?f.jsxs("div",{className:"flex h-full flex-col gap-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",n," / Eval: ",l]}),f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l})]}),!p&&f.jsx("button",{type:"button",onClick:()=>g(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run this Test"})]}),f.jsx(mp,{eval:m,runId:n}),!p&&f.jsx(bs,{open:h,onClose:()=>g(!1),prefill:{testIds:[l],target:m.target}})]}):f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:f.jsxs("p",{className:"text-gray-400",children:["Eval ",f.jsx("code",{className:"text-cyan-400",children:l})," not found in run"," ",f.jsx("code",{className:"text-cyan-400",children:n}),"."]})})}const gp=pa("/runs/$runId_/suite/$suite")({component:gN});function gN(){const{runId:n,suite:l}=gp.useParams(),{data:i,isLoading:r,error:o}=Zi(n),{data:d}=pt(),h=(d==null?void 0:d.threshold)??(d==null?void 0:d.pass_threshold)??.8;if(r)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(j=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},j))})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",o.message]});const g=((i==null?void 0:i.results)??[]).filter(j=>(j.suite??"Uncategorized")===l),p=g.length,m=g.filter(j=>Za(j.score,h)).length,x=p-m,v=p>0?m/p:0,S=g.reduce((j,N)=>j+(N.costUsd??0),0);return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Suite in run: ",n]})]}),f.jsx(Au,{total:p,passed:m,failed:x,passRate:v,totalCost:S>0?S:void 0}),p===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations in this suite"})}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:g.map((j,N)=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:f.jsx(Me,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:j.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:j.testId})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:j.target??"-"}),f.jsx("td",{className:"px-4 py-3",children:j.executionStatus==="execution_error"?f.jsx("span",{className:"inline-flex rounded-full px-2 py-0.5 text-xs font-medium bg-red-900/50 text-red-400",children:"ERR"}):f.jsx(Hi,{rate:j.score})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.durationMs!=null?`${(j.durationMs/1e3).toFixed(1)}s`:"-"}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.costUsd!=null?`$${j.costUsd.toFixed(4)}`:"-"})]},`${j.testId}-${N}`))})]})})]})}const pp=pa("/runs/$runId_/category/$category")({component:pN});function pN(){const{runId:n,category:l}=pp.useParams(),{data:i,isLoading:r,error:o}=ep(n,l);if(r)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(x=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},x))})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load category: ",o.message]});const d=(i==null?void 0:i.suites)??[],h=d.reduce((x,v)=>x+v.total,0),g=d.reduce((x,v)=>x+v.passed,0),p=h-g,m=h>0?g/h:0;return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Category in run: ",n]})]}),f.jsx(Au,{total:h,passed:g,failed:p,passRate:m}),d.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No suites in this category"})}):f.jsxs("div",{className:"space-y-3",children:[f.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Suites"}),f.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:d.map(x=>f.jsxs(Me,{to:"/runs/$runId/suite/$suite",params:{runId:n,suite:x.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:x.name}),f.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[x.passed,"/",x.total]})]}),f.jsx("div",{className:"mt-2",children:f.jsx(Cu,{score:x.avg_score})}),f.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[f.jsxs("span",{className:"text-emerald-400",children:[x.passed," passed"]}),x.failed>0&&f.jsxs("span",{className:"text-red-400",children:[x.failed," failed"]})]})]},x.name))})]})]})}const vp=pa("/projects/$benchmarkId_/runs/$runId")({component:vN});function vN(){var C;const{benchmarkId:n,runId:l}=vp.useParams(),{data:i,isLoading:r,error:o}=Wf(n,l),{data:d}=pt(),[h,g]=Q.useState(!1),p=(d==null?void 0:d.read_only)===!0;if(r)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(w=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},w))})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",o.message]});const m=(C=i==null?void 0:i.results)==null?void 0:C[0],x=m==null?void 0:m.target,v=m==null?void 0:m.experiment,S=m==null?void 0:m.timestamp,j=x?{target:x}:void 0,N=(()=>{const w=[v,x].filter($=>$&&$!=="default");return w.length>0?w.join(" · "):l})(),E=[x,v&&v!=="default"?v:null,S?new Date(S).toLocaleString():null,i==null?void 0:i.source].filter(Boolean).join(" · ");return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:N}),f.jsx("p",{className:"mt-1 text-sm text-gray-500",children:E})]}),!p&&f.jsx("button",{type:"button",onClick:()=>g(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Re-run with Filters"})]}),f.jsx(rp,{results:(i==null?void 0:i.results)??[],runId:l,benchmarkId:n}),!p&&f.jsx(bs,{open:h,onClose:()=>g(!1),benchmarkId:n,prefill:j})]})}const xp=pa("/projects/$benchmarkId_/evals/$runId/$evalId")({component:xN});function xN(){const{benchmarkId:n,runId:l,evalId:i}=xp.useParams(),{data:r,isLoading:o,error:d}=Wf(n,l),{data:h}=pt(),[g,p]=Q.useState(!1),m=(h==null?void 0:h.read_only)===!0;if(o)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(d)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",d.message]});const x=r==null?void 0:r.results.find(v=>v.testId===i);return x?f.jsxs("div",{className:"flex h-full flex-col gap-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",l," / Eval: ",i]}),f.jsx("h1",{className:"text-2xl font-semibold text-white",children:i})]}),!m&&f.jsx("button",{type:"button",onClick:()=>p(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run this Test"})]}),f.jsx(mp,{eval:x,runId:l,benchmarkId:n}),!m&&f.jsx(bs,{open:g,onClose:()=>p(!1),benchmarkId:n,prefill:{testIds:[i],target:x.target}})]}):f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:f.jsxs("p",{className:"text-gray-400",children:["Eval ",f.jsx("code",{className:"text-cyan-400",children:i})," not found in run"," ",f.jsx("code",{className:"text-cyan-400",children:l}),"."]})})}const bN=_j.update({id:"/settings",path:"/settings",getParentRoute:()=>ia}),SN=Kj.update({id:"/",path:"/",getParentRoute:()=>ia}),jN=up.update({id:"/runs/$runId",path:"/runs/$runId",getParentRoute:()=>ia}),NN=cp.update({id:"/projects/$benchmarkId",path:"/projects/$benchmarkId",getParentRoute:()=>ia}),RN=op.update({id:"/experiments/$experimentName",path:"/experiments/$experimentName",getParentRoute:()=>ia}),_N=yp.update({id:"/evals/$runId/$evalId",path:"/evals/$runId/$evalId",getParentRoute:()=>ia}),EN=gp.update({id:"/runs/$runId_/suite/$suite",path:"/runs/$runId/suite/$suite",getParentRoute:()=>ia}),TN=pp.update({id:"/runs/$runId_/category/$category",path:"/runs/$runId/category/$category",getParentRoute:()=>ia}),MN=vp.update({id:"/projects/$benchmarkId_/runs/$runId",path:"/projects/$benchmarkId/runs/$runId",getParentRoute:()=>ia}),CN=xp.update({id:"/projects/$benchmarkId_/evals/$runId/$evalId",path:"/projects/$benchmarkId/evals/$runId/$evalId",getParentRoute:()=>ia}),AN={IndexRoute:SN,SettingsRoute:bN,ExperimentsExperimentNameRoute:RN,ProjectsBenchmarkIdRoute:NN,RunsRunIdRoute:jN,EvalsRunIdEvalIdRoute:_N,ProjectsBenchmarkIdRunsRunIdRoute:MN,RunsRunIdCategoryCategoryRoute:TN,RunsRunIdSuiteSuiteRoute:EN,ProjectsBenchmarkIdEvalsRunIdEvalIdRoute:CN},wN=ia._addFileChildren(AN)._addFileTypes(),ON=new bb({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!0}}}),zN=_1({routeTree:wN}),bp=document.getElementById("root");if(!bp)throw new Error("Root element not found");Px.createRoot(bp).render(f.jsx(Q.StrictMode,{children:f.jsx(Sb,{client:ON,children:f.jsx(M1,{router:zN})})}));export{Oi as W,Q as r};
65
+ */var Ky;function PS(){if(Ky)return df;Ky=1;var n=Xi(),l=$S();function i(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var r=typeof Object.is=="function"?Object.is:i,o=l.useSyncExternalStore,d=n.useRef,h=n.useEffect,g=n.useMemo,p=n.useDebugValue;return df.useSyncExternalStoreWithSelector=function(m,x,v,S,j){var N=d(null);if(N.current===null){var E={hasValue:!1,value:null};N.current=E}else E=N.current;N=g(function(){function w(ee){if(!$){if($=!0,X=ee,ee=S(ee),j!==void 0&&E.hasValue){var P=E.value;if(j(P,ee))return L=P}return L=ee}if(P=L,r(X,ee))return P;var F=S(ee);return j!==void 0&&j(P,F)?(X=ee,P):(X=ee,L=F)}var $=!1,X,L,Z=v===void 0?null:v;return[function(){return w(x())},Z===null?void 0:function(){return w(Z())}]},[x,v,S,j]);var C=o(m,N[0],N[1]);return h(function(){E.hasValue=!0,E.value=C},[C]),p(C),C},df}var Vy;function FS(){return Vy||(Vy=1,ff.exports=PS()),ff.exports}var JS=FS();function IS(n,l){return n===l}function dt(n,l,i=IS){const r=Q.useCallback(h=>{if(!n)return()=>{};const{unsubscribe:g}=n.subscribe(h);return g},[n]),o=Q.useCallback(()=>n==null?void 0:n.get(),[n]);return JS.useSyncExternalStoreWithSelector(r,o,o,l,i)}var WS={state:void 0,get:()=>{},subscribe:()=>()=>{}};function vs(n){const l=gt(),i=Q.useContext(n.from?QS:zu),r=n.from??i,o=r?n.from?l.stores.getMatchStoreByRouteId(r):l.stores.activeMatchStoresById.get(r):void 0,d=Q.useRef(void 0);return dt(o??WS,h=>{if((n.shouldThrow??!0)&&!h&&Va(),h===void 0)return;const g=n.select?n.select(h):h;if(n.structuralSharing??l.options.defaultStructuralSharing){const p=Ka(d.current,g);return d.current=p,p}return g})}function Gg(n){return vs({from:n.from,strict:n.strict,structuralSharing:n.structuralSharing,select:l=>n.select?n.select(l.loaderData):l.loaderData})}function Kg(n){const{select:l,...i}=n;return vs({...i,select:r=>l?l(r.loaderDeps):r.loaderDeps})}function Vg(n){return vs({from:n.from,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,strict:n.strict,select:l=>{const i=n.strict===!1?l.params:l._strictParams;return n.select?n.select(i):i}})}function Xg(n){return vs({from:n.from,strict:n.strict,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,select:l=>n.select?n.select(l.search):l.search})}function Du(n){const l=gt();return Q.useCallback(i=>l.navigate({...i,from:i.from??(n==null?void 0:n.from)}),[n==null?void 0:n.from,l])}function Zg(n){return vs({...n,select:l=>n.select?n.select(l.context):l.context})}var e1=dg();function t1(n,l){const i=gt(),r=Lb(l),{activeProps:o,inactiveProps:d,activeOptions:h,to:g,preload:p,preloadDelay:m,hashScrollIntoView:x,replace:v,startTransition:S,resetScroll:j,viewTransition:N,children:E,target:C,disabled:w,style:$,className:X,onClick:L,onBlur:Z,onFocus:ee,onMouseEnter:P,onMouseLeave:F,onTouchStart:J,ignoreBlocker:K,params:I,search:se,hash:le,state:ue,mask:te,reloadDocument:D,unsafeRelative:V,from:ae,_fromLocation:he,...fe}=n,T=Ug(),Y=Q.useMemo(()=>n,[i,n.from,n._fromLocation,n.hash,n.to,n.search,n.params,n.state,n.mask,n.unsafeRelative]),q=dt(i.stores.location,Se=>Se,(Se,ht)=>Se.href===ht.href),W=Q.useMemo(()=>{const Se={_fromLocation:q,...Y};return i.buildLocation(Se)},[i,q,Y]),me=W.maskedLocation?W.maskedLocation.publicHref:W.publicHref,xe=W.maskedLocation?W.maskedLocation.external:W.external,be=Q.useMemo(()=>r1(me,xe,i.history,w),[w,xe,me,i.history]),Pe=Q.useMemo(()=>{if(be!=null&&be.external)return Ru(be.href,i.protocolAllowlist)?void 0:be.href;if(!u1(g)&&!(typeof g!="string"||g.indexOf(":")===-1))try{return new URL(g),Ru(g,i.protocolAllowlist)?void 0:g}catch{}},[g,be,i.protocolAllowlist]),He=Q.useMemo(()=>{if(Pe)return!1;if(h!=null&&h.exact){if(!Wb(q.pathname,W.pathname,i.basepath))return!1}else{const Se=_u(q.pathname,i.basepath),ht=_u(W.pathname,i.basepath);if(!(Se.startsWith(ht)&&(Se.length===ht.length||Se[ht.length]==="/")))return!1}return((h==null?void 0:h.includeSearch)??!0)&&!ms(q.search,W.search,{partial:!(h!=null&&h.exact),ignoreUndefined:!(h!=null&&h.explicitUndefined)})?!1:h!=null&&h.includeHash?T&&q.hash===W.hash:!0},[h==null?void 0:h.exact,h==null?void 0:h.explicitUndefined,h==null?void 0:h.includeHash,h==null?void 0:h.includeSearch,q,Pe,T,W.hash,W.pathname,W.search,i.basepath]),ra=He?wn(o,{})??a1:yf,va=He?yf:wn(d,{})??yf,Ss=[X,ra.className,va.className].filter(Boolean).join(" "),Ml=($||ra.style||va.style)&&{...$,...ra.style,...va.style},[xa,js]=Q.useState(!1),Ns=Q.useRef(!1),ka=n.reloadDocument||Pe?!1:p??i.options.defaultPreload,Rs=m??i.options.defaultPreloadDelay??0,ta=Q.useCallback(()=>{i.preloadRoute({...Y,_builtLocation:W}).catch(Se=>{console.warn(Se),console.warn(DS)})},[i,Y,W]);Db(r,Q.useCallback(Se=>{Se!=null&&Se.isIntersecting&&ta()},[ta]),i1,{disabled:!!w||ka!=="viewport"}),Q.useEffect(()=>{Ns.current||!w&&ka==="render"&&(ta(),Ns.current=!0)},[w,ta,ka]);const Cl=Se=>{const ht=Se.currentTarget.getAttribute("target"),ua=C!==void 0?C:ht;if(!w&&!c1(Se)&&!Se.defaultPrevented&&(!ua||ua==="_self")&&Se.button===0){Se.preventDefault(),e1.flushSync(()=>{js(!0)});const $i=i.subscribe("onResolved",()=>{$i(),js(!1)});i.navigate({...Y,replace:v,resetScroll:j,hashScrollIntoView:x,startTransition:S,viewTransition:N,ignoreBlocker:K})}};if(Pe)return{...fe,ref:r,href:Pe,...E&&{children:E},...C&&{target:C},...w&&{disabled:w},...$&&{style:$},...X&&{className:X},...L&&{onClick:L},...Z&&{onBlur:Z},...ee&&{onFocus:ee},...P&&{onMouseEnter:P},...F&&{onMouseLeave:F},...J&&{onTouchStart:J}};const _s=Se=>{if(w||ka!=="intent")return;if(!Rs){ta();return}const ht=Se.currentTarget;if(Mi.has(ht))return;const ua=setTimeout(()=>{Mi.delete(ht),ta()},Rs);Mi.set(ht,ua)},Lu=Se=>{w||ka!=="intent"||ta()},ki=Se=>{if(w||!ka||!Rs)return;const ht=Se.currentTarget,ua=Mi.get(ht);ua&&(clearTimeout(ua),Mi.delete(ht))};return{...fe,...ra,...va,href:be==null?void 0:be.href,ref:r,onClick:ol([L,Cl]),onBlur:ol([Z,ki]),onFocus:ol([ee,_s]),onMouseEnter:ol([P,_s]),onMouseLeave:ol([F,ki]),onTouchStart:ol([J,Lu]),disabled:!!w,target:C,...Ml&&{style:Ml},...Ss&&{className:Ss},...w&&n1,...He&&s1,...T&&xa&&l1}}var yf={},a1={className:"active"},n1={role:"link","aria-disabled":!0},s1={"data-status":"active","aria-current":"page"},l1={"data-transitioning":"transitioning"},Mi=new WeakMap,i1={rootMargin:"100px"},ol=n=>l=>{for(const i of n)if(i){if(l.defaultPrevented)return;i(l)}};function r1(n,l,i,r){if(!r)return l?{href:n,external:!0}:{href:i.createHref(n)||"/",external:!1}}function u1(n){if(typeof n!="string")return!1;const l=n.charCodeAt(0);return l===47?n.charCodeAt(1)!==47:l===46}var Me=Q.forwardRef((n,l)=>{const{_asChild:i,...r}=n,{type:o,...d}=t1(r,l),h=typeof r.children=="function"?r.children({isActive:d["data-status"]==="active"}):r.children;if(!i){const{disabled:g,...p}=d;return Q.createElement("a",p,h)}return Q.createElement(i,d,h)});function c1(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}var o1=class extends Lg{constructor(l){super(l),this.useMatch=i=>vs({select:i==null?void 0:i.select,from:this.id,structuralSharing:i==null?void 0:i.structuralSharing}),this.useRouteContext=i=>Zg({...i,from:this.id}),this.useSearch=i=>Xg({select:i==null?void 0:i.select,structuralSharing:i==null?void 0:i.structuralSharing,from:this.id}),this.useParams=i=>Vg({select:i==null?void 0:i.select,structuralSharing:i==null?void 0:i.structuralSharing,from:this.id}),this.useLoaderDeps=i=>Kg({...i,from:this.id}),this.useLoaderData=i=>Gg({...i,from:this.id}),this.useNavigate=()=>Du({from:this.fullPath}),this.Link=Oi.forwardRef((i,r)=>f.jsx(Me,{ref:r,from:this.fullPath,...i}))}};function f1(n){return new o1(n)}var d1=class extends LS{constructor(n){super(n),this.useMatch=l=>vs({select:l==null?void 0:l.select,from:this.id,structuralSharing:l==null?void 0:l.structuralSharing}),this.useRouteContext=l=>Zg({...l,from:this.id}),this.useSearch=l=>Xg({select:l==null?void 0:l.select,structuralSharing:l==null?void 0:l.structuralSharing,from:this.id}),this.useParams=l=>Vg({select:l==null?void 0:l.select,structuralSharing:l==null?void 0:l.structuralSharing,from:this.id}),this.useLoaderDeps=l=>Kg({...l,from:this.id}),this.useLoaderData=l=>Gg({...l,from:this.id}),this.useNavigate=()=>Du({from:this.fullPath}),this.Link=Oi.forwardRef((l,i)=>f.jsx(Me,{ref:i,from:this.fullPath,...l}))}};function h1(n){return new d1(n)}function pa(n){return typeof n=="object"?new Xy(n,{silent:!0}).createRoute(n):new Xy(n,{silent:!0}).createRoute}var Xy=class{constructor(n,l){this.path=n,this.createRoute=i=>{const r=f1(i);return r.isRoot=!1,r},this.silent=l==null?void 0:l.silent}};function m1(n){const l=gt(),i=`not-found-${dt(l.stores.location,r=>r.pathname)}-${dt(l.stores.status,r=>r)}`;return f.jsx(kf,{getResetKey:()=>i,onCatch:(r,o)=>{var d;if(St(r))(d=n.onCatch)==null||d.call(n,r,o);else throw r},errorComponent:({error:r})=>{var o;if(St(r))return(o=n.fallback)==null?void 0:o.call(n,r);throw r},children:n.children})}function y1(){return f.jsx("p",{children:"Not Found"})}function fl(n){return f.jsx(f.Fragment,{children:n.children})}function kg(n,l,i){return l.options.notFoundComponent?f.jsx(l.options.notFoundComponent,{...i}):n.options.defaultNotFoundComponent?f.jsx(n.options.defaultNotFoundComponent,{...i}):f.jsx(y1,{})}function g1(n){return null}function p1(){return g1(gt()),null}var $g=Q.memo(function({matchId:l}){const i=gt(),r=i.stores.activeMatchStoresById.get(l);r||Va();const o=dt(i.stores.loadedAt,h=>h),d=dt(r,h=>h);return f.jsx(v1,{router:i,matchId:l,resetKey:o,matchState:Q.useMemo(()=>{var p;const h=d.routeId,g=(p=i.routesById[h].parentRoute)==null?void 0:p.id;return{routeId:h,ssr:d.ssr,_displayPending:d._displayPending,parentRouteId:g}},[d._displayPending,d.routeId,d.ssr,i.routesById])})});function v1({router:n,matchId:l,resetKey:i,matchState:r}){var N,E;const o=n.routesById[r.routeId],d=o.options.pendingComponent??n.options.defaultPendingComponent,h=d?f.jsx(d,{}):null,g=o.options.errorComponent??n.options.defaultErrorComponent,p=o.options.onCatch??n.options.defaultOnCatch,m=o.isRoot?o.options.notFoundComponent??((N=n.options.notFoundRoute)==null?void 0:N.options.component):o.options.notFoundComponent,x=r.ssr===!1||r.ssr==="data-only",v=(!o.isRoot||o.options.wrapInSuspense||x)&&(o.options.wrapInSuspense??d??(((E=o.options.errorComponent)==null?void 0:E.preload)||x))?Q.Suspense:fl,S=g?kf:fl,j=m?m1:fl;return f.jsxs(o.isRoot?o.options.shellComponent??fl:fl,{children:[f.jsx(zu.Provider,{value:l,children:f.jsx(v,{fallback:h,children:f.jsx(S,{getResetKey:()=>i,errorComponent:g||$f,onCatch:(C,w)=>{if(St(C))throw C;p==null||p(C,w)},children:f.jsx(j,{fallback:C=>{if(!m||C.routeId&&C.routeId!==r.routeId||!C.routeId&&!o.isRoot)throw C;return Q.createElement(m,C)},children:x||r._displayPending?f.jsx(qS,{fallback:h,children:f.jsx(Zy,{matchId:l})}):f.jsx(Zy,{matchId:l})})})})}),r.parentRouteId===ys?f.jsxs(f.Fragment,{children:[f.jsx(x1,{resetKey:i}),n.options.scrollRestoration&&_g?f.jsx(p1,{}):null]}):null]})}function x1({resetKey:n}){const l=gt(),i=Q.useRef(void 0);return wi(()=>{const r=l.latestLocation.href;(i.current===void 0||i.current!==r)&&(l.emit({type:"onRendered",...dl(l.stores.location.state,l.stores.resolvedLocation.state)}),i.current=r)},[l.latestLocation.state.__TSR_key,n,l]),null}var Zy=Q.memo(function({matchId:l}){var m,x,v,S;const i=gt(),r=i.stores.activeMatchStoresById.get(l);r||Va();const o=dt(r,j=>j),d=o.routeId,h=i.routesById[d],g=Q.useMemo(()=>{var N;const j=(N=i.routesById[d].options.remountDeps??i.options.defaultRemountDeps)==null?void 0:N({routeId:d,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return j?JSON.stringify(j):void 0},[d,o.loaderDeps,o._strictParams,o._strictSearch,i.options.defaultRemountDeps,i.routesById]),p=Q.useMemo(()=>{const j=h.options.component??i.options.defaultComponent;return j?f.jsx(j,{},g):f.jsx(Pg,{})},[g,h.options.component,i.options.defaultComponent]);if(o._displayPending)throw(m=i.getMatch(o.id))==null?void 0:m._nonReactive.displayPendingPromise;if(o._forcePending)throw(x=i.getMatch(o.id))==null?void 0:x._nonReactive.minPendingPromise;if(o.status==="pending"){const j=h.options.pendingMinMs??i.options.defaultPendingMinMs;if(j){const N=i.getMatch(o.id);if(N&&!N._nonReactive.minPendingPromise){const E=El();N._nonReactive.minPendingPromise=E,setTimeout(()=>{E.resolve(),N._nonReactive.minPendingPromise=void 0},j)}}throw(v=i.getMatch(o.id))==null?void 0:v._nonReactive.loadPromise}if(o.status==="notFound")return St(o.error)||Va(),kg(i,h,o.error);if(o.status==="redirected")throw wt(o.error)||Va(),(S=i.getMatch(o.id))==null?void 0:S._nonReactive.loadPromise;if(o.status==="error")throw o.error;return p}),Pg=Q.memo(function(){const l=gt(),i=Q.useContext(zu);let r,o=!1,d;{const m=i?l.stores.activeMatchStoresById.get(i):void 0;[r,o]=dt(m,x=>[x==null?void 0:x.routeId,(x==null?void 0:x.globalNotFound)??!1]),d=dt(l.stores.matchesId,x=>x[x.findIndex(v=>v===i)+1])}const h=r?l.routesById[r]:void 0,g=l.options.defaultPendingComponent?f.jsx(l.options.defaultPendingComponent,{}):null;if(o)return h||Va(),kg(l,h,void 0);if(!d)return null;const p=f.jsx($g,{matchId:d});return r===ys?f.jsx(Q.Suspense,{fallback:g,children:p}):p});function b1(){const n=gt(),l=Q.useRef({router:n,mounted:!1}),[i,r]=Q.useState(!1),o=dt(n.stores.isLoading,v=>v),d=dt(n.stores.hasPendingMatches,v=>v),h=af(o),g=o||i||d,p=af(g),m=o||d,x=af(m);return n.startTransition=v=>{r(!0),Q.startTransition(()=>{v(),r(!1)})},Q.useEffect(()=>{const v=n.history.subscribe(n.load),S=n.buildLocation({to:n.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Dn(n.latestLocation.publicHref)!==Dn(S.publicHref)&&n.commitLocation({...S,replace:!0}),()=>{v()}},[n,n.history]),wi(()=>{if(typeof window<"u"&&n.ssr||l.current.router===n&&l.current.mounted)return;l.current={router:n,mounted:!0},(async()=>{try{await n.load()}catch(S){console.error(S)}})()},[n]),wi(()=>{h&&!o&&n.emit({type:"onLoad",...dl(n.stores.location.state,n.stores.resolvedLocation.state)})},[h,n,o]),wi(()=>{x&&!m&&n.emit({type:"onBeforeRouteMount",...dl(n.stores.location.state,n.stores.resolvedLocation.state)})},[m,x,n]),wi(()=>{if(p&&!g){const v=dl(n.stores.location.state,n.stores.resolvedLocation.state);n.emit({type:"onResolved",...v}),Hg(()=>{n.stores.status.setState(()=>"idle"),n.stores.resolvedLocation.setState(()=>n.stores.location.state)}),v.hrefChanged&&US(n)}},[g,p,n]),null}function S1(){const n=gt(),l=n.routesById[ys].options.pendingComponent??n.options.defaultPendingComponent,i=l?f.jsx(l,{}):null,r=f.jsxs(typeof document<"u"&&n.ssr?fl:Q.Suspense,{fallback:i,children:[f.jsx(b1,{}),f.jsx(j1,{})]});return n.options.InnerWrap?f.jsx(n.options.InnerWrap,{children:r}):r}function j1(){const n=gt(),l=dt(n.stores.firstMatchId,o=>o),i=dt(n.stores.loadedAt,o=>o),r=l?f.jsx($g,{matchId:l}):null;return f.jsx(zu.Provider,{value:l,children:n.options.disableGlobalCatchBoundary?r:f.jsx(kf,{getResetKey:()=>i,errorComponent:$f,onCatch:void 0,children:r})})}function Fg(){const n=gt();return dt(n.stores.matchRouteReactivity,l=>l),Q.useCallback(l=>{const{pending:i,caseSensitive:r,fuzzy:o,includeSearch:d,...h}=l;return n.matchRoute(h,{pending:i,caseSensitive:r,fuzzy:o,includeSearch:d})},[n])}function N1(n){const l=gt(),i=Q.useRef(void 0);return dt(l.stores.activeMatchesSnapshot,r=>{const o=r;if(l.options.defaultStructuralSharing){const d=Ka(i.current,o);return i.current=d,d}return o})}var R1=n=>({createMutableStore:Qy,createReadonlyStore:Qy,batch:Hg}),_1=n=>new E1(n),E1=class extends TS{constructor(n){super(n,R1)}};function T1({router:n,children:l,...i}){Object.keys(i).length>0&&n.update({...n.options,...i,context:{...n.options.context,...i.context}});const r=f.jsx(Bg.Provider,{value:n,children:l});return n.options.Wrap?f.jsx(n.options.Wrap,{children:r}):r}function M1({router:n,...l}){return f.jsx(T1,{router:n,...l,children:f.jsx(S1,{})})}function Jg(n){const i=gt();return Q.useRef(void 0),dt(i.stores.__store,r=>r)}function C1(n){const l=gt(),i=Q.useRef(void 0);return dt(l.stores.location,r=>{const o=r;if(l.options.defaultStructuralSharing){const d=Ka(i.current,o);return i.current=d,d}return o})}const Ig=Q.createContext({isOpen:!1,toggle:()=>{},close:()=>{}});function A1({children:n}){const[l,i]=Q.useState(!1);return f.jsx(Ig.Provider,{value:{isOpen:l,toggle:()=>i(r=>!r),close:()=>i(!1)},children:n})}function Wg(){return Q.useContext(Ig)}function gf(n){if(!n)return"Run";const[,l]=n.split("::");return l||n}function w1(n){const l=[];for(let i=1;i<n.length;i++){const r=n[i],o=r.routeId??r.id,d=r.params;o==="/"||o==="/_layout"||(o.includes("/runs/$runId/category/$category")?(l.some(h=>h.label===d.runId)||l.push({label:gf(d.runId),to:`/runs/${encodeURIComponent(d.runId)}`}),l.push({label:d.category??"Category",to:r.pathname})):o.includes("/runs/$runId/suite/$suite")?l.push({label:d.suite??"Suite",to:r.pathname}):o.includes("/runs/$runId")?l.push({label:gf(d.runId),to:r.pathname}):o.includes("/evals/$runId/$evalId")?(l.some(h=>h.label===d.runId)||l.push({label:gf(d.runId),to:`/runs/${encodeURIComponent(d.runId)}`}),l.push({label:d.evalId??"Eval",to:r.pathname})):o.includes("/experiments/$experimentName")?l.push({label:d.experimentName??"Experiment",to:r.pathname}):(o==="/index"||o==="/")&&l.push({label:"Home",to:"/"}))}return l}function O1(){const n=N1(),l=w1(n);return l.length===0?null:f.jsxs("div",{className:"flex items-center gap-2 border-b border-gray-800 bg-gray-950 px-6 py-2 text-sm",children:[f.jsx(Me,{to:"/",className:"text-cyan-400 hover:text-cyan-300 hover:underline",children:"Home"}),l.map((i,r)=>{const o=r===l.length-1;return f.jsxs("span",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-gray-600",children:">"}),o?f.jsx("span",{className:"text-gray-400",children:i.label}):f.jsx(Me,{to:i.to??"/",className:"text-cyan-400 hover:text-cyan-300 hover:underline",children:i.label})]},`${i.label}-${r}`)})]})}async function Xe(n){const l=await fetch(n);if(!l.ok)throw new Error(`API error: ${l.status} ${l.statusText}`);return l.json()}const z1={queryKey:["runs"],queryFn:()=>Xe("/api/runs"),refetchInterval:5e3};function D1(n){return{queryKey:["runs",n],queryFn:()=>Xe(`/api/runs/${encodeURIComponent(n)}`),enabled:!!n}}const L1={queryKey:["feedback"],queryFn:()=>Xe("/api/feedback")},U1={queryKey:["experiments"],queryFn:()=>Xe("/api/experiments")},B1={queryKey:["compare"],queryFn:()=>Xe("/api/compare")},q1={queryKey:["targets"],queryFn:()=>Xe("/api/targets")};function H1(n,l){return{queryKey:["runs",n,"evals",l,"files"],queryFn:()=>Xe(`/api/runs/${encodeURIComponent(n)}/evals/${encodeURIComponent(l)}/files`),enabled:!!n&&!!l}}function Q1(n,l,i){return{queryKey:["runs",n,"evals",l,"files",i],queryFn:()=>Xe(`/api/runs/${encodeURIComponent(n)}/evals/${encodeURIComponent(l)}/files/${i}`),enabled:!!n&&!!l&&!!i}}function Y1(n,l){return{queryKey:["runs",n,"categories",l,"suites"],queryFn:()=>Xe(`/api/runs/${encodeURIComponent(n)}/categories/${encodeURIComponent(l)}/suites`),enabled:!!n&&!!l}}const G1={queryKey:["config"],queryFn:()=>Xe("/api/config"),staleTime:5e3};function K1(n){const l=n?`${Gt(n)}/remote/status`:"/api/remote/status";return{queryKey:["remote-status",n??""],queryFn:()=>Xe(l),staleTime:5e3}}function Ff(){return Ve(z1)}function Zi(n){return Ve(D1(n))}function V1(){return Ve(L1)}function Jf(){return Ve(U1)}function X1(){return Ve(B1)}function Z1(){return Ve(q1)}function k1(n,l){return Ve(H1(n,l))}function $1(n,l,i){return Ve(Q1(n,l,i))}function ep(n,l){return Ve(Y1(n,l))}function pt(){return Ve(G1)}function tp(n){return Ve(K1(n))}const Uf=.8;function Za(n,l=Uf){return n>=l}const P1={queryKey:["benchmarks"],queryFn:()=>Xe("/api/benchmarks"),refetchInterval:1e4};function If(){return Ve(P1)}const F1={queryKey:["benchmarks","all-runs"],queryFn:()=>Xe("/api/benchmarks/all-runs"),refetchInterval:5e3};function J1(){return Ve(F1)}async function I1(n){const l=await fetch("/api/benchmarks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});if(!l.ok){const i=await l.json();throw new Error(i.error||`Failed to add project: ${l.status}`)}return l.json()}async function W1(n){const l=await fetch("/api/benchmarks/discover",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});if(!l.ok){const r=await l.json();throw new Error(r.error||`Failed to discover: ${l.status}`)}return(await l.json()).discovered}function Gt(n){return`/api/benchmarks/${encodeURIComponent(n)}`}function ej(n){return{queryKey:["benchmarks",n,"runs"],queryFn:()=>Xe(`${Gt(n)}/runs`),enabled:!!n,refetchInterval:5e3}}function ap(n){return Ve(ej(n))}function tj(n,l){return{queryKey:["benchmarks",n,"runs",l],queryFn:()=>Xe(`${Gt(n)}/runs/${encodeURIComponent(l)}`),enabled:!!n&&!!l}}function Wf(n,l){return Ve(tj(n,l))}function aj(n,l,i){return{queryKey:["benchmarks",n,"runs",l,"evals",i,"files"],queryFn:()=>Xe(`${Gt(n)}/runs/${encodeURIComponent(l)}/evals/${encodeURIComponent(i)}/files`),enabled:!!n&&!!l&&!!i}}function nj(n,l,i,r){return{queryKey:["benchmarks",n,"runs",l,"evals",i,"files",r],queryFn:()=>Xe(`${Gt(n)}/runs/${encodeURIComponent(l)}/evals/${encodeURIComponent(i)}/files/${r}`),enabled:!!n&&!!l&&!!i&&!!r}}function sj(n){return{queryKey:["benchmarks",n,"experiments"],queryFn:()=>Xe(`${Gt(n)}/experiments`),enabled:!!n}}function lj(n){return{queryKey:["benchmarks",n,"compare"],queryFn:()=>Xe(`${Gt(n)}/compare`),enabled:!!n}}function ij(n){return{queryKey:["benchmarks",n,"targets"],queryFn:()=>Xe(`${Gt(n)}/targets`),enabled:!!n}}async function np(n){const l=n?`${Gt(n)}/remote/sync`:"/api/remote/sync",i=await fetch(l,{method:"POST"});if(!i.ok)throw new Error(`Failed to sync remote results: ${i.status}`);return i.json()}async function rj(n){const l=await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok)throw new Error(`Failed to save config: ${l.status}`);return l.json()}function uj(n){const l=n?`${Gt(n)}/eval/discover`:"/api/eval/discover";return{queryKey:["eval-discover",n??""],queryFn:()=>Xe(l),staleTime:3e4}}function cj(n){return Ve(uj(n))}function oj(n){const l=n?`${Gt(n)}/eval/targets`:"/api/eval/targets";return{queryKey:["eval-targets",n??""],queryFn:()=>Xe(l),staleTime:3e4}}function fj(n){return Ve(oj(n))}async function dj(n,l){const i=l?`${Gt(l)}/eval/run`:"/api/eval/run",r=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const o=await r.json().catch(()=>({error:r.statusText}));throw new Error(o.error??`Failed: ${r.status}`)}return r.json()}function hj(n){return{queryKey:["eval-status",n],queryFn:()=>Xe(`/api/eval/status/${n}`),enabled:!!n,refetchInterval:l=>{var r;const i=(r=l.state.data)==null?void 0:r.status;return i==="finished"||i==="failed"?!1:2e3}}}function mj(n){return Ve(hj(n))}async function yj(n,l){const i=l?`${Gt(l)}/eval/preview`:"/api/eval/preview",r=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`Preview failed: ${r.status}`);return r.json()}function xs({children:n}){const{isOpen:l,close:i}=Wg(),r=C1();return Q.useEffect(()=>{i()},[i,r.pathname]),f.jsxs(f.Fragment,{children:[l&&f.jsx("div",{className:"fixed inset-0 z-30 bg-black/50 md:hidden",onClick:i,onKeyDown:o=>o.key==="Escape"&&i(),role:"button",tabIndex:-1,"aria-label":"Close navigation"}),f.jsx("aside",{className:`fixed inset-y-0 left-0 z-40 flex w-64 flex-col border-r border-gray-800 bg-gray-900/50 transition-transform duration-200 ease-in-out md:static md:z-auto md:translate-x-0 ${l?"translate-x-0":"-translate-x-full"}`,children:n})]})}function gj(){const n=Fg(),l=n({to:"/projects/$benchmarkId/evals/$runId/$evalId",fuzzy:!0}),i=n({to:"/projects/$benchmarkId/runs/$runId",fuzzy:!0}),r=n({to:"/projects/$benchmarkId",fuzzy:!0});if(l&&typeof l=="object"&&"benchmarkId"in l){const{benchmarkId:p,runId:m,evalId:x}=l;return f.jsx(Sj,{benchmarkId:p,runId:m,currentEvalId:x})}if(i&&typeof i=="object"&&"benchmarkId"in i){const{benchmarkId:p,runId:m}=i;return f.jsx(ky,{benchmarkId:p,currentRunId:m})}if(r&&typeof r=="object"&&"benchmarkId"in r){const{benchmarkId:p}=r;return f.jsx(ky,{benchmarkId:p})}const o=n({to:"/evals/$runId/$evalId",fuzzy:!0}),d=n({to:"/runs/$runId/category/$category",fuzzy:!0}),h=n({to:"/runs/$runId/suite/$suite",fuzzy:!0}),g=n({to:"/experiments/$experimentName",fuzzy:!0});if(d&&typeof d=="object"&&"runId"in d){const{runId:p,category:m}=d;return f.jsx(bj,{runId:p,category:m})}if(h&&typeof h=="object"&&"runId"in h){const{runId:p,suite:m}=h;return f.jsx(xj,{runId:p,suite:m})}if(o&&typeof o=="object"&&"runId"in o){const{runId:p,evalId:m}=o;return f.jsx(vj,{runId:p,currentEvalId:m})}if(g&&typeof g=="object"&&"experimentName"in g){const{experimentName:p}=g;return f.jsx(jj,{currentExperiment:p})}return f.jsx(pj,{})}function pj(){const n=Fg(),{data:l}=If(),i=((l==null?void 0:l.projects.length)??0)>0,r=n({to:"/"}),o=n({to:"/runs/$runId",fuzzy:!0}),d=i&&r!==!1,{data:h}=Ff(),{data:g}=J1(),p=d?g:h;return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Runs"}),p==null?void 0:p.runs.map(m=>{const x=r===!1&&o&&typeof o=="object"&&"runId"in o&&o.runId===m.filename;return m.project_id?f.jsx(Me,{to:"/projects/$benchmarkId/runs/$runId",params:{benchmarkId:m.project_id,runId:m.filename},className:"mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",title:m.project_name,children:m.display_name??m.filename},`${m.project_id}/${m.filename}`):f.jsx(Me,{to:"/runs/$runId",params:{runId:m.filename},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${x?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:m.display_name??m.filename},m.filename)})]}),f.jsx("div",{className:"border-t border-gray-800 px-4 py-3",children:f.jsx(Me,{to:"/settings",className:"flex items-center gap-2 text-sm text-gray-400 hover:text-cyan-400",children:"Settings"})})]})}function vj({runId:n,currentEvalId:l}){const{data:i}=Zi(n),{data:r}=pt(),o=(r==null?void 0:r.threshold)??(r==null?void 0:r.pass_threshold)??.8;return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Me,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),i==null?void 0:i.results.map(d=>{const h=d.testId===l,g=Za(d.score,o);return f.jsxs(Me,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:d.testId},className:`mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors ${h?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:[f.jsx("span",{className:`text-xs ${g?"text-emerald-400":"text-red-400"}`,children:g?"✓":"✗"}),f.jsx("span",{className:"truncate",children:d.testId})]},d.testId)})]})]})}function xj({runId:n,suite:l}){const{data:i}=Zi(n),{data:r}=pt(),o=(r==null?void 0:r.threshold)??(r==null?void 0:r.pass_threshold)??.8,d=((i==null?void 0:i.results)??[]).filter(h=>(h.suite??"Uncategorized")===l);return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Me,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n}),f.jsx("p",{className:"truncate text-xs text-gray-500",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),d.map(h=>{const g=Za(h.score,o);return f.jsxs(Me,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:h.testId},className:"mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",children:[f.jsx("span",{className:`text-xs ${g?"text-emerald-400":"text-red-400"}`,children:g?"✓":"✗"}),f.jsx("span",{className:"truncate",children:h.testId})]},h.testId)})]})]})}function bj({runId:n,category:l}){const{data:i}=ep(n,l),r=(i==null?void 0:i.suites)??[];return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Me,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n}),f.jsx("p",{className:"truncate text-xs text-gray-500",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Suites"}),r.map(o=>f.jsxs(Me,{to:"/runs/$runId/suite/$suite",params:{runId:n,suite:o.name},className:"mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",children:[f.jsx("span",{className:`text-xs ${o.passed===o.total?"text-emerald-400":"text-red-400"}`,children:o.passed===o.total?"✓":"✗"}),f.jsx("span",{className:"truncate",children:o.name})]},o.name))]})]})}function ky({benchmarkId:n,currentRunId:l}){const{data:i}=ap(n);return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Me,{to:"/",className:"text-xs text-gray-400 hover:text-cyan-400",children:"← All Benchmarks"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Runs"}),i==null?void 0:i.runs.map(r=>{const o=l===r.filename;return f.jsx(Me,{to:"/projects/$benchmarkId/runs/$runId",params:{benchmarkId:n,runId:r.filename},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${o?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:r.display_name??r.filename},r.filename)})]})]})}function Sj({benchmarkId:n,runId:l,currentEvalId:i}){const{data:r}=Wf(n,l),{data:o}=pt(),d=(o==null?void 0:o.threshold)??(o==null?void 0:o.pass_threshold)??.8;return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Me,{to:"/projects/$benchmarkId/runs/$runId",params:{benchmarkId:n,runId:l},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),r==null?void 0:r.results.map(h=>{const g=h.testId===i,p=Za(h.score,d);return f.jsxs(Me,{to:"/projects/$benchmarkId/evals/$runId/$evalId",params:{benchmarkId:n,runId:l,evalId:h.testId},className:`mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors ${g?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:[f.jsx("span",{className:`text-xs ${p?"text-emerald-400":"text-red-400"}`,children:p?"✓":"✗"}),f.jsx("span",{className:"truncate",children:h.testId})]},h.testId)})]})]})}function jj({currentExperiment:n}){const{data:l}=Jf(),i=(l==null?void 0:l.experiments)??[];return f.jsxs(xs,{children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Me,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsx("div",{className:"border-b border-gray-800 px-4 py-2",children:f.jsx(Me,{to:"/",search:{tab:"experiments"},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← All experiments"})}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Experiments"}),i.map(r=>{const o=r.name===n;return f.jsx(Me,{to:"/experiments/$experimentName",params:{experimentName:r.name},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${o?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:r.name},r.name)})]})]})}function Nj(){return f.jsx(A1,{children:f.jsx(Rj,{})})}function Rj(){const{toggle:n}=Wg();return f.jsxs("div",{className:"flex h-screen overflow-hidden",children:[f.jsx(gj,{}),f.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[f.jsxs("header",{className:"flex items-center gap-3 border-b border-gray-800 bg-gray-900/50 px-4 py-3 md:hidden",children:[f.jsx("button",{type:"button",onClick:n,className:"text-gray-400 hover:text-gray-200","aria-label":"Toggle navigation",children:f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":"Toggle navigation",children:[f.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),f.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),f.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),f.jsx("span",{className:"text-sm font-semibold text-white",children:"AgentV Studio"})]}),f.jsx(O1,{}),f.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:f.jsx(Pg,{})})]})]})}const ia=h1({component:Nj}),_j=pa("/settings")({component:Ej});function Ej(){const{data:n,isLoading:l}=pt(),i=Un(),[r,o]=Q.useState(""),[d,h]=Q.useState(!1),[g,p]=Q.useState(null),m=(n==null?void 0:n.threshold)??Uf,x=r||String(m),v=(n==null?void 0:n.read_only)===!0,S=async()=>{const j=Number.parseFloat(r||String(m));if(Number.isNaN(j)||j<0||j>1){p({type:"error",text:"Threshold must be a number between 0 and 1"});return}h(!0),p(null);try{await rj({threshold:j}),await i.invalidateQueries({queryKey:["config"]}),o(""),p({type:"success",text:"Settings saved"}),setTimeout(()=>p(null),3e3)}catch{p({type:"error",text:"Failed to save settings"})}finally{h(!1)}};return l?f.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[f.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-40 animate-pulse rounded-lg bg-gray-900"})]}):f.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Settings"}),f.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Configure your AgentV Studio dashboard"})]}),f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6",children:[f.jsx("h2",{className:"text-lg font-medium text-white",children:"Evaluation"}),f.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Configure how evaluation results are classified"}),f.jsx("div",{className:"mt-6 space-y-4",children:f.jsxs("div",{children:[f.jsx("label",{htmlFor:"pass-threshold",className:"block text-sm font-medium text-gray-300",children:"Pass Threshold"}),f.jsxs("p",{className:"mt-1 text-xs text-gray-500",children:["Score at or above this value is considered passing. Default: ",Uf]}),f.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[f.jsx("input",{id:"pass-threshold",type:"number",min:"0",max:"1",step:"0.05",value:x,onChange:j=>o(j.target.value),disabled:v,className:"w-32 rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500"}),f.jsxs("span",{className:"text-sm text-gray-400",children:["(",Math.round((Number.parseFloat(x)||0)*100),"%)"]})]})]})}),f.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[!v&&f.jsx("button",{type:"button",onClick:S,disabled:d,className:"rounded-md bg-cyan-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-cyan-500 disabled:opacity-50",children:d?"Saving...":"Save Settings"}),v&&f.jsx("span",{className:"text-sm text-gray-400",children:"Read-only mode is enabled."}),g&&f.jsx("span",{className:`text-sm ${g.type==="success"?"text-emerald-400":"text-red-400"}`,children:g.text})]})]}),f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:f.jsxs("p",{className:"text-xs text-gray-500",children:["Settings are stored in ",f.jsx("code",{className:"text-gray-400",children:".agentv/config.yaml"})]})})]})}function sp({data:n,isLoading:l,isError:i,error:r}){if(l)return f.jsx(Oj,{});if(i&&r)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load comparison data: ",r.message]});if(!n||n.cells.length===0)return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No comparison data available"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Run evaluations with different experiment and target combinations to see a comparison matrix."})]});const{experiments:o,targets:d,cells:h}=n;if(o.length<=1&&d.length<=1)return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"Not enough variation to compare"}),f.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["The comparison matrix requires at least 2 experiments or 2 targets. Currently there"," ",o.length===1?"is 1 experiment":`are ${o.length} experiments`," ","and ",d.length===1?"1 target":`${d.length} targets`,"."]})]});const g=new Map;for(const p of h)g.set(JSON.stringify([p.experiment,p.target]),p);return f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-400",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"inline-block h-3 w-3 rounded-sm bg-gray-800/60 ring-1 ring-emerald-500/60"}),f.jsx("span",{className:"text-emerald-400",children:"80%+"})]}),f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"inline-block h-3 w-3 rounded-sm bg-gray-800/60 ring-1 ring-amber-500/60"}),f.jsx("span",{className:"text-amber-400",children:"50–80%"})]}),f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"inline-block h-3 w-3 rounded-sm bg-gray-800/60 ring-1 ring-red-500/60"}),f.jsx("span",{className:"text-red-400",children:"<50%"})]}),f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"inline-block h-3 w-3 rounded-sm border border-dashed border-gray-700"}),"No data"]})]}),f.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),o.map(p=>f.jsx("th",{className:"px-4 py-3 text-center font-medium text-gray-400",children:p},p))]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:d.map(p=>f.jsx(Tj,{target:p,experiments:o,cellMap:g},p))})]})})]})}function Tj({target:n,experiments:l,cellMap:i}){return f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:n}),l.map(r=>{const o=i.get(JSON.stringify([r,n]));return f.jsx("td",{className:"px-2 py-2",children:o?f.jsx(Aj,{cell:o}):f.jsx("div",{className:"flex items-center justify-center rounded-lg border border-dashed border-gray-700 px-3 py-4 text-gray-600",children:"--"})},r)})]})}function Mj(n){return n>=.8?"ring-emerald-500/60":n>=.5?"ring-amber-500/60":"ring-red-500/60"}function Cj(n){return n>=.8?"text-emerald-400":n>=.5?"text-amber-400":"text-red-400"}function Aj({cell:n}){const[l,i]=Q.useState(!1),r=Math.round(n.pass_rate*100),o=Math.round(n.avg_score*100);return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("button",{type:"button",onClick:()=>i(!l),"aria-expanded":l,className:`w-full rounded-lg bg-gray-800/60 px-3 py-3 text-center ring-1 transition-colors hover:bg-gray-700/60 ${Mj(n.pass_rate)}`,children:[f.jsx("div",{className:"flex items-center justify-center",children:f.jsxs("span",{className:`text-lg font-semibold tabular-nums ${Cj(n.pass_rate)}`,children:[r,"%"]})}),f.jsxs("div",{className:"mt-0.5 text-xs text-gray-400",children:[n.passed_count,"/",n.eval_count," pass | avg ",o,"%"]})]}),l&&f.jsx(wj,{tests:n.tests})]})}function wj({tests:n}){return f.jsxs("div",{className:"mt-1 max-h-48 overflow-y-auto rounded-md border border-gray-800 bg-gray-950/80 p-2",children:[f.jsx("div",{className:"mb-1 text-xs font-medium text-gray-500",children:"Test Cases"}),f.jsx("div",{className:"space-y-0.5",children:n.map(l=>f.jsxs("div",{className:"flex items-center gap-2 rounded px-1.5 py-0.5 text-xs",children:[f.jsx("span",{className:l.passed?"text-emerald-400":"text-red-400",children:l.passed?"✓":"✗"}),f.jsx("span",{className:"flex-1 truncate text-gray-300",title:l.test_id,children:l.test_id}),f.jsxs("span",{className:"tabular-nums text-gray-500",children:[Math.round(l.score*100),"%"]})]},l.test_id))})]})}function Oj(){return f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3"].map(n=>f.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-6",children:[f.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"}),f.jsx("div",{className:"h-16 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-16 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-16 w-32 rounded bg-gray-800"})]},n))]})})}function Hi({rate:n}){const l=Math.round(n*100);return f.jsxs("div",{className:"relative h-5 w-20 overflow-hidden rounded-full bg-gray-800",children:[f.jsx("div",{className:"absolute inset-y-0 left-0 bg-gradient-to-r from-blue-400 to-blue-600",style:{width:`${l}%`}}),f.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-semibold tabular-nums text-white",children:[l,"%"]})]})}function zj(){const{data:n,isLoading:l}=Jf();if(l)return f.jsx(Dj,{});const i=(n==null?void 0:n.experiments)??[];return i.length===0?f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Experiments will appear here once evaluations are run with experiment labels."})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Targets"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Last Run"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:i.map(r=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:f.jsx(Me,{to:"/experiments/$experimentName",params:{experimentName:r.name},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:r.name})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.run_count}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.target_count}),f.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[f.jsx("span",{className:"text-emerald-400",children:r.passed_count}),f.jsx("span",{className:"text-gray-600",children:" / "}),r.eval_count]}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Hi,{rate:r.pass_rate})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",title:$y(r.last_run).full,children:$y(r.last_run).date})]},r.name))})]})})}function $y(n){if(!n)return{date:"N/A",full:"N/A"};try{const l=new Date(n);if(Number.isNaN(l.getTime()))return{date:"N/A",full:"N/A"};const i=l.toLocaleString(),r=Date.now()-l.getTime(),o=Math.floor(r/6e4),d=Math.floor(r/36e5);let h;return o<1?h="just now":o<60?h=`${o} min ago`:d<24?h=`${d} hour${d===1?"":"s"} ago`:h=l.toLocaleDateString(),{date:h,full:i}}catch{return{date:"N/A",full:"N/A"}}}function Dj(){return f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(n=>f.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[f.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},n))]})})}function Lj(n){if(!n)return"No runs";const l=new Date(n);if(Number.isNaN(l.getTime()))return"N/A";const i=Date.now()-l.getTime(),r=Math.floor(i/6e4);if(r<1)return"Just now";if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Uj({project:n}){const l=Math.round(n.pass_rate*100);return f.jsxs(Me,{to:"/projects/$benchmarkId",params:{benchmarkId:n.id},className:"group block rounded-lg border border-gray-800 bg-gray-900/50 p-5 transition-colors hover:border-cyan-800 hover:bg-gray-900",children:[f.jsx("div",{className:"flex items-start justify-between",children:f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("h3",{className:"truncate text-lg font-semibold text-white group-hover:text-cyan-400",children:n.name}),f.jsx("p",{className:"mt-1 truncate text-xs text-gray-500",children:n.path})]})}),f.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-3",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Runs"}),f.jsx("p",{className:"text-lg font-semibold text-white",children:n.run_count})]}),f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Pass Rate"}),f.jsx("p",{className:`text-lg font-semibold ${n.run_count===0?"text-gray-500":l>=80?"text-emerald-400":l>=50?"text-yellow-400":"text-red-400"}`,children:n.run_count>0?`${l}%`:"--"})]}),f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Last Run"}),f.jsx("p",{className:"text-sm text-gray-300",children:Lj(n.last_run)})]})]})]})}function bs({open:n,onClose:l,benchmarkId:i,prefill:r}){const o=Un(),[d,h]=Q.useState((r==null?void 0:r.suiteFilter)??""),[g,p]=Q.useState(""),[m,x]=Q.useState((r==null?void 0:r.testIds)??[]),[v,S]=Q.useState((r==null?void 0:r.target)??""),[j,N]=Q.useState(""),[E,C]=Q.useState(""),[w,$]=Q.useState(!1),[X,L]=Q.useState(!1),[Z,ee]=Q.useState(null),[P,F]=Q.useState(null),[J,K]=Q.useState(!1),[I,se]=Q.useState(null),{data:le}=cj(i),{data:ue}=fj(i),{data:te}=mj(Z),D=Q.useMemo(()=>(le==null?void 0:le.eval_files)??[],[le]),V=Q.useMemo(()=>(ue==null?void 0:ue.targets)??[],[ue]);Q.useEffect(()=>{n&&(h((r==null?void 0:r.suiteFilter)??""),x((r==null?void 0:r.testIds)??[]),S((r==null?void 0:r.target)??""),p(""),N(""),C(""),$(!1),L(!1),ee(null),F(null),K(!1),se(null))},[n,r]),Q.useEffect(()=>{((te==null?void 0:te.status)==="finished"||(te==null?void 0:te.status)==="failed")&&(o.invalidateQueries({queryKey:["runs"]}),o.invalidateQueries({queryKey:["projects"]}))},[te==null?void 0:te.status,o]);const ae=Q.useCallback(()=>{const q={};return d.trim()&&(q.suite_filter=d.trim()),m.length>0&&(q.test_ids=m),v&&(q.target=v),j&&(q.threshold=Number.parseFloat(j)),E&&(q.workers=Number.parseInt(E,10)),w&&(q.dry_run=!0),q},[d,m,v,j,E,w]);Q.useEffect(()=>{const q=ae();if(!q.suite_filter&&(!q.test_ids||q.test_ids.length===0)){se(null);return}yj(q,i).then(W=>se(W.command)).catch(()=>se(null))},[ae,i]);function he(){const q=g.trim();q&&!m.includes(q)&&x([...m,q]),p("")}function fe(q){x(m.filter(W=>W!==q))}async function T(){F(null),K(!0);try{const q=ae(),W=await dj(q,i);ee(W.id)}catch(q){F(q.message)}finally{K(!1)}}if(!n)return null;if(Z&&te)return f.jsx(Py,{onClose:l,title:"Eval Run",children:f.jsx(Bj,{status:te,onClose:l})});const Y=!!(d.trim()||m.length>0);return f.jsx(Py,{onClose:l,title:"Run Eval",children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx("label",{htmlFor:"suite-filter",className:"mb-1 block text-sm font-medium text-gray-300",children:"Suite Filter"}),f.jsx("input",{id:"suite-filter",type:"text",value:d,onChange:q=>h(q.target.value),placeholder:"evals/**/*.eval.yaml",className:"w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),D.length>0&&!d&&f.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[D.slice(0,5).map(q=>f.jsx("button",{type:"button",onClick:()=>h(W=>W?`${W}, ${q.relative_path}`:q.relative_path),className:"rounded bg-gray-800 px-2 py-0.5 text-xs text-gray-400 hover:bg-gray-700 hover:text-gray-200",children:q.relative_path},q.relative_path)),D.length>5&&f.jsxs("span",{className:"px-1 text-xs text-gray-500",children:["+",D.length-5," more"]})]})]}),f.jsxs("div",{children:[f.jsx("label",{htmlFor:"test-id-input",className:"mb-1 block text-sm font-medium text-gray-300",children:"Test ID Filter"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx("input",{id:"test-id-input",type:"text",value:g,onChange:q=>p(q.target.value),onKeyDown:q=>{q.key==="Enter"&&(q.preventDefault(),he())},placeholder:"auth-*, retrieval-basic",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),f.jsx("button",{type:"button",onClick:he,disabled:!g.trim(),className:"rounded-md bg-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-600 disabled:opacity-50",children:"Add"})]}),m.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:m.map(q=>f.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-cyan-900/40 px-2.5 py-0.5 text-xs text-cyan-300",children:[q,f.jsx("button",{type:"button",onClick:()=>fe(q),className:"text-cyan-400 hover:text-white",children:"×"})]},q))})]}),f.jsxs("div",{children:[f.jsx("label",{htmlFor:"target-override",className:"mb-1 block text-sm font-medium text-gray-300",children:"Target Override"}),f.jsxs("select",{id:"target-override",value:v,onChange:q=>S(q.target.value),className:"w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white focus:border-cyan-600 focus:outline-none",children:[f.jsx("option",{value:"",children:"Use eval's configured target"}),V.map(q=>f.jsx("option",{value:q,children:q},q))]})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>L(!X),className:"text-sm text-gray-400 hover:text-gray-200",children:[X?"▾":"▸"," Advanced Options"]}),X&&f.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-3",children:[f.jsxs("div",{children:[f.jsx("label",{htmlFor:"threshold-input",className:"mb-1 block text-xs text-gray-400",children:"Threshold (0–1)"}),f.jsx("input",{id:"threshold-input",type:"number",value:j,onChange:q=>N(q.target.value),min:"0",max:"1",step:"0.1",placeholder:"0.8",className:"w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"})]}),f.jsxs("div",{children:[f.jsx("label",{htmlFor:"workers-input",className:"mb-1 block text-xs text-gray-400",children:"Workers"}),f.jsx("input",{id:"workers-input",type:"number",value:E,onChange:q=>C(q.target.value),min:"1",max:"50",placeholder:"3",className:"w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"})]}),f.jsx("div",{className:"col-span-2",children:f.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-400",children:[f.jsx("input",{type:"checkbox",checked:w,onChange:q=>$(q.target.checked),className:"rounded border-gray-600 bg-gray-800"}),"Dry run (mock provider responses)"]})})]})]}),I&&f.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:[f.jsx("div",{className:"mb-1 text-xs text-gray-500",children:"CLI Preview"}),f.jsx("code",{className:"block break-all text-xs text-cyan-300",children:I})]}),P&&f.jsx("div",{className:"rounded-md border border-red-900/50 bg-red-950/20 p-2 text-sm text-red-400",children:P}),f.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[f.jsx("button",{type:"button",onClick:l,className:"rounded-md bg-gray-700 px-4 py-2 text-sm text-white hover:bg-gray-600",children:"Cancel"}),f.jsx("button",{type:"button",onClick:T,disabled:!Y||J,className:"rounded-md bg-cyan-600 px-4 py-2 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:J?"Launching…":"Run Now"})]})]})})}function Py({children:n,onClose:l,title:i}){return f.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/60 pt-[10vh]",children:f.jsxs("div",{className:"w-full max-w-lg rounded-lg border border-gray-700 bg-gray-900 shadow-xl",children:[f.jsxs("div",{className:"flex items-center justify-between border-b border-gray-800 px-5 py-3",children:[f.jsx("h2",{className:"text-lg font-semibold text-white",children:i}),f.jsx("button",{type:"button",onClick:l,className:"text-gray-400 hover:text-white",children:"✕"})]}),f.jsx("div",{className:"px-5 py-4",children:n})]})})}function Bj({status:n,onClose:l}){const i=n.status==="finished"||n.status==="failed",r={starting:"text-yellow-400",running:"text-cyan-400",finished:"text-emerald-400",failed:"text-red-400"};return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("span",{className:`text-sm font-medium ${r[n.status]??"text-gray-400"}`,children:[n.status==="running"&&"●"," ",n.status.charAt(0).toUpperCase()+n.status.slice(1)]}),!i&&f.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent"})]}),f.jsx("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:f.jsx("code",{className:"block break-all text-xs text-cyan-300",children:n.command})}),n.stdout&&f.jsx("div",{className:"max-h-48 overflow-y-auto rounded-md bg-gray-950 p-3",children:f.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-300",children:n.stdout.slice(-3e3)})}),n.stderr&&f.jsx("div",{className:"max-h-24 overflow-y-auto rounded-md bg-red-950/20 p-3",children:f.jsx("pre",{className:"whitespace-pre-wrap text-xs text-red-300",children:n.stderr.slice(-2e3)})}),i&&f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("span",{className:"text-xs text-gray-500",children:["Exit code: ",n.exit_code,n.finished_at&&` · ${new Date(n.finished_at).toLocaleTimeString()}`]}),f.jsx("button",{type:"button",onClick:l,className:"rounded-md bg-gray-700 px-4 py-2 text-sm text-white hover:bg-gray-600",children:"Close"})]})]})}function qj(n){if(!n)return{date:"N/A",full:"N/A"};try{const l=new Date(n);if(Number.isNaN(l.getTime()))return{date:"N/A",full:"N/A"};const i=l.toLocaleString(),r=Date.now()-l.getTime(),o=Math.floor(r/6e4),d=Math.floor(r/36e5);let h;return o<1?h="just now":o<60?h=`${o} min ago`:d<24?h=`${d} hour${d===1?"":"s"} ago`:h=l.toLocaleDateString(),{date:h,full:i}}catch{return{date:"N/A",full:"N/A"}}}function Hj(n){const l=[n.target,n.experiment].filter(i=>i&&i!=="default"&&i!=="-");return l.length>0?l.join(" · "):n.target?n.target:n.display_name??n.filename}function ed({runs:n,benchmarkId:l,emptyMessage:i}){return n.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:i??f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluation runs found."}),f.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Run an evaluation first:"," ",f.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"agentv eval <eval-file>"})]})]})}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"w-8 px-4 py-3"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Run"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Passed"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Failed"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Total"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"When"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(r=>{const o=qj(r.timestamp),d=r.pass_rate>=.8,h=Hj(r),g=Math.round(r.pass_rate*r.test_count),p=r.test_count-g;return f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3 text-center",children:f.jsx("span",{className:`text-base font-bold ${d?"text-emerald-400":"text-red-400"}`,children:d?"✓":"✗"})}),f.jsx("td",{className:"px-4 py-3",children:l?f.jsx(Me,{to:"/projects/$benchmarkId/runs/$runId",params:{benchmarkId:l,runId:r.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:h}):f.jsx(Me,{to:"/runs/$runId",params:{runId:r.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:h})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-emerald-300",children:g}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:p>0?p:f.jsx("span",{className:"text-gray-600",children:"0"})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.test_count}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Hi,{rate:r.pass_rate})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",title:o.full,children:o.date})]},r.filename)})})]})})}function Qj(n){if(!n)return"Never synced";const l=new Date(n);return Number.isNaN(l.getTime())?"Never synced":`Last synced ${l.toLocaleString()}`}function lp({filter:n,onFilterChange:l,remoteStatus:i,syncInFlight:r,onSync:o}){const d=(i==null?void 0:i.configured)===!0,h=d&&(i==null?void 0:i.available)!==!0;return f.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-4",children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[f.jsx("div",{className:"flex flex-wrap items-center gap-2",children:["all","local","remote"].map(g=>{const p=g==="remote"&&!d;return f.jsx("button",{type:"button",onClick:()=>l(g),title:p?"Remote results are not configured":void 0,className:`rounded-full px-3 py-1 text-sm font-medium transition-colors ${n===g?"bg-cyan-500/20 text-cyan-300":p?"bg-gray-800 text-gray-600":"bg-gray-800 text-gray-400 hover:text-gray-200"}`,children:g==="all"?"All Sources":g==="local"?"Local Only":"Remote Only"},g)})}),d&&o?f.jsx("button",{type:"button",onClick:o,disabled:r,className:"rounded-md border border-cyan-800 bg-cyan-950/40 px-3 py-1.5 text-sm font-medium text-cyan-300 transition-colors hover:bg-cyan-900/50 disabled:cursor-not-allowed disabled:opacity-60",children:r?"Syncing…":"Sync Remote Results"}):null]}),d?f.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-gray-400",children:[f.jsx("span",{children:Qj(i==null?void 0:i.last_synced_at)}),i!=null&&i.repo?f.jsxs("span",{children:["Repo: ",i.repo]}):null,h?f.jsx("span",{className:"text-yellow-400",children:"Remote cache unavailable"}):null]}):n==="all"?f.jsxs("p",{className:"text-sm text-gray-500",children:["Remote results are not configured. Add"," ",f.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:"results.export"})," to"," ",f.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:".agentv/config.yaml"})," to enable."]}):null,i!=null&&i.last_error?f.jsx("div",{className:"rounded-md border border-yellow-900/50 bg-yellow-950/20 px-3 py-2 text-sm text-yellow-300",children:i.last_error}):null]})}function Cu({score:n,className:l=""}){const i=Math.round(Math.max(0,Math.min(1,n))*100);return f.jsxs("div",{className:`flex items-center gap-3 ${l}`,children:[f.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-gray-800",children:f.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-cyan-400 to-blue-500 transition-all duration-300",style:{width:`${i}%`}})}),f.jsxs("span",{className:"w-12 text-right text-sm font-medium tabular-nums text-gray-300",children:[i,"%"]})]})}function Yj(){const{data:n,isLoading:l}=Z1();if(l)return f.jsx(Gj,{});const i=(n==null?void 0:n.targets)??[];return i.length===0?f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Targets will appear here once evaluations are run with target labels."})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Experiments"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:i.map(r=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:r.name}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.run_count}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.experiment_count}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Cu,{score:r.pass_rate})}),f.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[f.jsx("span",{className:"text-emerald-400",children:r.passed_count}),f.jsx("span",{className:"text-gray-600",children:"/"}),f.jsx("span",{children:r.eval_count})]})]},r.name))})]})})}function Gj(){return f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(n=>f.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[f.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-20 rounded bg-gray-800"})]},n))]})})}const Fy=[{id:"runs",label:"🏃 Recent Runs"},{id:"experiments",label:"🧪 Experiments"},{id:"compare",label:"📊 Compare"},{id:"targets",label:"🤖 Targets"}],Kj=pa("/")({component:Vj});function Vj(){const{data:n,isLoading:l}=If(),{data:i,isLoading:r}=pt(),o=((n==null?void 0:n.projects.length)??0)>0,d=i==null?void 0:i.multi_project_dashboard;return l||r?f.jsx(ip,{}):d===!0||d===void 0&&o?f.jsx(Xj,{}):f.jsx(Zj,{})}function Xj(){const{data:n}=If(),{data:l}=pt(),i=Un(),[r,o]=Q.useState(""),[d,h]=Q.useState(""),[g,p]=Q.useState(null),[m,x]=Q.useState(!1),[v,S]=Q.useState(!1),j=(n==null?void 0:n.projects)??[],N=(l==null?void 0:l.read_only)===!0;async function E(w){if(w.preventDefault(),!!r.trim()){p(null);try{await I1(r.trim()),o(""),x(!1),i.invalidateQueries({queryKey:["benchmarks"]})}catch($){p($.message)}}}async function C(w){if(w.preventDefault(),!!d.trim()){p(null);try{const $=await W1(d.trim());h(""),$.length===0&&p("No projects with .agentv/ found in that directory."),i.invalidateQueries({queryKey:["benchmarks"]})}catch($){p($.message)}}}return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Benchmarks"}),f.jsx("div",{className:"flex gap-2",children:!N&&f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button",onClick:()=>S(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"}),f.jsx("button",{type:"button",onClick:()=>x(!m),className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:m?"Cancel":"Add Benchmark"})]})})]}),g&&f.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-3 text-sm text-red-400",children:g}),!N&&m&&f.jsxs("div",{className:"space-y-3 rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[f.jsx("input",{type:"text",value:r,onChange:w=>o(w.target.value),placeholder:"Benchmark path (e.g., /home/user/projects/my-evals)",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),f.jsx("button",{type:"submit",className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:"Add"})]}),f.jsxs("form",{onSubmit:C,className:"flex gap-2",children:[f.jsx("input",{type:"text",value:d,onChange:w=>h(w.target.value),placeholder:"Discover benchmarks in directory...",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),f.jsx("button",{type:"submit",className:"rounded-md bg-gray-700 px-3 py-1.5 text-sm font-medium text-white hover:bg-gray-600",children:"Discover"})]})]}),f.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:j.map(w=>f.jsx(Uj,{project:w},w.id))}),!N&&f.jsx(bs,{open:v,onClose:()=>S(!1)})]})}function Zj(){const i=Jg().location.search.tab,r=Du(),o=Un(),{data:d,isLoading:h,error:g}=Ff(),{data:p}=tp(),{data:m}=pt(),[x,v]=Q.useState(!1),[S,j]=Q.useState("all"),[N,E]=Q.useState(!1),C=(m==null?void 0:m.read_only)===!0,w=Fy.some(L=>L.id===i)?i:"experiments",$=S==="all"?(d==null?void 0:d.runs)??[]:((d==null?void 0:d.runs)??[]).filter(L=>L.source===S);async function X(){E(!0);try{await np(),await Promise.all([o.invalidateQueries({queryKey:["runs"]}),o.invalidateQueries({queryKey:["experiments"]}),o.invalidateQueries({queryKey:["compare"]}),o.invalidateQueries({queryKey:["targets"]}),o.invalidateQueries({queryKey:["remote-status",""]})])}finally{E(!1)}}return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Evaluation Runs"}),(m==null?void 0:m.project_name)&&f.jsx("p",{className:"mt-0.5 text-sm text-gray-500",children:m.project_name})]}),!C&&f.jsx("button",{type:"button",onClick:()=>v(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"})]}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1",children:Fy.map(L=>f.jsx("button",{type:"button",onClick:()=>r({to:"/",search:{tab:L.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${w===L.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:L.label},L.id))})}),w==="runs"&&f.jsx($j,{runs:$,isLoading:h,error:g,sourceFilter:S,onSourceFilterChange:j,remoteStatus:p,syncInFlight:N,onSyncRemote:X}),w==="experiments"&&f.jsx(zj,{}),w==="compare"&&f.jsx(kj,{}),w==="targets"&&f.jsx(Yj,{}),!C&&f.jsx(bs,{open:x,onClose:()=>v(!1)})]})}function kj(){const{data:n,isLoading:l,isError:i,error:r}=X1();return f.jsx(sp,{data:n,isLoading:l,isError:i,error:r})}function $j({runs:n,isLoading:l,error:i,sourceFilter:r,onSourceFilterChange:o,remoteStatus:d,syncInFlight:h,onSyncRemote:g}){return l?f.jsx(ip,{}):i?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",i.message]}):f.jsxs("div",{className:"space-y-4",children:[f.jsx(lp,{filter:r,onFilterChange:o,remoteStatus:d,syncInFlight:h,onSync:g}),f.jsx(ed,{runs:n,emptyMessage:r==="remote"?d!=null&&d.configured?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No remote runs found."}),f.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Sync remote results or run an eval with"," ",f.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"auto_push: true"})," ","in your config."]})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"text-lg text-gray-400",children:"Remote results are not configured."}),f.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Add"," ",f.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"results.export"})," ","to"," ",f.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:".agentv/config.yaml"})," ","to enable remote result syncing."]})]}):void 0})]})}function ip(){return f.jsx("div",{className:"space-y-2",children:["s1","s2","s3","s4","s5"].map(n=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},n))})}function Au({total:n,passed:l,failed:i,passRate:r,totalCost:o}){const d=Math.round(r*100),h=d>=80?"text-cyan-400":d>=60?"text-amber-400":"text-red-400";return f.jsxs("div",{className:"flex flex-wrap items-center gap-6 rounded-lg border border-gray-800 bg-gray-900/60 px-5 py-3",children:[f.jsx(Ci,{label:"Pass Rate",value:`${d}%`,accent:h,large:!0}),f.jsx("div",{className:"h-6 w-px bg-gray-700"}),f.jsx(Ci,{label:"Passed",value:String(l),accent:"text-emerald-400"}),f.jsx(Ci,{label:"Failed",value:String(i),accent:"text-red-400"}),f.jsx(Ci,{label:"Total",value:String(n)}),o!==void 0&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"h-6 w-px bg-gray-700"}),f.jsx(Ci,{label:"Cost",value:`$${o.toFixed(4)}`,accent:"text-amber-400"})]})]})}function Ci({label:n,value:l,accent:i,large:r}){return f.jsxs("div",{className:"flex flex-col",children:[f.jsx("span",{className:"text-xs text-gray-500",children:n}),f.jsx("span",{className:`tabular-nums font-semibold ${r?"text-2xl":"text-lg"} ${i??"text-white"}`,children:l})]})}function Pj(n,l){const i=new Map;for(const r of n){const o=r.category??"Uncategorized",d=r.suite??"Uncategorized";i.has(o)||i.set(o,new Map);const h=i.get(o),g=h.get(d)??{passed:0,failed:0,total:0,scoreSum:0};g.total+=1,g.scoreSum+=r.score,Za(r.score,l)?g.passed+=1:g.failed+=1,h.set(d,g)}return Array.from(i.entries()).map(([r,o])=>{const d=Array.from(o.entries()).map(([x,v])=>({name:x,...v,avgScore:v.total>0?v.scoreSum/v.total:0})).sort((x,v)=>x.name.localeCompare(v.name)),h=d.reduce((x,v)=>x+v.total,0),g=d.reduce((x,v)=>x+v.passed,0),p=d.reduce((x,v)=>x+v.failed,0),m=d.reduce((x,v)=>x+v.avgScore*v.total,0);return{name:r,suites:d,total:h,passed:g,failed:p,avgScore:h>0?m/h:0}}).sort((r,o)=>r.name.localeCompare(o.name))}function rp({results:n,runId:l,benchmarkId:i}){const{data:r}=pt(),o=(r==null?void 0:r.threshold)??(r==null?void 0:r.pass_threshold)??.8,d=n.length,h=n.filter(v=>Za(v.score,o)).length,g=d-h,p=d>0?h/d:0,m=n.reduce((v,S)=>v+(S.costUsd??0),0),x=Pj(n,o);return d===0?f.jsxs("div",{className:"space-y-6",children:[f.jsx(Au,{total:0,passed:0,failed:0,passRate:0}),f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This run has no results yet."})]})]}):f.jsxs("div",{className:"space-y-6",children:[f.jsx(Au,{total:d,passed:h,failed:g,passRate:p,totalCost:m>0?m:void 0}),f.jsxs("div",{children:[f.jsx("h3",{className:"mb-3 text-sm font-medium text-gray-400",children:"Category Breakdown"}),f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Category"}),f.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Passed"}),f.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Failed"}),f.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Total"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:x.map(v=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-2.5 font-medium text-gray-200",children:v.name}),f.jsx("td",{className:"px-4 py-2.5",children:f.jsx(Hi,{rate:v.total>0?v.passed/v.total:0})}),f.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-emerald-400",children:v.passed}),f.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-red-400",children:v.failed>0?v.failed:f.jsx("span",{className:"text-gray-600",children:"0"})}),f.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-gray-400",children:v.total})]},v.name))})]})})]}),f.jsxs("div",{children:[f.jsx("h3",{className:"mb-3 text-sm font-medium text-gray-400",children:"All Evals"}),f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"w-8 px-4 py-3"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map((v,S)=>{const j=v.executionStatus==="execution_error",N=Za(v.score,o);return f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3 text-center",children:j?f.jsx("span",{className:"text-base font-bold text-red-400",children:"!"}):f.jsx("span",{className:`text-base font-bold ${N?"text-emerald-400":"text-red-400"}`,children:N?"✓":"✗"})}),f.jsx("td",{className:"px-4 py-3",children:i?f.jsx(Me,{to:"/projects/$benchmarkId/evals/$runId/$evalId",params:{benchmarkId:i,runId:l,evalId:v.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:v.testId}):f.jsx(Me,{to:"/evals/$runId/$evalId",params:{runId:l,evalId:v.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:v.testId})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:v.target??"-"}),f.jsx("td",{className:"px-4 py-3",children:j?f.jsx("span",{className:"inline-flex rounded-full bg-red-900/50 px-2 py-0.5 text-xs font-medium text-red-400",children:"ERR"}):f.jsx(Hi,{rate:v.score})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:v.durationMs!=null?`${(v.durationMs/1e3).toFixed(1)}s`:"-"}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:v.costUsd!=null?`$${v.costUsd.toFixed(4)}`:"-"})]},`${v.testId}-${S}`)})})]})})]})]})}const up=pa("/runs/$runId")({component:Fj});function Fj(){var E;const{runId:n}=up.useParams(),{data:l,isLoading:i,error:r}=Zi(n),{data:o}=pt(),[d,h]=Q.useState(!1),g=(o==null?void 0:o.read_only)===!0;if(i)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(C=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},C))})]});if(r)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",r.message]});const p=(E=l==null?void 0:l.results)==null?void 0:E[0],m=p==null?void 0:p.target,x=p==null?void 0:p.experiment,v=p==null?void 0:p.timestamp,S=m?{target:m}:void 0,j=(()=>{const C=[x,m].filter(w=>w&&w!=="default");return C.length>0?C.join(" · "):n})(),N=[m,x&&x!=="default"?x:null,v?new Date(v).toLocaleString():null,l==null?void 0:l.source].filter(Boolean).join(" · ");return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:j}),f.jsx("p",{className:"mt-1 text-sm text-gray-500",children:N})]}),!g&&f.jsx("button",{type:"button",onClick:()=>h(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Re-run with Filters"})]}),f.jsx(rp,{results:(l==null?void 0:l.results)??[],runId:n}),!g&&f.jsx(bs,{open:d,onClose:()=>h(!1),prefill:S})]})}const Jy=[{id:"runs",label:"Recent Runs"},{id:"experiments",label:"Experiments"},{id:"compare",label:"Compare"},{id:"targets",label:"Targets"}],cp=pa("/projects/$benchmarkId")({component:Jj});function Jj(){const{benchmarkId:n}=cp.useParams(),r=Jg().location.search.tab,o=Du(),[d,h]=Q.useState(!1),{data:g}=pt(),p=(g==null?void 0:g.read_only)===!0,m=Jy.some(x=>x.id===r)?r:"experiments";return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:n}),!p&&f.jsx("button",{type:"button",onClick:()=>h(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"})]}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1",children:Jy.map(x=>f.jsx("button",{type:"button",onClick:()=>o({to:"/projects/$benchmarkId",params:{benchmarkId:n},search:{tab:x.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${m===x.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:x.label},x.id))})}),m==="runs"&&f.jsx(Ij,{benchmarkId:n}),m==="experiments"&&f.jsx(Wj,{benchmarkId:n}),m==="compare"&&f.jsx(eN,{benchmarkId:n}),m==="targets"&&f.jsx(tN,{benchmarkId:n}),!p&&f.jsx(bs,{open:d,onClose:()=>h(!1),benchmarkId:n})]})}function Ij({benchmarkId:n}){const l=Un(),{data:i,isLoading:r,error:o}=ap(n),{data:d}=tp(n),[h,g]=Q.useState("all"),[p,m]=Q.useState(!1),x=h==="all"?(i==null?void 0:i.runs)??[]:((i==null?void 0:i.runs)??[]).filter(S=>S.source===h);async function v(){m(!0);try{await np(n),await Promise.all([l.invalidateQueries({queryKey:["benchmarks",n,"runs"]}),l.invalidateQueries({queryKey:["benchmarks",n,"experiments"]}),l.invalidateQueries({queryKey:["benchmarks",n,"compare"]}),l.invalidateQueries({queryKey:["benchmarks",n,"targets"]}),l.invalidateQueries({queryKey:["remote-status",n]})])}finally{m(!1)}}return r?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(S=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},S))}):o?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",o.message]}):f.jsxs("div",{className:"space-y-4",children:[f.jsx(lp,{filter:h,onFilterChange:g,remoteStatus:d,syncInFlight:p,onSync:v}),f.jsx(ed,{runs:x,benchmarkId:n})]})}function Wj({benchmarkId:n}){const{data:l,isLoading:i}=Ve(sj(n)),r=(l==null?void 0:l.experiments)??[];return i?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(o=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},o))}):r.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"})}):f.jsx("div",{className:"space-y-2",children:r.map(o=>f.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("div",{children:[f.jsx("p",{className:"font-medium text-white",children:o.name}),f.jsxs("p",{className:"text-sm text-gray-400",children:[o.run_count," run",o.run_count!==1?"s":""]})]}),f.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(o.pass_rate*100),"%"]})]},o.name))})}function eN({benchmarkId:n}){const{data:l,isLoading:i,isError:r,error:o}=Ve(lj(n));return f.jsx(sp,{data:l,isLoading:i,isError:r,error:o})}function tN({benchmarkId:n}){const{data:l,isLoading:i}=Ve(ij(n)),r=(l==null?void 0:l.targets)??[];return i?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(o=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},o))}):r.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"})}):f.jsx("div",{className:"space-y-2",children:r.map(o=>f.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("div",{children:[f.jsx("p",{className:"font-medium text-white",children:o.name}),f.jsxs("p",{className:"text-sm text-gray-400",children:[o.run_count," run",o.run_count!==1?"s":""," · ",o.experiment_count," ","experiment",o.experiment_count!==1?"s":""]})]}),f.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(o.pass_rate*100),"%"]})]},o.name))})}const op=pa("/experiments/$experimentName")({component:aN});function aN(){var v;const{experimentName:n}=op.useParams(),{data:l,isLoading:i}=Jf(),{data:r,isLoading:o}=Ff();if(i||o)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-4 gap-4",children:["s1","s2","s3","s4"].map(S=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},S))})]});const h=(v=l==null?void 0:l.experiments)==null?void 0:v.find(S=>S.name===n),g=(r==null?void 0:r.runs)??[],p=(h==null?void 0:h.pass_rate)??0,m=(h==null?void 0:h.run_count)??0,x=(h==null?void 0:h.target_count)??0;return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:n}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[m," run",m!==1?"s":""," · ",x," target",x!==1?"s":"",(h==null?void 0:h.last_run)&&f.jsxs("span",{className:"ml-2",children:["· Last run: ",Iy(h.last_run)]})]})]}),h&&f.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-4",children:[f.jsx(gu,{label:"Runs",value:String(m)}),f.jsx(gu,{label:"Targets",value:String(x)}),f.jsx(gu,{label:"Pass Rate",value:`${Math.round(p*100)}%`,accent:"text-cyan-400"}),f.jsx(gu,{label:"Last Run",value:Iy(h.last_run)})]}),f.jsxs("div",{children:[f.jsx("h2",{className:"mb-4 text-lg font-medium text-gray-200",children:"All Runs"}),f.jsx(ed,{runs:g})]})]})}function gu({label:n,value:l,accent:i}){return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("p",{className:"text-sm text-gray-400",children:n}),f.jsx("p",{className:`mt-1 text-2xl font-semibold tabular-nums ${i??"text-white"}`,children:l})]})}function Iy(n){if(!n)return"N/A";try{const l=new Date(n);return Number.isNaN(l.getTime())?"N/A":l.toLocaleString()}catch{return"N/A"}}async function nN(n,l){const i=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviews:[{test_id:n,comment:l}]})});if(!i.ok)throw new Error(`Failed to save feedback: ${i.status}`);return i.json()}function sN({testId:n}){var x;const{data:l}=V1(),i=Un(),r=(x=l==null?void 0:l.reviews)==null?void 0:x.find(v=>v.test_id===n),[o,d]=Q.useState((r==null?void 0:r.comment)??""),[h,g]=Q.useState(!1);Q.useEffect(()=>{d((r==null?void 0:r.comment)??""),g(!1)},[r==null?void 0:r.comment]);const p=zb({mutationFn:()=>nN(n,o),onSuccess:()=>{i.invalidateQueries({queryKey:["feedback"]}),g(!0),setTimeout(()=>g(!1),2e3)}}),m=Q.useCallback(()=>{p.mutate()},[p]);return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("h4",{className:"mb-2 text-sm font-medium text-gray-400",children:"Feedback"}),f.jsx("textarea",{value:o,onChange:v=>{d(v.target.value),g(!1)},placeholder:"Add feedback for this test...",className:"w-full rounded-md border border-gray-700 bg-gray-800 p-3 text-sm text-gray-200 placeholder-gray-500 focus:border-cyan-400 focus:outline-none",rows:3}),f.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[f.jsx("button",{type:"button",onClick:m,disabled:p.isPending,className:"rounded-md bg-cyan-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:p.isPending?"Saving...":"Save Feedback"}),h&&f.jsx("span",{className:"text-sm text-emerald-400",children:"Saved"}),p.isError&&f.jsx("span",{className:"text-sm text-red-400",children:"Error saving feedback"})]})]})}function lN(n){var i;switch((i=n.split(".").pop())==null?void 0:i.toLowerCase()){case"ts":case"tsx":return"📘";case"json":return"📋";case"log":case"txt":return"📜";case"md":return"📝";default:return"📄"}}function fp(n){const l=[];for(const i of n)i.type==="dir"&&(l.push(i.path),i.children&&l.push(...fp(i.children)));return l}function dp({node:n,selectedPath:l,onSelect:i,openFolders:r,toggleFolder:o,depth:d=0}){const h=n.type==="dir",g=r.has(n.path),p=l===n.path;return f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>{h?o(n.path):i(n.path)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors ${p?"bg-cyan-400/20 text-cyan-400":"text-gray-300 hover:bg-gray-800/50 hover:text-gray-200"}`,style:{paddingLeft:`${d*16+8}px`},children:[f.jsx("span",{className:"flex-shrink-0 text-xs",children:h?g?"📂":"📁":lN(n.name)}),f.jsx("span",{className:"truncate",children:n.name})]}),h&&g&&n.children&&f.jsx("div",{children:n.children.map(m=>f.jsx(dp,{node:m,selectedPath:l,onSelect:i,openFolders:r,toggleFolder:o,depth:d+1},m.path))})]})}function iN({files:n,selectedPath:l,onSelect:i}){const[r,o]=Q.useState(()=>new Set(fp(n))),d=h=>{o(g=>{const p=new Set(g);return p.has(h)?p.delete(h):p.add(h),p})};return f.jsxs("div",{className:"w-64 overflow-y-auto rounded-lg border border-gray-800 bg-gray-900 py-2",children:[n.length===0&&f.jsx("p",{className:"px-4 py-2 text-sm text-gray-500",children:"No files."}),n.map(h=>f.jsx(dp,{node:h,selectedPath:l,onSelect:i,openFolders:r,toggleFolder:d},h.path))]})}const rN="modulepreload",uN=function(n){return"/"+n},Wy={},cN=function(l,i,r){let o=Promise.resolve();if(i&&i.length>0){let h=function(m){return Promise.all(m.map(x=>Promise.resolve(x).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const g=document.querySelector("meta[property=csp-nonce]"),p=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=h(i.map(m=>{if(m=uN(m),m in Wy)return;Wy[m]=!0;const x=m.endsWith(".css"),v=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const S=document.createElement("link");if(S.rel=x?"stylesheet":rN,x||(S.as="script"),S.crossOrigin="",S.href=m,p&&S.setAttribute("nonce",p),document.head.appendChild(S),x)return new Promise((j,N)=>{S.addEventListener("load",j),S.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function d(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return o.then(h=>{for(const g of h||[])g.status==="rejected"&&d(g.reason);return l().catch(d)})},oN=Q.lazy(()=>cN(()=>import("./index-BehS0sDh.js"),[]));function fN({value:n,language:l="json",height:i="400px"}){return f.jsx(Q.Suspense,{fallback:f.jsx("div",{className:"flex items-center justify-center rounded-lg bg-gray-900 p-8 text-gray-500",children:"Loading editor..."}),children:f.jsx(oN,{height:i,language:l,value:n,theme:"vs-dark",options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:"on",wordWrap:"on",padding:{top:12}}})})}function hp(n){for(const l of n){if(l.type==="file")return l.path;if(l.children){const i=hp(l.children);if(i)return i}}return null}function mp({eval:n,runId:l,benchmarkId:i}){const[r,o]=Q.useState("checks"),{data:d}=pt(),h=(d==null?void 0:d.read_only)===!0,g=[{id:"checks",label:"Checks"},{id:"files",label:"Files"},...h?[]:[{id:"feedback",label:"Feedback"}]];return f.jsxs("div",{className:"flex min-h-full flex-col",children:[f.jsx("div",{className:"flex items-start justify-between border-b border-gray-800 px-4 py-3",children:f.jsxs("div",{children:[f.jsx("h3",{className:"text-lg font-medium",children:n.testId}),f.jsxs("p",{className:"mt-0.5 text-sm text-gray-400",children:[n.target&&f.jsxs("span",{children:["Target: ",n.target]}),n.durationMs!=null&&f.jsxs("span",{className:"ml-4",children:[(n.durationMs/1e3).toFixed(1),"s"]}),n.costUsd!=null&&f.jsxs("span",{className:"ml-4",children:["$",n.costUsd.toFixed(4)]})]})]})}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1 px-4",children:g.map(p=>f.jsx("button",{type:"button",onClick:()=>o(p.id),className:`px-4 py-2 text-sm font-medium transition-colors ${r===p.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:p.label},p.id))})}),f.jsxs("div",{className:"min-h-0 flex-1",children:[r==="checks"&&f.jsx("div",{className:"overflow-auto p-4",children:f.jsx(dN,{result:n})}),r==="files"&&f.jsx("div",{className:"h-full p-4",children:f.jsx(hN,{result:n,runId:l,benchmarkId:i})}),!h&&r==="feedback"&&f.jsx("div",{className:"p-4",children:f.jsx(sN,{testId:n.testId})})]})]})}function eg({assertion:n}){return f.jsxs("div",{className:`flex items-start gap-3 rounded-lg border p-3 ${n.passed?"border-emerald-900/50 bg-emerald-950/20":"border-red-900/50 bg-red-950/20"}`,children:[f.jsx("span",{className:`mt-0.5 text-lg ${n.passed?"text-emerald-400":"text-red-400"}`,children:n.passed?"✓":"✗"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("p",{className:"text-sm text-gray-200",children:[n.text,n.durationMs!=null&&f.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",(n.durationMs/1e3).toFixed(1),"s)"]})]}),n.evidence&&f.jsx("p",{className:"mt-1 text-xs text-gray-400",children:n.evidence})]})]})}function dN({result:n}){const{data:l}=pt(),i=(l==null?void 0:l.threshold)??(l==null?void 0:l.pass_threshold)??.8,r=!Za(n.score,i)||n.executionStatus==="error"||n.executionStatus==="failed",o=(n.scores??[]).filter(m=>Array.isArray(m.assertions)&&m.assertions.length>0),d=o.length>0,h=n.assertions??[],g=[];n.error&&g.push(n.error),(n.executionStatus==="error"||n.executionStatus==="failed")&&g.push(`Execution status: ${n.executionStatus}`);const p=d?o.flatMap(m=>m.assertions):h;for(const m of p.filter(x=>!x.passed)){const x=m.evidence?`${m.text}: ${m.evidence}`:m.text;g.push(x)}if(n.scores){for(const m of n.scores)if(!Za(m.score,i)&&m.details){const x=typeof m.details=="string"?m.details:JSON.stringify(m.details,null,2);g.push(`[${m.name??m.type??"evaluator"}] ${x}`)}}return f.jsxs("div",{className:"space-y-6",children:[f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("span",{className:"text-sm font-medium text-gray-400",children:"Overall score"}),f.jsx("div",{className:"flex-1",children:f.jsx(Cu,{score:n.score})})]})}),n.scores&&n.scores.length>0&&f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-400",children:"Evaluator Scores"}),f.jsx("div",{className:"space-y-3",children:n.scores.map((m,x)=>f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("span",{className:"w-40 truncate text-sm text-gray-300",children:m.name??m.type??`Score ${x+1}`}),f.jsx("div",{className:"flex-1",children:f.jsx(Cu,{score:m.score})})]},`${m.name??m.type??x}`))})]}),d?f.jsx("div",{className:"space-y-6",children:o.map((m,x)=>{const v=m.name??m.type??`Evaluator ${x+1}`;return f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:v}),m.assertions.map((S,j)=>f.jsx(eg,{assertion:S},`${S.text}-${j}`))]},`${m.name??m.type??x}`)})}):h.length>0?f.jsx("div",{className:"space-y-2",children:h.map((m,x)=>f.jsx(eg,{assertion:m},`${m.text}-${x}`))}):f.jsx("p",{className:"text-sm text-gray-500",children:"No assertion steps recorded."}),r&&g.length>0&&f.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[f.jsx("h4",{className:"mb-2 text-sm font-medium text-red-400",children:"Failure Reason"}),f.jsx("div",{className:"space-y-2",children:g.map(m=>f.jsx("p",{className:"text-sm text-gray-300",children:m},m))})]})]})}function hN({result:n,runId:l,benchmarkId:i}){const r=n.testId,{data:o}=i?Ve(aj(i,l,r)):k1(l,r),d=(o==null?void 0:o.files)??[],[h,g]=Q.useState(null),p=h??(d.length>0?hp(d):null),{data:m,isLoading:x}=i?Ve(nj(i,l,r,p??"")):$1(l,r,p??"");if(d.length===0)return f.jsx("p",{className:"text-sm text-gray-500",children:"No artifact files available."});const v=p?x?"Loading...":(m==null?void 0:m.content)??"":"",S=p?(m==null?void 0:m.language)??"plaintext":"plaintext";return f.jsxs("div",{className:"flex h-full min-h-[400px] gap-4",children:[f.jsx(iN,{files:d,selectedPath:p,onSelect:g}),f.jsx("div",{className:"flex-1",children:f.jsx(fN,{value:v,language:S,height:"100%"})})]})}const yp=pa("/evals/$runId/$evalId")({component:mN});function mN(){const{runId:n,evalId:l}=yp.useParams(),{data:i,isLoading:r,error:o}=Zi(n),{data:d}=pt(),[h,g]=Q.useState(!1),p=(d==null?void 0:d.read_only)===!0;if(r)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",o.message]});const m=i==null?void 0:i.results.find(x=>x.testId===l);return m?f.jsxs("div",{className:"flex h-full flex-col gap-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",n," / Eval: ",l]}),f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l})]}),!p&&f.jsx("button",{type:"button",onClick:()=>g(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run this Test"})]}),f.jsx(mp,{eval:m,runId:n}),!p&&f.jsx(bs,{open:h,onClose:()=>g(!1),prefill:{testIds:[l],target:m.target}})]}):f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:f.jsxs("p",{className:"text-gray-400",children:["Eval ",f.jsx("code",{className:"text-cyan-400",children:l})," not found in run"," ",f.jsx("code",{className:"text-cyan-400",children:n}),"."]})})}const gp=pa("/runs/$runId_/suite/$suite")({component:yN});function yN(){const{runId:n,suite:l}=gp.useParams(),{data:i,isLoading:r,error:o}=Zi(n),{data:d}=pt(),h=(d==null?void 0:d.threshold)??(d==null?void 0:d.pass_threshold)??.8;if(r)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(j=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},j))})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",o.message]});const g=((i==null?void 0:i.results)??[]).filter(j=>(j.suite??"Uncategorized")===l),p=g.length,m=g.filter(j=>Za(j.score,h)).length,x=p-m,v=p>0?m/p:0,S=g.reduce((j,N)=>j+(N.costUsd??0),0);return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Suite in run: ",n]})]}),f.jsx(Au,{total:p,passed:m,failed:x,passRate:v,totalCost:S>0?S:void 0}),p===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations in this suite"})}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:g.map((j,N)=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:f.jsx(Me,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:j.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:j.testId})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:j.target??"-"}),f.jsx("td",{className:"px-4 py-3",children:j.executionStatus==="execution_error"?f.jsx("span",{className:"inline-flex rounded-full px-2 py-0.5 text-xs font-medium bg-red-900/50 text-red-400",children:"ERR"}):f.jsx(Hi,{rate:j.score})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.durationMs!=null?`${(j.durationMs/1e3).toFixed(1)}s`:"-"}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.costUsd!=null?`$${j.costUsd.toFixed(4)}`:"-"})]},`${j.testId}-${N}`))})]})})]})}const pp=pa("/runs/$runId_/category/$category")({component:gN});function gN(){const{runId:n,category:l}=pp.useParams(),{data:i,isLoading:r,error:o}=ep(n,l);if(r)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(x=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},x))})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load category: ",o.message]});const d=(i==null?void 0:i.suites)??[],h=d.reduce((x,v)=>x+v.total,0),g=d.reduce((x,v)=>x+v.passed,0),p=h-g,m=h>0?g/h:0;return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Category in run: ",n]})]}),f.jsx(Au,{total:h,passed:g,failed:p,passRate:m}),d.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No suites in this category"})}):f.jsxs("div",{className:"space-y-3",children:[f.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Suites"}),f.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:d.map(x=>f.jsxs(Me,{to:"/runs/$runId/suite/$suite",params:{runId:n,suite:x.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:x.name}),f.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[x.passed,"/",x.total]})]}),f.jsx("div",{className:"mt-2",children:f.jsx(Cu,{score:x.avg_score})}),f.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[f.jsxs("span",{className:"text-emerald-400",children:[x.passed," passed"]}),x.failed>0&&f.jsxs("span",{className:"text-red-400",children:[x.failed," failed"]})]})]},x.name))})]})]})}const vp=pa("/projects/$benchmarkId_/runs/$runId")({component:pN});function pN(){var C;const{benchmarkId:n,runId:l}=vp.useParams(),{data:i,isLoading:r,error:o}=Wf(n,l),{data:d}=pt(),[h,g]=Q.useState(!1),p=(d==null?void 0:d.read_only)===!0;if(r)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(w=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},w))})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",o.message]});const m=(C=i==null?void 0:i.results)==null?void 0:C[0],x=m==null?void 0:m.target,v=m==null?void 0:m.experiment,S=m==null?void 0:m.timestamp,j=x?{target:x}:void 0,N=(()=>{const w=[v,x].filter($=>$&&$!=="default");return w.length>0?w.join(" · "):l})(),E=[x,v&&v!=="default"?v:null,S?new Date(S).toLocaleString():null,i==null?void 0:i.source].filter(Boolean).join(" · ");return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:N}),f.jsx("p",{className:"mt-1 text-sm text-gray-500",children:E})]}),!p&&f.jsx("button",{type:"button",onClick:()=>g(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Re-run with Filters"})]}),f.jsx(rp,{results:(i==null?void 0:i.results)??[],runId:l,benchmarkId:n}),!p&&f.jsx(bs,{open:h,onClose:()=>g(!1),benchmarkId:n,prefill:j})]})}const xp=pa("/projects/$benchmarkId_/evals/$runId/$evalId")({component:vN});function vN(){const{benchmarkId:n,runId:l,evalId:i}=xp.useParams(),{data:r,isLoading:o,error:d}=Wf(n,l),{data:h}=pt(),[g,p]=Q.useState(!1),m=(h==null?void 0:h.read_only)===!0;if(o)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(d)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",d.message]});const x=r==null?void 0:r.results.find(v=>v.testId===i);return x?f.jsxs("div",{className:"flex h-full flex-col gap-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",l," / Eval: ",i]}),f.jsx("h1",{className:"text-2xl font-semibold text-white",children:i})]}),!m&&f.jsx("button",{type:"button",onClick:()=>p(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run this Test"})]}),f.jsx(mp,{eval:x,runId:l,benchmarkId:n}),!m&&f.jsx(bs,{open:g,onClose:()=>p(!1),benchmarkId:n,prefill:{testIds:[i],target:x.target}})]}):f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:f.jsxs("p",{className:"text-gray-400",children:["Eval ",f.jsx("code",{className:"text-cyan-400",children:i})," not found in run"," ",f.jsx("code",{className:"text-cyan-400",children:l}),"."]})})}const xN=_j.update({id:"/settings",path:"/settings",getParentRoute:()=>ia}),bN=Kj.update({id:"/",path:"/",getParentRoute:()=>ia}),SN=up.update({id:"/runs/$runId",path:"/runs/$runId",getParentRoute:()=>ia}),jN=cp.update({id:"/projects/$benchmarkId",path:"/projects/$benchmarkId",getParentRoute:()=>ia}),NN=op.update({id:"/experiments/$experimentName",path:"/experiments/$experimentName",getParentRoute:()=>ia}),RN=yp.update({id:"/evals/$runId/$evalId",path:"/evals/$runId/$evalId",getParentRoute:()=>ia}),_N=gp.update({id:"/runs/$runId_/suite/$suite",path:"/runs/$runId/suite/$suite",getParentRoute:()=>ia}),EN=pp.update({id:"/runs/$runId_/category/$category",path:"/runs/$runId/category/$category",getParentRoute:()=>ia}),TN=vp.update({id:"/projects/$benchmarkId_/runs/$runId",path:"/projects/$benchmarkId/runs/$runId",getParentRoute:()=>ia}),MN=xp.update({id:"/projects/$benchmarkId_/evals/$runId/$evalId",path:"/projects/$benchmarkId/evals/$runId/$evalId",getParentRoute:()=>ia}),CN={IndexRoute:bN,SettingsRoute:xN,ExperimentsExperimentNameRoute:NN,ProjectsBenchmarkIdRoute:jN,RunsRunIdRoute:SN,EvalsRunIdEvalIdRoute:RN,ProjectsBenchmarkIdRunsRunIdRoute:TN,RunsRunIdCategoryCategoryRoute:EN,RunsRunIdSuiteSuiteRoute:_N,ProjectsBenchmarkIdEvalsRunIdEvalIdRoute:MN},AN=ia._addFileChildren(CN)._addFileTypes(),wN=new bb({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!0}}}),ON=_1({routeTree:AN}),bp=document.getElementById("root");if(!bp)throw new Error("Root element not found");Px.createRoot(bp).render(f.jsx(Q.StrictMode,{children:f.jsx(Sb,{client:wN,children:f.jsx(M1,{router:ON})})}));export{Oi as W,Q as r};