agentv 5.3.0-next.1 → 5.3.1-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.
- package/README.md +22 -20
- package/dist/{artifact-writer-JFNIPMKW.js → artifact-writer-7NBCOAYC.js} +4 -4
- package/dist/{chunk-T32NL3E6.js → chunk-ASIGJIOJ.js} +50 -30
- package/dist/chunk-ASIGJIOJ.js.map +1 -0
- package/dist/{chunk-6ZZCDZPD.js → chunk-ELCJ23K4.js} +12766 -12478
- package/dist/chunk-ELCJ23K4.js.map +1 -0
- package/dist/{chunk-FVR4RQFK.js → chunk-LKGARI3W.js} +333 -24
- package/dist/chunk-LKGARI3W.js.map +1 -0
- package/dist/{chunk-V52ATPTT.js → chunk-LXBI3SPX.js} +142 -14
- package/dist/chunk-LXBI3SPX.js.map +1 -0
- package/dist/{chunk-BHKQHG26.js → chunk-RKE7SSET.js} +2 -2
- package/dist/cli.js +5 -5
- package/dist/dashboard/assets/{index-DNgf3qJ2.js → index-CbEMiJSb.js} +1 -1
- package/dist/dashboard/assets/{index-r_jSJmlw.js → index-DTA6-l7q.js} +3 -3
- package/dist/dashboard/index.html +1 -1
- package/dist/{dist-6Z7U473R.js → dist-NMXMI5SK.js} +17 -5
- package/dist/index.js +5 -5
- package/dist/{interactive-RUY3OCBI.js → interactive-BN527UV3.js} +5 -5
- package/dist/skills/agentv-bench/SKILL.md +14 -13
- package/dist/skills/agentv-bench/agents/analyzer.md +1 -1
- package/dist/skills/agentv-bench/agents/executor.md +1 -1
- package/dist/skills/agentv-bench/references/autoresearch.md +9 -9
- package/dist/skills/agentv-bench/references/environment-adaptation.md +4 -4
- package/dist/skills/agentv-bench/references/eval-yaml-spec.md +30 -47
- package/dist/skills/agentv-bench/references/schemas.md +44 -60
- package/dist/skills/agentv-bench/references/subagent-pipeline.md +20 -18
- package/dist/skills/agentv-eval-migrations/SKILL.md +13 -0
- package/dist/skills/agentv-eval-migrations/references/breaking-changes.md +39 -21
- package/dist/skills/agentv-eval-writer/SKILL.md +75 -46
- package/dist/skills/agentv-eval-writer/references/custom-evaluators.md +10 -5
- package/dist/skills/agentv-eval-writer/references/eval.schema.json +749 -2158
- package/dist/skills/agentv-eval-writer/references/rubric-evaluator.md +1 -1
- package/dist/{ts-eval-loader-DQDYRULE-V3377FOL.js → ts-eval-loader-2RFVZHCT-7CZ3DCDD.js} +8 -4
- package/package.json +1 -1
- package/dist/chunk-6ZZCDZPD.js.map +0 -1
- package/dist/chunk-FVR4RQFK.js.map +0 -1
- package/dist/chunk-T32NL3E6.js.map +0 -1
- package/dist/chunk-V52ATPTT.js.map +0 -1
- /package/dist/{artifact-writer-JFNIPMKW.js.map → artifact-writer-7NBCOAYC.js.map} +0 -0
- /package/dist/{chunk-BHKQHG26.js.map → chunk-RKE7SSET.js.map} +0 -0
- /package/dist/{dist-6Z7U473R.js.map → dist-NMXMI5SK.js.map} +0 -0
- /package/dist/{interactive-RUY3OCBI.js.map → interactive-BN527UV3.js.map} +0 -0
- /package/dist/{ts-eval-loader-DQDYRULE-V3377FOL.js.map → ts-eval-loader-2RFVZHCT-7CZ3DCDD.js.map} +0 -0
|
@@ -115,7 +115,7 @@ Error generating stack: `+m.message+`
|
|
|
115
115
|
*
|
|
116
116
|
* This source code is licensed under the MIT license found in the
|
|
117
117
|
* LICENSE file in the root directory of this source tree.
|
|
118
|
-
*/var yP;function sJ(){if(yP)return tt;yP=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.view_transition"),x=Symbol.for("react.client.reference");function b(w){if(typeof w=="object"&&w!==null){var N=w.$$typeof;switch(N){case e:switch(w=w.type,w){case r:case i:case n:case h:case f:case y:return w;default:switch(w=w&&w.$$typeof,w){case l:case c:case g:case p:return w;case o:return w;default:return N}}case t:return N}}}return tt.ContextConsumer=o,tt.ContextProvider=l,tt.Element=e,tt.ForwardRef=c,tt.Fragment=r,tt.Lazy=g,tt.Memo=p,tt.Portal=t,tt.Profiler=i,tt.StrictMode=n,tt.Suspense=h,tt.SuspenseList=f,tt.isContextConsumer=function(w){return b(w)===o},tt.isContextProvider=function(w){return b(w)===l},tt.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},tt.isForwardRef=function(w){return b(w)===c},tt.isFragment=function(w){return b(w)===r},tt.isLazy=function(w){return b(w)===g},tt.isMemo=function(w){return b(w)===p},tt.isPortal=function(w){return b(w)===t},tt.isProfiler=function(w){return b(w)===i},tt.isStrictMode=function(w){return b(w)===n},tt.isSuspense=function(w){return b(w)===h},tt.isSuspenseList=function(w){return b(w)===f},tt.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===r||w===i||w===n||w===h||w===f||typeof w=="object"&&w!==null&&(w.$$typeof===g||w.$$typeof===p||w.$$typeof===l||w.$$typeof===o||w.$$typeof===c||w.$$typeof===x||w.getModuleId!==void 0)},tt.typeOf=b,tt}var vP;function oJ(){return vP||(vP=1,nx.exports=sJ()),nx.exports}var lJ=oJ(),xP=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",bP=null,ax=null,wk=e=>{if(e===bP&&Array.isArray(ax))return ax;var t=[];return S.Children.forEach(e,r=>{mt(r)||(lJ.isFragment(r)?t=t.concat(wk(r.props.children)):t.push(r))}),ax=t,bP=e,t};function uJ(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(i=>xP(i)):n=[xP(t)],wk(e).forEach(i=>{var o=Hl(i,"type.displayName")||Hl(i,"type.name");o&&n.indexOf(o)!==-1&&r.push(i)}),r}var Sk=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,ix={},jP;function cJ(){return jP||(jP=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var i;if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const o=r[Symbol.toStringTag];return o==null||!((i=Object.getOwnPropertyDescriptor(r,Symbol.toStringTag))!=null&&i.writable)?!1:r.toString()===`[object ${o}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(ix)),ix}var sx,wP;function dJ(){return wP||(wP=1,sx=cJ().isPlainObject),sx}var fJ=dJ();const hJ=rs(fJ);var SP,NP,_P,OP,EP;function AP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function TP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?AP(Object(r),!0).forEach(function(n){mJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mJ(e,t,r){return(t=pJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pJ(e){var t=gJ(e,"string");return typeof t=="symbol"?t:t+""}function gJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $m(){return $m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$m.apply(null,arguments)}function xc(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var CP=(e,t,r,n,i)=>{var o=r-n,l;return l=bt(SP||(SP=xc(["M ",",",""])),e,t),l+=bt(NP||(NP=xc(["L ",",",""])),e+r,t),l+=bt(_P||(_P=xc(["L ",",",""])),e+r-o/2,t+i),l+=bt(OP||(OP=xc(["L ",",",""])),e+r-o/2-n,t+i),l+=bt(EP||(EP=xc(["L ",","," Z"])),e,t),l},yJ={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},vJ=e=>{var t=fr(e,yJ),{x:r,y:n,upperWidth:i,lowerWidth:o,height:l,className:c}=t,{animationEasing:h,animationDuration:f,animationBegin:p,isUpdateAnimationActive:g}=t,y=S.useRef(null),[x,b]=S.useState(-1),w=S.useRef(i),N=S.useRef(o),_=S.useRef(l),E=S.useRef(r),T=S.useRef(n),A=Ep(e,"trapezoid-");if(S.useEffect(()=>{if(y.current&&y.current.getTotalLength)try{var Z=y.current.getTotalLength();Z&&b(Z)}catch{}},[]),r!==+r||n!==+n||i!==+i||o!==+o||l!==+l||i===0&&o===0||l===0)return null;var C=Xe("recharts-trapezoid",c);if(!g)return S.createElement("g",null,S.createElement("path",$m({},Er(t),{className:C,d:CP(r,n,i,o,l)})));var R=w.current,D=N.current,M=_.current,z=E.current,k=T.current,H="0px ".concat(x===-1?1:x,"px"),U="".concat(x,"px ").concat(x,"px"),ae=M3(["strokeDasharray"],f,h);return S.createElement(Op,{animationId:A,key:A,canBegin:x>0,duration:f,easing:h,isActive:g,begin:p},Z=>{var G=jt(R,i,Z),L=jt(D,o,Z),F=jt(M,l,Z),J=jt(z,r,Z),re=jt(k,n,Z);y.current&&(w.current=G,N.current=L,_.current=F,E.current=J,T.current=re);var oe=Z>0?{transition:ae,strokeDasharray:U}:{strokeDasharray:H};return S.createElement("path",$m({},Er(t),{className:C,d:CP(J,re,G,L,F),ref:y,style:TP(TP({},oe),t.style)}))})},xJ=["option","shapeType","activeClassName","inActiveClassName"];function bJ(e,t){if(e==null)return{};var r,n,i=jJ(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function jJ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function PP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Im(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?PP(Object(r),!0).forEach(function(n){wJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wJ(e,t,r){return(t=SJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SJ(e){var t=NJ(e,"string");return typeof t=="symbol"?t:t+""}function NJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _J(e,t){return Im(Im({},t),e)}function OJ(e,t){return e==="symbols"}function RP(e){var{shapeType:t,elementProps:r}=e;switch(t){case"rectangle":return S.createElement($3,r);case"trapezoid":return S.createElement(vJ,r);case"sector":return S.createElement(B3,r);case"symbols":if(OJ(t))return S.createElement(Ej,r);break;case"curve":return S.createElement(R3,r);default:return null}}function EJ(e){return S.isValidElement(e)?e.props:e}function Nk(e){var{option:t,shapeType:r,activeClassName:n="recharts-active-shape",inActiveClassName:i="recharts-shape"}=e,o=bJ(e,xJ),l;if(S.isValidElement(t))l=S.cloneElement(t,Im(Im({},o),EJ(t)));else if(typeof t=="function")l=t(o,o.index);else if(hJ(t)&&typeof t!="boolean"){var c=_J(t,o);l=S.createElement(RP,{shapeType:r,elementProps:c})}else{var h=o;l=S.createElement(RP,{shapeType:r,elementProps:h})}return o.isActive?S.createElement(sn,{className:n},l):S.createElement(sn,{className:i},l)}var _k=(e,t,r)=>{var n=ct();return(i,o)=>l=>{e==null||e(i,o,l),n(RD({activeIndex:String(o),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}},Ok=e=>{var t=ct();return(r,n)=>i=>{e==null||e(r,n,i),t(HQ())}},Ek=(e,t,r)=>{var n=ct();return(i,o)=>l=>{e==null||e(i,o,l),n(KQ({activeIndex:String(o),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}};function Ak(e){var{tooltipEntrySettings:t}=e,r=ct(),n=jr(),i=S.useRef(null);return S.useLayoutEffect(()=>{n||(i.current===null?r(BQ(t)):i.current!==t&&r(UQ({prev:i.current,next:t})),i.current=t)},[t,r,n]),S.useLayoutEffect(()=>()=>{i.current&&(r(qQ(i.current)),i.current=null)},[r]),null}function Tk(e){var{legendPayload:t}=e,r=ct(),n=jr(),i=S.useRef(null);return S.useLayoutEffect(()=>{n||(i.current===null?r(CF(t)):i.current!==t&&r(PF({prev:i.current,next:t})),i.current=t)},[r,n,t]),S.useLayoutEffect(()=>()=>{i.current&&(r(RF(i.current)),i.current=null)},[r]),null}var ox,AJ=()=>{var[e]=S.useState(()=>Uc("uid-"));return e},TJ=(ox=ZI.useId)!==null&&ox!==void 0?ox:AJ;function CJ(e,t){var r=TJ();return t||(e?"".concat(e,"-").concat(r):r)}var PJ=S.createContext(void 0),Ck=e=>{var{id:t,type:r,children:n}=e,i=CJ("recharts-".concat(r),t);return S.createElement(PJ.Provider,{value:i},n(i))},RJ={cartesianItems:[],polarItems:[]},Pk=br({name:"graphicalItems",initialState:RJ,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:ot()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=On(e).cartesianItems.indexOf(r);i>-1&&(e.cartesianItems[i]=n)},prepare:ot()},removeCartesianGraphicalItem:{reducer(e,t){var r=On(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:ot()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:ot()},removePolarGraphicalItem:{reducer(e,t){var r=On(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:ot()},replacePolarGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=On(e).polarItems.indexOf(r);i>-1&&(e.polarItems[i]=n)},prepare:ot()}}}),{addCartesianGraphicalItem:MJ,replaceCartesianGraphicalItem:DJ,removeCartesianGraphicalItem:kJ,addPolarGraphicalItem:Ale,removePolarGraphicalItem:Tle,replacePolarGraphicalItem:Cle}=Pk.actions,LJ=Pk.reducer,$J=e=>{var t=ct(),r=S.useRef(null);return S.useLayoutEffect(()=>{r.current===null?t(MJ(e)):r.current!==e&&t(DJ({prev:r.current,next:e})),r.current=e},[t,e]),S.useLayoutEffect(()=>()=>{r.current&&(t(kJ(r.current)),r.current=null)},[t]),null},Rk=S.memo($J),IJ=["points"];function MP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function lx(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?MP(Object(r),!0).forEach(function(n){zJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function zJ(e,t,r){return(t=BJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function BJ(e){var t=UJ(e,"string");return typeof t=="symbol"?t:t+""}function UJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zm(){return zm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},zm.apply(null,arguments)}function qJ(e,t){if(e==null)return{};var r,n,i=FJ(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function FJ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function HJ(e){var{option:t,dotProps:r,className:n}=e;if(S.isValidElement(t))return S.cloneElement(t,r);if(typeof t=="function")return t(r);var i=Xe(n,typeof t!="boolean"?t.className:""),o=r??{},{points:l}=o,c=qJ(o,IJ);return S.createElement(bk,zm({},c,{className:i}))}function KJ(e,t){return e==null?!1:t?!0:e.length===1}function GJ(e){var{points:t,dot:r,className:n,dotClassName:i,dataKey:o,baseProps:l,needClip:c,clipPathId:h,zIndex:f=Gt.scatter}=e;if(!KJ(t,r))return null;var p=Sk(r),g=g9(r),y=t.map((b,w)=>{var N,_,E=lx(lx(lx({r:3},l),g),{},{index:w,cx:(N=b.x)!==null&&N!==void 0?N:void 0,cy:(_=b.y)!==null&&_!==void 0?_:void 0,dataKey:o,value:b.value,payload:b.payload,points:t});return S.createElement(HJ,{key:"dot-".concat(w),option:r,dotProps:E,className:i})}),x={};return c&&h!=null&&(x.clipPath="url(#clipPath-".concat(p?"":"dots-").concat(h,")")),S.createElement(Cn,{zIndex:f},S.createElement(sn,zm({className:n},x),y))}function DP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function kP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?DP(Object(r),!0).forEach(function(n){YJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function YJ(e,t,r){return(t=VJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function VJ(e){var t=QJ(e,"string");return typeof t=="symbol"?t:t+""}function QJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Mk=0,XJ={xAxis:{},yAxis:{},zAxis:{}},Dk=br({name:"cartesianAxis",initialState:XJ,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:ot()},replaceXAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.xAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.xAxis[r.id],e.xAxis[n.id]=n)},prepare:ot()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:ot()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:ot()},replaceYAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.yAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.yAxis[r.id],e.yAxis[n.id]=n)},prepare:ot()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:ot()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:ot()},replaceZAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.zAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.zAxis[r.id],e.zAxis[n.id]=n)},prepare:ot()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:ot()},updateYAxisWidth(e,t){var{id:r,width:n}=t.payload,i=e.yAxis[r];if(i){var o,l=i.widthHistory||[];if(l.length===3&&l[0]===l[2]&&n===l[1]&&n!==i.width&&Math.abs(n-((o=l[0])!==null&&o!==void 0?o:0))<=1)return;var c=[...l,n].slice(-3);e.yAxis[r]=kP(kP({},i),{},{width:n,widthHistory:c})}}}}),{addXAxis:WJ,replaceXAxis:ZJ,removeXAxis:JJ,addYAxis:eee,replaceYAxis:tee,removeYAxis:ree,addZAxis:Ple,replaceZAxis:Rle,removeZAxis:Mle,updateYAxisWidth:nee}=Dk.actions,aee=Dk.reducer,iee=Q([Vt],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),see=Q([iee,Wa,Za],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),Vw=()=>ve(see),oee=()=>ve(BX);function LP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ux(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LP(Object(r),!0).forEach(function(n){lee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lee(e,t,r){return(t=uee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uee(e){var t=cee(e,"string");return typeof t=="symbol"?t:t+""}function cee(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var dee=e=>{var{point:t,childIndex:r,mainColor:n,activeDot:i,dataKey:o,clipPath:l}=e;if(i===!1||t.x==null||t.y==null)return null;var c={index:r,dataKey:o,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},h=ux(ux(ux({},c),gd(i)),Aj(i)),f;return S.isValidElement(i)?f=S.cloneElement(i,h):typeof i=="function"?f=i(h):f=S.createElement(bk,h),S.createElement(sn,{className:"recharts-active-dot",clipPath:l},f)};function fee(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:i,clipPath:o,zIndex:l=Gt.activeDot}=e,c=ve(uo),h=oee();if(t==null||h==null)return null;var f=t.find(p=>h.includes(p.payload));return mt(f)?null:S.createElement(Cn,{zIndex:l},S.createElement(dee,{point:f,childIndex:Number(c),mainColor:r,dataKey:i,activeDot:n,clipPath:o}))}var $P=(e,t,r)=>{var n=r??e;if(!mt(n))return Bn(n,t,0)},hee=(e,t,r)=>{var n={},i=e.filter(Mp),o=e.filter(f=>f.stackId==null),l=i.reduce((f,p)=>{var g=f[p.stackId];return g==null&&(g=[]),g.push(p),f[p.stackId]=g,f},n),c=Object.entries(l).map(f=>{var p,[g,y]=f,x=y.map(w=>w.dataKey),b=$P(t,r,(p=y[0])===null||p===void 0?void 0:p.barSize);return{stackId:g,dataKeys:x,barSize:b}}),h=o.map(f=>{var p=[f.dataKey].filter(y=>y!=null),g=$P(t,r,f.barSize);return{stackId:void 0,dataKeys:p,barSize:g}});return[...c,...h]};function IP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xh(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?IP(Object(r),!0).forEach(function(n){mee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):IP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mee(e,t,r){return(t=pee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pee(e){var t=gee(e,"string");return typeof t=="symbol"?t:t+""}function gee(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yee(e,t,r,n,i){var o,l=n.length;if(!(l<1)){var c=Bn(e,r,0,!0),h,f=[];if(Be((o=n[0])===null||o===void 0?void 0:o.barSize)){var p=!1,g=r/l,y=n.reduce((E,T)=>E+(T.barSize||0),0);y+=(l-1)*c,y>=r&&(y-=(l-1)*c,c=0),y>=r&&g>0&&(p=!0,g*=.9,y=l*g);var x=(r-y)/2>>0,b={offset:x-c,size:0};h=n.reduce((E,T)=>{var A,C={stackId:T.stackId,dataKeys:T.dataKeys,position:{offset:b.offset+b.size+c,size:p?g:(A=T.barSize)!==null&&A!==void 0?A:0}},R=[...E,C];return b=C.position,R},f)}else{var w=Bn(t,r,0,!0);r-2*w-(l-1)*c<=0&&(c=0);var N=(r-2*w-(l-1)*c)/l;N>1&&(N>>=0);var _=Be(i)?Math.min(N,i):N;h=n.reduce((E,T,A)=>[...E,{stackId:T.stackId,dataKeys:T.dataKeys,position:{offset:w+(N+c)*A+(N-_)/2,size:_}}],f)}return h}}var vee=(e,t,r,n,i,o,l)=>{var c=mt(l)?t:l,h=yee(r,n,i!==o?i:o,e,c);return i!==o&&h!=null&&(h=h.map(f=>xh(xh({},f),{},{position:xh(xh({},f.position),{},{offset:f.position.offset-i/2})}))),h},xee=(e,t)=>{var r=tw(t);if(!(!e||r==null||t==null)){var{stackId:n}=t;if(n!=null){var i=e[n];if(i){var{stackedData:o}=i;if(o)return o.find(l=>l.key===r)}}}},bee=(e,t)=>{if(!(e==null||t==null)){var r=e.find(n=>n.stackId===t.stackId&&t.dataKey!=null&&n.dataKeys.includes(t.dataKey));if(r!=null)return r.position}};function jee(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&Be(e.zIndex)?e.zIndex:t}var wee=e=>{var{chartData:t}=e,r=ct(),n=jr();return S.useEffect(()=>n?()=>{}:(r(ZC(t)),()=>{r(ZC(void 0))}),[t,r,n]),null},zP={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},kk=br({name:"brush",initialState:zP,reducers:{setBrushSettings(e,t){return t.payload==null?zP:t.payload}}}),{setBrushSettings:Dle}=kk.actions,See=kk.reducer;function Nee(e){return(e%180+180)%180}var _ee=function(t){var{width:r,height:n}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=Nee(i),l=o*Math.PI/180,c=Math.atan(n/r),h=l>c&&l<Math.PI-c?n/Math.sin(l):r/Math.cos(l);return Math.abs(h)},Oee={dots:[],areas:[],lines:[]},Lk=br({name:"referenceElements",initialState:Oee,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=On(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=On(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=On(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:kle,removeDot:Lle,addArea:$le,removeArea:Ile,addLine:zle,removeLine:Ble}=Lk.actions,Eee=Lk.reducer,Aee=S.createContext(void 0),Tee=e=>{var{children:t}=e,[r]=S.useState("".concat(Uc("recharts"),"-clip")),n=Vw();if(n==null)return null;var{x:i,y:o,width:l,height:c}=n;return S.createElement(Aee.Provider,{value:r},S.createElement("defs",null,S.createElement("clipPath",{id:r},S.createElement("rect",{x:i,y:o,height:c,width:l}))),t)};function $k(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;n<e.length;n+=t){var i=e[n];i!==void 0&&r.push(i)}return r}function Cee(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return _ee(n,r)}function Pee(e,t,r){var n=r==="width",{x:i,y:o,width:l,height:c}=e;return t===1?{start:n?i:o,end:n?i+l:o+c}:{start:n?i+l:o+c,end:n?i:o}}function td(e,t,r,n,i){if(e*t<e*n||e*t>e*i)return!1;var o=r();return e*(t-e*o/2-n)>=0&&e*(t+e*o/2-i)<=0}function Ree(e,t){return $k(e,t+1)}function Mee(e,t,r,n,i){for(var o=(n||[]).slice(),{start:l,end:c}=t,h=0,f=1,p=l,g=function(){var b=n==null?void 0:n[h];if(b===void 0)return{v:$k(n,f)};var w=h,N,_=()=>(N===void 0&&(N=r(b,w)),N),E=b.coordinate,T=h===0||td(e,E,_,p,c);T||(h=0,p=l,f+=1),T&&(p=E+e*(_()/2+i),h+=f)},y;f<=o.length;)if(y=g(),y)return y.v;return[]}function Dee(e,t,r,n,i){var o=(n||[]).slice(),l=o.length;if(l===0)return[];for(var{start:c,end:h}=t,f=1;f<=l;f++){for(var p=(l-1)%f,g=c,y=!0,x=function(){var A=n[w];if(A==null)return 0;var C=w,R,D=()=>(R===void 0&&(R=r(A,C)),R),M=A.coordinate,z=w===p||td(e,M,D,g,h);if(!z)return y=!1,1;z&&(g=M+e*(D()/2+i))},b,w=p;w<l&&(b=x(),!(b!==0&&b===1));w+=f);if(y){for(var N=[],_=p;_<l;_+=f){var E=n[_];E!=null&&N.push(E)}return N}}return[]}function BP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function yr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?BP(Object(r),!0).forEach(function(n){kee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):BP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function kee(e,t,r){return(t=Lee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lee(e){var t=$ee(e,"string");return typeof t=="symbol"?t:t+""}function $ee(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Iee(e,t,r,n,i){for(var o=(n||[]).slice(),l=o.length,{start:c}=t,{end:h}=t,f=function(y){var x=o[y];if(x==null)return 1;var b=x,w,N=()=>(w===void 0&&(w=r(x,y)),w);if(y===l-1){var _=e*(b.coordinate+e*N()/2-h);o[y]=b=yr(yr({},b),{},{tickCoord:_>0?b.coordinate-_*e:b.coordinate})}else o[y]=b=yr(yr({},b),{},{tickCoord:b.coordinate});if(b.tickCoord!=null){var E=td(e,b.tickCoord,N,c,h);E&&(h=b.tickCoord-e*(N()/2+i),o[y]=yr(yr({},b),{},{isShow:!0}))}},p=l-1;p>=0;p--)f(p);return o}function zee(e,t,r,n,i,o){var l=(n||[]).slice(),c=l.length,{start:h,end:f}=t;if(o){var p=n[c-1];if(p!=null){var g=r(p,c-1),y=e*(p.coordinate+e*g/2-f);if(l[c-1]=p=yr(yr({},p),{},{tickCoord:y>0?p.coordinate-y*e:p.coordinate}),p.tickCoord!=null){var x=td(e,p.tickCoord,()=>g,h,f);x&&(f=p.tickCoord-e*(g/2+i),l[c-1]=yr(yr({},p),{},{isShow:!0}))}}}for(var b=o?c-1:c,w=function(E){var T=l[E];if(T==null)return 1;var A=T,C,R=()=>(C===void 0&&(C=r(T,E)),C);if(E===0){var D=e*(A.coordinate-e*R()/2-h);l[E]=A=yr(yr({},A),{},{tickCoord:D<0?A.coordinate-D*e:A.coordinate})}else l[E]=A=yr(yr({},A),{},{tickCoord:A.coordinate});if(A.tickCoord!=null){var M=td(e,A.tickCoord,R,h,f);M&&(h=A.tickCoord+e*(R()/2+i),l[E]=yr(yr({},A),{},{isShow:!0}))}},N=0;N<b;N++)w(N);return l}function Qw(e,t,r){var{tick:n,ticks:i,viewBox:o,minTickGap:l,orientation:c,interval:h,tickFormatter:f,unit:p,angle:g}=e;if(!i||!i.length||!n)return[];if(ge(h)||Sd.isSsr){var y;return(y=Ree(i,ge(h)?h:0))!==null&&y!==void 0?y:[]}var x=[],b=c==="top"||c==="bottom"?"width":"height",w=p&&b==="width"?Ac(p,{fontSize:t,letterSpacing:r}):{width:0,height:0},N=(C,R)=>{var D=typeof f=="function"?f(C.value,R):C.value;return b==="width"?Cee(Ac(D,{fontSize:t,letterSpacing:r}),w,g):Ac(D,{fontSize:t,letterSpacing:r})[b]},_=i[0],E=i[1],T=i.length>=2&&_!=null&&E!=null?Br(E.coordinate-_.coordinate):1,A=Pee(o,T,b);return h==="equidistantPreserveStart"?Mee(T,A,N,i,l):h==="equidistantPreserveEnd"?Dee(T,A,N,i,l):(h==="preserveStart"||h==="preserveStartEnd"?x=zee(T,A,N,i,l,h==="preserveStartEnd"):x=Iee(T,A,N,i,l),x.filter(C=>C.isShow))}var Bee=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:i=0,tickMargin:o=0}=e,l=0;if(t){Array.from(t).forEach(p=>{if(p){var g=p.getBoundingClientRect();g.width>l&&(l=g.width)}});var c=r?r.getBoundingClientRect().width:0,h=i+o,f=l+h+c+(r?n:0);return Math.round(f)}return 0},Uee={xAxis:{},yAxis:{}},Ik=br({name:"renderedTicks",initialState:Uee,reducers:{setRenderedTicks:(e,t)=>{var{axisType:r,axisId:n,ticks:i}=t.payload;e[r][n]=i},removeRenderedTicks:(e,t)=>{var{axisType:r,axisId:n}=t.payload;delete e[r][n]}}}),{setRenderedTicks:qee,removeRenderedTicks:Fee}=Ik.actions,Hee=Ik.reducer,Kee=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function Gee(e,t){if(e==null)return{};var r,n,i=Yee(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Yee(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function co(){return co=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},co.apply(null,arguments)}function UP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?UP(Object(r),!0).forEach(function(n){Vee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vee(e,t,r){return(t=Qee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qee(e){var t=Xee(e,"string");return typeof t=="symbol"?t:t+""}function Xee(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ka={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Gt.axis};function Wee(e){var{x:t,y:r,width:n,height:i,orientation:o,mirror:l,axisLine:c,otherSvgProps:h}=e;if(!c)return null;var f=xt(xt(xt({},h),zn(c)),{},{fill:"none"});if(o==="top"||o==="bottom"){var p=+(o==="top"&&!l||o==="bottom"&&l);f=xt(xt({},f),{},{x1:t,y1:r+p*i,x2:t+n,y2:r+p*i})}else{var g=+(o==="left"&&!l||o==="right"&&l);f=xt(xt({},f),{},{x1:t+g*n,y1:r,x2:t+g*n,y2:r+i})}return S.createElement("line",co({},f,{className:Xe("recharts-cartesian-axis-line",Hl(c,"className"))}))}function Zee(e,t,r,n,i,o,l,c,h){var f,p,g,y,x,b,w=c?-1:1,N=e.tickSize||l,_=ge(e.tickCoord)?e.tickCoord:e.coordinate;switch(o){case"top":f=p=e.coordinate,y=r+ +!c*i,g=y-w*N,b=g-w*h,x=_;break;case"left":g=y=e.coordinate,p=t+ +!c*n,f=p-w*N,x=f-w*h,b=_;break;case"right":g=y=e.coordinate,p=t+ +c*n,f=p+w*N,x=f+w*h,b=_;break;default:f=p=e.coordinate,y=r+ +c*i,g=y+w*N,b=g+w*h,x=_;break}return{line:{x1:f,y1:g,x2:p,y2:y},tick:{x,y:b}}}function Jee(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function ete(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function tte(e){var{option:t,tickProps:r,value:n}=e,i,o=Xe(r.className,"recharts-cartesian-axis-tick-value");if(S.isValidElement(t))i=S.cloneElement(t,xt(xt({},r),{},{className:o}));else if(typeof t=="function")i=t(xt(xt({},r),{},{className:o}));else{var l="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(l=Xe(l,iJ(t))),i=S.createElement(Gw,co({},r,{className:l}),n)}return i}function rte(e){var{ticks:t,axisType:r,axisId:n}=e,i=ct();return S.useEffect(()=>{if(n==null||r==null)return go;var o=t.map(l=>({value:l.value,coordinate:l.coordinate,offset:l.offset,index:l.index}));return i(qee({ticks:o,axisId:n,axisType:r})),()=>{i(Fee({axisId:n,axisType:r}))}},[i,t,n,r]),null}var nte=S.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:i,stroke:o,tickFormatter:l,unit:c,padding:h,tickTextProps:f,orientation:p,mirror:g,x:y,y:x,width:b,height:w,tickSize:N,tickMargin:_,fontSize:E,letterSpacing:T,getTicksConfig:A,events:C,axisType:R,axisId:D}=e,M=Qw(xt(xt({},A),{},{ticks:r}),E,T),z=zn(A),k=gd(n),H=ck(z.textAnchor)?z.textAnchor:Jee(p,g),U=ete(p,g),ae={};typeof i=="object"&&(ae=i);var Z=xt(xt({},z),{},{fill:"none"},ae),G=M.map(J=>xt({entry:J},Zee(J,y,x,b,w,p,N,g,_))),L=G.map(J=>{var{entry:re,line:oe}=J;return S.createElement(sn,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(re.value,"-").concat(re.coordinate,"-").concat(re.tickCoord)},i&&S.createElement("line",co({},Z,oe,{className:Xe("recharts-cartesian-axis-tick-line",Hl(i,"className"))})))}),F=G.map((J,re)=>{var oe,$,{entry:X,tick:le}=J,ue=xt(xt(xt(xt({verticalAnchor:U},z),{},{textAnchor:H,stroke:"none",fill:o},le),{},{index:re,payload:X,visibleTicksCount:M.length,tickFormatter:l,padding:h},f),{},{angle:(oe=($=f==null?void 0:f.angle)!==null&&$!==void 0?$:z.angle)!==null&&oe!==void 0?oe:0}),pe=xt(xt({},ue),k);return S.createElement(sn,co({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(X.value,"-").concat(X.coordinate,"-").concat(X.tickCoord)},sp(C,X,re)),n&&S.createElement(tte,{option:n,tickProps:pe,value:"".concat(typeof l=="function"?l(X.value,re):X.value).concat(c||"")}))});return S.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(R,"-ticks")},S.createElement(rte,{ticks:M,axisId:D,axisType:R}),F.length>0&&S.createElement(Cn,{zIndex:Gt.label},S.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(R,"-tick-labels"),ref:t},F)),L.length>0&&S.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(R,"-tick-lines")},L))}),ate=S.forwardRef((e,t)=>{var{axisLine:r,width:n,height:i,className:o,hide:l,ticks:c,axisType:h,axisId:f}=e,p=Gee(e,Kee),[g,y]=S.useState(""),[x,b]=S.useState(""),w=S.useRef(null);S.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var _;return Bee({ticks:w.current,label:(_=e.labelRef)===null||_===void 0?void 0:_.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var N=S.useCallback(_=>{if(_){var E=_.getElementsByClassName("recharts-cartesian-axis-tick-value");w.current=E;var T=E[0];if(T){var A=window.getComputedStyle(T),C=A.fontSize,R=A.letterSpacing;(C!==g||R!==x)&&(y(C),b(R))}}},[g,x]);return l||n!=null&&n<=0||i!=null&&i<=0?null:S.createElement(Cn,{zIndex:e.zIndex},S.createElement(sn,{className:Xe("recharts-cartesian-axis",o)},S.createElement(Wee,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:zn(e)}),S.createElement(nte,{ref:N,axisType:h,events:p,fontSize:g,getTicksConfig:e,height:e.height,letterSpacing:x,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:c,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:f}),S.createElement(BZ,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},S.createElement(XZ,{label:e.label,labelRef:e.labelRef}),e.children)))}),Xw=S.forwardRef((e,t)=>{var r=fr(e,Ka);return S.createElement(ate,co({},r,{ref:t}))});Xw.displayName="CartesianAxis";var ite=["x1","y1","x2","y2","key"],ste=["offset"],ote=["xAxisId","yAxisId"],lte=["xAxisId","yAxisId"];function qP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qP(Object(r),!0).forEach(function(n){ute(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ute(e,t,r){return(t=cte(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cte(e){var t=dte(e,"string");return typeof t=="symbol"?t:t+""}function dte(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $s(){return $s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$s.apply(null,arguments)}function Bm(e,t){if(e==null)return{};var r,n,i=fte(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function fte(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var hte=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:i,width:o,height:l,ry:c}=e;return S.createElement("rect",{x:n,y:i,ry:c,width:o,height:l,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function zk(e){var{option:t,lineItemProps:r}=e,n;if(S.isValidElement(t))n=S.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var i,{x1:o,y1:l,x2:c,y2:h,key:f}=r,p=Bm(r,ite),g=(i=zn(p))!==null&&i!==void 0?i:{},{offset:y}=g,x=Bm(g,ste);n=S.createElement("line",$s({},x,{x1:o,y1:l,x2:c,y2:h,fill:"none",key:f}))}return n}function mte(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:o,yAxisId:l}=e,c=Bm(e,ote),h=i.map((f,p)=>{var g=vr(vr({},c),{},{x1:t,y1:f,x2:t+r,y2:f,key:"line-".concat(p),index:p});return S.createElement(zk,{key:"line-".concat(p),option:n,lineItemProps:g})});return S.createElement("g",{className:"recharts-cartesian-grid-horizontal"},h)}function pte(e){var{y:t,height:r,vertical:n=!0,verticalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:o,yAxisId:l}=e,c=Bm(e,lte),h=i.map((f,p)=>{var g=vr(vr({},c),{},{x1:f,y1:t,x2:f,y2:t+r,key:"line-".concat(p),index:p});return S.createElement(zk,{option:n,lineItemProps:g,key:"line-".concat(p)})});return S.createElement("g",{className:"recharts-cartesian-grid-vertical"},h)}function gte(e){var{horizontalFill:t,fillOpacity:r,x:n,y:i,width:o,height:l,horizontalPoints:c,horizontal:h=!0}=e;if(!h||!t||!t.length||c==null)return null;var f=c.map(g=>Math.round(g+i-i)).sort((g,y)=>g-y);i!==f[0]&&f.unshift(0);var p=f.map((g,y)=>{var x=f[y+1],b=x==null,w=b?i+l-g:x-g;if(w<=0)return null;var N=y%t.length;return S.createElement("rect",{key:"react-".concat(y),y:g,x:n,height:w,width:o,stroke:"none",fill:t[N],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},p)}function yte(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:i,y:o,width:l,height:c,verticalPoints:h}=e;if(!t||!r||!r.length)return null;var f=h.map(g=>Math.round(g+i-i)).sort((g,y)=>g-y);i!==f[0]&&f.unshift(0);var p=f.map((g,y)=>{var x=f[y+1],b=x==null,w=b?i+l-g:x-g;if(w<=0)return null;var N=y%r.length;return S.createElement("rect",{key:"react-".concat(y),x:g,y:o,width:w,height:c,stroke:"none",fill:r[N],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var vte=(e,t)=>{var{xAxis:r,width:n,height:i,offset:o}=e;return h3(Qw(vr(vr(vr({},Ka),r),{},{ticks:m3(r),viewBox:{x:0,y:0,width:n,height:i}})),o.left,o.left+o.width,t)},xte=(e,t)=>{var{yAxis:r,width:n,height:i,offset:o}=e;return h3(Qw(vr(vr(vr({},Ka),r),{},{ticks:m3(r),viewBox:{x:0,y:0,width:n,height:i}})),o.top,o.top+o.height,t)},bte={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Gt.grid};function Gp(e){var t=Uj(),r=qj(),n=x3(),i=vr(vr({},fr(e,bte)),{},{x:ge(e.x)?e.x:n.left,y:ge(e.y)?e.y:n.top,width:ge(e.width)?e.width:n.width,height:ge(e.height)?e.height:n.height}),{xAxisId:o,yAxisId:l,x:c,y:h,width:f,height:p,syncWithTicks:g,horizontalValues:y,verticalValues:x}=i,b=jr(),w=ve(z=>zC(z,"xAxis",o,b)),N=ve(z=>zC(z,"yAxis",l,b));if(!ca(f)||!ca(p)||!ge(c)||!ge(h))return null;var _=i.verticalCoordinatesGenerator||vte,E=i.horizontalCoordinatesGenerator||xte,{horizontalPoints:T,verticalPoints:A}=i;if((!T||!T.length)&&typeof E=="function"){var C=y&&y.length,R=E({yAxis:N?vr(vr({},N),{},{ticks:C?y:N.ticks}):void 0,width:t??f,height:r??p,offset:n},C?!0:g);dm(Array.isArray(R),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof R,"]")),Array.isArray(R)&&(T=R)}if((!A||!A.length)&&typeof _=="function"){var D=x&&x.length,M=_({xAxis:w?vr(vr({},w),{},{ticks:D?x:w.ticks}):void 0,width:t??f,height:r??p,offset:n},D?!0:g);dm(Array.isArray(M),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof M,"]")),Array.isArray(M)&&(A=M)}return S.createElement(Cn,{zIndex:i.zIndex},S.createElement("g",{className:"recharts-cartesian-grid"},S.createElement(hte,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),S.createElement(gte,$s({},i,{horizontalPoints:T})),S.createElement(yte,$s({},i,{verticalPoints:A})),S.createElement(mte,$s({},i,{offset:n,horizontalPoints:T,xAxis:w,yAxis:N})),S.createElement(pte,$s({},i,{offset:n,verticalPoints:A,xAxis:w,yAxis:N}))))}Gp.displayName="CartesianGrid";var jte={},Bk=br({name:"errorBars",initialState:jte,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:i}=t.payload;e[r]&&(e[r]=e[r].map(o=>o.dataKey===n.dataKey&&o.direction===n.direction?i:o))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(i=>i.dataKey!==n.dataKey||i.direction!==n.direction))}}}),{addErrorBar:Ule,replaceErrorBar:qle,removeErrorBar:Fle}=Bk.actions,wte=Bk.reducer,Ste=["children"];function Nte(e,t){if(e==null)return{};var r,n,i=_te(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _te(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Ote={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},Ete=S.createContext(Ote);function Uk(e){var{children:t}=e,r=Nte(e,Ste);return S.createElement(Ete.Provider,{value:r},t)}function Ww(e,t){var r,n,i=ve(f=>ei(f,e)),o=ve(f=>ti(f,t)),l=(r=i==null?void 0:i.allowDataOverflow)!==null&&r!==void 0?r:Lt.allowDataOverflow,c=(n=o==null?void 0:o.allowDataOverflow)!==null&&n!==void 0?n:$t.allowDataOverflow,h=l||c;return{needClip:h,needClipX:l,needClipY:c}}function qk(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,i=Vw(),{needClipX:o,needClipY:l,needClip:c}=Ww(t,r);if(!c||!i)return null;var{x:h,y:f,width:p,height:g}=i;return S.createElement("clipPath",{id:"clipPath-".concat(n)},S.createElement("rect",{x:o?h:h-p/2,y:l?f:f-g/2,width:o?p:p*2,height:l?g:g*2}))}var Fk=(e,t,r,n)=>es(e,"xAxis",t,n),Hk=(e,t,r,n)=>Ji(e,"xAxis",t,n),Kk=(e,t,r,n)=>es(e,"yAxis",r,n),Gk=(e,t,r,n)=>Ji(e,"yAxis",r,n),Ate=Q([We,Fk,Kk,Hk,Gk],(e,t,r,n,i)=>Xa(e,"xAxis")?Gl(t,n,!1):Gl(r,i,!1)),Tte=(e,t,r,n,i)=>i;function Cte(e){return e.type==="line"}var Pte=Q([qp,Tte],(e,t)=>e.filter(Cte).find(r=>r.id===t)),Rte=Q([We,Fk,Kk,Hk,Gk,Pte,Ate,Nd],(e,t,r,n,i,o,l,c)=>{var{chartData:h,dataStartIndex:f,dataEndIndex:p}=c;if(!(o==null||t==null||r==null||n==null||i==null||n.length===0||i.length===0||l==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:g,data:y}=o,x;if(y!=null&&y.length>0?x=y:x=h==null?void 0:h.slice(f,p+1),x!=null)return Jte({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataKey:g,bandSize:l,displayedData:x})}});function Mte(e){var t=gd(e),r=3,n=2;if(t!=null){var{r:i,strokeWidth:o}=t,l=Number(i),c=Number(o);return(Number.isNaN(l)||l<0)&&(l=r),(Number.isNaN(c)||c<0)&&(c=n),{r:l,strokeWidth:c}}return{r,strokeWidth:n}}var Dte=["id"],kte=["type","layout","connectNulls","needClip","shape"],Lte=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function rd(){return rd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rd.apply(null,arguments)}function FP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function na(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?FP(Object(r),!0).forEach(function(n){$te(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):FP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $te(e,t,r){return(t=Ite(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ite(e){var t=zte(e,"string");return typeof t=="symbol"?t:t+""}function zte(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zw(e,t){if(e==null)return{};var r,n,i=Bte(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Bte(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Ute=e=>{var{dataKey:t,name:r,stroke:n,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:n,value:yp(r,t),payload:e}]},qte=S.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:o,name:l,hide:c,unit:h,tooltipType:f,id:p}=e,g={dataDefinedOnItem:r,getPosition:go,settings:{stroke:n,strokeWidth:i,fill:o,dataKey:t,nameKey:void 0,name:yp(l,t),hide:c,type:f,color:n,unit:h,graphicalItemId:p}};return S.createElement(Ak,{tooltipEntrySettings:g})}),Yk=(e,t)=>"".concat(t,"px ").concat(e,"px");function Fte(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],i=0;i<t;++i)n.push(...r);return n}var Hte=(e,t,r)=>{var n=r.reduce((y,x)=>y+x,0);if(!n)return Yk(t,e);for(var i=Math.floor(e/n),o=e%n,l=[],c=0,h=0;c<r.length;h+=(f=r[c])!==null&&f!==void 0?f:0,++c){var f,p=r[c];if(p!=null&&h+p>o){l=[...r.slice(0,c),o-h];break}}var g=l.length%2===0?[0,t]:[t];return[...Fte(r,i),...l,...g].map(y=>"".concat(y,"px")).join(", ")};function Kte(e){var{clipPathId:t,points:r,props:n}=e,{dot:i,dataKey:o,needClip:l}=n,{id:c}=n,h=Zw(n,Dte),f=zn(h);return S.createElement(GJ,{points:r,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:o,baseProps:f,needClip:l,clipPathId:t})}function Gte(e){var{showLabels:t,children:r,points:n}=e,i=S.useMemo(()=>n==null?void 0:n.map(o=>{var l,c,h={x:(l=o.x)!==null&&l!==void 0?l:0,y:(c=o.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return na(na({},h),{},{value:o.value,payload:o.payload,viewBox:h,parentViewBox:void 0,fill:void 0})}),[n]);return S.createElement(yk,{value:t?i:void 0},r)}function HP(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:i,props:o}=e,{type:l,layout:c,connectNulls:h,needClip:f,shape:p}=o,g=Zw(o,kte),y=na(na({},Er(g)),{},{fill:"none",className:"recharts-line-curve",clipPath:f?"url(#clipPath-".concat(t,")"):void 0,points:n,type:l,layout:c,connectNulls:h,strokeDasharray:i??o.strokeDasharray});return S.createElement(S.Fragment,null,(n==null?void 0:n.length)>1&&S.createElement(Nk,rd({shapeType:"curve",option:p},y,{pathRef:r})),S.createElement(Kte,{points:n,clipPathId:t,props:o}))}function Yte(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Vte(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:i,longestAnimatedLengthRef:o}=e,{points:l,strokeDasharray:c,isAnimationActive:h,animationBegin:f,animationDuration:p,animationEasing:g,animateNewValues:y,width:x,height:b,onAnimationEnd:w,onAnimationStart:N}=r,_=i.current,E=Ep(l,"recharts-line-"),T=S.useRef(E),[A,C]=S.useState(!1),R=!A,D=S.useCallback(()=>{typeof w=="function"&&w(),C(!1)},[w]),M=S.useCallback(()=>{typeof N=="function"&&N(),C(!0)},[N]),z=Yte(n.current),k=S.useRef(0);T.current!==E&&(k.current=o.current,T.current=E);var H=k.current;return S.createElement(Gte,{points:l,showLabels:R},r.children,S.createElement(Op,{animationId:E,begin:f,duration:p,isActive:h,easing:g,onAnimationEnd:D,onAnimationStart:M,key:E},U=>{var ae=jt(H,z+H,U),Z=Math.min(ae,z),G;if(h)if(c){var L="".concat(c).split(/[,\s]+/gim).map(re=>parseFloat(re));G=Hte(Z,z,L)}else G=Yk(z,Z);else G=c==null?void 0:String(c);if(U>0&&z>0&&(i.current=l,o.current=Math.max(o.current,Z)),_){var F=_.length/l.length,J=U===1?l:l.map((re,oe)=>{var $=Math.floor(oe*F);if(_[$]){var X=_[$];return na(na({},re),{},{x:jt(X.x,re.x,U),y:jt(X.y,re.y,U)})}return y?na(na({},re),{},{x:jt(x*2,re.x,U),y:jt(b/2,re.y,U)}):na(na({},re),{},{x:re.x,y:re.y})});return i.current=J,S.createElement(HP,{props:r,points:J,clipPathId:t,pathRef:n,strokeDasharray:G})}return S.createElement(HP,{props:r,points:l,clipPathId:t,pathRef:n,strokeDasharray:G})}),S.createElement(xk,{label:r.label}))}function Qte(e){var{clipPathId:t,props:r}=e,n=S.useRef(null),i=S.useRef(0),o=S.useRef(null);return S.createElement(Vte,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:i,pathRef:o})}var Xte=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:Ot(e.payload,t)}};class Wte extends S.Component{render(){var{hide:t,dot:r,points:n,className:i,xAxisId:o,yAxisId:l,top:c,left:h,width:f,height:p,id:g,needClip:y,zIndex:x}=this.props;if(t)return null;var b=Xe("recharts-line",i),w=g,{r:N,strokeWidth:_}=Mte(r),E=Sk(r),T=N*2+_,A=y?"url(#clipPath-".concat(E?"":"dots-").concat(w,")"):void 0;return S.createElement(Cn,{zIndex:x},S.createElement(sn,{className:b},y&&S.createElement("defs",null,S.createElement(qk,{clipPathId:w,xAxisId:o,yAxisId:l}),!E&&S.createElement("clipPath",{id:"clipPath-dots-".concat(w)},S.createElement("rect",{x:h-T/2,y:c-T/2,width:f+T,height:p+T}))),S.createElement(Uk,{xAxisId:o,yAxisId:l,data:n,dataPointFormatter:Xte,errorBarOffset:0},S.createElement(Qte,{props:this.props,clipPathId:w}))),S.createElement(fee,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:A}))}}var Vk={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Gt.line,type:"linear"};function Zte(e){var t=fr(e,Vk),{activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:o,animationEasing:l,connectNulls:c,dot:h,hide:f,isAnimationActive:p,label:g,legendType:y,xAxisId:x,yAxisId:b,id:w}=t,N=Zw(t,Lte),{needClip:_}=Ww(x,b),E=Vw(),T=yo(),A=jr(),C=ve(k=>Rte(k,x,b,A,w));if(T!=="horizontal"&&T!=="vertical"||C==null||E==null)return null;var{height:R,width:D,x:M,y:z}=E;return S.createElement(Wte,rd({},N,{id:w,connectNulls:c,dot:h,activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:o,animationEasing:l,isAnimationActive:p,hide:f,label:g,legendType:y,xAxisId:x,yAxisId:b,points:C,layout:T,height:R,width:D,left:M,top:z,needClip:_}))}function Jte(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:o,dataKey:l,bandSize:c,displayedData:h}=e;return h.map((f,p)=>{var g=Ot(f,l);if(t==="horizontal"){var y=PA({axis:r,ticks:i,bandSize:c,entry:f,index:p}),x=mt(g)?null:n.scale.map(g);return{x:y,y:x??null,value:g,payload:f}}var b=mt(g)?null:r.scale.map(g),w=PA({axis:n,ticks:o,bandSize:c,entry:f,index:p});return b==null||w==null?null:{x:b,y:w,value:g,payload:f}}).filter(Boolean)}function ere(e){var t=fr(e,Vk),r=jr();return S.createElement(Ck,{id:t.id,type:"line"},n=>S.createElement(S.Fragment,null,S.createElement(Tk,{legendPayload:Ute(t)}),S.createElement(qte,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),S.createElement(Rk,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),S.createElement(Zte,rd({},t,{id:n}))))}var Qk=S.memo(ere,ru);Qk.displayName="Line";function jo(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||n===void 0?void 0:n.xAxisId)!==null&&r!==void 0?r:Mk}function wo(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||n===void 0?void 0:n.yAxisId)!==null&&r!==void 0?r:Mk}var tre="Invariant failed";function rre(e,t){throw new Error(tre)}function Rb(){return Rb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rb.apply(null,arguments)}function Jw(e){return S.createElement(Nk,Rb({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},e))}var nre=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,i)=>{if(ge(t))return t;var o=ge(n)||mt(n);return o?t(n,i):(o||rre(),r)}},are=(e,t,r)=>r,ire=(e,t)=>t,Dd=Q([qp,ire],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),sre=Q([Dd],e=>e==null?void 0:e.maxBarSize),ore=(e,t,r,n)=>n,lre=Q([We,qp,jo,wo,are],(e,t,r,n,i)=>t.filter(o=>e==="horizontal"?o.xAxisId===r:o.yAxisId===n).filter(o=>o.isPanorama===i).filter(o=>o.hide===!1).filter(o=>o.type==="bar")),ure=(e,t,r)=>{var n=We(e),i=jo(e,t),o=wo(e,t);if(!(i==null||o==null))return n==="horizontal"?Eb(e,"yAxis",o,r):Eb(e,"xAxis",i,r)},cre=(e,t)=>{var r=We(e),n=jo(e,t),i=wo(e,t);if(!(n==null||i==null))return r==="horizontal"?IC(e,"xAxis",n):IC(e,"yAxis",i)},dre=Q([lre,YK,cre],hee),fre=(e,t,r)=>{var n,i,o=Dd(e,t);if(o==null)return 0;var l=jo(e,t),c=wo(e,t);if(l==null||c==null)return 0;var h=We(e),f=J3(e),{maxBarSize:p}=o,g=mt(p)?f:p,y,x;return h==="horizontal"?(y=es(e,"xAxis",l,r),x=Ji(e,"xAxis",l,r)):(y=es(e,"yAxis",c,r),x=Ji(e,"yAxis",c,r)),(n=(i=Gl(y,x,!0))!==null&&i!==void 0?i:g)!==null&&n!==void 0?n:0},Xk=(e,t,r)=>{var n=We(e),i=jo(e,t),o=wo(e,t);if(!(i==null||o==null)){var l,c;return n==="horizontal"?(l=es(e,"xAxis",i,r),c=Ji(e,"xAxis",i,r)):(l=es(e,"yAxis",o,r),c=Ji(e,"yAxis",o,r)),Gl(l,c)}},hre=Q([dre,J3,GK,e4,fre,Xk,sre],vee),mre=(e,t,r)=>{var n=jo(e,t);if(n!=null)return es(e,"xAxis",n,r)},pre=(e,t,r)=>{var n=wo(e,t);if(n!=null)return es(e,"yAxis",n,r)},gre=(e,t,r)=>{var n=jo(e,t);if(n!=null)return Ji(e,"xAxis",n,r)},yre=(e,t,r)=>{var n=wo(e,t);if(n!=null)return Ji(e,"yAxis",n,r)},vre=Q([hre,Dd],bee),xre=Q([ure,Dd],xee),bre=Q([Vt,$j,mre,pre,gre,yre,vre,We,IK,Xk,xre,Dd,ore],(e,t,r,n,i,o,l,c,h,f,p,g,y)=>{var{chartData:x,dataStartIndex:b,dataEndIndex:w}=h;if(!(g==null||l==null||t==null||c!=="horizontal"&&c!=="vertical"||r==null||n==null||i==null||o==null||f==null)){var{data:N}=g,_;if(N!=null&&N.length>0?_=N:_=x==null?void 0:x.slice(b,w+1),_!=null)return Vre({layout:c,barSettings:g,pos:l,parentViewBox:t,bandSize:f,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:o,stackedData:p,displayedData:_,offset:e,cells:y,dataStartIndex:b})}}),jre=["index"];function Mb(){return Mb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mb.apply(null,arguments)}function wre(e,t){if(e==null)return{};var r,n,i=Sre(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Sre(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Wk=S.createContext(void 0),Nre=e=>{var t=S.useContext(Wk);if(t!=null)return t.stackId;if(e!=null)return P7(e)},_re=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),Ore=e=>{var t=S.useContext(Wk);if(t!=null){var{stackId:r}=t;return"url(#".concat(_re(r,e),")")}},Zk=e=>{var{index:t}=e,r=wre(e,jre),n=Ore(t);return S.createElement(sn,Mb({className:"recharts-bar-stack-layer",clipPath:n},r))},Ere=["onMouseEnter","onMouseLeave","onClick"],Are=["value","background","tooltipPosition"],Tre=["id"],Cre=["onMouseEnter","onClick","onMouseLeave"];function ts(){return ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ts.apply(null,arguments)}function KP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Nr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KP(Object(r),!0).forEach(function(n){Pre(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Pre(e,t,r){return(t=Rre(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rre(e){var t=Mre(e,"string");return typeof t=="symbol"?t:t+""}function Mre(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Um(e,t){if(e==null)return{};var r,n,i=Dre(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Dre(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var kre=e=>{var{dataKey:t,name:r,fill:n,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:n,value:yp(r,t),payload:e}]},Lre=S.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:i,name:o,hide:l,unit:c,tooltipType:h,id:f}=e,p={dataDefinedOnItem:void 0,getPosition:go,settings:{stroke:r,strokeWidth:n,fill:i,dataKey:t,nameKey:void 0,name:yp(o,t),hide:l,type:h,color:i,unit:c,graphicalItemId:f}};return S.createElement(Ak,{tooltipEntrySettings:p})});function $re(e){var t=ve(uo),{data:r,dataKey:n,background:i,allOtherBarProps:o}=e,{onMouseEnter:l,onMouseLeave:c,onClick:h}=o,f=Um(o,Ere),p=_k(l,n,o.id),g=Ok(c),y=Ek(h,n,o.id);if(!i||r==null)return null;var x=gd(i);return S.createElement(Cn,{zIndex:jee(i,Gt.barBackground)},r.map((b,w)=>{var{value:N,background:_,tooltipPosition:E}=b,T=Um(b,Are);if(!_)return null;var A=p(b,w),C=g(b,w),R=y(b,w),D=Nr(Nr(Nr(Nr(Nr({option:i,isActive:String(w)===t},T),{},{fill:"#eee"},_),x),sp(f,b,w)),{},{onMouseEnter:A,onMouseLeave:C,onClick:R,dataKey:n,index:w,className:"recharts-bar-background-rectangle"});return S.createElement(Jw,ts({key:"background-bar-".concat(w)},D))}))}function Ire(e){var{showLabels:t,children:r,rects:n}=e,i=n==null?void 0:n.map(o=>{var l={x:o.x,y:o.y,width:o.width,lowerWidth:o.width,upperWidth:o.width,height:o.height};return Nr(Nr({},l),{},{value:o.value,payload:o.payload,parentViewBox:o.parentViewBox,viewBox:l,fill:o.fill})});return S.createElement(yk,{value:t?i:void 0},r)}function zre(e){var{shape:t,activeBar:r,baseProps:n,entry:i,index:o,dataKey:l}=e,c=ve(uo),h=ve(VD),f=r&&String(i.originalDataIndex)===c&&(h==null||l===h),[p,g]=S.useState(!1),[y,x]=S.useState(!1);S.useEffect(()=>{var T;return f?(g(!0),T=requestAnimationFrame(()=>{x(!0)})):x(!1),()=>{cancelAnimationFrame(T)}},[f]);var b=S.useCallback(()=>{f||g(!1)},[f]),w=f&&y,N=f||p,_;f?r===!0?_=t:_=r:_=t;var E=S.createElement(Jw,ts({},n,{name:String(n.name)},i,{isActive:w,option:_,index:o,dataKey:l,onTransitionEnd:b}));return N?S.createElement(Cn,{zIndex:Gt.activeBar},S.createElement(Zk,{index:i.originalDataIndex},E)):E}function Bre(e){var{shape:t,baseProps:r,entry:n,index:i,dataKey:o}=e;return S.createElement(Jw,ts({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:i,dataKey:o}))}function Ure(e){var t,{data:r,props:n}=e,i=(t=zn(n))!==null&&t!==void 0?t:{},{id:o}=i,l=Um(i,Tre),{shape:c,dataKey:h,activeBar:f}=n,{onMouseEnter:p,onClick:g,onMouseLeave:y}=n,x=Um(n,Cre),b=_k(p,h,o),w=Ok(y),N=Ek(g,h,o);return r?S.createElement(S.Fragment,null,r.map((_,E)=>S.createElement(Zk,ts({index:_.originalDataIndex,key:"rectangle-".concat(_==null?void 0:_.x,"-").concat(_==null?void 0:_.y,"-").concat(_==null?void 0:_.value,"-").concat(E),className:"recharts-bar-rectangle"},sp(x,_,E),{onMouseEnter:b(_,E),onMouseLeave:w(_,E),onClick:N(_,E)}),f?S.createElement(zre,{shape:c,activeBar:f,baseProps:l,entry:_,index:E,dataKey:h}):S.createElement(Bre,{shape:c,baseProps:l,entry:_,index:E,dataKey:h})))):null}function qre(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:i,isAnimationActive:o,animationBegin:l,animationDuration:c,animationEasing:h,onAnimationEnd:f,onAnimationStart:p}=t,g=r.current,y=Ep(t,"recharts-bar-"),[x,b]=S.useState(!1),w=!x,N=S.useCallback(()=>{typeof f=="function"&&f(),b(!1)},[f]),_=S.useCallback(()=>{typeof p=="function"&&p(),b(!0)},[p]);return S.createElement(Ire,{showLabels:w,rects:n},S.createElement(Op,{animationId:y,begin:l,duration:c,isActive:o,easing:h,onAnimationEnd:N,onAnimationStart:_,key:y},E=>{var T=E===1?n:n==null?void 0:n.map((A,C)=>{var R=g&&g[C];if(R)return Nr(Nr({},A),{},{x:jt(R.x,A.x,E),y:jt(R.y,A.y,E),width:jt(R.width,A.width,E),height:jt(R.height,A.height,E)});if(i==="horizontal"){var D=jt(0,A.height,E),M=jt(A.stackedBarStart,A.y,E);return Nr(Nr({},A),{},{y:M,height:D})}var z=jt(0,A.width,E),k=jt(A.stackedBarStart,A.x,E);return Nr(Nr({},A),{},{width:z,x:k})});return E>0&&(r.current=T??null),T==null?null:S.createElement(sn,null,S.createElement(Ure,{props:t,data:T}))}),S.createElement(xk,{label:t.label}),t.children)}function Fre(e){var t=S.useRef(null);return S.createElement(qre,{previousRectanglesRef:t,props:e})}var Jk=0,Hre=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:Ot(e,t)}};class Kre extends S.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:i,xAxisId:o,yAxisId:l,needClip:c,background:h,id:f}=this.props;if(t||r==null)return null;var p=Xe("recharts-bar",i),g=f;return S.createElement(sn,{className:p,id:f},c&&S.createElement("defs",null,S.createElement(qk,{clipPathId:g,xAxisId:o,yAxisId:l})),S.createElement(sn,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(g,")"):void 0},S.createElement($re,{data:r,dataKey:n,background:h,allOtherBarProps:this.props}),S.createElement(Fre,this.props)))}}var Gre={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:Jk,xAxisId:0,yAxisId:0,zIndex:Gt.bar};function Yre(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:o,activeBar:l,animationBegin:c,animationDuration:h,animationEasing:f,isAnimationActive:p}=e,{needClip:g}=Ww(t,r),y=yo(),x=jr(),b=uJ(e.children,Kw),w=ve(E=>bre(E,e.id,x,b));if(y!=="vertical"&&y!=="horizontal")return null;var N,_=w==null?void 0:w[0];return _==null||_.height==null||_.width==null?N=0:N=y==="vertical"?_.height/2:_.width/2,S.createElement(Uk,{xAxisId:t,yAxisId:r,data:w,dataPointFormatter:Hre,errorBarOffset:N},S.createElement(Kre,ts({},e,{layout:y,needClip:g,data:w,xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:o,activeBar:l,animationBegin:c,animationDuration:h,animationEasing:f,isAnimationActive:p})))}function Vre(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n,hasCustomShape:i},pos:o,bandSize:l,xAxis:c,yAxis:h,xAxisTicks:f,yAxisTicks:p,stackedData:g,displayedData:y,offset:x,cells:b,parentViewBox:w,dataStartIndex:N}=e,_=t==="horizontal"?h:c,E=g?_.scale.domain():null,T=R7({numericAxis:_}),A=_.scale.map(T);return y.map((C,R)=>{var D,M,z,k,H,U;if(g){var ae=g[R+N];if(ae==null)return null;D=O7(ae,E)}else D=Ot(C,r),Array.isArray(D)||(D=[T,D]);var Z=nre(n,Jk)(D[1],R);if(t==="horizontal"){var G,L=h.scale.map(D[0]),F=h.scale.map(D[1]);if(L==null||F==null)return null;M=RA({axis:c,ticks:f,bandSize:l,offset:o.offset,entry:C,index:R}),z=(G=F??L)!==null&&G!==void 0?G:void 0,k=o.size;var J=L-F;if(H=la(J)?0:J,U={x:M,y:x.top,width:k,height:x.height},Math.abs(Z)>0&&Math.abs(H)<Math.abs(Z)){var re=Br(H||Z)*(Math.abs(Z)-Math.abs(H));z-=re,H+=re}}else{var oe=c.scale.map(D[0]),$=c.scale.map(D[1]);if(oe==null||$==null)return null;if(M=oe,z=RA({axis:h,ticks:p,bandSize:l,offset:o.offset,entry:C,index:R}),k=$-oe,H=o.size,U={x:x.left,y:z,width:x.width,height:H},Math.abs(Z)>0&&Math.abs(k)<Math.abs(Z)){var X=Br(k||Z)*(Math.abs(Z)-Math.abs(k));k+=X}}if(M==null||z==null||k==null||H==null||!i&&(k===0||H===0))return null;var le=Nr(Nr({},C),{},{stackedBarStart:A,x:M,y:z,width:k,height:H,value:g?D:D[1],payload:C,background:U,tooltipPosition:{x:M+k/2,y:z+H/2},parentViewBox:w,originalDataIndex:R},b&&b[R]&&b[R].props);return le}).filter(Boolean)}function Qre(e){var t=fr(e,Gre),r=Nre(t.stackId),n=jr();return S.createElement(Ck,{id:t.id,type:"bar"},i=>S.createElement(S.Fragment,null,S.createElement(Tk,{legendPayload:kre(t)}),S.createElement(Lre,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:i}),S.createElement(Rk,{type:"bar",id:i,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:r,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:n,hasCustomShape:t.shape!=null}),S.createElement(Cn,{zIndex:t.zIndex},S.createElement(Yre,ts({},t,{id:i})))))}var eS=S.memo(Qre,ru);eS.displayName="Bar";var Xre=["domain","range"],Wre=["domain","range"];function GP(e,t){if(e==null)return{};var r,n,i=Zre(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Zre(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function YP(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function e5(e,t){if(e===t)return!0;var{domain:r,range:n}=e,i=GP(e,Xre),{domain:o,range:l}=t,c=GP(t,Wre);return!YP(r,o)||!YP(n,l)?!1:ru(i,c)}var Jre=["type"],ene=["dangerouslySetInnerHTML","ticks","scale"],tne=["id","scale"];function Db(){return Db=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Db.apply(null,arguments)}function VP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function QP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?VP(Object(r),!0).forEach(function(n){rne(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rne(e,t,r){return(t=nne(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nne(e){var t=ane(e,"string");return typeof t=="symbol"?t:t+""}function ane(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kb(e,t){if(e==null)return{};var r,n,i=ine(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function ine(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function sne(e){var t=ct(),r=S.useRef(null),n=b3(),{type:i}=e,o=kb(e,Jre),l=Cp(n,"xAxis",i),c=S.useMemo(()=>{if(l!=null)return QP(QP({},o),{},{type:l})},[o,l]);return S.useLayoutEffect(()=>{c!=null&&(r.current===null?t(WJ(c)):r.current!==c&&t(ZJ({prev:r.current,next:c})),r.current=c)},[c,t]),S.useLayoutEffect(()=>()=>{r.current&&(t(JJ(r.current)),r.current=null)},[t]),null}var one=e=>{var{xAxisId:t,className:r}=e,n=ve($j),i=jr(),o="xAxis",l=ve(_=>OD(_,o,t,i)),c=ve(_=>SD(_,t)),h=ve(_=>AQ(_,t)),f=ve(_=>K4(_,t));if(c==null||h==null||f==null)return null;var{dangerouslySetInnerHTML:p,ticks:g,scale:y}=e,x=kb(e,ene),{id:b,scale:w}=f,N=kb(f,tne);return S.createElement(Xw,Db({},x,N,{x:h.x,y:h.y,width:c.width,height:c.height,className:Xe("recharts-".concat(o," ").concat(o),r),viewBox:n,ticks:l,axisType:o,axisId:t}))},lne={allowDataOverflow:Lt.allowDataOverflow,allowDecimals:Lt.allowDecimals,allowDuplicatedCategory:Lt.allowDuplicatedCategory,angle:Lt.angle,axisLine:Ka.axisLine,height:Lt.height,hide:!1,includeHidden:Lt.includeHidden,interval:Lt.interval,label:!1,minTickGap:Lt.minTickGap,mirror:Lt.mirror,orientation:Lt.orientation,padding:Lt.padding,reversed:Lt.reversed,scale:Lt.scale,tick:Lt.tick,tickCount:Lt.tickCount,tickLine:Ka.tickLine,tickSize:Ka.tickSize,type:Lt.type,niceTicks:Lt.niceTicks,xAxisId:0},une=e=>{var t=fr(e,lne);return S.createElement(S.Fragment,null,S.createElement(sne,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),S.createElement(one,t))},Yp=S.memo(une,e5);Yp.displayName="XAxis";var cne=["type"],dne=["dangerouslySetInnerHTML","ticks","scale"],fne=["id","scale"];function Lb(){return Lb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Lb.apply(null,arguments)}function XP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function WP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?XP(Object(r),!0).forEach(function(n){hne(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):XP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hne(e,t,r){return(t=mne(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mne(e){var t=pne(e,"string");return typeof t=="symbol"?t:t+""}function pne(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $b(e,t){if(e==null)return{};var r,n,i=gne(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function gne(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function yne(e){var t=ct(),r=S.useRef(null),n=b3(),{type:i}=e,o=$b(e,cne),l=Cp(n,"yAxis",i),c=S.useMemo(()=>{if(l!=null)return WP(WP({},o),{},{type:l})},[l,o]);return S.useLayoutEffect(()=>{c!=null&&(r.current===null?t(eee(c)):r.current!==c&&t(tee({prev:r.current,next:c})),r.current=c)},[c,t]),S.useLayoutEffect(()=>()=>{r.current&&(t(ree(r.current)),r.current=null)},[t]),null}function vne(e){var{yAxisId:t,className:r,width:n,label:i}=e,o=S.useRef(null),l=S.useRef(null),c=ve($j),h=jr(),f=ct(),p="yAxis",g=ve(R=>ND(R,t)),y=ve(R=>CQ(R,t)),x=ve(R=>OD(R,p,t,h)),b=ve(R=>G4(R,t));if(S.useLayoutEffect(()=>{if(!(n!=="auto"||!g||Yw(i)||S.isValidElement(i)||b==null)){var R=o.current;if(R){var D=R.getCalculatedWidth();Math.round(g.width)!==Math.round(D)&&f(nee({id:t,width:D}))}}},[x,g,f,i,t,n,b]),g==null||y==null||b==null)return null;var{dangerouslySetInnerHTML:w,ticks:N,scale:_}=e,E=$b(e,dne),{id:T,scale:A}=b,C=$b(b,fne);return S.createElement(Xw,Lb({},E,C,{ref:o,labelRef:l,x:y.x,y:y.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:g.width,height:g.height,className:Xe("recharts-".concat(p," ").concat(p),r),viewBox:c,ticks:x,axisType:p,axisId:t}))}var xne={allowDataOverflow:$t.allowDataOverflow,allowDecimals:$t.allowDecimals,allowDuplicatedCategory:$t.allowDuplicatedCategory,angle:$t.angle,axisLine:Ka.axisLine,hide:!1,includeHidden:$t.includeHidden,interval:$t.interval,label:!1,minTickGap:$t.minTickGap,mirror:$t.mirror,orientation:$t.orientation,padding:$t.padding,reversed:$t.reversed,scale:$t.scale,tick:$t.tick,tickCount:$t.tickCount,tickLine:Ka.tickLine,tickSize:Ka.tickSize,type:$t.type,niceTicks:$t.niceTicks,width:$t.width,yAxisId:0},bne=e=>{var t=fr(e,xne);return S.createElement(S.Fragment,null,S.createElement(yne,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),S.createElement(vne,t))},Vp=S.memo(bne,e5);Vp.displayName="YAxis";var jne=(e,t)=>t,tS=Q([jne,We,o4,Xt,HD,ri,JX,Vt],sW);function wne(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function rS(e){var t=e.currentTarget.getBoundingClientRect(),r,n;if(wne(e)){var i=e.currentTarget.getBBox();r=i.width>0?t.width/i.width:1,n=i.height>0?t.height/i.height:1}else{var o=e.currentTarget;r=o.offsetWidth>0?t.width/o.offsetWidth:1,n=o.offsetHeight>0?t.height/o.offsetHeight:1}var l=(c,h)=>({relativeX:Math.round((c-t.left)/r),relativeY:Math.round((h-t.top)/n)});return"touches"in e?Array.from(e.touches).map(c=>l(c.clientX,c.clientY)):l(e.clientX,e.clientY)}var t5=on("mouseClick"),r5=xd();r5.startListening({actionCreator:t5,effect:(e,t)=>{var r=e.payload,n=tS(t.getState(),rS(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(GQ({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Ib=on("mouseMove"),n5=xd(),pl=null,_s=null,cx=null;n5.startListening({actionCreator:Ib,effect:(e,t)=>{var r=e.payload,n=t.getState(),{throttleDelay:i,throttledEvents:o}=n.eventSettings,l=o==="all"||(o==null?void 0:o.includes("mousemove"));pl!==null&&(cancelAnimationFrame(pl),pl=null),_s!==null&&(typeof i!="number"||!l)&&(clearTimeout(_s),_s=null),cx=rS(r);var c=()=>{var h=t.getState(),f=Rd(h,h.tooltip.settings.shared);if(!cx){pl=null,_s=null;return}if(f==="axis"){var p=tS(h,cx);(p==null?void 0:p.activeIndex)!=null?t.dispatch(DD({activeIndex:p.activeIndex,activeDataKey:void 0,activeCoordinate:p.activeCoordinate})):t.dispatch(MD())}pl=null,_s=null};if(!l){c();return}i==="raf"?pl=requestAnimationFrame(c):typeof i=="number"&&_s===null&&(_s=setTimeout(c,i))}});function Sne(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var ZP={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},a5=br({name:"rootProps",initialState:ZP,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:ZP.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),Nne=a5.reducer,{updateOptions:_ne}=a5.actions,One=null,Ene={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},i5=br({name:"polarOptions",initialState:One,reducers:Ene}),{updatePolarOptions:Hle}=i5.actions,Ane=i5.reducer,s5=on("keyDown"),o5=on("focus"),l5=on("blur"),Qp=xd(),gl=null,Os=null,bh=null;Qp.startListening({actionCreator:s5,effect:(e,t)=>{bh=e.payload,gl!==null&&(cancelAnimationFrame(gl),gl=null);var r=t.getState(),{throttleDelay:n,throttledEvents:i}=r.eventSettings,o=i==="all"||i.includes("keydown");Os!==null&&(typeof n!="number"||!o)&&(clearTimeout(Os),Os=null);var l=()=>{try{var c=t.getState(),h=c.rootProps.accessibilityLayer!==!1;if(!h)return;var{keyboardInteraction:f}=c.tooltip,p=bh;if(p!=="ArrowRight"&&p!=="ArrowLeft"&&p!=="Enter")return;var g=Ec(f,lo(c),Zl(c),Jl(c)),y=g==null?-1:Number(g),x=!Number.isFinite(y)||y<0,b=ri(c),w=lo(c),N=Rd(c,c.tooltip.settings.shared);if(p==="Enter"){if(x)return;var _=km(c,N,"hover",String(f.index));t.dispatch(Dm({active:!f.active,activeIndex:f.index,activeCoordinate:_}));return}var E=kQ(c),T=E==="left-to-right"?1:-1,A=p==="ArrowRight"?1:-1,C;if(x){var R=Zl(c),D=Jl(c),M=A*T,z=Z=>({active:!1,index:String(Z),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(C=-1,M>0){for(var k=0;k<w.length;k++)if(Ec(z(k),w,R,D)!=null){C=k;break}}else for(var H=w.length-1;H>=0;H--)if(Ec(z(H),w,R,D)!=null){C=H;break}if(C<0)return}else{C=y+A*T;var U=(b==null?void 0:b.length)||w.length;if(U===0||C>=U||C<0)return}var ae=km(c,N,"hover",String(C));t.dispatch(Dm({active:!0,activeIndex:C.toString(),activeCoordinate:ae}))}finally{gl=null,Os=null}};if(!o){l();return}n==="raf"?gl=requestAnimationFrame(l):typeof n=="number"&&Os===null&&(l(),bh=null,Os=setTimeout(()=>{bh?l():(Os=null,gl=null)},n))}});Qp.startListening({actionCreator:o5,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;if(!i.active&&i.index==null){var o="0",l=Rd(r,r.tooltip.settings.shared),c=km(r,l,"hover",String(o));t.dispatch(Dm({active:!0,activeIndex:o,activeCoordinate:c}))}}}});Qp.startListening({actionCreator:l5,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;i.active&&t.dispatch(Dm({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function u5(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(r,n)=>{if(n==="currentTarget")return t;var i=Reflect.get(r,n);return typeof i=="function"?i.bind(r):i}})}var jn=on("externalEvent"),c5=xd(),jh=new Map,bc=new Map,dx=new Map;c5.startListening({actionCreator:jn,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){var i=n.type,o=u5(n);dx.set(i,{handler:r,reactEvent:o});var l=jh.get(i);l!==void 0&&(cancelAnimationFrame(l),jh.delete(i));var c=t.getState(),{throttleDelay:h,throttledEvents:f}=c.eventSettings,p=f,g=p==="all"||(p==null?void 0:p.includes(i)),y=bc.get(i);y!==void 0&&(typeof h!="number"||!g)&&(clearTimeout(y),bc.delete(i));var x=()=>{var N=dx.get(i);try{if(!N)return;var{handler:_,reactEvent:E}=N,T=t.getState(),A={activeCoordinate:$X(T),activeDataKey:VD(T),activeIndex:uo(T),activeLabel:YD(T),activeTooltipIndex:uo(T),isTooltipActive:IX(T)};_&&_(A,E)}finally{jh.delete(i),bc.delete(i),dx.delete(i)}};if(!g){x();return}if(h==="raf"){var b=requestAnimationFrame(x);jh.set(i,b)}else if(typeof h=="number"){if(!bc.has(i)){x();var w=setTimeout(x,h);bc.set(i,w)}}else x()}}});var Tne=Q([cu],e=>e.tooltipItemPayloads),Cne=Q([Tne,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(o=>o.settings.graphicalItemId===r);if(n!=null){var{getPosition:i}=n;if(i!=null)return i(t)}}}),d5=on("touchMove"),f5=xd(),Es=null,Ti=null,JP=null,jc=null;f5.startListening({actionCreator:d5,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){jc=u5(r);var n=t.getState(),{throttleDelay:i,throttledEvents:o}=n.eventSettings,l=o==="all"||o.includes("touchmove");Es!==null&&(cancelAnimationFrame(Es),Es=null),Ti!==null&&(typeof i!="number"||!l)&&(clearTimeout(Ti),Ti=null),JP=Array.from(r.touches).map(h=>rS({clientX:h.clientX,clientY:h.clientY,currentTarget:r.currentTarget}));var c=()=>{if(jc!=null){var h=t.getState(),f=Rd(h,h.tooltip.settings.shared);if(f==="axis"){var p,g=(p=JP)===null||p===void 0?void 0:p[0];if(g==null){Es=null,Ti=null;return}var y=tS(h,g);(y==null?void 0:y.activeIndex)!=null&&t.dispatch(DD({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(f==="item"){var x,b=jc.touches[0];if(document.elementFromPoint==null||b==null)return;var w=document.elementFromPoint(b.clientX,b.clientY);if(!w||!w.getAttribute)return;var N=w.getAttribute(z7),_=(x=w.getAttribute(B7))!==null&&x!==void 0?x:void 0,E=bo(h).find(C=>C.id===_);if(N==null||E==null||_==null)return;var{dataKey:T}=E,A=Cne(h,N,_);t.dispatch(RD({activeDataKey:T,activeIndex:N,activeCoordinate:A,activeGraphicalItemId:_}))}Es=null,Ti=null}};if(!l){c();return}i==="raf"?Es=requestAnimationFrame(c):typeof i=="number"&&Ti===null&&(c(),jc=null,Ti=setTimeout(()=>{jc?c():(Ti=null,Es=null)},i))}}});var h5={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},m5=br({name:"eventSettings",initialState:h5,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:Pne}=m5.actions,Rne=m5.reducer,Mne=IM({brush:See,cartesianAxis:aee,chartData:LW,errorBars:wte,eventSettings:Rne,graphicalItems:LJ,layout:j7,legend:MF,options:PW,polarAxis:aJ,polarOptions:Ane,referenceElements:Eee,renderedTicks:Hee,rootProps:Nne,tooltip:YQ,zIndex:xW}),Dne=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return Gq({reducer:Mne,preloadedState:t,middleware:n=>{var i;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([r5.middleware,n5.middleware,Qp.middleware,c5.middleware,f5.middleware])},enhancers:n=>{var i=n;return typeof n=="function"&&(i=n()),i.concat(JM({type:"raf"}))},devTools:{serialize:{replacer:Sne},name:"recharts-".concat(r)}})};function kne(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=jr(),o=S.useRef(null);if(i)return r;o.current==null&&(o.current=Dne(t,n));var l=Cj;return S.createElement(QF,{context:l,store:o.current},r)}function Lne(e){var{layout:t,margin:r}=e,n=ct(),i=jr();return S.useEffect(()=>{i||(n(v7(t)),n(y7(r)))},[n,i,t,r]),null}var $ne=S.memo(Lne,ru);function Ine(e){var t=ct();return S.useEffect(()=>{t(_ne(e))},[t,e]),null}var zne=e=>{var t=ct();return S.useEffect(()=>{t(Pne(e))},[t,e]),null},Bne=S.memo(zne,ru);function e2(e){var{zIndex:t,isPanorama:r}=e,n=S.useRef(null),i=ct();return S.useLayoutEffect(()=>(n.current&&i(yW({zIndex:t,element:n.current,isPanorama:r})),()=>{i(vW({zIndex:t,isPanorama:r}))}),[i,t,r]),S.createElement("g",{tabIndex:-1,ref:n,className:"recharts-zIndex-layer_".concat(t)})}function t2(e){var{children:t,isPanorama:r}=e,n=ve(lW);if(!n||n.length===0)return t;var i=n.filter(l=>l<0),o=n.filter(l=>l>0);return S.createElement(S.Fragment,null,i.map(l=>S.createElement(e2,{key:l,zIndex:l,isPanorama:r})),t,o.map(l=>S.createElement(e2,{key:l,zIndex:l,isPanorama:r})))}var Une=["children"];function qne(e,t){if(e==null)return{};var r,n,i=Fne(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Fne(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function qm(){return qm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qm.apply(null,arguments)}var Hne={width:"100%",height:"100%",display:"block"},Kne=S.forwardRef((e,t)=>{var r=Uj(),n=qj(),i=P3();if(!ca(r)||!ca(n))return null;var{children:o,otherAttributes:l,title:c,desc:h}=e,f,p;return l!=null&&(typeof l.tabIndex=="number"?f=l.tabIndex:f=i?0:void 0,typeof l.role=="string"?p=l.role:p=i?"application":void 0),S.createElement(bj,qm({},l,{title:c,desc:h,role:p,tabIndex:f,width:r,height:n,style:Hne,ref:t}),o)}),Gne=e=>{var{children:t}=e,r=ve(jp);if(!r)return null;var{width:n,height:i,y:o,x:l}=r;return S.createElement(bj,{width:n,height:i,x:l,y:o},t)},r2=S.forwardRef((e,t)=>{var{children:r}=e,n=qne(e,Une),i=jr();return i?S.createElement(Gne,null,S.createElement(t2,{isPanorama:!0},r)):S.createElement(Kne,qm({ref:t},n),S.createElement(t2,{isPanorama:!1},r))});function Yne(){var e=ct(),[t,r]=S.useState(null),n=ve(I7);return S.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),o=i.width/t.offsetWidth;Be(o)&&o!==n&&e(b7(o))}},[t,e,n]),r}function n2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Vne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?n2(Object(r),!0).forEach(function(n){Qne(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qne(e,t,r){return(t=Xne(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xne(e){var t=Wne(e,"string");return typeof t=="symbol"?t:t+""}function Wne(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Wi(){return Wi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wi.apply(null,arguments)}var Zne=()=>(KW(),null);function Fm(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Jne=S.forwardRef((e,t)=>{var r,n,i=S.useRef(null),[o,l]=S.useState({containerWidth:Fm((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:Fm((n=e.style)===null||n===void 0?void 0:n.height)}),c=S.useCallback((f,p)=>{l(g=>{var y=Math.round(f),x=Math.round(p);return g.containerWidth===y&&g.containerHeight===x?g:{containerWidth:y,containerHeight:x}})},[]),h=S.useCallback(f=>{if(typeof t=="function"&&t(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var{width:p,height:g}=f.getBoundingClientRect();c(p,g);var y=b=>{var w=b[0];if(w!=null){var{width:N,height:_}=w.contentRect;c(N,_)}},x=new ResizeObserver(y);x.observe(f),i.current=x}},[t,c]);return S.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),S.createElement(S.Fragment,null,S.createElement(jd,{width:o.containerWidth,height:o.containerHeight}),S.createElement("div",Wi({ref:h},e)))}),eae=S.forwardRef((e,t)=>{var{width:r,height:n}=e,[i,o]=S.useState({containerWidth:Fm(r),containerHeight:Fm(n)}),l=S.useCallback((h,f)=>{o(p=>{var g=Math.round(h),y=Math.round(f);return p.containerWidth===g&&p.containerHeight===y?p:{containerWidth:g,containerHeight:y}})},[]),c=S.useCallback(h=>{if(typeof t=="function"&&t(h),h!=null){var{width:f,height:p}=h.getBoundingClientRect();l(f,p)}},[t,l]);return S.createElement(S.Fragment,null,S.createElement(jd,{width:i.containerWidth,height:i.containerHeight}),S.createElement("div",Wi({ref:c},e)))}),tae=S.forwardRef((e,t)=>{var{width:r,height:n}=e;return S.createElement(S.Fragment,null,S.createElement(jd,{width:r,height:n}),S.createElement("div",Wi({ref:t},e)))}),rae=S.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?S.createElement(eae,Wi({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?S.createElement(tae,Wi({},e,{width:r,height:n,ref:t})):S.createElement(S.Fragment,null,S.createElement(jd,{width:r,height:n}),S.createElement("div",Wi({ref:t},e)))});function nae(e){return e?Jne:rae}var aae=S.forwardRef((e,t)=>{var{children:r,className:n,height:i,onClick:o,onContextMenu:l,onDoubleClick:c,onMouseDown:h,onMouseEnter:f,onMouseLeave:p,onMouseMove:g,onMouseUp:y,onTouchEnd:x,onTouchMove:b,onTouchStart:w,style:N,width:_,responsive:E,dispatchTouchEvents:T=!0}=e,A=S.useRef(null),C=ct(),[R,D]=S.useState(null),[M,z]=S.useState(null),k=Yne(),H=Ij(),U=(H==null?void 0:H.width)>0?H.width:_,ae=(H==null?void 0:H.height)>0?H.height:i,Z=S.useCallback(te=>{k(te),typeof t=="function"&&t(te),D(te),z(te),te!=null&&(A.current=te)},[k,t,D,z]),G=S.useCallback(te=>{C(t5(te)),C(jn({handler:o,reactEvent:te}))},[C,o]),L=S.useCallback(te=>{C(Ib(te)),C(jn({handler:f,reactEvent:te}))},[C,f]),F=S.useCallback(te=>{C(MD()),C(jn({handler:p,reactEvent:te}))},[C,p]),J=S.useCallback(te=>{C(Ib(te)),C(jn({handler:g,reactEvent:te}))},[C,g]),re=S.useCallback(()=>{C(o5())},[C]),oe=S.useCallback(()=>{C(l5())},[C]),$=S.useCallback(te=>{C(s5(te.key))},[C]),X=S.useCallback(te=>{C(jn({handler:l,reactEvent:te}))},[C,l]),le=S.useCallback(te=>{C(jn({handler:c,reactEvent:te}))},[C,c]),ue=S.useCallback(te=>{C(jn({handler:h,reactEvent:te}))},[C,h]),pe=S.useCallback(te=>{C(jn({handler:y,reactEvent:te}))},[C,y]),xe=S.useCallback(te=>{C(jn({handler:w,reactEvent:te}))},[C,w]),we=S.useCallback(te=>{T&&C(d5(te)),C(jn({handler:b,reactEvent:te}))},[C,T,b]),_e=S.useCallback(te=>{C(jn({handler:x,reactEvent:te}))},[C,x]),de=nae(E);return S.createElement(tk.Provider,{value:R},S.createElement(JR.Provider,{value:M},S.createElement(de,{width:U??(N==null?void 0:N.width),height:ae??(N==null?void 0:N.height),className:Xe("recharts-wrapper",n),style:Vne({position:"relative",cursor:"default",width:U,height:ae},N),onClick:G,onContextMenu:X,onDoubleClick:le,onFocus:re,onBlur:oe,onKeyDown:$,onMouseDown:ue,onMouseEnter:L,onMouseLeave:F,onMouseMove:J,onMouseUp:pe,onTouchEnd:_e,onTouchMove:we,onTouchStart:xe,ref:Z},S.createElement(Zne,null),r)))}),iae=["width","height","responsive","children","className","style","compact","title","desc"];function sae(e,t){if(e==null)return{};var r,n,i=oae(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function oae(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var lae=S.forwardRef((e,t)=>{var{width:r,height:n,responsive:i,children:o,className:l,style:c,compact:h,title:f,desc:p}=e,g=sae(e,iae),y=zn(g);return h?S.createElement(S.Fragment,null,S.createElement(jd,{width:r,height:n}),S.createElement(r2,{otherAttributes:y,title:f,desc:p},o)):S.createElement(aae,{className:l,style:c,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},S.createElement(r2,{otherAttributes:y,title:f,desc:p,ref:t},S.createElement(Tee,null,o)))});function zb(){return zb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},zb.apply(null,arguments)}function a2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function uae(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?a2(Object(r),!0).forEach(function(n){cae(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cae(e,t,r){return(t=dae(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dae(e){var t=fae(e,"string");return typeof t=="symbol"?t:t+""}function fae(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hae={top:5,right:5,bottom:5,left:5},mae=uae({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:hae,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},h5),p5=S.forwardRef(function(t,r){var n,i=fr(t.categoricalChartProps,mae),{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:c,tooltipPayloadSearcher:h,categoricalChartProps:f}=t,p={chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:c,tooltipPayloadSearcher:h,eventEmitter:void 0};return S.createElement(kne,{preloadedState:{options:p},reduxStoreName:(n=f.id)!==null&&n!==void 0?n:o},S.createElement(wee,{chartData:f.data}),S.createElement($ne,{layout:i.layout,margin:i.margin}),S.createElement(Bne,{throttleDelay:i.throttleDelay,throttledEvents:i.throttledEvents}),S.createElement(Ine,{baseValue:i.baseValue,accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className,reverseStackOrder:i.reverseStackOrder}),S.createElement(lae,zb({},i,{ref:r})))}),pae=["axis"],gae=S.forwardRef((e,t)=>S.createElement(p5,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:pae,tooltipPayloadSearcher:rk,categoricalChartProps:e,ref:t})),yae=["axis","item"],g5=S.forwardRef((e,t)=>S.createElement(p5,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:yae,tooltipPayloadSearcher:rk,categoricalChartProps:e,ref:t}));const y5="Uncategorized";function v5(e){const t=e==null?void 0:e.replace(/\\/g,"/").split("/").map(r=>r.trim()).filter(r=>r.length>0).join("/");return t&&t.length>0?t:y5}function vae(e,t){const r=new Map,n=o=>{const l=r.get(o);if(l)return l;const c={results:[],suites:new Set,children:new Set};return r.set(o,c),c};for(const o of e){const l=v5(o.category),c=o.suite??"Uncategorized",h=xae(l);for(const f of h){const p=n(f);p.results.push(o),p.suites.add(c)}for(let f=1;f<h.length;f++)n(h[f-1]).children.add(h[f])}const i=new Map([...r.entries()].map(([o,l])=>[o,wae(o,l,t)]));return[...i.values()].filter(o=>!o.parent).sort(b5).map(o=>x5(o,r,i))}function xae(e){const t=e.split("/").filter(r=>r.length>0);return t.length===0?[y5]:t.map((r,n)=>t.slice(0,n+1).join("/"))}function bae(e){const t=e.split("/");return t.length>1?t.slice(0,-1).join("/"):void 0}function jae(e){return e.split("/").at(-1)??e}function wae(e,t,r){const n=rp(t.results,r),i=bae(e);return{name:e,label:jae(e),...i&&{parent:i},depth:e.split("/").filter(Boolean).length-1,total:n.total,passed:n.passed,failed:n.failed,executionErrors:n.executionErrors,avgScore:n.avgScore,suiteCount:t.suites.size,childCount:t.children.size,children:[]}}function x5(e,t,r){var i;const n=[...((i=t.get(e.name))==null?void 0:i.children)??[]].map(o=>r.get(o)).filter(o=>!!o).sort(b5).map(o=>x5(o,t,r));return{...e,children:n}}function b5(e,t){return e.name.localeCompare(t.name)}const Di="",Bb=[{value:"all",label:"All time"},{value:"24h",label:"Last 24h",windowMs:1440*60*1e3},{value:"7d",label:"Last 7d",windowMs:10080*60*1e3},{value:"30d",label:"Last 30d",windowMs:720*60*60*1e3}],fx=10;function Sae(e,t,r=new Date){const n=Nae(e),i=Oae(e,n),o=Eae(n.flatMap(g=>g.category?Cae(g.category):[])),l=o.length>0,c=n.some(g=>g.startedAtMs!==void 0),h=Bb.find(g=>g.value===t.timePeriod)??Bb[0],f=h.windowMs===void 0?void 0:r.getTime()-h.windowMs,p=n.filter(g=>t.experiment&&g.experiment!==t.experiment||t.category&&!Pae(g.category,t.category)?!1:f!==void 0?g.startedAtMs!==void 0&&g.startedAtMs>=f:!0);return{buckets:Aae(p.map(g=>g.score)),experimentOptions:i,categoryOptions:o,totalScores:n.length,filteredScores:p.length,categoryAvailable:l,hasTimestampedScores:c}}function Nae(e){return e.runs&&e.runs.length>0?e.runs.flatMap(t=>_ae(t)):e.cells.flatMap(t=>t.tests.flatMap(r=>{const n=j5(r,t.experiment);return n?[n]:[]}))}function _ae(e){const t=Rae(e.started_at);return e.tests.flatMap(r=>{const n=j5(r,e.experiment);return n?[{...n,startedAtMs:t}]:[]})}function j5(e,t){if(!Number.isFinite(e.score))return;const r=Tae(e.category);return{score:e.score,experiment:t,...r&&{category:r}}}function Oae(e,t){const r=new Map,n=new Set(e.experiments);for(const i of e.cells)n.add(i.experiment);for(const i of t)n.add(i.experiment),r.set(i.experiment,(r.get(i.experiment)??0)+1);return[...n].sort((i,o)=>i.localeCompare(o)).map(i=>({value:i,label:i,count:r.get(i)??0}))}function Eae(e){const t=new Map;for(const r of e)t.set(r,(t.get(r)??0)+1);return[...t.entries()].sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>({value:r,label:r,count:n}))}function Aae(e){if(e.length===0)return[];const t=Array.from({length:fx},(r,n)=>({range:`${n*10}-${(n+1)*10}%`,count:0}));for(const r of e){const n=Math.max(0,Math.min(r,1)),i=Math.min(Math.floor(n*fx),fx-1);t[i].count++}return t}function Tae(e){const t=e==null?void 0:e.trim();return t?v5(t):void 0}function Cae(e){const t=e.split("/").filter(r=>r.length>0);return t.map((r,n)=>t.slice(0,n+1).join("/"))}function Pae(e,t){return e!==void 0&&(e===t||e.startsWith(`${t}/`))}function Rae(e){const t=Date.parse(e);return Number.isFinite(t)?t:void 0}const _t={green:"#34d399",red:"#f87171",gray:"#4b5563",cyan:"#22d3ee",gridLine:"#1f2937",labelText:"#9ca3af"},i2=["#22d3ee","#34d399","#facc15","#f87171","#a78bfa","#fb923c","#f472b6","#60a5fa"];function Mae(e){return i2[e%i2.length]}function Dae({data:e,projectId:t}){const[r,n]=S.useState(!0),[i,o]=S.useState(""),l=e.targets,c=Ue(t?MR(t,i||void 0):a6(i||void 0)),h=i?c.data:void 0,f=S.useMemo(()=>Bae(e.runs??[]),[e.runs]);return d.jsxs("div",{className:"rounded-lg border border-gray-800",children:[d.jsxs("button",{type:"button",onClick:()=>n(p=>!p),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-gray-900/30",children:[d.jsx("span",{className:"text-sm font-medium text-gray-300",children:"Analytics"}),d.jsx("span",{className:"text-xs text-gray-500",children:r?"▸ Show":"▾ Hide"})]}),!r&&d.jsxs("div",{className:"space-y-6 border-t border-gray-800 px-4 py-4",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("label",{htmlFor:"baseline-select",className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Baseline target"}),d.jsxs("select",{id:"baseline-select",value:i,onChange:p=>o(p.target.value),className:"rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-100 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:[d.jsx("option",{value:"",children:"Select a baseline…"}),l.map(p=>d.jsx("option",{value:p,children:p},p))]}),i&&c.isLoading&&d.jsx("span",{className:"text-xs text-gray-500",children:"Loading…"})]}),i&&h&&d.jsx(kae,{data:h,baseline:i}),i&&h&&d.jsx(Lae,{data:h,baseline:i}),d.jsx($ae,{data:e}),f.length>1&&l.length>0&&d.jsx(Uae,{data:f,targets:l}),!i&&d.jsx("p",{className:"text-xs text-gray-500",children:"Select a baseline target above to see gain and delta charts."})]})]})}function nS({active:e,payload:t,label:r}){return!e||!(t!=null&&t.length)?null:d.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-900 px-3 py-2 text-xs shadow-xl",children:[r&&d.jsx("div",{className:"mb-1 font-medium text-gray-300",children:r}),t.map((n,i)=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:n.color}}),d.jsxs("span",{className:"text-gray-400",children:[n.name,":"]}),d.jsx("span",{className:"tabular-nums text-gray-200",children:typeof n.value=="number"?n.value.toFixed(3):n.value})]},`${n.name}-${i}`))]})}function nd({title:e,children:t}){return d.jsxs("div",{className:"space-y-3",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-400",children:e}),t]})}function kae({data:e,baseline:t}){const r=S.useMemo(()=>{const i=[];for(const o of e.cells)o.target!==t&&o.delta!==void 0&&i.push({experiment:o.experiment,target:o.target,g:o.normalized_gain??null,delta:o.delta});return i.sort((o,l)=>Math.abs(l.g??0)-Math.abs(o.g??0)),i},[e.cells,t]);if(r.length===0)return d.jsx(nd,{title:"Normalized Gain (g)",children:d.jsx("p",{className:"text-xs text-gray-500",children:"No gain data available. Ensure multiple targets exist."})});const n=r.map(i=>({name:`${i.target} · ${i.experiment}`,g:i.g??0,isNull:i.g===null}));return d.jsx(nd,{title:"Normalized Gain (g)",children:d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:d.jsx(zj,{width:"100%",height:Math.max(200,n.length*32),children:d.jsxs(g5,{data:n,layout:"vertical",margin:{left:120,right:20,top:5,bottom:5},children:[d.jsx(Gp,{strokeDasharray:"3 3",stroke:_t.gridLine,horizontal:!1}),d.jsx(Yp,{type:"number",tick:{fill:_t.labelText,fontSize:11},axisLine:{stroke:_t.gridLine}}),d.jsx(Vp,{type:"category",dataKey:"name",tick:{fill:_t.labelText,fontSize:11},width:120,axisLine:{stroke:_t.gridLine}}),d.jsx(Hw,{content:d.jsx(nS,{})}),d.jsx(eS,{dataKey:"g",name:"Normalized Gain",children:n.map(i=>d.jsx(Kw,{fill:i.isNull?_t.gray:i.g>0?_t.green:i.g<0?_t.red:_t.gray},i.name))})]})})})})}function Lae({data:e,baseline:t}){const r=S.useMemo(()=>e.cells.filter(n=>n.target!==t&&n.delta!==void 0&&n.delta<0).sort((n,i)=>(n.delta??0)-(i.delta??0)),[e.cells,t]);return r.length===0?null:d.jsx(nd,{title:"Regressions vs. Baseline",children:d.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Avg Score"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Delta"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"g"})]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:r.map(n=>{var i;return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:n.experiment}),d.jsx("td",{className:"px-4 py-3 text-gray-300",children:n.target}),d.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[Math.round(n.avg_score*100),"%"]}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:(i=n.delta)==null?void 0:i.toFixed(3)}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:n.normalized_gain!==void 0&&n.normalized_gain!==null?n.normalized_gain.toFixed(3):"—"})]},`${n.experiment}::${n.target}`)})})]})})})}const s2={experiment:Di,category:Di,timePeriod:"all"};function $ae({data:e}){const[t,r]=S.useState(s2),n=S.useMemo(()=>Sae(e,t),[e,t]);S.useEffect(()=>{r(f=>{const p=!f.experiment||n.experimentOptions.some(x=>x.value===f.experiment),g=!f.category||n.categoryOptions.some(x=>x.value===f.category),y=f.timePeriod==="all"||n.hasTimestampedScores;return p&&g&&y?f:{experiment:p?f.experiment:Di,category:g?f.category:Di,timePeriod:y?f.timePeriod:"all"}})},[n.experimentOptions,n.categoryOptions,n.hasTimestampedScores]);const i=(f,p)=>{r(g=>({...g,[f]:p}))},o=()=>r(s2),l=t.experiment!==Di||t.category!==Di||t.timePeriod!=="all",c=n.totalScores>0,h=zae(n,t);return d.jsx(nd,{title:"Score Distribution",children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 px-3 py-3",children:[d.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[d.jsxs(hx,{id:"score-distribution-experiment",label:"Experiment",value:t.experiment,onChange:f=>i("experiment",f),disabled:n.experimentOptions.length===0,children:[d.jsx("option",{value:Di,children:"All experiments"}),n.experimentOptions.map(f=>d.jsxs("option",{value:f.value,children:[f.label," (",f.count,")"]},f.value))]}),d.jsxs(hx,{id:"score-distribution-category",label:"Category",value:t.category,onChange:f=>i("category",f),disabled:!n.categoryAvailable,help:n.categoryAvailable||!c?void 0:"Category metadata is not present in these compare results.",children:[d.jsx("option",{value:Di,children:"All categories"}),n.categoryOptions.map(f=>d.jsxs("option",{value:f.value,children:[f.label," (",f.count,")"]},f.value))]}),d.jsx(hx,{id:"score-distribution-time",label:"Time period",value:t.timePeriod,onChange:f=>i("timePeriod",f),disabled:!n.hasTimestampedScores,help:n.hasTimestampedScores||!c?void 0:"Recent windows need run timestamps from compare data.",children:Bb.map(f=>d.jsx("option",{value:f.value,children:f.label},f.value))})]}),d.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 border-t border-gray-800/70 pt-3 text-xs",children:[d.jsxs("span",{className:"tabular-nums text-gray-400",children:["Showing ",d.jsx("span",{className:"text-gray-200",children:n.filteredScores})," of"," ",d.jsx("span",{className:"text-gray-200",children:n.totalScores})," scores"]}),l&&d.jsx("button",{type:"button",onClick:o,className:"text-gray-500 underline-offset-2 transition-colors hover:text-gray-300 hover:underline",children:"Clear filters"})]})]}),n.buckets.length>0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:d.jsx(zj,{width:"100%",height:200,children:d.jsxs(g5,{data:n.buckets,margin:{left:10,right:10,top:5,bottom:5},children:[d.jsx(Gp,{strokeDasharray:"3 3",stroke:_t.gridLine,vertical:!1}),d.jsx(Yp,{dataKey:"range",tick:{fill:_t.labelText,fontSize:11},axisLine:{stroke:_t.gridLine}}),d.jsx(Vp,{tick:{fill:_t.labelText,fontSize:11},axisLine:{stroke:_t.gridLine}}),d.jsx(Hw,{content:d.jsx(nS,{})}),d.jsx(eS,{dataKey:"count",name:"Tests",fill:_t.cyan,radius:[2,2,0,0]})]})})}):d.jsx(Iae,{message:h})]})})}function hx({id:e,label:t,value:r,onChange:n,disabled:i,help:o,children:l}){return d.jsxs("div",{className:"min-w-0 space-y-1",children:[d.jsx("label",{htmlFor:e,className:"block text-xs font-medium uppercase tracking-wider text-gray-500",children:t}),d.jsx("select",{id:e,value:r,disabled:i,onChange:c=>n(c.target.value),className:"w-full rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-100 transition-colors focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500 disabled:cursor-not-allowed disabled:border-gray-800 disabled:text-gray-600",children:l}),o&&d.jsx("p",{className:"text-xs leading-5 text-gray-500",children:o})]})}function Iae({message:e}){return d.jsx("div",{className:"rounded-lg border border-dashed border-gray-800 bg-gray-900/20 px-4 py-8 text-center",children:d.jsx("p",{className:"text-sm text-gray-400",children:e})})}function zae(e,t){return e.totalScores===0?"No test scores are available in this comparison yet.":t.category&&!e.categoryAvailable?"Category metadata is not available in these compare results.":"No scores match the selected distribution filters."}function Bae(e){if(e.length===0)return[];const t=new Map;for(const n of e){const i=n.started_at.slice(0,10);let o=t.get(i);o||(o=new Map,t.set(i,o));let l=o.get(n.target);l||(l={scoreSum:0,count:0},o.set(n.target,l)),l.scoreSum+=n.avg_score,l.count++}return[...t.keys()].sort().map(n=>{const i={date:n},o=t.get(n);if(!o)return i;for(const[l,c]of o)i[l]=Math.round(c.scoreSum/c.count*1e3)/1e3;return i})}function Uae({data:e,targets:t}){return d.jsx(nd,{title:"Score Trend Over Time",children:d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:d.jsx(zj,{width:"100%",height:250,children:d.jsxs(gae,{data:e,margin:{left:10,right:20,top:5,bottom:5},children:[d.jsx(Gp,{strokeDasharray:"3 3",stroke:_t.gridLine}),d.jsx(Yp,{dataKey:"date",tick:{fill:_t.labelText,fontSize:11},axisLine:{stroke:_t.gridLine}}),d.jsx(Vp,{domain:[0,1],tick:{fill:_t.labelText,fontSize:11},axisLine:{stroke:_t.gridLine}}),d.jsx(Hw,{content:d.jsx(nS,{})}),d.jsx(T3,{wrapperStyle:{fontSize:12,color:_t.labelText}}),t.map((r,n)=>d.jsx(Qk,{type:"monotone",dataKey:r,stroke:Mae(n),strokeWidth:2,dot:{r:3},connectNulls:!0},r))]})})})})}function an({rate:e}){const t=Math.round(e*100);return d.jsxs("div",{className:"relative h-5 w-20 overflow-hidden rounded-full bg-gray-800",children:[d.jsx("div",{className:"absolute inset-y-0 left-0 bg-gradient-to-r from-blue-400 to-blue-600",style:{width:`${t}%`}}),d.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-semibold tabular-nums text-white",children:[t,"%"]})]})}function w5({data:e,isLoading:t,isError:r,error:n,projectId:i}){var f;const[o,l]=S.useState("aggregated"),c=((f=e==null?void 0:e.runs)==null?void 0:f.length)??0,h=e&&e.cells.length>0;return d.jsxs("div",{className:"space-y-4",children:[d.jsx(qae,{mode:o,onModeChange:l,runsCount:c}),t&&d.jsx(rie,{}),!t&&r&&n&&d.jsx(eie,{message:`Failed to load comparison data: ${n.message}`}),!t&&!r&&!h&&d.jsx(tie,{}),!t&&!r&&h&&e&&d.jsxs(d.Fragment,{children:[o==="aggregated"&&d.jsx(Hae,{data:e,projectId:i}),o==="per-run"&&d.jsx(Qae,{data:e})]})]})}function qae({mode:e,onModeChange:t,runsCount:r}){return d.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold text-white",children:"Analyze runs"}),d.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Study one experiment against another, or pit individual runs head-to-head."})]}),d.jsx(Fae,{mode:e,onChange:t,runsCount:r})]})}function Fae({mode:e,onChange:t,runsCount:r}){const n=r===0;return d.jsxs("div",{role:"tablist","aria-label":"Comparison view mode",className:"inline-flex items-center rounded-lg border border-gray-800 bg-gray-900/50 p-1",children:[d.jsx(o2,{active:e==="aggregated",onClick:()=>t("aggregated"),children:"Aggregated"}),d.jsxs(o2,{active:e==="per-run",onClick:()=>t("per-run"),disabled:n,title:n?"No runs available":void 0,children:["Per run",r>0&&d.jsx("span",{className:"ml-1.5 rounded bg-gray-800 px-1.5 py-0.5 text-xs tabular-nums text-gray-400",children:r})]})]})}function o2({active:e,onClick:t,disabled:r,title:n,children:i}){return d.jsx("button",{type:"button",role:"tab","aria-selected":e,onClick:t,disabled:r,title:n,className:`rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${e?"bg-gray-800 text-cyan-400 shadow-sm":"text-gray-400 hover:text-gray-200 disabled:text-gray-600 disabled:hover:text-gray-600"}`,children:i})}function Hae({data:e,projectId:t}){const{experiments:r,targets:n,cells:i}=e,o=S.useMemo(()=>{const l=new Map;for(const c of i)l.set(`${c.experiment}::${c.target}`,c);return l},[i]);return r.length<=1&&n.length<=1?d.jsx(aS,{headline:"Not enough variation to compare",body:`The aggregated matrix requires at least 2 experiments or 2 targets. Currently ${r.length} experiment(s) and ${n.length} target(s).`}):d.jsxs("div",{className:"space-y-3",children:[d.jsx(Jae,{}),d.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:d.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Target ↓ / Experiment →"})}),r.map(l=>d.jsx("th",{className:"px-4 py-3 font-medium text-gray-300",children:l},l))]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(l=>d.jsx(Kae,{target:l,experiments:r,cellMap:o},l))})]})}),d.jsx(Dae,{data:e,projectId:t})]})}function Kae({target:e,experiments:t,cellMap:r}){return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:e}),t.map(n=>{const i=r.get(`${n}::${e}`);return d.jsx("td",{className:"px-4 py-3",children:i?d.jsx(Gae,{cell:i}):d.jsx(Yae,{})},n)})]})}function Gae({cell:e}){const[t,r]=S.useState(!1),n=Math.round(e.avg_score*100),i=Bc(e),o=ur(e);return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("button",{type:"button",className:"group flex w-full flex-col gap-1 rounded-md border border-gray-800 bg-gray-900/40 px-3 py-2 text-left transition-colors hover:border-gray-700 hover:bg-gray-900/70",onClick:()=>r(l=>!l),"aria-expanded":t,children:[d.jsx(an,{rate:e.pass_rate}),d.jsxs("div",{className:"flex items-center gap-2 text-xs tabular-nums text-gray-500",children:[d.jsxs("span",{children:[d.jsx("span",{className:"text-emerald-400",children:e.passed_count}),d.jsx("span",{className:"text-gray-600",children:" / "}),d.jsx("span",{children:i})]}),d.jsx("span",{className:"text-gray-700",children:"·"}),d.jsxs("span",{children:["avg ",n,"%"]}),o>0&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-gray-700",children:"·"}),d.jsxs("span",{className:"text-amber-400",children:[o," errors"]})]})]})]}),t&&d.jsx(Vae,{tests:e.tests})]})}function Yae(){return d.jsx("div",{className:"text-center text-gray-600",children:"—"})}function Vae({tests:e}){return d.jsxs("div",{className:"rounded-md border border-gray-800 bg-gray-950/60 px-3 py-2",children:[d.jsx("div",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Test cases"}),d.jsx("ul",{className:"space-y-1",children:e.map(t=>{const r=t.execution_status==="execution_error";return d.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[d.jsx("span",{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full ${r?"bg-amber-400":t.passed?"bg-emerald-400":"bg-red-400"}`}),d.jsx("span",{className:"flex-1 truncate text-gray-300",title:t.test_id,children:t.test_id}),d.jsx("span",{className:`tabular-nums ${r?"text-amber-400":t.passed?"text-emerald-400":"text-red-400"}`,children:r?"error":`${Math.round(t.score*100)}%`})]},t.test_id)})})]})}function Qae({data:e}){const t=e.runs??[],[r,n]=S.useState(new Set),[i,o]=S.useState(!1),l=f=>{n(p=>{const g=new Set(p);return g.has(f)?g.delete(f):g.add(f),g})},c=()=>n(new Set),h=S.useMemo(()=>t.filter(f=>r.has(f.run_id)),[t,r]);return t.length===0?d.jsx(aS,{headline:"No runs yet",body:"Run an evaluation to populate the per-run view."}):i&&h.length>=2?d.jsx(Wae,{runs:h,onBack:()=>o(!1)}):d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"flex items-center justify-between text-sm text-gray-400",children:d.jsxs("span",{children:[d.jsx("span",{className:"font-medium text-gray-300",children:t.length})," run",t.length===1?"":"s"," — select two or more to compare side-by-side"]})}),d.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"w-10 px-3 py-3","aria-label":"Select"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Timestamp"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Tests"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Avg"})]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:t.map(f=>d.jsx(Xae,{run:f,checked:r.has(f.run_id),onToggle:()=>l(f.run_id)},f.run_id))})]})}),r.size>0&&d.jsxs("div",{role:"toolbar","aria-label":"Selection actions",className:"sticky bottom-4 z-10 flex items-center justify-between gap-3 rounded-lg border border-cyan-900/50 bg-gray-900/95 px-4 py-3 shadow-xl backdrop-blur",children:[d.jsxs("div",{className:"text-sm text-gray-300",children:[d.jsx("span",{className:"font-semibold tabular-nums text-cyan-400",children:r.size})," ","selected"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{type:"button",onClick:c,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200",children:"Clear"}),d.jsxs("button",{type:"button",disabled:r.size<2,onClick:()=>o(!0),className:"inline-flex items-center gap-1.5 rounded-md bg-cyan-500 px-3 py-1.5 text-sm font-medium text-gray-950 transition-colors hover:bg-cyan-400 disabled:cursor-not-allowed disabled:bg-gray-700 disabled:text-gray-500",children:["Compare ",r.size,d.jsx("span",{"aria-hidden":!0,children:"→"})]})]})]})]})}function Xae({run:e,checked:t,onToggle:r}){const n=Math.round(e.avg_score*100),i=Bc(e),o=ur(e),l=nie(e.run_id);return d.jsxs("tr",{className:`transition-colors ${t?"bg-cyan-950/20 hover:bg-cyan-950/30":"hover:bg-gray-900/30"}`,children:[d.jsx("td",{className:"px-3 py-3 align-middle",children:d.jsx("input",{type:"checkbox",className:"h-4 w-4 cursor-pointer rounded border-gray-700 bg-gray-900 text-cyan-500 accent-cyan-500 focus:ring-cyan-500",checked:t,onChange:r,"aria-label":`Select run ${e.run_id}`})}),d.jsxs("td",{className:"px-4 py-3 align-middle",title:e.run_id,children:[d.jsx("div",{className:"font-medium text-gray-200 tabular-nums",children:S5(e.started_at)}),l&&d.jsx("div",{className:"text-xs text-gray-500",children:l})]}),d.jsx("td",{className:"px-4 py-3 align-middle text-gray-300",children:e.experiment}),d.jsx("td",{className:"px-4 py-3 align-middle text-gray-300",children:e.target}),d.jsxs("td",{className:"px-4 py-3 align-middle text-right tabular-nums text-gray-400",children:[d.jsx("div",{children:i}),o>0&&d.jsxs("div",{className:"text-xs text-amber-400",children:[o," errors"]})]}),d.jsx("td",{className:"px-4 py-3 align-middle",children:d.jsx(an,{rate:e.pass_rate})}),d.jsxs("td",{className:"px-4 py-3 align-middle text-right tabular-nums text-gray-400",children:[n,"%"]})]})}function Wae({runs:e,onBack:t}){const r=S.useMemo(()=>{const i=new Set,o=[];for(const l of e)for(const c of l.tests)i.has(c.test_id)||(i.add(c.test_id),o.push(c.test_id));return o},[e]),n=S.useMemo(()=>e.map(i=>{const o=new Map;for(const l of i.tests)o.set(l.test_id,l);return o}),[e]);return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1 text-sm text-cyan-400 transition-colors hover:text-cyan-300",children:[d.jsx("span",{"aria-hidden":!0,children:"←"})," Back to runs"]}),d.jsxs("span",{className:"text-sm text-gray-500",children:[e.length," runs · ",r.length," tests"]})]}),d.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"w-full text-left text-sm",children:[d.jsxs("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:[d.jsxs("tr",{children:[d.jsx("th",{className:"sticky left-0 z-10 bg-gray-900/80 px-4 py-3 font-medium text-gray-400 backdrop-blur",children:"Test case"}),e.map(i=>d.jsx("th",{className:"px-4 py-3 align-bottom",children:d.jsx(Zae,{run:i})},i.run_id))]}),d.jsxs("tr",{className:"border-t border-gray-800/50 bg-gray-900/30",children:[d.jsx("th",{className:"sticky left-0 z-10 bg-gray-900/80 px-4 py-2 text-xs font-medium uppercase tracking-wider text-gray-500 backdrop-blur",children:"Pass rate"}),e.map(i=>d.jsx("th",{className:"px-4 py-2",children:d.jsx(an,{rate:i.pass_rate})},i.run_id))]})]}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:r.map(i=>d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"sticky left-0 z-10 bg-gray-950/70 px-4 py-3 font-medium text-gray-200 backdrop-blur",children:i}),n.map((o,l)=>{const c=o.get(i),h=e[l].run_id;return c?d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"flex items-center gap-2",children:c.execution_status==="execution_error"?d.jsxs(d.Fragment,{children:[d.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-amber-400"}),d.jsx("span",{className:"tabular-nums text-amber-400",children:"error"})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full ${c.passed?"bg-emerald-400":"bg-red-400"}`}),d.jsxs("span",{className:`tabular-nums ${c.passed?"text-emerald-400":"text-red-400"}`,children:[Math.round(c.score*100),"%"]})]})})},h):d.jsx("td",{className:"px-4 py-3 text-center text-gray-600",children:"—"},h)})]},i))})]})})]})}function Zae({run:e}){return d.jsxs("div",{className:"min-w-[140px] space-y-1",children:[d.jsx("div",{className:"text-sm font-medium text-gray-200 tabular-nums",title:e.run_id,children:S5(e.started_at)}),d.jsxs("div",{className:"text-xs text-gray-500",children:[e.experiment," · ",e.target]})]})}function Jae(){return d.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500",role:"note",children:[d.jsx(wh,{className:"bg-emerald-400",label:"80%+"}),d.jsx(wh,{className:"bg-yellow-400",label:"50–80%"}),d.jsx(wh,{className:"bg-red-400",label:"< 50%"}),d.jsx(wh,{className:"bg-gray-700",label:"no data"})]})}function wh({className:e,label:t}){return d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.jsx("span",{className:`h-2 w-2 rounded-full ${e}`,"aria-hidden":!0}),d.jsx("span",{children:t})]})}function eie({message:e}){return d.jsx("div",{className:"rounded-lg border border-red-900/60 bg-red-950/30 p-4 text-sm text-red-400",children:e})}function tie(){return d.jsx(aS,{headline:"No comparison data yet",body:"Run evaluations with different experiment and target combinations to populate this view."})}function aS({headline:e,body:t}){return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-300",children:e}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:t})]})}function rie(){return d.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:d.jsxs("div",{className:"animate-pulse",children:[d.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>d.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[d.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},e))]})})}function S5(e){try{const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),l=String(t.getMinutes()).padStart(2,"0");return`${r}-${n}-${i} ${o}:${l}`}catch{return e}}function nie(e){const t=e.split("::");return t.length<2?null:t.slice(0,-1).join(" · ")}function aie(e){if(!e)return"No runs";const t=new Date(e);if(Number.isNaN(t.getTime()))return"N/A";const r=Date.now()-t.getTime(),n=Math.floor(r/6e4);if(n<1)return"Just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function iie({project:e,canRemove:t=!1,onRemove:r}){const n=Math.round(e.pass_rate*100),i=ur(e),[o,l]=S.useState(!1),[c,h]=S.useState(!1),[f,p]=S.useState(!1),[g,y]=S.useState(null),x=S.useId(),b=S.useId(),w=S.useRef(null),N=S.useRef(null),_=S.useRef(null);S.useEffect(()=>{if(!o)return;function C(D){var z,k;const M=D.target;(z=w.current)!=null&&z.contains(M)||(k=N.current)!=null&&k.contains(M)||l(!1)}function R(D){var M;D.key==="Escape"&&(l(!1),(M=w.current)==null||M.focus())}return document.addEventListener("pointerdown",C),document.addEventListener("keydown",R),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",R)}},[o]),S.useEffect(()=>{var C;c&&((C=_.current)==null||C.focus())},[c]);function E(){l(!1),y(null),h(!0)}async function T(){if(!(!r||f)){p(!0),y(null);try{await r(e)}catch(C){y(C.message),p(!1)}}}function A(){var C;f||(h(!1),y(null),(C=w.current)==null||C.focus())}return d.jsxs("article",{className:"group relative rounded-lg border border-gray-800 bg-gray-900/50 transition-colors hover:border-cyan-800 hover:bg-gray-900",children:[d.jsxs(Ee,{to:"/projects/$projectId",params:{projectId:e.id},className:"block p-5 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-cyan-500",children:[d.jsx("div",{className:"flex items-start justify-between",children:d.jsxs("div",{className:"min-w-0 flex-1 pr-10",children:[d.jsx("h3",{className:"truncate text-lg font-semibold text-white group-hover:text-cyan-400",children:e.id}),d.jsx("p",{className:"mt-1 truncate text-xs text-gray-500",children:e.path})]})}),d.jsxs("div",{className:"mt-4 grid grid-cols-4 gap-3",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-gray-500",children:"Runs"}),d.jsx("p",{className:"text-lg font-semibold text-white",children:e.run_count})]}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-gray-500",children:"Pass Rate"}),d.jsx("p",{className:`text-lg font-semibold ${e.run_count===0?"text-gray-500":n>=80?"text-emerald-400":n>=50?"text-yellow-400":"text-red-400"}`,children:e.run_count>0?`${n}%`:"--"})]}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-gray-500",children:"Errors"}),d.jsx("p",{className:`text-lg font-semibold ${i>0?"text-amber-300":"text-gray-500"}`,children:i})]}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-gray-500",children:"Last Run"}),d.jsx("p",{className:"text-sm text-gray-300",children:aie(e.last_run)})]})]})]}),t&&r?d.jsxs("div",{className:"absolute right-3 top-3 z-10",children:[d.jsx("button",{ref:w,type:"button","aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?x:void 0,"aria-label":`Open ${e.id} project menu`,onClick:()=>l(C=>!C),className:"flex h-8 w-8 items-center justify-center rounded-md text-lg leading-none text-gray-500 transition-colors hover:bg-gray-800 hover:text-gray-200 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:d.jsx("span",{"aria-hidden":"true",children:"..."})}),o?d.jsx("div",{ref:N,id:x,role:"menu","aria-label":`${e.id} actions`,className:"absolute right-0 top-10 w-44 overflow-hidden rounded-md border border-gray-800 bg-gray-950 py-1 shadow-xl",children:d.jsx("button",{type:"button",role:"menuitem",onClick:E,className:"block w-full px-3 py-2 text-left text-sm text-red-400 transition-colors hover:bg-red-950/30 hover:text-red-300 focus:bg-red-950/30 focus:outline-none",children:"Remove project"})}):null]}):null,c?d.jsx("dialog",{ref:_,open:!0,"aria-modal":"true","aria-labelledby":b,tabIndex:-1,onKeyDown:C=>{C.key==="Escape"&&(C.preventDefault(),A())},className:"fixed inset-0 z-50 flex h-full max-h-none w-full max-w-none items-center justify-center bg-black/70 p-4 text-left text-gray-100 backdrop:bg-black/70",children:d.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-lg border border-gray-800 bg-gray-950 shadow-xl",children:[d.jsx("div",{className:"border-b border-gray-800 px-4 py-3",children:d.jsx("h2",{id:b,className:"text-lg font-semibold text-white",children:"Remove project?"})}),d.jsxs("div",{className:"space-y-3 p-4",children:[d.jsxs("p",{className:"text-sm text-gray-300",children:["Remove ",d.jsx("span",{className:"font-medium text-white",children:e.id})," from this Dashboard registry."]}),d.jsxs("p",{className:"text-sm text-gray-500",children:["The project folder and files stay on disk at ",e.path,"."]}),g?d.jsx("div",{role:"alert",className:"rounded-lg border border-red-900/60 bg-red-950/30 p-3 text-sm text-red-400",children:g}):null]}),d.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-800 bg-gray-900/50 px-4 py-3",children:[d.jsx("button",{type:"button",onClick:A,disabled:f,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),d.jsx("button",{type:"button",onClick:()=>void T(),disabled:f,className:"rounded-md border border-red-900/60 px-3 py-1.5 text-sm font-medium text-red-400 transition-colors hover:border-red-800 hover:bg-red-950/30 hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-50",children:f?"Removing...":"Remove project"})]})]})}):null]})}function sie(e){return e.map(t=>({path:t.path,relativePath:t.relative_path,category:t.category}))}function oie(e){return(e.split(",").at(-1)??"").trim()}function lie(e,t){const r=oie(t).toLowerCase();return r?e.filter(n=>n.relativePath.toLowerCase().includes(r)||n.category.toLowerCase().includes(r)):e}function uie(e,t){const r=e.split(",");return[...(/,\s*$/.test(e)?r:r.slice(0,-1)).map(c=>c.trim()).filter(Boolean).filter(c=>c!==t),t].join(", ")}function cie(e,t,r){return t?e:iS(e,r)}function iS(e,t){return e||String(t??Ic)}function die({suiteFilter:e,testIds:t,target:r,experiment:n,thresholdInput:i,studioThreshold:o,workers:l}){const c={};e.trim()&&(c.suite_filter=e.trim()),t.length>0&&(c.test_ids=t),r&&(c.target=r),n.trim()&&(c.experiment=n.trim());const h=iS(i,o);return h&&(c.threshold=Number.parseFloat(h)),l&&(c.workers=Number.parseInt(l,10)),c}const mx="default";function So({open:e,onClose:t,projectId:r,prefill:n}){const i=ho(),o=po(),[l,c]=S.useState((n==null?void 0:n.suiteFilter)??""),[h,f]=S.useState(""),[p,g]=S.useState((n==null?void 0:n.testIds)??[]),[y,x]=S.useState((n==null?void 0:n.target)??""),[b,w]=S.useState(mx),[N,_]=S.useState(""),[E,T]=S.useState(!1),[A,C]=S.useState(""),[R,D]=S.useState(!1),[M,z]=S.useState(null),[k,H]=S.useState(null),[U,ae]=S.useState(!1),[Z,G]=S.useState(null),{data:L}=R6(r),{data:F}=D6(r),{data:J}=hj(M,r),{data:re}=pt(r),oe=S.useMemo(()=>sie((L==null?void 0:L.eval_files)??[]),[L]),$=S.useMemo(()=>lie(oe,l),[oe,l]),X=S.useMemo(()=>(F==null?void 0:F.targets)??[],[F]),le=S.useMemo(()=>iS(N,re==null?void 0:re.threshold),[re==null?void 0:re.threshold,N]),ue=S.useMemo(()=>cie(N,E,re==null?void 0:re.threshold),[re==null?void 0:re.threshold,N,E]);S.useEffect(()=>{e&&(c((n==null?void 0:n.suiteFilter)??""),g((n==null?void 0:n.testIds)??[]),x((n==null?void 0:n.target)??""),w(mx),f(""),_(""),T(!1),C(""),D(!1),z(null),H(null),ae(!1),G(null))},[e,n]),S.useEffect(()=>{((J==null?void 0:J.status)==="finished"||(J==null?void 0:J.status)==="failed")&&(i.invalidateQueries({queryKey:["runs"]}),i.invalidateQueries({queryKey:["projects"]}))},[J==null?void 0:J.status,i]);const pe=S.useCallback(()=>die({suiteFilter:l,testIds:p,target:y,experiment:b,thresholdInput:N,studioThreshold:re==null?void 0:re.threshold,workers:A}),[b,re==null?void 0:re.threshold,l,y,p,N,A]);S.useEffect(()=>{const te=pe();if(!te.suite_filter&&(!te.test_ids||te.test_ids.length===0)){G(null);return}I6(te,r).then(je=>G(je.command)).catch(()=>G(null))},[pe,r]);function xe(){const te=h.trim();te&&!p.includes(te)&&g([...p,te]),f("")}function we(te){g(p.filter(je=>je!==te))}async function _e(){H(null),ae(!0);try{const te=pe(),je=await $R(te,r);z(je.id)}catch(te){H(te.message)}finally{ae(!1)}}if(!e)return null;if(M&&J){let te=function(){t(),o({to:IB(r)})};return d.jsx(l2,{onClose:t,title:"Eval Run",children:d.jsx(fie,{status:J,onClose:t,onRunInBackground:te,runId:M})})}const de=!!(l.trim()||p.length>0);return d.jsx(l2,{onClose:t,title:"Start",children:d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"suite-filter",className:"mb-1 block text-sm font-medium text-gray-300",children:"Suite Filter"}),d.jsx("input",{id:"suite-filter",type:"text",value:l,onChange:te=>c(te.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"}),oe.length>0&&d.jsx("div",{className:"mt-1.5 max-h-44 overflow-y-auto rounded-md border border-gray-800 bg-gray-950/60 p-1",children:$.length>0?$.map(te=>d.jsxs("button",{type:"button",onClick:()=>c(je=>uie(je,te.relativePath)),className:"block w-full rounded px-2 py-1 text-left text-xs text-gray-400 hover:bg-gray-800 hover:text-gray-200",children:[d.jsx("span",{className:"block truncate",children:te.relativePath}),te.category&&d.jsx("span",{className:"block truncate text-[11px] text-gray-600",children:te.category})]},te.relativePath)):d.jsx("div",{className:"px-2 py-1 text-xs text-gray-500",children:"No matching eval files"})})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"test-id-input",className:"mb-1 block text-sm font-medium text-gray-300",children:"Test ID Filter"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{id:"test-id-input",type:"text",value:h,onChange:te=>f(te.target.value),onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),xe())},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"}),d.jsx("button",{type:"button",onClick:xe,disabled:!h.trim(),className:"rounded-md bg-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-600 disabled:opacity-50",children:"Add"})]}),p.length>0&&d.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:p.map(te=>d.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:[te,d.jsx("button",{type:"button",onClick:()=>we(te),className:"text-cyan-400 hover:text-white",children:"×"})]},te))})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"target-override",className:"mb-1 block text-sm font-medium text-gray-300",children:"Target Override"}),d.jsxs("select",{id:"target-override",value:y,onChange:te=>x(te.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:[d.jsx("option",{value:"",children:"Use eval's configured target"}),X.map(te=>d.jsx("option",{value:te,children:te},te))]})]}),d.jsx("div",{className:"rounded-md border border-gray-800 bg-gray-950/40 p-3",children:d.jsxs("div",{children:[d.jsx("label",{htmlFor:"experiment-input",className:"mb-1 block text-xs font-medium text-gray-400",children:"Experiment"}),d.jsx("input",{id:"experiment-input",type:"text",value:b,onChange:te=>w(te.target.value),placeholder:mx,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"})]})}),d.jsxs("div",{children:[d.jsxs("button",{type:"button",onClick:()=>D(!R),className:"text-sm text-gray-400 hover:text-gray-200",children:[R?"▾":"▸"," Advanced Options"]}),R&&d.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-3",children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"threshold-input",className:"mb-1 block text-xs text-gray-400",children:"Threshold (0–1)"}),d.jsx("input",{id:"threshold-input",type:"number",value:ue,onChange:te=>{T(!0),_(te.target.value)},min:"0",max:"1",step:"0.1",placeholder:le,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"})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"workers-input",className:"mb-1 block text-xs text-gray-400",children:"Workers"}),d.jsx("input",{id:"workers-input",type:"number",value:A,onChange:te=>C(te.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"})]})]})]}),Z&&d.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:[d.jsx("div",{className:"mb-1 text-xs text-gray-500",children:"CLI Preview"}),d.jsx("code",{className:"block break-all text-xs text-cyan-300",children:Z})]}),k&&d.jsx("div",{className:"rounded-md border border-red-900/50 bg-red-950/20 p-2 text-sm text-red-400",children:k}),d.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[d.jsx("button",{type:"button",onClick:t,className:"rounded-md bg-gray-700 px-4 py-2 text-sm text-white hover:bg-gray-600",children:"Cancel"}),d.jsx("button",{type:"button",onClick:_e,disabled:!de||U,className:"rounded-md bg-cyan-600 px-4 py-2 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:U?"Launching…":"Start"})]})]})})}function l2({children:e,onClose:t,title:r}){return d.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/60 pt-[10vh]",children:d.jsxs("div",{className:"max-h-[80vh] w-full max-w-lg overflow-y-auto rounded-lg border border-gray-700 bg-gray-900 shadow-xl",children:[d.jsxs("div",{className:"flex items-center justify-between border-b border-gray-800 px-5 py-3",children:[d.jsx("h2",{className:"text-lg font-semibold text-white",children:r}),d.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-white",children:"✕"})]}),d.jsx("div",{className:"px-5 py-4",children:e})]})})}function fie({status:e,onClose:t,onRunInBackground:r,runId:n}){const i=e.status==="finished"||e.status==="failed",o={starting:"text-yellow-400",running:"text-cyan-400",finished:"text-emerald-400",failed:"text-red-400"};return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("span",{className:`text-sm font-medium ${o[e.status]??"text-gray-400"}`,children:[e.status==="running"&&"●"," ",e.status.charAt(0).toUpperCase()+e.status.slice(1)]}),!i&&d.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent"})]}),d.jsx("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:d.jsx("code",{className:"block break-all text-xs text-cyan-300",children:e.command})}),e.stdout&&d.jsx("div",{className:"max-h-48 overflow-y-auto rounded-md bg-gray-950 p-3",children:d.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-300",children:e.stdout.slice(-3e3)})}),e.stderr&&d.jsx("div",{className:"max-h-24 overflow-y-auto rounded-md bg-red-950/20 p-3",children:d.jsx("pre",{className:"whitespace-pre-wrap text-xs text-red-300",children:e.stderr.slice(-2e3)})}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-xs text-gray-500",children:i?d.jsxs(d.Fragment,{children:["Exit code: ",e.exit_code,e.finished_at&&` · ${new Date(e.finished_at).toLocaleTimeString()}`]}):n&&d.jsx("button",{type:"button",onClick:r,className:"text-xs text-gray-400 hover:text-cyan-400",children:"Run in background"})}),i&&d.jsx("button",{type:"button",onClick:t,className:"rounded-md bg-gray-700 px-4 py-2 text-sm text-white hover:bg-gray-600",children:"Close"})]})]})}function px(e){if(e.source==="remote")return"Remote runs cannot be combined or deleted from the local workspace.";if(e.status==="starting"||e.status==="running")return"Running runs cannot be combined or deleted yet."}function hie(e){return`${e} local run${e===1?"":"s"} selected`}function mie(e,t){return`Combined ${e} local run${e===1?"":"s"} into ${t}.`}function pie(e){return`Deleted ${e} local run${e===1?"":"s"}.`}function gie(e){if(!e)return{date:"N/A",full:"N/A"};try{const t=new Date(e);if(Number.isNaN(t.getTime()))return{date:"N/A",full:"N/A"};const r=t.toLocaleString(),n=Date.now()-t.getTime(),i=Math.floor(n/6e4),o=Math.floor(n/36e5);let l;return i<1?l="just now":i<60?l=`${i} min ago`:o<24?l=`${o} hour${o===1?"":"s"} ago`:l=t.toLocaleDateString(),{date:l,full:r}}catch{return{date:"N/A",full:"N/A"}}}function yie(e,t){const r=gie(e.timestamp),n=e.status==="starting"||e.status==="running",i=yj(e,{includePassRate:!1}),o=i.label,l=ur(e),c=e.test_count,h=Math.max(0,e.test_count-l),f=h>0?e.pass_rate>=t:l===0,p=Math.round(e.pass_rate*h),g=h-p,y=IR(e),x=e.runtime_source?pj(e.runtime_source):void 0,b=e.runtime_source?B6(e.runtime_source):void 0;return{run:e,ts:r,isActive:n,label:o,display:i,errors:l,totalCount:c,qualityCount:h,passing:f,passedCount:p,failedCount:g,experimentNamespace:y,runtimeSourceLabel:x,runtimeSourceTitle:b}}function Xp({runs:e,projectId:t,emptyMessage:r,hasNextPage:n=!1,isFetchingNextPage:i=!1,onLoadMore:o,enableCombine:l=!1,remoteBranch:c}){const{data:h}=pt(t),f=ho(),p=(h==null?void 0:h.threshold)??Ic,g=S.useRef(null),y=S.useRef(null),x=S.useRef(!1),[b,w]=S.useState([]),[N,_]=S.useState(null),[E,T]=S.useState(!1),[A,C]=S.useState(!1),R=S.useMemo(()=>e.map(L=>yie(L,p)),[p,e]),D=S.useMemo(()=>e.filter(L=>l&&!px(L)).map(L=>L.filename),[l,e]),M=new Set(b),z=S.useMemo(()=>new Map(e.map(L=>[L.filename,L])),[e]);S.useEffect(()=>{i||(x.current=!1)},[i]),S.useEffect(()=>{if(!n||!o)return;const L=[];if(g.current&&L.push(g.current),y.current&&L.push(y.current),L.length===0)return;const F=new IntersectionObserver(J=>{J.some(re=>re.isIntersecting)&&!i&&!x.current&&(x.current=!0,o())},{rootMargin:"200px 0px"});for(const J of L)F.observe(J);return()=>F.disconnect()},[n,i,o]),S.useEffect(()=>{const L=new Set(D);w(F=>F.filter(J=>L.has(J)))},[D]);async function k(){if(t){await Promise.all([f.invalidateQueries({queryKey:["projects",t,"runs"]}),f.invalidateQueries({queryKey:["projects",t,"tags"]}),f.invalidateQueries({queryKey:["projects",t,"compare"]}),f.invalidateQueries({queryKey:["projects",t,"targets"]})]);return}await Promise.all([f.invalidateQueries({queryKey:["runs"]}),f.invalidateQueries({queryKey:["tags"]}),f.invalidateQueries({queryKey:["compare"]}),f.invalidateQueries({queryKey:["targets"]})])}async function H(){if(b.length<2||E)return;const L=[...b],F=[...new Set(L.map(re=>{var oe,$;return(($=(oe=z.get(re))==null?void 0:oe.experiment)==null?void 0:$.trim())||"default"}).filter(Boolean))].sort();let J;if(F.length>1){const re=window.prompt(`Selected runs span experiments (${F.join(", ")}). Enter a new experiment name for the combined run:`);if(re===null)return;if(J=re.trim(),!J){_({kind:"error",message:"Experiment name is required to combine runs from multiple experiments."});return}}_(null),T(!0);try{let re;try{re=await uE(L,"error",t,void 0,J)}catch(oe){if(!(oe instanceof LR)||oe.status!==409)throw oe;const $=oe.duplicates.length;if(!window.confirm(`${$} duplicate (test_id, target) pair${$===1?"":"s"} found. Replace duplicates with the latest timestamp?`))return;re=await uE(L,"latest",t,void 0,J)}w([]),_({kind:"success",message:mie(L.length,re.display_name),combinedRunId:re.run_id,sourceRunIds:L}),await k()}catch(re){_({kind:"error",message:re.message})}finally{T(!1)}}async function U(){b.length===0||A||await Z(b,"selected")}async function ae(){const L=(N==null?void 0:N.sourceRunIds)??[];L.length===0||A||await Z(L,"combined-sources")}async function Z(L,F){const J=L.length,re=J===1?"run":"runs",oe=F==="combined-sources"?`Delete the ${J} source local ${re} used for the combined run? The combined run will remain.`:`Delete ${J} local ${re}? This removes the run workspace and artifacts from disk.`;if(window.confirm(oe)){_(null),C(!0);try{for(const X of L)await T6(X,t);w([]),_({kind:"success",message:pie(J)}),await k()}catch(X){_({kind:"error",message:X.message})}finally{C(!1)}}}function G(L){w(F=>F.includes(L)?F.filter(J=>J!==L):[...F,L])}return e.length===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:r??d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"text-lg text-gray-400",children:"No evaluation runs found."}),d.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Run an evaluation first:"," ",d.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"agentv eval <eval-file>"})]})]})}):d.jsxs("div",{className:"space-y-3",children:[l&&d.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-gray-800 bg-gray-900/40 px-4 py-3 sm:flex-row sm:items-start sm:justify-between",children:[d.jsxs("div",{className:"min-w-0 space-y-1",children:[d.jsx("p",{className:"text-sm font-medium text-gray-200",children:hie(b.length)}),d.jsx("p",{className:"text-xs text-gray-500",children:"Select completed local runs to combine or delete. Remote runs stay read-only here."}),N&&d.jsx("div",{className:`mt-2 rounded-md border px-3 py-2 text-sm ${N.kind==="success"?"border-emerald-900/60 bg-emerald-950/20 text-emerald-300":"border-red-900/60 bg-red-950/20 text-red-300"}`,role:N.kind==="error"?"alert":"status",children:d.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[d.jsx("span",{children:N.message}),N.combinedRunId?t?d.jsx(Ee,{to:"/projects/$projectId/runs/$runId",params:{projectId:t,runId:N.combinedRunId},className:"font-medium text-cyan-300 hover:text-cyan-200 hover:underline",children:"Open combined run"}):d.jsx(Ee,{to:"/runs/$runId",params:{runId:N.combinedRunId},className:"font-medium text-cyan-300 hover:text-cyan-200 hover:underline",children:"Open combined run"}):null,N.sourceRunIds&&N.sourceRunIds.length>0?d.jsx("button",{type:"button",onClick:()=>void ae(),disabled:A||E,className:"font-medium text-red-300 hover:text-red-200 hover:underline disabled:cursor-not-allowed disabled:text-gray-500",children:A?"Deleting sources...":"Delete source runs"}):null]})})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[d.jsx("button",{type:"button",onClick:()=>void U(),disabled:b.length===0||A||E,className:"whitespace-nowrap rounded-md border border-red-900/70 px-3 py-1.5 text-sm font-medium text-red-300 hover:border-red-700 hover:bg-red-950/40 disabled:cursor-not-allowed disabled:border-gray-800 disabled:text-gray-500",children:A?"Deleting...":"Delete selected"}),d.jsx("button",{type:"button",onClick:()=>void H(),disabled:b.length<2||E||A,className:"whitespace-nowrap rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:bg-gray-700 disabled:text-gray-400",children:E?"Combining...":"Combine selected"})]})]}),d.jsxs("div",{className:"space-y-2 sm:hidden",children:[R.map(L=>{const{run:F,ts:J,label:re,display:oe,errors:$,totalCount:X,passedCount:le,failedCount:ue,experimentNamespace:pe,runtimeSourceLabel:xe,runtimeSourceTitle:we}=L,_e=px(F),de=!_e&&D.includes(F.filename);return d.jsxs("article",{className:"rounded-lg border border-gray-800 bg-gray-900/40 px-3 py-3",children:[d.jsxs("div",{className:"flex items-start gap-3",children:[l&&d.jsx("input",{type:"checkbox",checked:M.has(F.filename),disabled:!de,onChange:()=>G(F.filename),title:_e,"aria-label":_e?`${re}: ${_e}`:`Select ${re}`,className:"mt-1 h-4 w-4 shrink-0 rounded border-gray-700 bg-gray-900 text-cyan-500 disabled:opacity-30"}),d.jsx(d2,{view:L,className:"mt-1 shrink-0"}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx(u2,{projectId:t,runId:F.filename,label:oe.primary,title:oe.title,className:"block truncate text-sm font-medium text-cyan-400 hover:text-cyan-300 hover:underline"}),oe.secondary?d.jsx("p",{className:"mt-0.5 truncate text-xs text-gray-500",title:oe.title,children:oe.secondary}):null,d.jsx(bie,{experimentNamespace:pe,runtimeSourceLabel:xe,runtimeSourceTitle:we}),d.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[d.jsx(c2,{onRemote:F.on_remote===!0,branch:c}),d.jsx("span",{className:"text-xs text-gray-500",title:J.full,children:J.date})]})]})]}),d.jsxs("dl",{className:"mt-3 grid grid-cols-2 gap-x-3 gap-y-2 border-t border-gray-800/70 pt-3",children:[d.jsx(yl,{label:"Pass Rate",valueClassName:"text-gray-300",children:d.jsx(an,{rate:F.pass_rate})}),d.jsx(yl,{label:"Total",valueClassName:"text-gray-300",children:X}),d.jsx(yl,{label:"Passed",valueClassName:"text-emerald-300",children:le}),d.jsx(yl,{label:"Failures",valueClassName:"text-red-400",children:ue>0?ue:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx(yl,{label:"Errors",valueClassName:"text-amber-300",children:$>0?$:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx(yl,{label:"Remote",valueClassName:"text-gray-400",children:F.on_remote===!0?"On remote":"Local only"})]})]},F.filename)}),(n||i)&&d.jsx("div",{ref:y,className:"rounded-lg border border-gray-800 bg-gray-900/40 px-4 py-3 text-center text-xs text-gray-500",children:i?"Loading more runs...":"Scroll to load more..."})]}),d.jsx("div",{className:"hidden max-w-full overflow-x-auto rounded-lg border border-gray-800 sm:block",children:d.jsxs("table",{className:"min-w-[860px] w-full whitespace-nowrap text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[l&&d.jsx("th",{className:"w-10 px-4 py-3"}),d.jsx("th",{className:"w-8 px-4 py-3"}),d.jsx("th",{className:"w-[18rem] px-4 py-3 font-medium text-gray-400",children:"Experiment"}),d.jsx("th",{className:"w-[16rem] px-4 py-3 font-medium text-gray-400",children:"Target"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Remote"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Passed"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Failures"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Errors"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Total"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"When"})]})}),d.jsxs("tbody",{className:"divide-y divide-gray-800/50",children:[R.map(L=>{var je;const{run:F,ts:J,label:re,display:oe,errors:$,totalCount:X,passedCount:le,failedCount:ue,experimentNamespace:pe,runtimeSourceLabel:xe,runtimeSourceTitle:we}=L,_e=px(F),de=!_e&&D.includes(F.filename),te=((je=F.target)==null?void 0:je.trim())||oe.primary;return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[l&&d.jsx("td",{className:"px-4 py-3",children:d.jsx("input",{type:"checkbox",checked:M.has(F.filename),disabled:!de,onChange:()=>G(F.filename),title:_e,"aria-label":_e?`${re}: ${_e}`:`Select ${re}`,className:"h-4 w-4 rounded border-gray-700 bg-gray-900 text-cyan-500 disabled:opacity-30"})}),d.jsx("td",{className:"px-4 py-3 text-center",children:d.jsx(d2,{view:L})}),d.jsx("td",{className:"w-[18rem] max-w-[18rem] px-4 py-3",children:d.jsxs("div",{className:"min-w-0",children:[d.jsx("div",{className:"truncate font-medium text-gray-200",title:`Experiment: ${pe}`,children:pe}),xe?d.jsx("div",{className:"mt-0.5 truncate text-xs text-cyan-300",title:we??xe,children:xe}):null]})}),d.jsx("td",{className:"w-[16rem] max-w-[16rem] px-4 py-3",children:d.jsx("div",{className:"min-w-0",children:d.jsx("div",{className:"flex min-w-0 items-center gap-2",children:d.jsx(u2,{projectId:t,runId:F.filename,label:te,title:oe.title,className:"block min-w-0 truncate font-medium text-cyan-400 hover:text-cyan-300 hover:underline"})})})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(c2,{onRemote:F.on_remote===!0,branch:c})}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-emerald-300",children:le}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:ue>0?ue:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums",children:$>0?d.jsx("span",{className:"text-amber-300",children:$}):d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:X}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(an,{rate:F.pass_rate})}),d.jsx("td",{className:"px-4 py-3 text-gray-400",title:J.full,children:J.date})]},F.filename)}),(n||i)&&d.jsx("tr",{ref:g,children:d.jsx("td",{colSpan:l?11:10,className:"px-4 py-3 text-center text-xs text-gray-500",children:i?"Loading more runs...":"Scroll to load more..."})})]})]})})]})}function u2({projectId:e,runId:t,label:r,title:n,className:i}){return e?d.jsx(Ee,{to:"/projects/$projectId/runs/$runId",params:{projectId:e,runId:t},className:i,title:n,children:r}):d.jsx(Ee,{to:"/runs/$runId",params:{runId:t},className:i,title:n,children:r})}function c2({onRemote:e,branch:t}){return e?d.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-cyan-900/60 bg-cyan-950/20 px-2 py-0.5 text-xs font-medium text-cyan-300",title:t?`On ${t}`:"On the remote results branch","aria-label":t?`On remote branch ${t}`:"On the remote results branch",children:[d.jsx(vie,{}),"Synced"]}):d.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-gray-800 bg-gray-900/70 px-2 py-0.5 text-xs font-medium text-gray-500",title:"Local only — not pushed","aria-label":"Local only — not pushed",children:[d.jsx(xie,{}),"Local only"]})}function vie(){return d.jsxs("svg",{viewBox:"0 0 24 24",className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"M7 18a4 4 0 0 1-.5-7.97A5 5 0 0 1 16 9a3.5 3.5 0 0 1 1 6.86"}),d.jsx("path",{d:"m9 14 2 2 4-4"})]})}function xie(){return d.jsx("svg",{viewBox:"0 0 24 24",className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M7 18a4 4 0 0 1-.5-7.97A5 5 0 0 1 16 9a3.5 3.5 0 0 1 1 6.86"})})}function bie({experimentNamespace:e,runtimeSourceLabel:t,runtimeSourceTitle:r}){return d.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 text-[11px]",children:[d.jsxs("span",{className:"max-w-full truncate rounded-md border border-gray-800 bg-gray-950/50 px-1.5 py-0.5 text-gray-400",title:`Experiment namespace: ${e}`,children:["Experiment: ",e]}),t?d.jsxs("span",{className:"max-w-full truncate rounded-md border border-cyan-900/50 bg-cyan-950/20 px-1.5 py-0.5 text-cyan-300",title:r??t,children:["Runtime: ",t]}):null]})}function d2({view:e,className:t=""}){return e.isActive?d.jsx("span",{className:`inline-block h-2 w-2 animate-pulse rounded-full bg-cyan-400 ${t}`,title:e.run.status==="starting"?"Starting...":"Running...","aria-label":e.run.status==="starting"?"Starting":"Running"}):e.qualityCount===0&&e.errors>0?d.jsx("span",{className:`text-base font-bold text-amber-300 ${t}`,title:"Execution errors",children:"!"}):d.jsx("span",{className:`text-base font-bold ${e.passing?"text-emerald-400":"text-red-400"} ${t}`,children:e.passing?"✓":"✗"})}function yl({label:e,valueClassName:t,children:r}){return d.jsxs("div",{className:"min-w-0",children:[d.jsx("dt",{className:"text-xs text-gray-500",children:e}),d.jsx("dd",{className:`mt-1 min-w-0 text-sm tabular-nums ${t}`,children:r})]})}function N5({remoteStatus:e,syncInFlight:t,onSync:r,projectName:n,syncFeedback:i,onRemoteSummary:o,onConfirmMerge:l,confirmMergeInFlight:c}){var _,E;const h=(e==null?void 0:e.configured)===!0,f=YB(e,t),p=t===!0||!f.canSync,g=f.pendingMerge,y={neutral:"border-gray-700 bg-gray-800/70 text-gray-300",good:"border-emerald-800/70 bg-emerald-950/30 text-emerald-300",info:"border-cyan-800/70 bg-cyan-950/30 text-cyan-300",warn:"border-yellow-800/70 bg-yellow-950/30 text-yellow-300",danger:"border-red-800/70 bg-red-950/30 text-red-300"}[f.tone],x=(i==null?void 0:i.kind)==="success"?"border-emerald-900/60 bg-emerald-950/20 text-emerald-300":(i==null?void 0:i.kind)==="warning"?"border-yellow-900/60 bg-yellow-950/20 text-yellow-300":"border-red-900/60 bg-red-950/20 text-red-300",b=((_=e==null?void 0:e.dirty_paths)==null?void 0:_.length)??0,w=((E=e==null?void 0:e.conflicted_paths)==null?void 0:E.length)??0,N=KB(e,n,o);return d.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-4",children:[d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:"text-sm font-medium text-gray-200",children:"Recent Runs"}),h&&o?d.jsx("p",{className:"mt-0.5 text-xs text-gray-500",children:o}):null]}),h?d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:`inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-medium ${y}`,children:f.label}),r?d.jsx("button",{type:"button",onClick:r,disabled:p,title:f.canSync?void 0:f.nextAction,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:t?"Syncing...":f.actionLabel}):null]}):null]}),h?d.jsxs("div",{className:"space-y-2 text-sm",children:[d.jsx("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-gray-400",children:N.map(T=>d.jsx("span",{children:T},T))}),d.jsx("p",{className:f.tone==="danger"?"text-red-300":"text-gray-400",children:f.summary}),f.nextAction?d.jsx("p",{className:"text-xs text-gray-500",children:f.nextAction}):null,b>0||w>0?d.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[b>0?d.jsxs("span",{className:"rounded-md border border-yellow-900/60 bg-yellow-950/20 px-2 py-0.5 text-yellow-300",children:[b," dirty path",b===1?"":"s"]}):null,w>0?d.jsxs("span",{className:"rounded-md border border-red-900/60 bg-red-950/20 px-2 py-0.5 text-red-300",children:[w," conflicted path",w===1?"":"s"]}):null]}):null]}):d.jsxs("p",{className:"text-sm text-gray-500",children:["Remote results are not configured. Add"," ",d.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:"results"})," to"," ",d.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:".agentv/config.yaml"})," to enable."]}),g?d.jsxs("div",{className:"space-y-2 rounded-md border border-yellow-900/60 bg-yellow-950/20 px-3 py-2.5 text-sm text-yellow-200",children:[d.jsx("p",{className:"font-medium text-yellow-300",children:"Pending merge on GitHub"}),d.jsxs("p",{className:"text-yellow-200/90",children:["Local results were pushed to"," ",d.jsx("code",{className:"rounded bg-yellow-950/60 px-1 font-mono text-xs text-yellow-200",children:g.tempBranch})," ","instead of force-pushing"," ",d.jsx("code",{className:"rounded bg-yellow-950/60 px-1 font-mono text-xs text-yellow-200",children:g.targetBranch}),typeof g.contributedRunCount=="number"?` (${g.contributedRunCount} run${g.contributedRunCount===1?"":"s"})`:"",". Merge it on GitHub, then resync."]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-0.5",children:[g.compareUrl?d.jsx("a",{href:g.compareUrl,target:"_blank",rel:"noreferrer noopener",className:"rounded-md border border-yellow-700 bg-yellow-950/40 px-3 py-1.5 text-sm font-medium text-yellow-200 transition-colors hover:bg-yellow-900/40",children:"Open merge on GitHub ↗"}):null,l?d.jsx("button",{type:"button",onClick:l,disabled:c===!0||t===!0,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:c?"Resyncing...":"I merged it — resync"}):null]})]}):null,i?d.jsx("div",{className:`rounded-md border px-3 py-2 text-sm ${x}`,role:i.kind==="error"?"alert":"status",children:i.message}):null,e!=null&&e.last_error?d.jsxs("div",{className:"rounded-md border border-red-900/60 bg-red-950/20 px-3 py-2 text-sm text-red-300",role:"alert",children:[d.jsx("p",{className:"font-medium",children:"Remote sync error"}),d.jsx("p",{children:e.last_error}),d.jsx("p",{className:"mt-1 text-xs text-red-200/80",children:oj(e)})]}):null,e!=null&&e.git_diff_summary&&f.state!=="clean"?d.jsx("pre",{className:"max-h-32 overflow-auto whitespace-pre-wrap rounded-md border border-gray-800 bg-gray-950/60 px-3 py-2 text-xs text-gray-500",children:e.git_diff_summary}):null]})}function _5({projectId:e,tagKey:t,onTagKeyChange:r}){const{data:n}=Ue(e?n6(e):r6),i=(n==null?void 0:n.keys)??[jl],o=i.includes(t),l=o?t:i.includes(jl)?jl:i[0]??jl;S.useEffect(()=>{n&&!o&&l!==t&&r(l)},[n,o,l,t,r]);const{data:c,isLoading:h}=Ue(e?cj(e,l):uj(l)),f=(c==null?void 0:c.groups)??[];return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("label",{htmlFor:"tag-key-select",className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Group by"}),d.jsx("select",{id:"tag-key-select",value:l,onChange:p=>r(p.target.value),className:"rounded-md border border-gray-700 bg-gray-900 px-2 py-1 text-sm text-gray-200 focus:border-cyan-700 focus:outline-none",children:i.map(p=>d.jsx("option",{value:p,children:Zi(p)},p))})]}),h?d.jsx(jie,{}):f.length===0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsxs("p",{className:"text-lg text-gray-400",children:["No values found for tag `",l,"`"]}),d.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Values will appear here once evaluations are run with a ",d.jsx("code",{children:l})," tag."]})]}):d.jsx("div",{className:"max-w-full overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"min-w-[760px] w-full whitespace-nowrap text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:Zi(l)}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Targets"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Execution Errors"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Last Run"})]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:f.map(p=>{const g=Bc(p),y=ur(p);return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"px-4 py-3",children:e?d.jsx(Ee,{to:"/projects/$projectId/tags/$key/$value",params:{projectId:e,key:l,value:p.name},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:p.name}):d.jsx(Ee,{to:"/tags/$key/$value",params:{key:l,value:p.name},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:p.name})}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:p.run_count}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:p.target_count}),d.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[d.jsx("span",{className:"text-emerald-400",children:p.passed_count}),d.jsx("span",{className:"text-gray-600",children:" / "}),g]}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-amber-400",children:y>0?y:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(an,{rate:p.pass_rate})}),d.jsx("td",{className:"px-4 py-3 text-gray-400",title:f2(p.last_run).full,children:f2(p.last_run).date})]},p.name)})})]})})]})}function f2(e){if(!e)return{date:"N/A",full:"N/A"};try{const t=new Date(e);if(Number.isNaN(t.getTime()))return{date:"N/A",full:"N/A"};const r=t.toLocaleString(),n=Date.now()-t.getTime(),i=Math.floor(n/6e4),o=Math.floor(n/36e5);let l;return i<1?l="just now":i<60?l=`${i} min ago`:o<24?l=`${o} hour${o===1?"":"s"} ago`:l=t.toLocaleDateString(),{date:l,full:r}}catch{return{date:"N/A",full:"N/A"}}}function jie(){return d.jsx("div",{className:"max-w-full overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("div",{className:"min-w-[760px] animate-pulse",children:[d.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>d.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[d.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},e))]})})}const h2="remote::";function wie(e){return e.startsWith(h2)?e.slice(h2.length):e}function Wp(e){const t=new Map;for(const r of e){const n=wie(r.filename),i=t.get(n);if(!i){t.set(n,r);continue}const o=i.source==="remote"&&r.source==="local"?r:i;t.set(n,{...o,on_remote:i.on_remote===!0||r.on_remote===!0})}return[...t.values()]}function O5({projectId:e}={}){var g,y;const[t,r]=S.useState(null),n=Ue(e?E6(e):s6),i=Ue(e?fj(e):lj),o=((g=n.data)==null?void 0:g.targets)??[],l=((y=i.data)==null?void 0:y.runs)??[],c=n.error??i.error,h=n.isLoading||i.isLoading,f=S.useMemo(()=>o.find(x=>x.name===t)??null,[t,o]);S.useEffect(()=>{t&&!o.some(x=>x.name===t)&&r(null)},[t,o]);const p=S.useMemo(()=>{if(!f)return[];const x=new Map;for(const b of l){if((b.target??"default")!==f.name)continue;const N=b.experiment??"default",_=x.get(N)??[];_.push(b),x.set(N,_)}return[...x.entries()].map(([b,w])=>Sie(b,Wp(w))).sort((b,w)=>b.latestTimestamp&&w.latestTimestamp&&b.latestTimestamp!==w.latestTimestamp?w.latestTimestamp.localeCompare(b.latestTimestamp):b.latestTimestamp?-1:w.latestTimestamp?1:b.name.localeCompare(w.name))},[l,f]);return h?d.jsx(Oie,{}):c?d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load targets: ",c.message]}):o.length===0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Targets will appear here once evaluations are run with target labels."})]}):f?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"space-y-3",children:[d.jsx("button",{type:"button",onClick:()=>r(null),className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200",children:"← Back to targets"}),d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:d.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold text-white",children:f.name}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[f.run_count," run",f.run_count===1?"":"s"," ·"," ",f.experiment_count," experiment",f.experiment_count===1?"":"s"," ·"," ",d.jsx("span",{className:"text-emerald-400",children:f.passed_count}),d.jsx("span",{className:"text-gray-600",children:" / "}),Bc(f)," evals passed",ur(f)>0&&d.jsxs("span",{className:"ml-2 text-amber-400",children:["· ",ur(f)," execution errors"]})]})]}),d.jsx("div",{className:"w-full max-w-52",children:d.jsx(an,{rate:f.pass_rate})})]})})]}),p.length===0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-400",children:"No runs found for this target"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This target summary exists, but there are no matching runs to group by experiment."})]}):d.jsx("div",{className:"space-y-6",children:p.map(x=>d.jsxs("section",{className:"space-y-3",children:[d.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-4 sm:flex-row sm:items-center sm:justify-between",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"text-lg font-medium text-gray-200",children:Nie(x.name)}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[x.runs.length," run",x.runs.length===1?"":"s"," ·"," ",d.jsx("span",{className:"text-emerald-400",children:x.passedCount}),d.jsx("span",{className:"text-gray-600",children:" / "}),x.qualityCount," evals passed",x.executionErrorCount>0&&d.jsxs("span",{className:"ml-2 text-amber-400",children:["· ",x.executionErrorCount," execution errors"]}),x.latestTimestamp&&d.jsxs("span",{className:"ml-2 text-gray-500",children:["· Last run ",_ie(x.latestTimestamp)]})]})]}),d.jsx("div",{className:"w-full max-w-52",children:d.jsx(an,{rate:x.passRate})})]}),d.jsx(Xp,{runs:x.runs,projectId:e})]},x.name))})]}):d.jsx("div",{className:"max-w-full overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"min-w-[720px] w-full whitespace-nowrap text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Experiments"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Execution Errors"})]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:o.map(x=>{const b=Bc(x),w=ur(x);return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"px-4 py-3",children:d.jsx("button",{type:"button",onClick:()=>r(x.name),className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:x.name})}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:x.run_count}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:x.experiment_count}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(an,{rate:x.pass_rate})}),d.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[d.jsx("span",{className:"text-emerald-400",children:x.passed_count}),d.jsx("span",{className:"text-gray-600",children:" / "}),d.jsx("span",{children:b})]}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-amber-400",children:w>0?w:d.jsx("span",{className:"text-gray-600",children:"0"})})]},x.name)})})]})})}function Sie(e,t){let r=0,n=0,i=0,o=0,l=null;for(const c of t){const h=ur(c),f=Math.max(0,c.test_count-h);r+=c.test_count,n+=f,o+=h,i+=Math.round(c.pass_rate*f),c.timestamp&&(!l||c.timestamp>l)&&(l=c.timestamp)}return{name:e,runs:t,latestTimestamp:l,evalCount:r,qualityCount:n,passedCount:i,executionErrorCount:o,passRate:n>0?i/n:0}}function Nie(e){return e==="default"?"Default experiment":e}function _ie(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const r=Date.now()-t.getTime(),n=Math.floor(r/6e4),i=Math.floor(r/36e5);return n<1?"just now":n<60?`${n} min ago`:i<24?`${i} hour${i===1?"":"s"} ago`:t.toLocaleDateString()}function Oie(){return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[d.jsx("div",{className:"h-6 w-40 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"mt-3 h-4 w-72 animate-pulse rounded bg-gray-800"})]}),d.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:d.jsxs("div",{className:"animate-pulse",children:[d.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>d.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[d.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-20 rounded bg-gray-800"})]},e))]})}),d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900/40 p-4",children:[d.jsx("div",{className:"h-5 w-48 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"mt-3 h-4 w-56 animate-pulse rounded bg-gray-800"})]})]})}const m2=[{id:"runs",label:"🏃 Recent Runs"},{id:"tags",label:"🏷️ Tags"},{id:"analytics",label:"📊 Analytics"},{id:"targets",label:"🤖 Targets"}],Eie=dr("/")({component:Aie});function Aie(){const e=po(),n=nj().location.search.tab,{data:i,isLoading:o}=dj(),{data:l,isLoading:c}=pt(),h=(i==null?void 0:i.projects)??[],[f,p]=S.useState(void 0);S.useEffect(()=>{if(o||c)return;const y=l==null?void 0:l.current_project_id;if(!y){p(null);return}const x=LB(y),b=typeof window<"u"&&window.sessionStorage.getItem(x)==="1",w=zB(h.map(N=>N.id),y,b);typeof window<"u"&&w&&window.sessionStorage.setItem(x,"1"),p(w??null)},[l==null?void 0:l.current_project_id,c,h,o]);const g=BB(h.map(y=>y.id),l==null?void 0:l.project_dashboard,f??void 0,n);return S.useEffect(()=>{g.kind==="redirect"&&g.redirectPath&&e({to:g.redirectPath,replace:!0})},[g,e]),o||c||f===void 0?d.jsx(Ub,{}):g.kind==="redirect"?d.jsx(Ub,{}):g.kind==="dashboard"?d.jsx(Tie,{}):d.jsx(Cie,{})}function Tie(){const{data:e}=dj(),{data:t}=pt(),r=ho(),[n,i]=S.useState(!1),[o,l]=S.useState(!1),[c,h]=S.useState(null),f=(e==null?void 0:e.projects)??[],p=(t==null?void 0:t.read_only)===!0;async function g(y){await b6(y.id),r.setQueryData(["projects"],x=>x&&{projects:x.projects.filter(b=>b.id!==y.id)}),h(`Project removed from Dashboard: ${y.id}. Files were left on disk.`),r.invalidateQueries({queryKey:["projects"]})}return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Projects"}),d.jsx("div",{className:"flex gap-2",children:!p&&d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:()=>l(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"Start"}),d.jsx("button",{type:"button",onClick:()=>{h(null),i(!0)},className:"rounded-md bg-cyan-500 px-3 py-1.5 text-sm font-medium text-gray-950 transition-colors hover:bg-cyan-400",children:"Add Project"})]})})]}),c&&d.jsx("div",{className:"rounded-lg border border-cyan-900/60 bg-cyan-950/30 p-3 text-sm text-cyan-300",children:c}),f.length===0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-300",children:"No projects registered yet."}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Add a project path to start browsing runs, tags, analytics, and targets."})]}):d.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:f.map(y=>d.jsx(iie,{project:y,canRemove:!p,onRemove:g},y.id))}),!p&&d.jsx(So,{open:o,onClose:()=>l(!1)}),!p&&d.jsx(f9,{open:n,onClose:()=>i(!1),onAdded:y=>{h(`Project registered: ${y.id}`),r.invalidateQueries({queryKey:["projects"]})}})]})}function Cie(){var ae;const t=nj().location.search,r=t.tab,n=(ae=t.key)!=null&&ae.trim()?t.key:jl,i=po(),o=ho(),{data:l,isLoading:c,error:h,hasNextPage:f,fetchNextPage:p,isFetchingNextPage:g}=h6(),{data:y}=ep(),{data:x}=pt(),[b,w]=S.useState(!1),[N,_]=S.useState(!1),[E,T]=S.useState(!1),[A,C]=S.useState(null),R=(x==null?void 0:x.read_only)===!0,D=m2.some(Z=>Z.id===r)?r:"runs",M=Wp((l==null?void 0:l.runs)??[]),z=M.filter(Z=>Z.on_remote===!0).length,k=(y==null?void 0:y.configured)===!0?AR(z,M.length,y.branch):void 0;async function H(){_(!0),C(null);try{const Z=await DR();o.setQueryData($c().queryKey,Z),C(Hh(Z)),Promise.all([o.invalidateQueries({queryKey:["runs"]}),o.invalidateQueries({queryKey:["tags"]}),o.invalidateQueries({queryKey:["compare"]}),o.invalidateQueries({queryKey:["targets"]}),o.invalidateQueries({queryKey:["remote-status",""]})]).catch(()=>{})}catch(Z){C(Kh(Z,y)),o.invalidateQueries({queryKey:["remote-status",""]}).catch(()=>{})}finally{_(!1)}}S.useEffect(()=>{if((A==null?void 0:A.kind)!=="success")return;const Z=window.setTimeout(()=>C(null),7e3);return()=>window.clearTimeout(Z)},[A]);async function U(){T(!0),C(null);try{const Z=await kR();o.setQueryData($c().queryKey,Z),C(Hh(Z)),Promise.all([o.invalidateQueries({queryKey:["runs"]}),o.invalidateQueries({queryKey:["tags"]}),o.invalidateQueries({queryKey:["compare"]}),o.invalidateQueries({queryKey:["targets"]}),o.invalidateQueries({queryKey:["remote-status",""]})]).catch(()=>{})}catch(Z){C(Kh(Z,y)),o.invalidateQueries({queryKey:["remote-status",""]}).catch(()=>{})}finally{T(!1)}}return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Evaluation Runs"}),(x==null?void 0:x.project_name)&&d.jsx("p",{className:"mt-0.5 text-sm text-gray-500",children:x.project_name})]}),!R&&d.jsx("button",{type:"button",onClick:()=>w(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"Start"})]}),d.jsx("div",{className:"border-b border-gray-800",children:d.jsx("div",{className:"flex flex-wrap gap-1 sm:flex-nowrap",children:m2.map(Z=>d.jsx("button",{type:"button",onClick:()=>i({to:"/",search:Z.id==="tags"?{tab:Z.id,key:n}:{tab:Z.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${D===Z.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:Z.label},Z.id))})}),D==="runs"&&d.jsx(Rie,{runs:M,isLoading:c,error:h,remoteStatus:y,syncInFlight:N,syncFeedback:A,onSyncRemote:H,onConfirmMerge:U,confirmMergeInFlight:E,projectName:x==null?void 0:x.project_name,onRemoteSummary:k,hasNextPage:f,isFetchingNextPage:g,onLoadMore:()=>void p(),readOnly:R}),D==="tags"&&d.jsx(_5,{tagKey:n,onTagKeyChange:Z=>i({to:"/",search:{tab:"tags",key:Z}})}),D==="analytics"&&d.jsx(Pie,{readOnly:R}),D==="targets"&&d.jsx(O5,{}),!R&&d.jsx(So,{open:b,onClose:()=>w(!1)})]})}function Pie({readOnly:e}){const{data:t,isLoading:r,isError:n,error:i}=m6();return d.jsx(w5,{data:t,isLoading:r,isError:n,error:i,readOnly:e})}function Rie({runs:e,isLoading:t,error:r,remoteStatus:n,syncInFlight:i,syncFeedback:o,onSyncRemote:l,onConfirmMerge:c,confirmMergeInFlight:h,projectName:f,onRemoteSummary:p,hasNextPage:g,isFetchingNextPage:y,onLoadMore:x,readOnly:b}){return t?d.jsx(Ub,{}):r?d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",r.message]}):d.jsxs("div",{className:"space-y-4",children:[d.jsx(Mie,{}),d.jsx(N5,{remoteStatus:n,syncInFlight:i,onSync:l,projectName:f,syncFeedback:o,onRemoteSummary:p,onConfirmMerge:c,confirmMergeInFlight:h}),d.jsx(Xp,{runs:e,enableCombine:!b,remoteBranch:n==null?void 0:n.branch,hasNextPage:g,isFetchingNextPage:y,onLoadMore:x})]})}function Mie(){const{data:e}=mj(),t=((e==null?void 0:e.runs)??[]).filter(r=>r.status==="starting"||r.status==="running");return t.length===0?null:d.jsxs("div",{className:"rounded-lg border border-cyan-900/40 bg-cyan-950/10",children:[d.jsx("div",{className:"border-b border-cyan-900/30 px-4 py-2.5",children:d.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-cyan-400",children:"Active"})}),d.jsx("ul",{className:"divide-y divide-gray-800/50",children:t.map(r=>d.jsxs("li",{className:"flex items-center justify-between px-4 py-3",children:[d.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[d.jsx("span",{className:"inline-block h-2 w-2 flex-shrink-0 animate-pulse rounded-full bg-cyan-400"}),d.jsx("span",{className:"truncate font-mono text-sm text-gray-300",children:r.id}),d.jsx("span",{className:"flex-shrink-0 text-xs text-gray-500",children:new Date(r.started_at).toLocaleTimeString()})]}),d.jsx(Ee,{to:"/jobs/$runId",params:{runId:r.id},className:"ml-4 flex-shrink-0 text-xs text-cyan-400 hover:text-cyan-300",children:"View Log →"})]},r.id))})]})}function Ub(){return d.jsx("div",{className:"space-y-2",children:["s1","s2","s3","s4","s5"].map(e=>d.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},e))})}function E5(e){return e==="finished"||e==="failed"}function Die(e,t){return t||!e?!1:!E5(e)}function kie(e,t,r,n){return t||n&&!E5(n)?!1:!!(e.some(i=>i.executionStatus==="execution_error")||r!==void 0&&e.length<r)}function Lie(e){const t={suite_filter:e.suiteFilter,output:e.runDir};return e.target&&(t.target=e.target),e.mode==="resume"?t.resume=!0:t.rerun_failed=!0,t}function $ie(e){const t=!e.ready||e.busy!==null;return[{mode:"rerun",label:"Re-run",title:e.ready?"Re-run failed or missing work, keep passing results":e.disabledReason,disabled:t,testId:"rerun-failed-menu-item"},{mode:"resume",label:"Resume",title:e.ready?"Resume missing or errored work":e.disabledReason,disabled:t,testId:"resume-run-menu-item"}]}function A5({results:e,runDir:t,suiteFilter:r,target:n,projectId:i,isReadOnly:o,plannedTestCount:l,runStatus:c}){const h=po(),f=S.useRef(null),[p,g]=S.useState(null),[y,x]=S.useState(null),[b,w]=S.useState(!1),N=kie(e,o,l,c),_=!!t&&!!r,T=$ie({ready:_,busy:p,disabledReason:t?r?"":"Original eval file path missing from summary.json — cannot determine what to resume":"Run directory unavailable (remote run cannot be resumed in place)"});if(S.useEffect(()=>{if(!b)return;function C(D){f.current&&!f.current.contains(D.target)&&w(!1)}function R(D){D.key==="Escape"&&w(!1)}return document.addEventListener("pointerdown",C),document.addEventListener("keydown",R),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",R)}},[b]),!N)return null;async function A(C){if(!(!_||!t||!r)){w(!1),g(C),x(null);try{const R=Lie({mode:C,runDir:t,suiteFilter:r,target:n}),D=await $R(R,i);h(i?{to:"/projects/$projectId/jobs/$runId",params:{projectId:i,runId:D.id}}:{to:"/jobs/$runId",params:{runId:D.id}})}catch(R){x(R instanceof Error?R.message:"Failed to launch resume"),g(null)}}}return d.jsxs("div",{className:"flex flex-col items-end gap-1",ref:f,children:[d.jsxs("div",{className:"relative",children:[d.jsx("button",{type:"button",onClick:()=>w(C=>!C),disabled:p!==null,"aria-haspopup":"menu","aria-expanded":b,className:"rounded-md border border-gray-700 bg-gray-900 px-3 py-1.5 text-sm font-medium text-gray-200 hover:border-gray-600 hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"run-actions-menu-button",children:p==="resume"?"Resuming...":p==="rerun"?"Re-running...":"Actions"}),b&&d.jsx("div",{className:"absolute left-0 z-20 mt-2 w-48 overflow-hidden rounded-md border border-gray-700 bg-gray-950 py-1 text-sm shadow-xl shadow-black/30 sm:left-auto sm:right-0",role:"menu","aria-label":"Run actions",children:T.map(C=>d.jsx("button",{type:"button",role:"menuitem",onClick:()=>void A(C.mode),disabled:C.disabled,title:C.title,className:"block w-full px-3 py-2 text-left text-gray-200 hover:bg-gray-800 disabled:cursor-not-allowed disabled:text-gray-500","data-testid":C.testId,children:C.label},C.mode))})]}),y&&d.jsx("p",{className:"text-xs text-red-400",children:y})]})}function T5(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function C5(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function Iie(e){const t=C5(e);if(t)try{const r=new URL(t);return!["http:","https:"].includes(r.protocol)||r.username||r.password?void 0:(r.search="",r.hash="",r.toString())}catch{return}}function zie(e){const t=C5(e.provider);return t===void 0||t.toLowerCase()==="phoenix"}function Bie(e){if(e)return{provider:e.external_trace_provider??e["external_trace.provider"],ui_url:e.external_trace_ui_url??e.external_trace_url??e["external_trace.ui_url"]??e["external_trace.url"]}}function Uie(e){const t=e,r=T5(e.metadata)?e.metadata:void 0;return[t.external_trace,t.externalTrace,r==null?void 0:r.external_trace,r==null?void 0:r.externalTrace,Bie(r)]}function qie(e){for(const t of e)for(const r of Uie(t)){if(!T5(r)||!zie(r))continue;const n=Iie(r.ui_url??r.uiUrl??r.url??r.href);if(n)return n}}const P5=[{id:"all",label:"All"},{id:"passing",label:"Passing"},{id:"failing",label:"Failing"},{id:"errors",label:"Errors"},{id:"grader_errors",label:"Grader errors"}],R5="all",M5="all";function zt(e){if(typeof e!="string")return;const t=e.trim();return t||void 0}function p2(e){return[...new Set([...e].filter(t=>t.trim().length>0))].sort((t,r)=>t.localeCompare(r))}function D5(e,t){return zt(e.name)??zt(e.type)??`Grader ${t+1}`}function k5(e,t){var r,n;return e.verdict==="fail"||e.score<t||(r=e.assertions)!=null&&r.some(i=>!i.passed)?!0:((n=e.scores)==null?void 0:n.some(i=>k5(i,t)))??!1}function L5(e){if(!e||e.length===0)return[];const t=[];return e.forEach((r,n)=>{t.push(D5(r,n),r.type??"",r.verdict??"");for(const i of r.assertions??[])t.push(i.text,i.evidence??"");t.push(...L5(r.scores))}),t.filter(r=>r.length>0)}function qb(e){return!e||e.length===0?[]:e.flatMap(t=>[...t.assertions??[],...qb(t.scores)])}function Fie(e){const t=new Set;return e.filter(r=>{const n=`${r.text}\0${r.evidence??""}\0${r.passed}`;return t.has(n)?!1:(t.add(n),!0)})}function Hie(e){const t=new Map;return e==null||e.forEach((r,n)=>{const i=D5(r,n);t.has(i)||t.set(i,r)}),t}function Kie(e){const t=e.tokenUsage;if(!t)return;const r=[t.input,t.output,t.reasoning,t.cached].filter(n=>typeof n=="number"&&Number.isFinite(n));if(r.length!==0)return r.reduce((n,i)=>n+i,0)}function gx(e){return e.filter(t=>typeof t=="number"&&Number.isFinite(t))}function Lh(e){return e.attempts??e.trials??[]}function Gie(e,t){return e.verdict==="pass"?!0:e.verdict==="fail"?!1:typeof e.score=="number"?e.score>=t:!1}function Yie(e){return[e.metrics_path,e.timing_path,e.grading_path,e.transcript_path,e.answer_path].filter(Boolean).length}function Vie(e){const t=zt(e.model);if(t)return t;const r=e.metadata;if(r)return zt(r.model)??zt(r.model_name)??zt(r.target_model)??zt(r.provider_model)}function Qie(e){const t=zt(e.target)??"default",r=zt(e.targetUsed);return r&&r!==t?`${t} -> ${r}`:t}function Xie(e){return zt(e.eval_path)??zt(e.suite)}function Wie(e,t){const r=zt(e.result_dir);return r?`result_dir:${r}`:["result",zt(e.eval_path)??zt(e.suite)??"",e.testId,zt(e.target)??"",zt(e.targetUsed)??"",zt(e.timestamp)??"",String(t)].join(":")}function Zie(e,t,r){var N;const n=VR(e),i=!n&&e.score>=r,o=n?"error":i?"passing":"failing",l=Hie(e.scores),c=[...l.keys()],h=((N=e.scores)==null?void 0:N.some(_=>k5(_,r)))??!1,f=Vie(e),p=Qie(e),g=Xie(e),y=zt(e.suite),x=zt(e.category),b=Kie(e),w=[e.testId,p,f??"",g??"",y??"",x??"",e.executionStatus??"",e.error??"",...L5(e.scores),...(e.assertions??[]).flatMap(_=>[_.text,_.evidence??""])];return{key:Wie(e,t),result:e,index:t,testId:e.testId,status:o,statusLabel:n?"Error":i?"Passing":"Failing",passing:i,executionError:n,graderError:h,targetLabel:p,...f&&{modelLabel:f},...g&&{evalLabel:g},...x&&{categoryLabel:x},...b!==void 0&&{tokenTotal:b},graderNames:c,graderScores:l,searchText:w.join(" ").toLowerCase()}}function Jie(e,t){const r=Lh(e.result).filter(g=>g.sample_path||g.attempt_path||g.run_path||g.verdict);if(r.length<=1)return;const n=r.filter(g=>Gie(g,t)).length,i=r.filter(g=>g.execution_status==="execution_error").length,o=gx(r.map(g=>g.duration_ms)),l=gx(r.map(g=>g.score)),c=gx(r.map(g=>g.total_tool_calls)),h=r.reduce((g,y)=>g+Yie(y),0),f=Fie([...e.result.assertions??[],...qb(e.result.scores),...r.flatMap(g=>[...g.assertions??[],...qb(g.scores)])]),p=f.filter(g=>g.passed).length;return{row:e,trials:r,trialCount:r.length,passedTrials:n,failedTrials:r.length-n,executionErrorTrials:i,passRate:r.length>0?n/r.length:0,meanScore:l.length>0?l.reduce((g,y)=>g+y,0)/l.length:e.result.score,assertionCount:f.length,passedAssertions:p,...f.length>0&&{assertionPassRate:p/f.length},...o.length>0&&{meanDurationMs:o.reduce((g,y)=>g+y,0)/o.length},...c.length>0&&{totalToolCalls:c.reduce((g,y)=>g+y,0)},artifactCount:h}}function ese(e,t){const r=e.some(f=>Lh(f.result).length>1),n=e.some(f=>f.evalLabel),i=e.some(f=>f.categoryLabel),o=e.some(f=>f.result.durationMs!=null||Lh(f.result).some(p=>p.duration_ms!=null)),l=e.some(f=>f.result.costUsd!=null||f.tokenTotal!=null||Lh(f.result).some(p=>p.cost_usd!=null||p.total_tokens!=null||p.token_usage!=null)),c=e.some(f=>f.result.error);return[{id:"status",label:"Status",kind:"base",defaultVisible:!0},...r?[{id:"expander",label:"Expand",kind:"base",defaultVisible:!0}]:[],{id:"test",label:"Test ID",kind:"base",defaultVisible:!0},{id:"target",label:"Target",kind:"base",defaultVisible:!0},...n?[{id:"eval",label:"Eval",kind:"base",defaultVisible:!0}]:[],{id:"score",label:"Score",kind:"base",defaultVisible:!0},...i?[{id:"category",label:"Category",kind:"base",defaultVisible:!1}]:[],...o?[{id:"duration",label:"Duration",kind:"base",defaultVisible:!0}]:[],...l?[{id:"cost_tokens",label:"Cost / Tokens",kind:"base",defaultVisible:!0}]:[],...c?[{id:"error",label:"Error",kind:"base",defaultVisible:!1}]:[],...t.map(f=>({id:`grader:${f}`,label:f,kind:"grader",defaultVisible:!0}))]}function tse(e){return e==="scorer_errors"?"grader_errors":P5.some(t=>t.id===e)?e:"all"}function rse(e){const t=e.filter(r=>r.defaultVisible).map(r=>r.id);return t.length>0?t:e.slice(0,4).map(r=>r.id)}function nse(e,t){if(!t.some(l=>l.id==="expander"))return[...e];if(e.includes("expander")||!e.includes("test"))return[...e];const r=[...e],n=r.indexOf("status"),i=r.indexOf("test"),o=n>=0?n+1:i;return r.splice(o,0,"expander"),r}function ase(e,t,r,n){var p,g;const i=new Set(t.map(y=>y.id)),o=((p=e==null?void 0:e.visibleColumnIds)==null?void 0:p.map(y=>y.startsWith("scorer:")?`grader:${y.slice(7)}`:y).filter(y=>i.has(y)))??[],l=o.length>0?nse(o,t):rse(t),c=e!=null&&e.target&&r.includes(e.target)?e.target:R5,h=(e==null?void 0:e.grader)??(e==null?void 0:e.scorer),f=h&&n.includes(h)?h:M5;return{view:tse(e==null?void 0:e.view),search:((g=e==null?void 0:e.search)==null?void 0:g.trim())??"",target:c,grader:f,visibleColumnIds:l}}function ise(e,t){switch(t){case"passing":return e.status==="passing";case"failing":return e.status==="failing";case"errors":return e.status==="error";case"grader_errors":return e.graderError;case"all":return!0}}function sse(e){return{all:e.length,passing:e.filter(t=>t.status==="passing").length,failing:e.filter(t=>t.status==="failing").length,errors:e.filter(t=>t.status==="error").length,grader_errors:e.filter(t=>t.graderError).length}}function ose(e){const t=e.results.map((y,x)=>Zie(y,x,e.passThreshold)),r=p2(t.map(y=>y.targetLabel)),n=p2(t.flatMap(y=>y.graderNames)),i=ese(t,n),o=ase(e.state,i,r,n),l=o.search.toLowerCase(),c=new Set(o.visibleColumnIds),h=t.filter(y=>!(!ise(y,o.view)||o.target!==R5&&y.targetLabel!==o.target||o.grader!==M5&&!y.graderScores.has(o.grader)||l&&!y.searchText.includes(l))),f=t.map(y=>Jie(y,e.passThreshold)).filter(y=>!!y),p=new Set(h.map(y=>y.key)),g=f.filter(y=>p.has(y.row.key));return{rows:t,filteredRows:h,repeatGroups:f,filteredRepeatGroups:g,columns:i,visibleColumns:i.filter(y=>c.has(y.id)),state:o,targetOptions:r,graderOptions:n,viewCounts:sse(t)}}function lse(e){var r;switch((r=e.split(".").pop())==null?void 0:r.toLowerCase()){case"ts":case"tsx":return"📘";case"json":return"📋";case"log":case"txt":return"📜";case"md":return"📝";default:return"📄"}}function use(e){if(e.type==="file")return e.storage==="git"&&e.ref?e.ref:e.storage&&e.storage!=="local"?e.storage:void 0}function $5(e){const t=[];for(const r of e)r.type==="dir"&&(t.push(r.path),r.children&&t.push(...$5(r.children)));return t}function I5({node:e,selectedPath:t,onSelect:r,openFolders:n,toggleFolder:i,depth:o=0}){const l=e.type==="dir",c=n.has(e.path),h=t===e.path,f=use(e);return d.jsxs("div",{children:[d.jsxs("button",{type:"button",onClick:()=>{l?i(e.path):r(e.path)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors ${h?"bg-cyan-400/20 text-cyan-400":"text-gray-300 hover:bg-gray-800/50 hover:text-gray-200"}`,style:{paddingLeft:`${o*16+8}px`},children:[d.jsx("span",{className:"flex-shrink-0 text-xs",children:l?c?"📂":"📁":lse(e.name)}),d.jsx("span",{className:"truncate",children:e.name}),f&&d.jsx("span",{className:"ml-auto max-w-32 flex-shrink-0 truncate rounded border border-gray-700 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-gray-400",title:[e.kind?`kind: ${e.kind}`:void 0,e.ref?`ref: ${e.ref}`:void 0,e.key?`key: ${e.key}`:void 0].filter(Boolean).join(`
|
|
119
|
-
`),children:f})]}),l&&c&&e.children&&d.jsx("div",{children:e.children.map(p=>d.jsx(I5,{node:p,selectedPath:t,onSelect:r,openFolders:n,toggleFolder:i,depth:o+1},p.path))})]})}function cse({files:e,selectedPath:t,onSelect:r}){const[n,i]=S.useState(()=>new Set($5(e))),o=l=>{i(c=>{const h=new Set(c);return h.has(l)?h.delete(l):h.add(l),h})};return d.jsxs("div",{className:"w-full md:w-64 overflow-y-auto rounded-lg border border-gray-800 bg-gray-900 py-2",children:[e.length===0&&d.jsx("p",{className:"px-4 py-2 text-sm text-gray-500",children:"No files."}),e.map(l=>d.jsx(I5,{node:l,selectedPath:t,onSelect:r,openFolders:n,toggleFolder:o},l.path))]})}const dse="modulepreload",fse=function(e){return"/"+e},g2={},hse=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){let l=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),h=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=l(r.map(f=>{if(f=fse(f),f in g2)return;g2[f]=!0;const p=f.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":dse,p||(y.as="script"),y.crossOrigin="",y.href=f,h&&y.setAttribute("nonce",h),document.head.appendChild(y),p)return new Promise((x,b)=>{y.addEventListener("load",x),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})},mse=S.lazy(()=>hse(()=>import("./index-
|
|
118
|
+
*/var yP;function sJ(){if(yP)return tt;yP=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.view_transition"),x=Symbol.for("react.client.reference");function b(w){if(typeof w=="object"&&w!==null){var N=w.$$typeof;switch(N){case e:switch(w=w.type,w){case r:case i:case n:case h:case f:case y:return w;default:switch(w=w&&w.$$typeof,w){case l:case c:case g:case p:return w;case o:return w;default:return N}}case t:return N}}}return tt.ContextConsumer=o,tt.ContextProvider=l,tt.Element=e,tt.ForwardRef=c,tt.Fragment=r,tt.Lazy=g,tt.Memo=p,tt.Portal=t,tt.Profiler=i,tt.StrictMode=n,tt.Suspense=h,tt.SuspenseList=f,tt.isContextConsumer=function(w){return b(w)===o},tt.isContextProvider=function(w){return b(w)===l},tt.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},tt.isForwardRef=function(w){return b(w)===c},tt.isFragment=function(w){return b(w)===r},tt.isLazy=function(w){return b(w)===g},tt.isMemo=function(w){return b(w)===p},tt.isPortal=function(w){return b(w)===t},tt.isProfiler=function(w){return b(w)===i},tt.isStrictMode=function(w){return b(w)===n},tt.isSuspense=function(w){return b(w)===h},tt.isSuspenseList=function(w){return b(w)===f},tt.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===r||w===i||w===n||w===h||w===f||typeof w=="object"&&w!==null&&(w.$$typeof===g||w.$$typeof===p||w.$$typeof===l||w.$$typeof===o||w.$$typeof===c||w.$$typeof===x||w.getModuleId!==void 0)},tt.typeOf=b,tt}var vP;function oJ(){return vP||(vP=1,nx.exports=sJ()),nx.exports}var lJ=oJ(),xP=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",bP=null,ax=null,wk=e=>{if(e===bP&&Array.isArray(ax))return ax;var t=[];return S.Children.forEach(e,r=>{mt(r)||(lJ.isFragment(r)?t=t.concat(wk(r.props.children)):t.push(r))}),ax=t,bP=e,t};function uJ(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(i=>xP(i)):n=[xP(t)],wk(e).forEach(i=>{var o=Hl(i,"type.displayName")||Hl(i,"type.name");o&&n.indexOf(o)!==-1&&r.push(i)}),r}var Sk=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,ix={},jP;function cJ(){return jP||(jP=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var i;if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const o=r[Symbol.toStringTag];return o==null||!((i=Object.getOwnPropertyDescriptor(r,Symbol.toStringTag))!=null&&i.writable)?!1:r.toString()===`[object ${o}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(ix)),ix}var sx,wP;function dJ(){return wP||(wP=1,sx=cJ().isPlainObject),sx}var fJ=dJ();const hJ=rs(fJ);var SP,NP,_P,OP,EP;function AP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function TP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?AP(Object(r),!0).forEach(function(n){mJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mJ(e,t,r){return(t=pJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pJ(e){var t=gJ(e,"string");return typeof t=="symbol"?t:t+""}function gJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $m(){return $m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$m.apply(null,arguments)}function xc(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var CP=(e,t,r,n,i)=>{var o=r-n,l;return l=bt(SP||(SP=xc(["M ",",",""])),e,t),l+=bt(NP||(NP=xc(["L ",",",""])),e+r,t),l+=bt(_P||(_P=xc(["L ",",",""])),e+r-o/2,t+i),l+=bt(OP||(OP=xc(["L ",",",""])),e+r-o/2-n,t+i),l+=bt(EP||(EP=xc(["L ",","," Z"])),e,t),l},yJ={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},vJ=e=>{var t=fr(e,yJ),{x:r,y:n,upperWidth:i,lowerWidth:o,height:l,className:c}=t,{animationEasing:h,animationDuration:f,animationBegin:p,isUpdateAnimationActive:g}=t,y=S.useRef(null),[x,b]=S.useState(-1),w=S.useRef(i),N=S.useRef(o),_=S.useRef(l),E=S.useRef(r),T=S.useRef(n),A=Ep(e,"trapezoid-");if(S.useEffect(()=>{if(y.current&&y.current.getTotalLength)try{var Z=y.current.getTotalLength();Z&&b(Z)}catch{}},[]),r!==+r||n!==+n||i!==+i||o!==+o||l!==+l||i===0&&o===0||l===0)return null;var C=Xe("recharts-trapezoid",c);if(!g)return S.createElement("g",null,S.createElement("path",$m({},Er(t),{className:C,d:CP(r,n,i,o,l)})));var R=w.current,D=N.current,M=_.current,z=E.current,k=T.current,H="0px ".concat(x===-1?1:x,"px"),U="".concat(x,"px ").concat(x,"px"),ae=M3(["strokeDasharray"],f,h);return S.createElement(Op,{animationId:A,key:A,canBegin:x>0,duration:f,easing:h,isActive:g,begin:p},Z=>{var G=jt(R,i,Z),L=jt(D,o,Z),F=jt(M,l,Z),J=jt(z,r,Z),re=jt(k,n,Z);y.current&&(w.current=G,N.current=L,_.current=F,E.current=J,T.current=re);var oe=Z>0?{transition:ae,strokeDasharray:U}:{strokeDasharray:H};return S.createElement("path",$m({},Er(t),{className:C,d:CP(J,re,G,L,F),ref:y,style:TP(TP({},oe),t.style)}))})},xJ=["option","shapeType","activeClassName","inActiveClassName"];function bJ(e,t){if(e==null)return{};var r,n,i=jJ(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function jJ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function PP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Im(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?PP(Object(r),!0).forEach(function(n){wJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wJ(e,t,r){return(t=SJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SJ(e){var t=NJ(e,"string");return typeof t=="symbol"?t:t+""}function NJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _J(e,t){return Im(Im({},t),e)}function OJ(e,t){return e==="symbols"}function RP(e){var{shapeType:t,elementProps:r}=e;switch(t){case"rectangle":return S.createElement($3,r);case"trapezoid":return S.createElement(vJ,r);case"sector":return S.createElement(B3,r);case"symbols":if(OJ(t))return S.createElement(Ej,r);break;case"curve":return S.createElement(R3,r);default:return null}}function EJ(e){return S.isValidElement(e)?e.props:e}function Nk(e){var{option:t,shapeType:r,activeClassName:n="recharts-active-shape",inActiveClassName:i="recharts-shape"}=e,o=bJ(e,xJ),l;if(S.isValidElement(t))l=S.cloneElement(t,Im(Im({},o),EJ(t)));else if(typeof t=="function")l=t(o,o.index);else if(hJ(t)&&typeof t!="boolean"){var c=_J(t,o);l=S.createElement(RP,{shapeType:r,elementProps:c})}else{var h=o;l=S.createElement(RP,{shapeType:r,elementProps:h})}return o.isActive?S.createElement(sn,{className:n},l):S.createElement(sn,{className:i},l)}var _k=(e,t,r)=>{var n=ct();return(i,o)=>l=>{e==null||e(i,o,l),n(RD({activeIndex:String(o),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}},Ok=e=>{var t=ct();return(r,n)=>i=>{e==null||e(r,n,i),t(HQ())}},Ek=(e,t,r)=>{var n=ct();return(i,o)=>l=>{e==null||e(i,o,l),n(KQ({activeIndex:String(o),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}};function Ak(e){var{tooltipEntrySettings:t}=e,r=ct(),n=jr(),i=S.useRef(null);return S.useLayoutEffect(()=>{n||(i.current===null?r(BQ(t)):i.current!==t&&r(UQ({prev:i.current,next:t})),i.current=t)},[t,r,n]),S.useLayoutEffect(()=>()=>{i.current&&(r(qQ(i.current)),i.current=null)},[r]),null}function Tk(e){var{legendPayload:t}=e,r=ct(),n=jr(),i=S.useRef(null);return S.useLayoutEffect(()=>{n||(i.current===null?r(CF(t)):i.current!==t&&r(PF({prev:i.current,next:t})),i.current=t)},[r,n,t]),S.useLayoutEffect(()=>()=>{i.current&&(r(RF(i.current)),i.current=null)},[r]),null}var ox,AJ=()=>{var[e]=S.useState(()=>Uc("uid-"));return e},TJ=(ox=ZI.useId)!==null&&ox!==void 0?ox:AJ;function CJ(e,t){var r=TJ();return t||(e?"".concat(e,"-").concat(r):r)}var PJ=S.createContext(void 0),Ck=e=>{var{id:t,type:r,children:n}=e,i=CJ("recharts-".concat(r),t);return S.createElement(PJ.Provider,{value:i},n(i))},RJ={cartesianItems:[],polarItems:[]},Pk=br({name:"graphicalItems",initialState:RJ,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:ot()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=On(e).cartesianItems.indexOf(r);i>-1&&(e.cartesianItems[i]=n)},prepare:ot()},removeCartesianGraphicalItem:{reducer(e,t){var r=On(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:ot()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:ot()},removePolarGraphicalItem:{reducer(e,t){var r=On(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:ot()},replacePolarGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=On(e).polarItems.indexOf(r);i>-1&&(e.polarItems[i]=n)},prepare:ot()}}}),{addCartesianGraphicalItem:MJ,replaceCartesianGraphicalItem:DJ,removeCartesianGraphicalItem:kJ,addPolarGraphicalItem:Ale,removePolarGraphicalItem:Tle,replacePolarGraphicalItem:Cle}=Pk.actions,LJ=Pk.reducer,$J=e=>{var t=ct(),r=S.useRef(null);return S.useLayoutEffect(()=>{r.current===null?t(MJ(e)):r.current!==e&&t(DJ({prev:r.current,next:e})),r.current=e},[t,e]),S.useLayoutEffect(()=>()=>{r.current&&(t(kJ(r.current)),r.current=null)},[t]),null},Rk=S.memo($J),IJ=["points"];function MP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function lx(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?MP(Object(r),!0).forEach(function(n){zJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function zJ(e,t,r){return(t=BJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function BJ(e){var t=UJ(e,"string");return typeof t=="symbol"?t:t+""}function UJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zm(){return zm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},zm.apply(null,arguments)}function qJ(e,t){if(e==null)return{};var r,n,i=FJ(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function FJ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function HJ(e){var{option:t,dotProps:r,className:n}=e;if(S.isValidElement(t))return S.cloneElement(t,r);if(typeof t=="function")return t(r);var i=Xe(n,typeof t!="boolean"?t.className:""),o=r??{},{points:l}=o,c=qJ(o,IJ);return S.createElement(bk,zm({},c,{className:i}))}function KJ(e,t){return e==null?!1:t?!0:e.length===1}function GJ(e){var{points:t,dot:r,className:n,dotClassName:i,dataKey:o,baseProps:l,needClip:c,clipPathId:h,zIndex:f=Gt.scatter}=e;if(!KJ(t,r))return null;var p=Sk(r),g=g9(r),y=t.map((b,w)=>{var N,_,E=lx(lx(lx({r:3},l),g),{},{index:w,cx:(N=b.x)!==null&&N!==void 0?N:void 0,cy:(_=b.y)!==null&&_!==void 0?_:void 0,dataKey:o,value:b.value,payload:b.payload,points:t});return S.createElement(HJ,{key:"dot-".concat(w),option:r,dotProps:E,className:i})}),x={};return c&&h!=null&&(x.clipPath="url(#clipPath-".concat(p?"":"dots-").concat(h,")")),S.createElement(Cn,{zIndex:f},S.createElement(sn,zm({className:n},x),y))}function DP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function kP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?DP(Object(r),!0).forEach(function(n){YJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function YJ(e,t,r){return(t=VJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function VJ(e){var t=QJ(e,"string");return typeof t=="symbol"?t:t+""}function QJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Mk=0,XJ={xAxis:{},yAxis:{},zAxis:{}},Dk=br({name:"cartesianAxis",initialState:XJ,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:ot()},replaceXAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.xAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.xAxis[r.id],e.xAxis[n.id]=n)},prepare:ot()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:ot()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:ot()},replaceYAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.yAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.yAxis[r.id],e.yAxis[n.id]=n)},prepare:ot()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:ot()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:ot()},replaceZAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.zAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.zAxis[r.id],e.zAxis[n.id]=n)},prepare:ot()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:ot()},updateYAxisWidth(e,t){var{id:r,width:n}=t.payload,i=e.yAxis[r];if(i){var o,l=i.widthHistory||[];if(l.length===3&&l[0]===l[2]&&n===l[1]&&n!==i.width&&Math.abs(n-((o=l[0])!==null&&o!==void 0?o:0))<=1)return;var c=[...l,n].slice(-3);e.yAxis[r]=kP(kP({},i),{},{width:n,widthHistory:c})}}}}),{addXAxis:WJ,replaceXAxis:ZJ,removeXAxis:JJ,addYAxis:eee,replaceYAxis:tee,removeYAxis:ree,addZAxis:Ple,replaceZAxis:Rle,removeZAxis:Mle,updateYAxisWidth:nee}=Dk.actions,aee=Dk.reducer,iee=Q([Vt],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),see=Q([iee,Wa,Za],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),Vw=()=>ve(see),oee=()=>ve(BX);function LP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ux(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LP(Object(r),!0).forEach(function(n){lee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lee(e,t,r){return(t=uee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uee(e){var t=cee(e,"string");return typeof t=="symbol"?t:t+""}function cee(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var dee=e=>{var{point:t,childIndex:r,mainColor:n,activeDot:i,dataKey:o,clipPath:l}=e;if(i===!1||t.x==null||t.y==null)return null;var c={index:r,dataKey:o,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},h=ux(ux(ux({},c),gd(i)),Aj(i)),f;return S.isValidElement(i)?f=S.cloneElement(i,h):typeof i=="function"?f=i(h):f=S.createElement(bk,h),S.createElement(sn,{className:"recharts-active-dot",clipPath:l},f)};function fee(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:i,clipPath:o,zIndex:l=Gt.activeDot}=e,c=ve(uo),h=oee();if(t==null||h==null)return null;var f=t.find(p=>h.includes(p.payload));return mt(f)?null:S.createElement(Cn,{zIndex:l},S.createElement(dee,{point:f,childIndex:Number(c),mainColor:r,dataKey:i,activeDot:n,clipPath:o}))}var $P=(e,t,r)=>{var n=r??e;if(!mt(n))return Bn(n,t,0)},hee=(e,t,r)=>{var n={},i=e.filter(Mp),o=e.filter(f=>f.stackId==null),l=i.reduce((f,p)=>{var g=f[p.stackId];return g==null&&(g=[]),g.push(p),f[p.stackId]=g,f},n),c=Object.entries(l).map(f=>{var p,[g,y]=f,x=y.map(w=>w.dataKey),b=$P(t,r,(p=y[0])===null||p===void 0?void 0:p.barSize);return{stackId:g,dataKeys:x,barSize:b}}),h=o.map(f=>{var p=[f.dataKey].filter(y=>y!=null),g=$P(t,r,f.barSize);return{stackId:void 0,dataKeys:p,barSize:g}});return[...c,...h]};function IP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xh(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?IP(Object(r),!0).forEach(function(n){mee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):IP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mee(e,t,r){return(t=pee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pee(e){var t=gee(e,"string");return typeof t=="symbol"?t:t+""}function gee(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yee(e,t,r,n,i){var o,l=n.length;if(!(l<1)){var c=Bn(e,r,0,!0),h,f=[];if(Be((o=n[0])===null||o===void 0?void 0:o.barSize)){var p=!1,g=r/l,y=n.reduce((E,T)=>E+(T.barSize||0),0);y+=(l-1)*c,y>=r&&(y-=(l-1)*c,c=0),y>=r&&g>0&&(p=!0,g*=.9,y=l*g);var x=(r-y)/2>>0,b={offset:x-c,size:0};h=n.reduce((E,T)=>{var A,C={stackId:T.stackId,dataKeys:T.dataKeys,position:{offset:b.offset+b.size+c,size:p?g:(A=T.barSize)!==null&&A!==void 0?A:0}},R=[...E,C];return b=C.position,R},f)}else{var w=Bn(t,r,0,!0);r-2*w-(l-1)*c<=0&&(c=0);var N=(r-2*w-(l-1)*c)/l;N>1&&(N>>=0);var _=Be(i)?Math.min(N,i):N;h=n.reduce((E,T,A)=>[...E,{stackId:T.stackId,dataKeys:T.dataKeys,position:{offset:w+(N+c)*A+(N-_)/2,size:_}}],f)}return h}}var vee=(e,t,r,n,i,o,l)=>{var c=mt(l)?t:l,h=yee(r,n,i!==o?i:o,e,c);return i!==o&&h!=null&&(h=h.map(f=>xh(xh({},f),{},{position:xh(xh({},f.position),{},{offset:f.position.offset-i/2})}))),h},xee=(e,t)=>{var r=tw(t);if(!(!e||r==null||t==null)){var{stackId:n}=t;if(n!=null){var i=e[n];if(i){var{stackedData:o}=i;if(o)return o.find(l=>l.key===r)}}}},bee=(e,t)=>{if(!(e==null||t==null)){var r=e.find(n=>n.stackId===t.stackId&&t.dataKey!=null&&n.dataKeys.includes(t.dataKey));if(r!=null)return r.position}};function jee(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&Be(e.zIndex)?e.zIndex:t}var wee=e=>{var{chartData:t}=e,r=ct(),n=jr();return S.useEffect(()=>n?()=>{}:(r(ZC(t)),()=>{r(ZC(void 0))}),[t,r,n]),null},zP={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},kk=br({name:"brush",initialState:zP,reducers:{setBrushSettings(e,t){return t.payload==null?zP:t.payload}}}),{setBrushSettings:Dle}=kk.actions,See=kk.reducer;function Nee(e){return(e%180+180)%180}var _ee=function(t){var{width:r,height:n}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=Nee(i),l=o*Math.PI/180,c=Math.atan(n/r),h=l>c&&l<Math.PI-c?n/Math.sin(l):r/Math.cos(l);return Math.abs(h)},Oee={dots:[],areas:[],lines:[]},Lk=br({name:"referenceElements",initialState:Oee,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=On(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=On(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=On(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:kle,removeDot:Lle,addArea:$le,removeArea:Ile,addLine:zle,removeLine:Ble}=Lk.actions,Eee=Lk.reducer,Aee=S.createContext(void 0),Tee=e=>{var{children:t}=e,[r]=S.useState("".concat(Uc("recharts"),"-clip")),n=Vw();if(n==null)return null;var{x:i,y:o,width:l,height:c}=n;return S.createElement(Aee.Provider,{value:r},S.createElement("defs",null,S.createElement("clipPath",{id:r},S.createElement("rect",{x:i,y:o,height:c,width:l}))),t)};function $k(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;n<e.length;n+=t){var i=e[n];i!==void 0&&r.push(i)}return r}function Cee(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return _ee(n,r)}function Pee(e,t,r){var n=r==="width",{x:i,y:o,width:l,height:c}=e;return t===1?{start:n?i:o,end:n?i+l:o+c}:{start:n?i+l:o+c,end:n?i:o}}function td(e,t,r,n,i){if(e*t<e*n||e*t>e*i)return!1;var o=r();return e*(t-e*o/2-n)>=0&&e*(t+e*o/2-i)<=0}function Ree(e,t){return $k(e,t+1)}function Mee(e,t,r,n,i){for(var o=(n||[]).slice(),{start:l,end:c}=t,h=0,f=1,p=l,g=function(){var b=n==null?void 0:n[h];if(b===void 0)return{v:$k(n,f)};var w=h,N,_=()=>(N===void 0&&(N=r(b,w)),N),E=b.coordinate,T=h===0||td(e,E,_,p,c);T||(h=0,p=l,f+=1),T&&(p=E+e*(_()/2+i),h+=f)},y;f<=o.length;)if(y=g(),y)return y.v;return[]}function Dee(e,t,r,n,i){var o=(n||[]).slice(),l=o.length;if(l===0)return[];for(var{start:c,end:h}=t,f=1;f<=l;f++){for(var p=(l-1)%f,g=c,y=!0,x=function(){var A=n[w];if(A==null)return 0;var C=w,R,D=()=>(R===void 0&&(R=r(A,C)),R),M=A.coordinate,z=w===p||td(e,M,D,g,h);if(!z)return y=!1,1;z&&(g=M+e*(D()/2+i))},b,w=p;w<l&&(b=x(),!(b!==0&&b===1));w+=f);if(y){for(var N=[],_=p;_<l;_+=f){var E=n[_];E!=null&&N.push(E)}return N}}return[]}function BP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function yr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?BP(Object(r),!0).forEach(function(n){kee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):BP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function kee(e,t,r){return(t=Lee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lee(e){var t=$ee(e,"string");return typeof t=="symbol"?t:t+""}function $ee(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Iee(e,t,r,n,i){for(var o=(n||[]).slice(),l=o.length,{start:c}=t,{end:h}=t,f=function(y){var x=o[y];if(x==null)return 1;var b=x,w,N=()=>(w===void 0&&(w=r(x,y)),w);if(y===l-1){var _=e*(b.coordinate+e*N()/2-h);o[y]=b=yr(yr({},b),{},{tickCoord:_>0?b.coordinate-_*e:b.coordinate})}else o[y]=b=yr(yr({},b),{},{tickCoord:b.coordinate});if(b.tickCoord!=null){var E=td(e,b.tickCoord,N,c,h);E&&(h=b.tickCoord-e*(N()/2+i),o[y]=yr(yr({},b),{},{isShow:!0}))}},p=l-1;p>=0;p--)f(p);return o}function zee(e,t,r,n,i,o){var l=(n||[]).slice(),c=l.length,{start:h,end:f}=t;if(o){var p=n[c-1];if(p!=null){var g=r(p,c-1),y=e*(p.coordinate+e*g/2-f);if(l[c-1]=p=yr(yr({},p),{},{tickCoord:y>0?p.coordinate-y*e:p.coordinate}),p.tickCoord!=null){var x=td(e,p.tickCoord,()=>g,h,f);x&&(f=p.tickCoord-e*(g/2+i),l[c-1]=yr(yr({},p),{},{isShow:!0}))}}}for(var b=o?c-1:c,w=function(E){var T=l[E];if(T==null)return 1;var A=T,C,R=()=>(C===void 0&&(C=r(T,E)),C);if(E===0){var D=e*(A.coordinate-e*R()/2-h);l[E]=A=yr(yr({},A),{},{tickCoord:D<0?A.coordinate-D*e:A.coordinate})}else l[E]=A=yr(yr({},A),{},{tickCoord:A.coordinate});if(A.tickCoord!=null){var M=td(e,A.tickCoord,R,h,f);M&&(h=A.tickCoord+e*(R()/2+i),l[E]=yr(yr({},A),{},{isShow:!0}))}},N=0;N<b;N++)w(N);return l}function Qw(e,t,r){var{tick:n,ticks:i,viewBox:o,minTickGap:l,orientation:c,interval:h,tickFormatter:f,unit:p,angle:g}=e;if(!i||!i.length||!n)return[];if(ge(h)||Sd.isSsr){var y;return(y=Ree(i,ge(h)?h:0))!==null&&y!==void 0?y:[]}var x=[],b=c==="top"||c==="bottom"?"width":"height",w=p&&b==="width"?Ac(p,{fontSize:t,letterSpacing:r}):{width:0,height:0},N=(C,R)=>{var D=typeof f=="function"?f(C.value,R):C.value;return b==="width"?Cee(Ac(D,{fontSize:t,letterSpacing:r}),w,g):Ac(D,{fontSize:t,letterSpacing:r})[b]},_=i[0],E=i[1],T=i.length>=2&&_!=null&&E!=null?Br(E.coordinate-_.coordinate):1,A=Pee(o,T,b);return h==="equidistantPreserveStart"?Mee(T,A,N,i,l):h==="equidistantPreserveEnd"?Dee(T,A,N,i,l):(h==="preserveStart"||h==="preserveStartEnd"?x=zee(T,A,N,i,l,h==="preserveStartEnd"):x=Iee(T,A,N,i,l),x.filter(C=>C.isShow))}var Bee=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:i=0,tickMargin:o=0}=e,l=0;if(t){Array.from(t).forEach(p=>{if(p){var g=p.getBoundingClientRect();g.width>l&&(l=g.width)}});var c=r?r.getBoundingClientRect().width:0,h=i+o,f=l+h+c+(r?n:0);return Math.round(f)}return 0},Uee={xAxis:{},yAxis:{}},Ik=br({name:"renderedTicks",initialState:Uee,reducers:{setRenderedTicks:(e,t)=>{var{axisType:r,axisId:n,ticks:i}=t.payload;e[r][n]=i},removeRenderedTicks:(e,t)=>{var{axisType:r,axisId:n}=t.payload;delete e[r][n]}}}),{setRenderedTicks:qee,removeRenderedTicks:Fee}=Ik.actions,Hee=Ik.reducer,Kee=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function Gee(e,t){if(e==null)return{};var r,n,i=Yee(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Yee(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function co(){return co=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},co.apply(null,arguments)}function UP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?UP(Object(r),!0).forEach(function(n){Vee(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vee(e,t,r){return(t=Qee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qee(e){var t=Xee(e,"string");return typeof t=="symbol"?t:t+""}function Xee(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ka={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Gt.axis};function Wee(e){var{x:t,y:r,width:n,height:i,orientation:o,mirror:l,axisLine:c,otherSvgProps:h}=e;if(!c)return null;var f=xt(xt(xt({},h),zn(c)),{},{fill:"none"});if(o==="top"||o==="bottom"){var p=+(o==="top"&&!l||o==="bottom"&&l);f=xt(xt({},f),{},{x1:t,y1:r+p*i,x2:t+n,y2:r+p*i})}else{var g=+(o==="left"&&!l||o==="right"&&l);f=xt(xt({},f),{},{x1:t+g*n,y1:r,x2:t+g*n,y2:r+i})}return S.createElement("line",co({},f,{className:Xe("recharts-cartesian-axis-line",Hl(c,"className"))}))}function Zee(e,t,r,n,i,o,l,c,h){var f,p,g,y,x,b,w=c?-1:1,N=e.tickSize||l,_=ge(e.tickCoord)?e.tickCoord:e.coordinate;switch(o){case"top":f=p=e.coordinate,y=r+ +!c*i,g=y-w*N,b=g-w*h,x=_;break;case"left":g=y=e.coordinate,p=t+ +!c*n,f=p-w*N,x=f-w*h,b=_;break;case"right":g=y=e.coordinate,p=t+ +c*n,f=p+w*N,x=f+w*h,b=_;break;default:f=p=e.coordinate,y=r+ +c*i,g=y+w*N,b=g+w*h,x=_;break}return{line:{x1:f,y1:g,x2:p,y2:y},tick:{x,y:b}}}function Jee(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function ete(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function tte(e){var{option:t,tickProps:r,value:n}=e,i,o=Xe(r.className,"recharts-cartesian-axis-tick-value");if(S.isValidElement(t))i=S.cloneElement(t,xt(xt({},r),{},{className:o}));else if(typeof t=="function")i=t(xt(xt({},r),{},{className:o}));else{var l="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(l=Xe(l,iJ(t))),i=S.createElement(Gw,co({},r,{className:l}),n)}return i}function rte(e){var{ticks:t,axisType:r,axisId:n}=e,i=ct();return S.useEffect(()=>{if(n==null||r==null)return go;var o=t.map(l=>({value:l.value,coordinate:l.coordinate,offset:l.offset,index:l.index}));return i(qee({ticks:o,axisId:n,axisType:r})),()=>{i(Fee({axisId:n,axisType:r}))}},[i,t,n,r]),null}var nte=S.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:i,stroke:o,tickFormatter:l,unit:c,padding:h,tickTextProps:f,orientation:p,mirror:g,x:y,y:x,width:b,height:w,tickSize:N,tickMargin:_,fontSize:E,letterSpacing:T,getTicksConfig:A,events:C,axisType:R,axisId:D}=e,M=Qw(xt(xt({},A),{},{ticks:r}),E,T),z=zn(A),k=gd(n),H=ck(z.textAnchor)?z.textAnchor:Jee(p,g),U=ete(p,g),ae={};typeof i=="object"&&(ae=i);var Z=xt(xt({},z),{},{fill:"none"},ae),G=M.map(J=>xt({entry:J},Zee(J,y,x,b,w,p,N,g,_))),L=G.map(J=>{var{entry:re,line:oe}=J;return S.createElement(sn,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(re.value,"-").concat(re.coordinate,"-").concat(re.tickCoord)},i&&S.createElement("line",co({},Z,oe,{className:Xe("recharts-cartesian-axis-tick-line",Hl(i,"className"))})))}),F=G.map((J,re)=>{var oe,$,{entry:X,tick:le}=J,ue=xt(xt(xt(xt({verticalAnchor:U},z),{},{textAnchor:H,stroke:"none",fill:o},le),{},{index:re,payload:X,visibleTicksCount:M.length,tickFormatter:l,padding:h},f),{},{angle:(oe=($=f==null?void 0:f.angle)!==null&&$!==void 0?$:z.angle)!==null&&oe!==void 0?oe:0}),pe=xt(xt({},ue),k);return S.createElement(sn,co({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(X.value,"-").concat(X.coordinate,"-").concat(X.tickCoord)},sp(C,X,re)),n&&S.createElement(tte,{option:n,tickProps:pe,value:"".concat(typeof l=="function"?l(X.value,re):X.value).concat(c||"")}))});return S.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(R,"-ticks")},S.createElement(rte,{ticks:M,axisId:D,axisType:R}),F.length>0&&S.createElement(Cn,{zIndex:Gt.label},S.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(R,"-tick-labels"),ref:t},F)),L.length>0&&S.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(R,"-tick-lines")},L))}),ate=S.forwardRef((e,t)=>{var{axisLine:r,width:n,height:i,className:o,hide:l,ticks:c,axisType:h,axisId:f}=e,p=Gee(e,Kee),[g,y]=S.useState(""),[x,b]=S.useState(""),w=S.useRef(null);S.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var _;return Bee({ticks:w.current,label:(_=e.labelRef)===null||_===void 0?void 0:_.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var N=S.useCallback(_=>{if(_){var E=_.getElementsByClassName("recharts-cartesian-axis-tick-value");w.current=E;var T=E[0];if(T){var A=window.getComputedStyle(T),C=A.fontSize,R=A.letterSpacing;(C!==g||R!==x)&&(y(C),b(R))}}},[g,x]);return l||n!=null&&n<=0||i!=null&&i<=0?null:S.createElement(Cn,{zIndex:e.zIndex},S.createElement(sn,{className:Xe("recharts-cartesian-axis",o)},S.createElement(Wee,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:zn(e)}),S.createElement(nte,{ref:N,axisType:h,events:p,fontSize:g,getTicksConfig:e,height:e.height,letterSpacing:x,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:c,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:f}),S.createElement(BZ,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},S.createElement(XZ,{label:e.label,labelRef:e.labelRef}),e.children)))}),Xw=S.forwardRef((e,t)=>{var r=fr(e,Ka);return S.createElement(ate,co({},r,{ref:t}))});Xw.displayName="CartesianAxis";var ite=["x1","y1","x2","y2","key"],ste=["offset"],ote=["xAxisId","yAxisId"],lte=["xAxisId","yAxisId"];function qP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qP(Object(r),!0).forEach(function(n){ute(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ute(e,t,r){return(t=cte(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cte(e){var t=dte(e,"string");return typeof t=="symbol"?t:t+""}function dte(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $s(){return $s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$s.apply(null,arguments)}function Bm(e,t){if(e==null)return{};var r,n,i=fte(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function fte(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var hte=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:i,width:o,height:l,ry:c}=e;return S.createElement("rect",{x:n,y:i,ry:c,width:o,height:l,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function zk(e){var{option:t,lineItemProps:r}=e,n;if(S.isValidElement(t))n=S.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var i,{x1:o,y1:l,x2:c,y2:h,key:f}=r,p=Bm(r,ite),g=(i=zn(p))!==null&&i!==void 0?i:{},{offset:y}=g,x=Bm(g,ste);n=S.createElement("line",$s({},x,{x1:o,y1:l,x2:c,y2:h,fill:"none",key:f}))}return n}function mte(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:o,yAxisId:l}=e,c=Bm(e,ote),h=i.map((f,p)=>{var g=vr(vr({},c),{},{x1:t,y1:f,x2:t+r,y2:f,key:"line-".concat(p),index:p});return S.createElement(zk,{key:"line-".concat(p),option:n,lineItemProps:g})});return S.createElement("g",{className:"recharts-cartesian-grid-horizontal"},h)}function pte(e){var{y:t,height:r,vertical:n=!0,verticalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:o,yAxisId:l}=e,c=Bm(e,lte),h=i.map((f,p)=>{var g=vr(vr({},c),{},{x1:f,y1:t,x2:f,y2:t+r,key:"line-".concat(p),index:p});return S.createElement(zk,{option:n,lineItemProps:g,key:"line-".concat(p)})});return S.createElement("g",{className:"recharts-cartesian-grid-vertical"},h)}function gte(e){var{horizontalFill:t,fillOpacity:r,x:n,y:i,width:o,height:l,horizontalPoints:c,horizontal:h=!0}=e;if(!h||!t||!t.length||c==null)return null;var f=c.map(g=>Math.round(g+i-i)).sort((g,y)=>g-y);i!==f[0]&&f.unshift(0);var p=f.map((g,y)=>{var x=f[y+1],b=x==null,w=b?i+l-g:x-g;if(w<=0)return null;var N=y%t.length;return S.createElement("rect",{key:"react-".concat(y),y:g,x:n,height:w,width:o,stroke:"none",fill:t[N],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},p)}function yte(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:i,y:o,width:l,height:c,verticalPoints:h}=e;if(!t||!r||!r.length)return null;var f=h.map(g=>Math.round(g+i-i)).sort((g,y)=>g-y);i!==f[0]&&f.unshift(0);var p=f.map((g,y)=>{var x=f[y+1],b=x==null,w=b?i+l-g:x-g;if(w<=0)return null;var N=y%r.length;return S.createElement("rect",{key:"react-".concat(y),x:g,y:o,width:w,height:c,stroke:"none",fill:r[N],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return S.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var vte=(e,t)=>{var{xAxis:r,width:n,height:i,offset:o}=e;return h3(Qw(vr(vr(vr({},Ka),r),{},{ticks:m3(r),viewBox:{x:0,y:0,width:n,height:i}})),o.left,o.left+o.width,t)},xte=(e,t)=>{var{yAxis:r,width:n,height:i,offset:o}=e;return h3(Qw(vr(vr(vr({},Ka),r),{},{ticks:m3(r),viewBox:{x:0,y:0,width:n,height:i}})),o.top,o.top+o.height,t)},bte={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Gt.grid};function Gp(e){var t=Uj(),r=qj(),n=x3(),i=vr(vr({},fr(e,bte)),{},{x:ge(e.x)?e.x:n.left,y:ge(e.y)?e.y:n.top,width:ge(e.width)?e.width:n.width,height:ge(e.height)?e.height:n.height}),{xAxisId:o,yAxisId:l,x:c,y:h,width:f,height:p,syncWithTicks:g,horizontalValues:y,verticalValues:x}=i,b=jr(),w=ve(z=>zC(z,"xAxis",o,b)),N=ve(z=>zC(z,"yAxis",l,b));if(!ca(f)||!ca(p)||!ge(c)||!ge(h))return null;var _=i.verticalCoordinatesGenerator||vte,E=i.horizontalCoordinatesGenerator||xte,{horizontalPoints:T,verticalPoints:A}=i;if((!T||!T.length)&&typeof E=="function"){var C=y&&y.length,R=E({yAxis:N?vr(vr({},N),{},{ticks:C?y:N.ticks}):void 0,width:t??f,height:r??p,offset:n},C?!0:g);dm(Array.isArray(R),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof R,"]")),Array.isArray(R)&&(T=R)}if((!A||!A.length)&&typeof _=="function"){var D=x&&x.length,M=_({xAxis:w?vr(vr({},w),{},{ticks:D?x:w.ticks}):void 0,width:t??f,height:r??p,offset:n},D?!0:g);dm(Array.isArray(M),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof M,"]")),Array.isArray(M)&&(A=M)}return S.createElement(Cn,{zIndex:i.zIndex},S.createElement("g",{className:"recharts-cartesian-grid"},S.createElement(hte,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),S.createElement(gte,$s({},i,{horizontalPoints:T})),S.createElement(yte,$s({},i,{verticalPoints:A})),S.createElement(mte,$s({},i,{offset:n,horizontalPoints:T,xAxis:w,yAxis:N})),S.createElement(pte,$s({},i,{offset:n,verticalPoints:A,xAxis:w,yAxis:N}))))}Gp.displayName="CartesianGrid";var jte={},Bk=br({name:"errorBars",initialState:jte,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:i}=t.payload;e[r]&&(e[r]=e[r].map(o=>o.dataKey===n.dataKey&&o.direction===n.direction?i:o))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(i=>i.dataKey!==n.dataKey||i.direction!==n.direction))}}}),{addErrorBar:Ule,replaceErrorBar:qle,removeErrorBar:Fle}=Bk.actions,wte=Bk.reducer,Ste=["children"];function Nte(e,t){if(e==null)return{};var r,n,i=_te(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _te(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Ote={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},Ete=S.createContext(Ote);function Uk(e){var{children:t}=e,r=Nte(e,Ste);return S.createElement(Ete.Provider,{value:r},t)}function Ww(e,t){var r,n,i=ve(f=>ei(f,e)),o=ve(f=>ti(f,t)),l=(r=i==null?void 0:i.allowDataOverflow)!==null&&r!==void 0?r:Lt.allowDataOverflow,c=(n=o==null?void 0:o.allowDataOverflow)!==null&&n!==void 0?n:$t.allowDataOverflow,h=l||c;return{needClip:h,needClipX:l,needClipY:c}}function qk(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,i=Vw(),{needClipX:o,needClipY:l,needClip:c}=Ww(t,r);if(!c||!i)return null;var{x:h,y:f,width:p,height:g}=i;return S.createElement("clipPath",{id:"clipPath-".concat(n)},S.createElement("rect",{x:o?h:h-p/2,y:l?f:f-g/2,width:o?p:p*2,height:l?g:g*2}))}var Fk=(e,t,r,n)=>es(e,"xAxis",t,n),Hk=(e,t,r,n)=>Ji(e,"xAxis",t,n),Kk=(e,t,r,n)=>es(e,"yAxis",r,n),Gk=(e,t,r,n)=>Ji(e,"yAxis",r,n),Ate=Q([We,Fk,Kk,Hk,Gk],(e,t,r,n,i)=>Xa(e,"xAxis")?Gl(t,n,!1):Gl(r,i,!1)),Tte=(e,t,r,n,i)=>i;function Cte(e){return e.type==="line"}var Pte=Q([qp,Tte],(e,t)=>e.filter(Cte).find(r=>r.id===t)),Rte=Q([We,Fk,Kk,Hk,Gk,Pte,Ate,Nd],(e,t,r,n,i,o,l,c)=>{var{chartData:h,dataStartIndex:f,dataEndIndex:p}=c;if(!(o==null||t==null||r==null||n==null||i==null||n.length===0||i.length===0||l==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:g,data:y}=o,x;if(y!=null&&y.length>0?x=y:x=h==null?void 0:h.slice(f,p+1),x!=null)return Jte({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataKey:g,bandSize:l,displayedData:x})}});function Mte(e){var t=gd(e),r=3,n=2;if(t!=null){var{r:i,strokeWidth:o}=t,l=Number(i),c=Number(o);return(Number.isNaN(l)||l<0)&&(l=r),(Number.isNaN(c)||c<0)&&(c=n),{r:l,strokeWidth:c}}return{r,strokeWidth:n}}var Dte=["id"],kte=["type","layout","connectNulls","needClip","shape"],Lte=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function rd(){return rd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rd.apply(null,arguments)}function FP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function na(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?FP(Object(r),!0).forEach(function(n){$te(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):FP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $te(e,t,r){return(t=Ite(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ite(e){var t=zte(e,"string");return typeof t=="symbol"?t:t+""}function zte(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zw(e,t){if(e==null)return{};var r,n,i=Bte(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Bte(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Ute=e=>{var{dataKey:t,name:r,stroke:n,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:n,value:yp(r,t),payload:e}]},qte=S.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:o,name:l,hide:c,unit:h,tooltipType:f,id:p}=e,g={dataDefinedOnItem:r,getPosition:go,settings:{stroke:n,strokeWidth:i,fill:o,dataKey:t,nameKey:void 0,name:yp(l,t),hide:c,type:f,color:n,unit:h,graphicalItemId:p}};return S.createElement(Ak,{tooltipEntrySettings:g})}),Yk=(e,t)=>"".concat(t,"px ").concat(e,"px");function Fte(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],i=0;i<t;++i)n.push(...r);return n}var Hte=(e,t,r)=>{var n=r.reduce((y,x)=>y+x,0);if(!n)return Yk(t,e);for(var i=Math.floor(e/n),o=e%n,l=[],c=0,h=0;c<r.length;h+=(f=r[c])!==null&&f!==void 0?f:0,++c){var f,p=r[c];if(p!=null&&h+p>o){l=[...r.slice(0,c),o-h];break}}var g=l.length%2===0?[0,t]:[t];return[...Fte(r,i),...l,...g].map(y=>"".concat(y,"px")).join(", ")};function Kte(e){var{clipPathId:t,points:r,props:n}=e,{dot:i,dataKey:o,needClip:l}=n,{id:c}=n,h=Zw(n,Dte),f=zn(h);return S.createElement(GJ,{points:r,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:o,baseProps:f,needClip:l,clipPathId:t})}function Gte(e){var{showLabels:t,children:r,points:n}=e,i=S.useMemo(()=>n==null?void 0:n.map(o=>{var l,c,h={x:(l=o.x)!==null&&l!==void 0?l:0,y:(c=o.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return na(na({},h),{},{value:o.value,payload:o.payload,viewBox:h,parentViewBox:void 0,fill:void 0})}),[n]);return S.createElement(yk,{value:t?i:void 0},r)}function HP(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:i,props:o}=e,{type:l,layout:c,connectNulls:h,needClip:f,shape:p}=o,g=Zw(o,kte),y=na(na({},Er(g)),{},{fill:"none",className:"recharts-line-curve",clipPath:f?"url(#clipPath-".concat(t,")"):void 0,points:n,type:l,layout:c,connectNulls:h,strokeDasharray:i??o.strokeDasharray});return S.createElement(S.Fragment,null,(n==null?void 0:n.length)>1&&S.createElement(Nk,rd({shapeType:"curve",option:p},y,{pathRef:r})),S.createElement(Kte,{points:n,clipPathId:t,props:o}))}function Yte(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Vte(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:i,longestAnimatedLengthRef:o}=e,{points:l,strokeDasharray:c,isAnimationActive:h,animationBegin:f,animationDuration:p,animationEasing:g,animateNewValues:y,width:x,height:b,onAnimationEnd:w,onAnimationStart:N}=r,_=i.current,E=Ep(l,"recharts-line-"),T=S.useRef(E),[A,C]=S.useState(!1),R=!A,D=S.useCallback(()=>{typeof w=="function"&&w(),C(!1)},[w]),M=S.useCallback(()=>{typeof N=="function"&&N(),C(!0)},[N]),z=Yte(n.current),k=S.useRef(0);T.current!==E&&(k.current=o.current,T.current=E);var H=k.current;return S.createElement(Gte,{points:l,showLabels:R},r.children,S.createElement(Op,{animationId:E,begin:f,duration:p,isActive:h,easing:g,onAnimationEnd:D,onAnimationStart:M,key:E},U=>{var ae=jt(H,z+H,U),Z=Math.min(ae,z),G;if(h)if(c){var L="".concat(c).split(/[,\s]+/gim).map(re=>parseFloat(re));G=Hte(Z,z,L)}else G=Yk(z,Z);else G=c==null?void 0:String(c);if(U>0&&z>0&&(i.current=l,o.current=Math.max(o.current,Z)),_){var F=_.length/l.length,J=U===1?l:l.map((re,oe)=>{var $=Math.floor(oe*F);if(_[$]){var X=_[$];return na(na({},re),{},{x:jt(X.x,re.x,U),y:jt(X.y,re.y,U)})}return y?na(na({},re),{},{x:jt(x*2,re.x,U),y:jt(b/2,re.y,U)}):na(na({},re),{},{x:re.x,y:re.y})});return i.current=J,S.createElement(HP,{props:r,points:J,clipPathId:t,pathRef:n,strokeDasharray:G})}return S.createElement(HP,{props:r,points:l,clipPathId:t,pathRef:n,strokeDasharray:G})}),S.createElement(xk,{label:r.label}))}function Qte(e){var{clipPathId:t,props:r}=e,n=S.useRef(null),i=S.useRef(0),o=S.useRef(null);return S.createElement(Vte,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:i,pathRef:o})}var Xte=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:Ot(e.payload,t)}};class Wte extends S.Component{render(){var{hide:t,dot:r,points:n,className:i,xAxisId:o,yAxisId:l,top:c,left:h,width:f,height:p,id:g,needClip:y,zIndex:x}=this.props;if(t)return null;var b=Xe("recharts-line",i),w=g,{r:N,strokeWidth:_}=Mte(r),E=Sk(r),T=N*2+_,A=y?"url(#clipPath-".concat(E?"":"dots-").concat(w,")"):void 0;return S.createElement(Cn,{zIndex:x},S.createElement(sn,{className:b},y&&S.createElement("defs",null,S.createElement(qk,{clipPathId:w,xAxisId:o,yAxisId:l}),!E&&S.createElement("clipPath",{id:"clipPath-dots-".concat(w)},S.createElement("rect",{x:h-T/2,y:c-T/2,width:f+T,height:p+T}))),S.createElement(Uk,{xAxisId:o,yAxisId:l,data:n,dataPointFormatter:Xte,errorBarOffset:0},S.createElement(Qte,{props:this.props,clipPathId:w}))),S.createElement(fee,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:A}))}}var Vk={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Gt.line,type:"linear"};function Zte(e){var t=fr(e,Vk),{activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:o,animationEasing:l,connectNulls:c,dot:h,hide:f,isAnimationActive:p,label:g,legendType:y,xAxisId:x,yAxisId:b,id:w}=t,N=Zw(t,Lte),{needClip:_}=Ww(x,b),E=Vw(),T=yo(),A=jr(),C=ve(k=>Rte(k,x,b,A,w));if(T!=="horizontal"&&T!=="vertical"||C==null||E==null)return null;var{height:R,width:D,x:M,y:z}=E;return S.createElement(Wte,rd({},N,{id:w,connectNulls:c,dot:h,activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:o,animationEasing:l,isAnimationActive:p,hide:f,label:g,legendType:y,xAxisId:x,yAxisId:b,points:C,layout:T,height:R,width:D,left:M,top:z,needClip:_}))}function Jte(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:o,dataKey:l,bandSize:c,displayedData:h}=e;return h.map((f,p)=>{var g=Ot(f,l);if(t==="horizontal"){var y=PA({axis:r,ticks:i,bandSize:c,entry:f,index:p}),x=mt(g)?null:n.scale.map(g);return{x:y,y:x??null,value:g,payload:f}}var b=mt(g)?null:r.scale.map(g),w=PA({axis:n,ticks:o,bandSize:c,entry:f,index:p});return b==null||w==null?null:{x:b,y:w,value:g,payload:f}}).filter(Boolean)}function ere(e){var t=fr(e,Vk),r=jr();return S.createElement(Ck,{id:t.id,type:"line"},n=>S.createElement(S.Fragment,null,S.createElement(Tk,{legendPayload:Ute(t)}),S.createElement(qte,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),S.createElement(Rk,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),S.createElement(Zte,rd({},t,{id:n}))))}var Qk=S.memo(ere,ru);Qk.displayName="Line";function jo(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||n===void 0?void 0:n.xAxisId)!==null&&r!==void 0?r:Mk}function wo(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||n===void 0?void 0:n.yAxisId)!==null&&r!==void 0?r:Mk}var tre="Invariant failed";function rre(e,t){throw new Error(tre)}function Rb(){return Rb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rb.apply(null,arguments)}function Jw(e){return S.createElement(Nk,Rb({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},e))}var nre=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,i)=>{if(ge(t))return t;var o=ge(n)||mt(n);return o?t(n,i):(o||rre(),r)}},are=(e,t,r)=>r,ire=(e,t)=>t,Dd=Q([qp,ire],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),sre=Q([Dd],e=>e==null?void 0:e.maxBarSize),ore=(e,t,r,n)=>n,lre=Q([We,qp,jo,wo,are],(e,t,r,n,i)=>t.filter(o=>e==="horizontal"?o.xAxisId===r:o.yAxisId===n).filter(o=>o.isPanorama===i).filter(o=>o.hide===!1).filter(o=>o.type==="bar")),ure=(e,t,r)=>{var n=We(e),i=jo(e,t),o=wo(e,t);if(!(i==null||o==null))return n==="horizontal"?Eb(e,"yAxis",o,r):Eb(e,"xAxis",i,r)},cre=(e,t)=>{var r=We(e),n=jo(e,t),i=wo(e,t);if(!(n==null||i==null))return r==="horizontal"?IC(e,"xAxis",n):IC(e,"yAxis",i)},dre=Q([lre,YK,cre],hee),fre=(e,t,r)=>{var n,i,o=Dd(e,t);if(o==null)return 0;var l=jo(e,t),c=wo(e,t);if(l==null||c==null)return 0;var h=We(e),f=J3(e),{maxBarSize:p}=o,g=mt(p)?f:p,y,x;return h==="horizontal"?(y=es(e,"xAxis",l,r),x=Ji(e,"xAxis",l,r)):(y=es(e,"yAxis",c,r),x=Ji(e,"yAxis",c,r)),(n=(i=Gl(y,x,!0))!==null&&i!==void 0?i:g)!==null&&n!==void 0?n:0},Xk=(e,t,r)=>{var n=We(e),i=jo(e,t),o=wo(e,t);if(!(i==null||o==null)){var l,c;return n==="horizontal"?(l=es(e,"xAxis",i,r),c=Ji(e,"xAxis",i,r)):(l=es(e,"yAxis",o,r),c=Ji(e,"yAxis",o,r)),Gl(l,c)}},hre=Q([dre,J3,GK,e4,fre,Xk,sre],vee),mre=(e,t,r)=>{var n=jo(e,t);if(n!=null)return es(e,"xAxis",n,r)},pre=(e,t,r)=>{var n=wo(e,t);if(n!=null)return es(e,"yAxis",n,r)},gre=(e,t,r)=>{var n=jo(e,t);if(n!=null)return Ji(e,"xAxis",n,r)},yre=(e,t,r)=>{var n=wo(e,t);if(n!=null)return Ji(e,"yAxis",n,r)},vre=Q([hre,Dd],bee),xre=Q([ure,Dd],xee),bre=Q([Vt,$j,mre,pre,gre,yre,vre,We,IK,Xk,xre,Dd,ore],(e,t,r,n,i,o,l,c,h,f,p,g,y)=>{var{chartData:x,dataStartIndex:b,dataEndIndex:w}=h;if(!(g==null||l==null||t==null||c!=="horizontal"&&c!=="vertical"||r==null||n==null||i==null||o==null||f==null)){var{data:N}=g,_;if(N!=null&&N.length>0?_=N:_=x==null?void 0:x.slice(b,w+1),_!=null)return Vre({layout:c,barSettings:g,pos:l,parentViewBox:t,bandSize:f,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:o,stackedData:p,displayedData:_,offset:e,cells:y,dataStartIndex:b})}}),jre=["index"];function Mb(){return Mb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mb.apply(null,arguments)}function wre(e,t){if(e==null)return{};var r,n,i=Sre(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Sre(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Wk=S.createContext(void 0),Nre=e=>{var t=S.useContext(Wk);if(t!=null)return t.stackId;if(e!=null)return P7(e)},_re=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),Ore=e=>{var t=S.useContext(Wk);if(t!=null){var{stackId:r}=t;return"url(#".concat(_re(r,e),")")}},Zk=e=>{var{index:t}=e,r=wre(e,jre),n=Ore(t);return S.createElement(sn,Mb({className:"recharts-bar-stack-layer",clipPath:n},r))},Ere=["onMouseEnter","onMouseLeave","onClick"],Are=["value","background","tooltipPosition"],Tre=["id"],Cre=["onMouseEnter","onClick","onMouseLeave"];function ts(){return ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ts.apply(null,arguments)}function KP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Nr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KP(Object(r),!0).forEach(function(n){Pre(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Pre(e,t,r){return(t=Rre(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rre(e){var t=Mre(e,"string");return typeof t=="symbol"?t:t+""}function Mre(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Um(e,t){if(e==null)return{};var r,n,i=Dre(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Dre(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var kre=e=>{var{dataKey:t,name:r,fill:n,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:n,value:yp(r,t),payload:e}]},Lre=S.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:i,name:o,hide:l,unit:c,tooltipType:h,id:f}=e,p={dataDefinedOnItem:void 0,getPosition:go,settings:{stroke:r,strokeWidth:n,fill:i,dataKey:t,nameKey:void 0,name:yp(o,t),hide:l,type:h,color:i,unit:c,graphicalItemId:f}};return S.createElement(Ak,{tooltipEntrySettings:p})});function $re(e){var t=ve(uo),{data:r,dataKey:n,background:i,allOtherBarProps:o}=e,{onMouseEnter:l,onMouseLeave:c,onClick:h}=o,f=Um(o,Ere),p=_k(l,n,o.id),g=Ok(c),y=Ek(h,n,o.id);if(!i||r==null)return null;var x=gd(i);return S.createElement(Cn,{zIndex:jee(i,Gt.barBackground)},r.map((b,w)=>{var{value:N,background:_,tooltipPosition:E}=b,T=Um(b,Are);if(!_)return null;var A=p(b,w),C=g(b,w),R=y(b,w),D=Nr(Nr(Nr(Nr(Nr({option:i,isActive:String(w)===t},T),{},{fill:"#eee"},_),x),sp(f,b,w)),{},{onMouseEnter:A,onMouseLeave:C,onClick:R,dataKey:n,index:w,className:"recharts-bar-background-rectangle"});return S.createElement(Jw,ts({key:"background-bar-".concat(w)},D))}))}function Ire(e){var{showLabels:t,children:r,rects:n}=e,i=n==null?void 0:n.map(o=>{var l={x:o.x,y:o.y,width:o.width,lowerWidth:o.width,upperWidth:o.width,height:o.height};return Nr(Nr({},l),{},{value:o.value,payload:o.payload,parentViewBox:o.parentViewBox,viewBox:l,fill:o.fill})});return S.createElement(yk,{value:t?i:void 0},r)}function zre(e){var{shape:t,activeBar:r,baseProps:n,entry:i,index:o,dataKey:l}=e,c=ve(uo),h=ve(VD),f=r&&String(i.originalDataIndex)===c&&(h==null||l===h),[p,g]=S.useState(!1),[y,x]=S.useState(!1);S.useEffect(()=>{var T;return f?(g(!0),T=requestAnimationFrame(()=>{x(!0)})):x(!1),()=>{cancelAnimationFrame(T)}},[f]);var b=S.useCallback(()=>{f||g(!1)},[f]),w=f&&y,N=f||p,_;f?r===!0?_=t:_=r:_=t;var E=S.createElement(Jw,ts({},n,{name:String(n.name)},i,{isActive:w,option:_,index:o,dataKey:l,onTransitionEnd:b}));return N?S.createElement(Cn,{zIndex:Gt.activeBar},S.createElement(Zk,{index:i.originalDataIndex},E)):E}function Bre(e){var{shape:t,baseProps:r,entry:n,index:i,dataKey:o}=e;return S.createElement(Jw,ts({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:i,dataKey:o}))}function Ure(e){var t,{data:r,props:n}=e,i=(t=zn(n))!==null&&t!==void 0?t:{},{id:o}=i,l=Um(i,Tre),{shape:c,dataKey:h,activeBar:f}=n,{onMouseEnter:p,onClick:g,onMouseLeave:y}=n,x=Um(n,Cre),b=_k(p,h,o),w=Ok(y),N=Ek(g,h,o);return r?S.createElement(S.Fragment,null,r.map((_,E)=>S.createElement(Zk,ts({index:_.originalDataIndex,key:"rectangle-".concat(_==null?void 0:_.x,"-").concat(_==null?void 0:_.y,"-").concat(_==null?void 0:_.value,"-").concat(E),className:"recharts-bar-rectangle"},sp(x,_,E),{onMouseEnter:b(_,E),onMouseLeave:w(_,E),onClick:N(_,E)}),f?S.createElement(zre,{shape:c,activeBar:f,baseProps:l,entry:_,index:E,dataKey:h}):S.createElement(Bre,{shape:c,baseProps:l,entry:_,index:E,dataKey:h})))):null}function qre(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:i,isAnimationActive:o,animationBegin:l,animationDuration:c,animationEasing:h,onAnimationEnd:f,onAnimationStart:p}=t,g=r.current,y=Ep(t,"recharts-bar-"),[x,b]=S.useState(!1),w=!x,N=S.useCallback(()=>{typeof f=="function"&&f(),b(!1)},[f]),_=S.useCallback(()=>{typeof p=="function"&&p(),b(!0)},[p]);return S.createElement(Ire,{showLabels:w,rects:n},S.createElement(Op,{animationId:y,begin:l,duration:c,isActive:o,easing:h,onAnimationEnd:N,onAnimationStart:_,key:y},E=>{var T=E===1?n:n==null?void 0:n.map((A,C)=>{var R=g&&g[C];if(R)return Nr(Nr({},A),{},{x:jt(R.x,A.x,E),y:jt(R.y,A.y,E),width:jt(R.width,A.width,E),height:jt(R.height,A.height,E)});if(i==="horizontal"){var D=jt(0,A.height,E),M=jt(A.stackedBarStart,A.y,E);return Nr(Nr({},A),{},{y:M,height:D})}var z=jt(0,A.width,E),k=jt(A.stackedBarStart,A.x,E);return Nr(Nr({},A),{},{width:z,x:k})});return E>0&&(r.current=T??null),T==null?null:S.createElement(sn,null,S.createElement(Ure,{props:t,data:T}))}),S.createElement(xk,{label:t.label}),t.children)}function Fre(e){var t=S.useRef(null);return S.createElement(qre,{previousRectanglesRef:t,props:e})}var Jk=0,Hre=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:Ot(e,t)}};class Kre extends S.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:i,xAxisId:o,yAxisId:l,needClip:c,background:h,id:f}=this.props;if(t||r==null)return null;var p=Xe("recharts-bar",i),g=f;return S.createElement(sn,{className:p,id:f},c&&S.createElement("defs",null,S.createElement(qk,{clipPathId:g,xAxisId:o,yAxisId:l})),S.createElement(sn,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(g,")"):void 0},S.createElement($re,{data:r,dataKey:n,background:h,allOtherBarProps:this.props}),S.createElement(Fre,this.props)))}}var Gre={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:Jk,xAxisId:0,yAxisId:0,zIndex:Gt.bar};function Yre(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:o,activeBar:l,animationBegin:c,animationDuration:h,animationEasing:f,isAnimationActive:p}=e,{needClip:g}=Ww(t,r),y=yo(),x=jr(),b=uJ(e.children,Kw),w=ve(E=>bre(E,e.id,x,b));if(y!=="vertical"&&y!=="horizontal")return null;var N,_=w==null?void 0:w[0];return _==null||_.height==null||_.width==null?N=0:N=y==="vertical"?_.height/2:_.width/2,S.createElement(Uk,{xAxisId:t,yAxisId:r,data:w,dataPointFormatter:Hre,errorBarOffset:N},S.createElement(Kre,ts({},e,{layout:y,needClip:g,data:w,xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:o,activeBar:l,animationBegin:c,animationDuration:h,animationEasing:f,isAnimationActive:p})))}function Vre(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n,hasCustomShape:i},pos:o,bandSize:l,xAxis:c,yAxis:h,xAxisTicks:f,yAxisTicks:p,stackedData:g,displayedData:y,offset:x,cells:b,parentViewBox:w,dataStartIndex:N}=e,_=t==="horizontal"?h:c,E=g?_.scale.domain():null,T=R7({numericAxis:_}),A=_.scale.map(T);return y.map((C,R)=>{var D,M,z,k,H,U;if(g){var ae=g[R+N];if(ae==null)return null;D=O7(ae,E)}else D=Ot(C,r),Array.isArray(D)||(D=[T,D]);var Z=nre(n,Jk)(D[1],R);if(t==="horizontal"){var G,L=h.scale.map(D[0]),F=h.scale.map(D[1]);if(L==null||F==null)return null;M=RA({axis:c,ticks:f,bandSize:l,offset:o.offset,entry:C,index:R}),z=(G=F??L)!==null&&G!==void 0?G:void 0,k=o.size;var J=L-F;if(H=la(J)?0:J,U={x:M,y:x.top,width:k,height:x.height},Math.abs(Z)>0&&Math.abs(H)<Math.abs(Z)){var re=Br(H||Z)*(Math.abs(Z)-Math.abs(H));z-=re,H+=re}}else{var oe=c.scale.map(D[0]),$=c.scale.map(D[1]);if(oe==null||$==null)return null;if(M=oe,z=RA({axis:h,ticks:p,bandSize:l,offset:o.offset,entry:C,index:R}),k=$-oe,H=o.size,U={x:x.left,y:z,width:x.width,height:H},Math.abs(Z)>0&&Math.abs(k)<Math.abs(Z)){var X=Br(k||Z)*(Math.abs(Z)-Math.abs(k));k+=X}}if(M==null||z==null||k==null||H==null||!i&&(k===0||H===0))return null;var le=Nr(Nr({},C),{},{stackedBarStart:A,x:M,y:z,width:k,height:H,value:g?D:D[1],payload:C,background:U,tooltipPosition:{x:M+k/2,y:z+H/2},parentViewBox:w,originalDataIndex:R},b&&b[R]&&b[R].props);return le}).filter(Boolean)}function Qre(e){var t=fr(e,Gre),r=Nre(t.stackId),n=jr();return S.createElement(Ck,{id:t.id,type:"bar"},i=>S.createElement(S.Fragment,null,S.createElement(Tk,{legendPayload:kre(t)}),S.createElement(Lre,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:i}),S.createElement(Rk,{type:"bar",id:i,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:r,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:n,hasCustomShape:t.shape!=null}),S.createElement(Cn,{zIndex:t.zIndex},S.createElement(Yre,ts({},t,{id:i})))))}var eS=S.memo(Qre,ru);eS.displayName="Bar";var Xre=["domain","range"],Wre=["domain","range"];function GP(e,t){if(e==null)return{};var r,n,i=Zre(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Zre(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function YP(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function e5(e,t){if(e===t)return!0;var{domain:r,range:n}=e,i=GP(e,Xre),{domain:o,range:l}=t,c=GP(t,Wre);return!YP(r,o)||!YP(n,l)?!1:ru(i,c)}var Jre=["type"],ene=["dangerouslySetInnerHTML","ticks","scale"],tne=["id","scale"];function Db(){return Db=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Db.apply(null,arguments)}function VP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function QP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?VP(Object(r),!0).forEach(function(n){rne(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rne(e,t,r){return(t=nne(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nne(e){var t=ane(e,"string");return typeof t=="symbol"?t:t+""}function ane(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kb(e,t){if(e==null)return{};var r,n,i=ine(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function ine(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function sne(e){var t=ct(),r=S.useRef(null),n=b3(),{type:i}=e,o=kb(e,Jre),l=Cp(n,"xAxis",i),c=S.useMemo(()=>{if(l!=null)return QP(QP({},o),{},{type:l})},[o,l]);return S.useLayoutEffect(()=>{c!=null&&(r.current===null?t(WJ(c)):r.current!==c&&t(ZJ({prev:r.current,next:c})),r.current=c)},[c,t]),S.useLayoutEffect(()=>()=>{r.current&&(t(JJ(r.current)),r.current=null)},[t]),null}var one=e=>{var{xAxisId:t,className:r}=e,n=ve($j),i=jr(),o="xAxis",l=ve(_=>OD(_,o,t,i)),c=ve(_=>SD(_,t)),h=ve(_=>AQ(_,t)),f=ve(_=>K4(_,t));if(c==null||h==null||f==null)return null;var{dangerouslySetInnerHTML:p,ticks:g,scale:y}=e,x=kb(e,ene),{id:b,scale:w}=f,N=kb(f,tne);return S.createElement(Xw,Db({},x,N,{x:h.x,y:h.y,width:c.width,height:c.height,className:Xe("recharts-".concat(o," ").concat(o),r),viewBox:n,ticks:l,axisType:o,axisId:t}))},lne={allowDataOverflow:Lt.allowDataOverflow,allowDecimals:Lt.allowDecimals,allowDuplicatedCategory:Lt.allowDuplicatedCategory,angle:Lt.angle,axisLine:Ka.axisLine,height:Lt.height,hide:!1,includeHidden:Lt.includeHidden,interval:Lt.interval,label:!1,minTickGap:Lt.minTickGap,mirror:Lt.mirror,orientation:Lt.orientation,padding:Lt.padding,reversed:Lt.reversed,scale:Lt.scale,tick:Lt.tick,tickCount:Lt.tickCount,tickLine:Ka.tickLine,tickSize:Ka.tickSize,type:Lt.type,niceTicks:Lt.niceTicks,xAxisId:0},une=e=>{var t=fr(e,lne);return S.createElement(S.Fragment,null,S.createElement(sne,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),S.createElement(one,t))},Yp=S.memo(une,e5);Yp.displayName="XAxis";var cne=["type"],dne=["dangerouslySetInnerHTML","ticks","scale"],fne=["id","scale"];function Lb(){return Lb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Lb.apply(null,arguments)}function XP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function WP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?XP(Object(r),!0).forEach(function(n){hne(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):XP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hne(e,t,r){return(t=mne(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mne(e){var t=pne(e,"string");return typeof t=="symbol"?t:t+""}function pne(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $b(e,t){if(e==null)return{};var r,n,i=gne(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function gne(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function yne(e){var t=ct(),r=S.useRef(null),n=b3(),{type:i}=e,o=$b(e,cne),l=Cp(n,"yAxis",i),c=S.useMemo(()=>{if(l!=null)return WP(WP({},o),{},{type:l})},[l,o]);return S.useLayoutEffect(()=>{c!=null&&(r.current===null?t(eee(c)):r.current!==c&&t(tee({prev:r.current,next:c})),r.current=c)},[c,t]),S.useLayoutEffect(()=>()=>{r.current&&(t(ree(r.current)),r.current=null)},[t]),null}function vne(e){var{yAxisId:t,className:r,width:n,label:i}=e,o=S.useRef(null),l=S.useRef(null),c=ve($j),h=jr(),f=ct(),p="yAxis",g=ve(R=>ND(R,t)),y=ve(R=>CQ(R,t)),x=ve(R=>OD(R,p,t,h)),b=ve(R=>G4(R,t));if(S.useLayoutEffect(()=>{if(!(n!=="auto"||!g||Yw(i)||S.isValidElement(i)||b==null)){var R=o.current;if(R){var D=R.getCalculatedWidth();Math.round(g.width)!==Math.round(D)&&f(nee({id:t,width:D}))}}},[x,g,f,i,t,n,b]),g==null||y==null||b==null)return null;var{dangerouslySetInnerHTML:w,ticks:N,scale:_}=e,E=$b(e,dne),{id:T,scale:A}=b,C=$b(b,fne);return S.createElement(Xw,Lb({},E,C,{ref:o,labelRef:l,x:y.x,y:y.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:g.width,height:g.height,className:Xe("recharts-".concat(p," ").concat(p),r),viewBox:c,ticks:x,axisType:p,axisId:t}))}var xne={allowDataOverflow:$t.allowDataOverflow,allowDecimals:$t.allowDecimals,allowDuplicatedCategory:$t.allowDuplicatedCategory,angle:$t.angle,axisLine:Ka.axisLine,hide:!1,includeHidden:$t.includeHidden,interval:$t.interval,label:!1,minTickGap:$t.minTickGap,mirror:$t.mirror,orientation:$t.orientation,padding:$t.padding,reversed:$t.reversed,scale:$t.scale,tick:$t.tick,tickCount:$t.tickCount,tickLine:Ka.tickLine,tickSize:Ka.tickSize,type:$t.type,niceTicks:$t.niceTicks,width:$t.width,yAxisId:0},bne=e=>{var t=fr(e,xne);return S.createElement(S.Fragment,null,S.createElement(yne,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),S.createElement(vne,t))},Vp=S.memo(bne,e5);Vp.displayName="YAxis";var jne=(e,t)=>t,tS=Q([jne,We,o4,Xt,HD,ri,JX,Vt],sW);function wne(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function rS(e){var t=e.currentTarget.getBoundingClientRect(),r,n;if(wne(e)){var i=e.currentTarget.getBBox();r=i.width>0?t.width/i.width:1,n=i.height>0?t.height/i.height:1}else{var o=e.currentTarget;r=o.offsetWidth>0?t.width/o.offsetWidth:1,n=o.offsetHeight>0?t.height/o.offsetHeight:1}var l=(c,h)=>({relativeX:Math.round((c-t.left)/r),relativeY:Math.round((h-t.top)/n)});return"touches"in e?Array.from(e.touches).map(c=>l(c.clientX,c.clientY)):l(e.clientX,e.clientY)}var t5=on("mouseClick"),r5=xd();r5.startListening({actionCreator:t5,effect:(e,t)=>{var r=e.payload,n=tS(t.getState(),rS(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(GQ({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Ib=on("mouseMove"),n5=xd(),pl=null,_s=null,cx=null;n5.startListening({actionCreator:Ib,effect:(e,t)=>{var r=e.payload,n=t.getState(),{throttleDelay:i,throttledEvents:o}=n.eventSettings,l=o==="all"||(o==null?void 0:o.includes("mousemove"));pl!==null&&(cancelAnimationFrame(pl),pl=null),_s!==null&&(typeof i!="number"||!l)&&(clearTimeout(_s),_s=null),cx=rS(r);var c=()=>{var h=t.getState(),f=Rd(h,h.tooltip.settings.shared);if(!cx){pl=null,_s=null;return}if(f==="axis"){var p=tS(h,cx);(p==null?void 0:p.activeIndex)!=null?t.dispatch(DD({activeIndex:p.activeIndex,activeDataKey:void 0,activeCoordinate:p.activeCoordinate})):t.dispatch(MD())}pl=null,_s=null};if(!l){c();return}i==="raf"?pl=requestAnimationFrame(c):typeof i=="number"&&_s===null&&(_s=setTimeout(c,i))}});function Sne(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var ZP={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},a5=br({name:"rootProps",initialState:ZP,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:ZP.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),Nne=a5.reducer,{updateOptions:_ne}=a5.actions,One=null,Ene={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},i5=br({name:"polarOptions",initialState:One,reducers:Ene}),{updatePolarOptions:Hle}=i5.actions,Ane=i5.reducer,s5=on("keyDown"),o5=on("focus"),l5=on("blur"),Qp=xd(),gl=null,Os=null,bh=null;Qp.startListening({actionCreator:s5,effect:(e,t)=>{bh=e.payload,gl!==null&&(cancelAnimationFrame(gl),gl=null);var r=t.getState(),{throttleDelay:n,throttledEvents:i}=r.eventSettings,o=i==="all"||i.includes("keydown");Os!==null&&(typeof n!="number"||!o)&&(clearTimeout(Os),Os=null);var l=()=>{try{var c=t.getState(),h=c.rootProps.accessibilityLayer!==!1;if(!h)return;var{keyboardInteraction:f}=c.tooltip,p=bh;if(p!=="ArrowRight"&&p!=="ArrowLeft"&&p!=="Enter")return;var g=Ec(f,lo(c),Zl(c),Jl(c)),y=g==null?-1:Number(g),x=!Number.isFinite(y)||y<0,b=ri(c),w=lo(c),N=Rd(c,c.tooltip.settings.shared);if(p==="Enter"){if(x)return;var _=km(c,N,"hover",String(f.index));t.dispatch(Dm({active:!f.active,activeIndex:f.index,activeCoordinate:_}));return}var E=kQ(c),T=E==="left-to-right"?1:-1,A=p==="ArrowRight"?1:-1,C;if(x){var R=Zl(c),D=Jl(c),M=A*T,z=Z=>({active:!1,index:String(Z),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(C=-1,M>0){for(var k=0;k<w.length;k++)if(Ec(z(k),w,R,D)!=null){C=k;break}}else for(var H=w.length-1;H>=0;H--)if(Ec(z(H),w,R,D)!=null){C=H;break}if(C<0)return}else{C=y+A*T;var U=(b==null?void 0:b.length)||w.length;if(U===0||C>=U||C<0)return}var ae=km(c,N,"hover",String(C));t.dispatch(Dm({active:!0,activeIndex:C.toString(),activeCoordinate:ae}))}finally{gl=null,Os=null}};if(!o){l();return}n==="raf"?gl=requestAnimationFrame(l):typeof n=="number"&&Os===null&&(l(),bh=null,Os=setTimeout(()=>{bh?l():(Os=null,gl=null)},n))}});Qp.startListening({actionCreator:o5,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;if(!i.active&&i.index==null){var o="0",l=Rd(r,r.tooltip.settings.shared),c=km(r,l,"hover",String(o));t.dispatch(Dm({active:!0,activeIndex:o,activeCoordinate:c}))}}}});Qp.startListening({actionCreator:l5,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;i.active&&t.dispatch(Dm({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function u5(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(r,n)=>{if(n==="currentTarget")return t;var i=Reflect.get(r,n);return typeof i=="function"?i.bind(r):i}})}var jn=on("externalEvent"),c5=xd(),jh=new Map,bc=new Map,dx=new Map;c5.startListening({actionCreator:jn,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){var i=n.type,o=u5(n);dx.set(i,{handler:r,reactEvent:o});var l=jh.get(i);l!==void 0&&(cancelAnimationFrame(l),jh.delete(i));var c=t.getState(),{throttleDelay:h,throttledEvents:f}=c.eventSettings,p=f,g=p==="all"||(p==null?void 0:p.includes(i)),y=bc.get(i);y!==void 0&&(typeof h!="number"||!g)&&(clearTimeout(y),bc.delete(i));var x=()=>{var N=dx.get(i);try{if(!N)return;var{handler:_,reactEvent:E}=N,T=t.getState(),A={activeCoordinate:$X(T),activeDataKey:VD(T),activeIndex:uo(T),activeLabel:YD(T),activeTooltipIndex:uo(T),isTooltipActive:IX(T)};_&&_(A,E)}finally{jh.delete(i),bc.delete(i),dx.delete(i)}};if(!g){x();return}if(h==="raf"){var b=requestAnimationFrame(x);jh.set(i,b)}else if(typeof h=="number"){if(!bc.has(i)){x();var w=setTimeout(x,h);bc.set(i,w)}}else x()}}});var Tne=Q([cu],e=>e.tooltipItemPayloads),Cne=Q([Tne,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(o=>o.settings.graphicalItemId===r);if(n!=null){var{getPosition:i}=n;if(i!=null)return i(t)}}}),d5=on("touchMove"),f5=xd(),Es=null,Ti=null,JP=null,jc=null;f5.startListening({actionCreator:d5,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){jc=u5(r);var n=t.getState(),{throttleDelay:i,throttledEvents:o}=n.eventSettings,l=o==="all"||o.includes("touchmove");Es!==null&&(cancelAnimationFrame(Es),Es=null),Ti!==null&&(typeof i!="number"||!l)&&(clearTimeout(Ti),Ti=null),JP=Array.from(r.touches).map(h=>rS({clientX:h.clientX,clientY:h.clientY,currentTarget:r.currentTarget}));var c=()=>{if(jc!=null){var h=t.getState(),f=Rd(h,h.tooltip.settings.shared);if(f==="axis"){var p,g=(p=JP)===null||p===void 0?void 0:p[0];if(g==null){Es=null,Ti=null;return}var y=tS(h,g);(y==null?void 0:y.activeIndex)!=null&&t.dispatch(DD({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(f==="item"){var x,b=jc.touches[0];if(document.elementFromPoint==null||b==null)return;var w=document.elementFromPoint(b.clientX,b.clientY);if(!w||!w.getAttribute)return;var N=w.getAttribute(z7),_=(x=w.getAttribute(B7))!==null&&x!==void 0?x:void 0,E=bo(h).find(C=>C.id===_);if(N==null||E==null||_==null)return;var{dataKey:T}=E,A=Cne(h,N,_);t.dispatch(RD({activeDataKey:T,activeIndex:N,activeCoordinate:A,activeGraphicalItemId:_}))}Es=null,Ti=null}};if(!l){c();return}i==="raf"?Es=requestAnimationFrame(c):typeof i=="number"&&Ti===null&&(c(),jc=null,Ti=setTimeout(()=>{jc?c():(Ti=null,Es=null)},i))}}});var h5={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},m5=br({name:"eventSettings",initialState:h5,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:Pne}=m5.actions,Rne=m5.reducer,Mne=IM({brush:See,cartesianAxis:aee,chartData:LW,errorBars:wte,eventSettings:Rne,graphicalItems:LJ,layout:j7,legend:MF,options:PW,polarAxis:aJ,polarOptions:Ane,referenceElements:Eee,renderedTicks:Hee,rootProps:Nne,tooltip:YQ,zIndex:xW}),Dne=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return Gq({reducer:Mne,preloadedState:t,middleware:n=>{var i;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([r5.middleware,n5.middleware,Qp.middleware,c5.middleware,f5.middleware])},enhancers:n=>{var i=n;return typeof n=="function"&&(i=n()),i.concat(JM({type:"raf"}))},devTools:{serialize:{replacer:Sne},name:"recharts-".concat(r)}})};function kne(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=jr(),o=S.useRef(null);if(i)return r;o.current==null&&(o.current=Dne(t,n));var l=Cj;return S.createElement(QF,{context:l,store:o.current},r)}function Lne(e){var{layout:t,margin:r}=e,n=ct(),i=jr();return S.useEffect(()=>{i||(n(v7(t)),n(y7(r)))},[n,i,t,r]),null}var $ne=S.memo(Lne,ru);function Ine(e){var t=ct();return S.useEffect(()=>{t(_ne(e))},[t,e]),null}var zne=e=>{var t=ct();return S.useEffect(()=>{t(Pne(e))},[t,e]),null},Bne=S.memo(zne,ru);function e2(e){var{zIndex:t,isPanorama:r}=e,n=S.useRef(null),i=ct();return S.useLayoutEffect(()=>(n.current&&i(yW({zIndex:t,element:n.current,isPanorama:r})),()=>{i(vW({zIndex:t,isPanorama:r}))}),[i,t,r]),S.createElement("g",{tabIndex:-1,ref:n,className:"recharts-zIndex-layer_".concat(t)})}function t2(e){var{children:t,isPanorama:r}=e,n=ve(lW);if(!n||n.length===0)return t;var i=n.filter(l=>l<0),o=n.filter(l=>l>0);return S.createElement(S.Fragment,null,i.map(l=>S.createElement(e2,{key:l,zIndex:l,isPanorama:r})),t,o.map(l=>S.createElement(e2,{key:l,zIndex:l,isPanorama:r})))}var Une=["children"];function qne(e,t){if(e==null)return{};var r,n,i=Fne(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Fne(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function qm(){return qm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qm.apply(null,arguments)}var Hne={width:"100%",height:"100%",display:"block"},Kne=S.forwardRef((e,t)=>{var r=Uj(),n=qj(),i=P3();if(!ca(r)||!ca(n))return null;var{children:o,otherAttributes:l,title:c,desc:h}=e,f,p;return l!=null&&(typeof l.tabIndex=="number"?f=l.tabIndex:f=i?0:void 0,typeof l.role=="string"?p=l.role:p=i?"application":void 0),S.createElement(bj,qm({},l,{title:c,desc:h,role:p,tabIndex:f,width:r,height:n,style:Hne,ref:t}),o)}),Gne=e=>{var{children:t}=e,r=ve(jp);if(!r)return null;var{width:n,height:i,y:o,x:l}=r;return S.createElement(bj,{width:n,height:i,x:l,y:o},t)},r2=S.forwardRef((e,t)=>{var{children:r}=e,n=qne(e,Une),i=jr();return i?S.createElement(Gne,null,S.createElement(t2,{isPanorama:!0},r)):S.createElement(Kne,qm({ref:t},n),S.createElement(t2,{isPanorama:!1},r))});function Yne(){var e=ct(),[t,r]=S.useState(null),n=ve(I7);return S.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),o=i.width/t.offsetWidth;Be(o)&&o!==n&&e(b7(o))}},[t,e,n]),r}function n2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Vne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?n2(Object(r),!0).forEach(function(n){Qne(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qne(e,t,r){return(t=Xne(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xne(e){var t=Wne(e,"string");return typeof t=="symbol"?t:t+""}function Wne(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Wi(){return Wi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wi.apply(null,arguments)}var Zne=()=>(KW(),null);function Fm(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Jne=S.forwardRef((e,t)=>{var r,n,i=S.useRef(null),[o,l]=S.useState({containerWidth:Fm((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:Fm((n=e.style)===null||n===void 0?void 0:n.height)}),c=S.useCallback((f,p)=>{l(g=>{var y=Math.round(f),x=Math.round(p);return g.containerWidth===y&&g.containerHeight===x?g:{containerWidth:y,containerHeight:x}})},[]),h=S.useCallback(f=>{if(typeof t=="function"&&t(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var{width:p,height:g}=f.getBoundingClientRect();c(p,g);var y=b=>{var w=b[0];if(w!=null){var{width:N,height:_}=w.contentRect;c(N,_)}},x=new ResizeObserver(y);x.observe(f),i.current=x}},[t,c]);return S.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),S.createElement(S.Fragment,null,S.createElement(jd,{width:o.containerWidth,height:o.containerHeight}),S.createElement("div",Wi({ref:h},e)))}),eae=S.forwardRef((e,t)=>{var{width:r,height:n}=e,[i,o]=S.useState({containerWidth:Fm(r),containerHeight:Fm(n)}),l=S.useCallback((h,f)=>{o(p=>{var g=Math.round(h),y=Math.round(f);return p.containerWidth===g&&p.containerHeight===y?p:{containerWidth:g,containerHeight:y}})},[]),c=S.useCallback(h=>{if(typeof t=="function"&&t(h),h!=null){var{width:f,height:p}=h.getBoundingClientRect();l(f,p)}},[t,l]);return S.createElement(S.Fragment,null,S.createElement(jd,{width:i.containerWidth,height:i.containerHeight}),S.createElement("div",Wi({ref:c},e)))}),tae=S.forwardRef((e,t)=>{var{width:r,height:n}=e;return S.createElement(S.Fragment,null,S.createElement(jd,{width:r,height:n}),S.createElement("div",Wi({ref:t},e)))}),rae=S.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?S.createElement(eae,Wi({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?S.createElement(tae,Wi({},e,{width:r,height:n,ref:t})):S.createElement(S.Fragment,null,S.createElement(jd,{width:r,height:n}),S.createElement("div",Wi({ref:t},e)))});function nae(e){return e?Jne:rae}var aae=S.forwardRef((e,t)=>{var{children:r,className:n,height:i,onClick:o,onContextMenu:l,onDoubleClick:c,onMouseDown:h,onMouseEnter:f,onMouseLeave:p,onMouseMove:g,onMouseUp:y,onTouchEnd:x,onTouchMove:b,onTouchStart:w,style:N,width:_,responsive:E,dispatchTouchEvents:T=!0}=e,A=S.useRef(null),C=ct(),[R,D]=S.useState(null),[M,z]=S.useState(null),k=Yne(),H=Ij(),U=(H==null?void 0:H.width)>0?H.width:_,ae=(H==null?void 0:H.height)>0?H.height:i,Z=S.useCallback(te=>{k(te),typeof t=="function"&&t(te),D(te),z(te),te!=null&&(A.current=te)},[k,t,D,z]),G=S.useCallback(te=>{C(t5(te)),C(jn({handler:o,reactEvent:te}))},[C,o]),L=S.useCallback(te=>{C(Ib(te)),C(jn({handler:f,reactEvent:te}))},[C,f]),F=S.useCallback(te=>{C(MD()),C(jn({handler:p,reactEvent:te}))},[C,p]),J=S.useCallback(te=>{C(Ib(te)),C(jn({handler:g,reactEvent:te}))},[C,g]),re=S.useCallback(()=>{C(o5())},[C]),oe=S.useCallback(()=>{C(l5())},[C]),$=S.useCallback(te=>{C(s5(te.key))},[C]),X=S.useCallback(te=>{C(jn({handler:l,reactEvent:te}))},[C,l]),le=S.useCallback(te=>{C(jn({handler:c,reactEvent:te}))},[C,c]),ue=S.useCallback(te=>{C(jn({handler:h,reactEvent:te}))},[C,h]),pe=S.useCallback(te=>{C(jn({handler:y,reactEvent:te}))},[C,y]),xe=S.useCallback(te=>{C(jn({handler:w,reactEvent:te}))},[C,w]),we=S.useCallback(te=>{T&&C(d5(te)),C(jn({handler:b,reactEvent:te}))},[C,T,b]),_e=S.useCallback(te=>{C(jn({handler:x,reactEvent:te}))},[C,x]),de=nae(E);return S.createElement(tk.Provider,{value:R},S.createElement(JR.Provider,{value:M},S.createElement(de,{width:U??(N==null?void 0:N.width),height:ae??(N==null?void 0:N.height),className:Xe("recharts-wrapper",n),style:Vne({position:"relative",cursor:"default",width:U,height:ae},N),onClick:G,onContextMenu:X,onDoubleClick:le,onFocus:re,onBlur:oe,onKeyDown:$,onMouseDown:ue,onMouseEnter:L,onMouseLeave:F,onMouseMove:J,onMouseUp:pe,onTouchEnd:_e,onTouchMove:we,onTouchStart:xe,ref:Z},S.createElement(Zne,null),r)))}),iae=["width","height","responsive","children","className","style","compact","title","desc"];function sae(e,t){if(e==null)return{};var r,n,i=oae(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function oae(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var lae=S.forwardRef((e,t)=>{var{width:r,height:n,responsive:i,children:o,className:l,style:c,compact:h,title:f,desc:p}=e,g=sae(e,iae),y=zn(g);return h?S.createElement(S.Fragment,null,S.createElement(jd,{width:r,height:n}),S.createElement(r2,{otherAttributes:y,title:f,desc:p},o)):S.createElement(aae,{className:l,style:c,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},S.createElement(r2,{otherAttributes:y,title:f,desc:p,ref:t},S.createElement(Tee,null,o)))});function zb(){return zb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},zb.apply(null,arguments)}function a2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function uae(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?a2(Object(r),!0).forEach(function(n){cae(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cae(e,t,r){return(t=dae(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dae(e){var t=fae(e,"string");return typeof t=="symbol"?t:t+""}function fae(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hae={top:5,right:5,bottom:5,left:5},mae=uae({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:hae,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},h5),p5=S.forwardRef(function(t,r){var n,i=fr(t.categoricalChartProps,mae),{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:c,tooltipPayloadSearcher:h,categoricalChartProps:f}=t,p={chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:c,tooltipPayloadSearcher:h,eventEmitter:void 0};return S.createElement(kne,{preloadedState:{options:p},reduxStoreName:(n=f.id)!==null&&n!==void 0?n:o},S.createElement(wee,{chartData:f.data}),S.createElement($ne,{layout:i.layout,margin:i.margin}),S.createElement(Bne,{throttleDelay:i.throttleDelay,throttledEvents:i.throttledEvents}),S.createElement(Ine,{baseValue:i.baseValue,accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className,reverseStackOrder:i.reverseStackOrder}),S.createElement(lae,zb({},i,{ref:r})))}),pae=["axis"],gae=S.forwardRef((e,t)=>S.createElement(p5,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:pae,tooltipPayloadSearcher:rk,categoricalChartProps:e,ref:t})),yae=["axis","item"],g5=S.forwardRef((e,t)=>S.createElement(p5,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:yae,tooltipPayloadSearcher:rk,categoricalChartProps:e,ref:t}));const y5="Uncategorized";function v5(e){const t=e==null?void 0:e.replace(/\\/g,"/").split("/").map(r=>r.trim()).filter(r=>r.length>0).join("/");return t&&t.length>0?t:y5}function vae(e,t){const r=new Map,n=o=>{const l=r.get(o);if(l)return l;const c={results:[],suites:new Set,children:new Set};return r.set(o,c),c};for(const o of e){const l=v5(o.category),c=o.suite??"Uncategorized",h=xae(l);for(const f of h){const p=n(f);p.results.push(o),p.suites.add(c)}for(let f=1;f<h.length;f++)n(h[f-1]).children.add(h[f])}const i=new Map([...r.entries()].map(([o,l])=>[o,wae(o,l,t)]));return[...i.values()].filter(o=>!o.parent).sort(b5).map(o=>x5(o,r,i))}function xae(e){const t=e.split("/").filter(r=>r.length>0);return t.length===0?[y5]:t.map((r,n)=>t.slice(0,n+1).join("/"))}function bae(e){const t=e.split("/");return t.length>1?t.slice(0,-1).join("/"):void 0}function jae(e){return e.split("/").at(-1)??e}function wae(e,t,r){const n=rp(t.results,r),i=bae(e);return{name:e,label:jae(e),...i&&{parent:i},depth:e.split("/").filter(Boolean).length-1,total:n.total,passed:n.passed,failed:n.failed,executionErrors:n.executionErrors,avgScore:n.avgScore,suiteCount:t.suites.size,childCount:t.children.size,children:[]}}function x5(e,t,r){var i;const n=[...((i=t.get(e.name))==null?void 0:i.children)??[]].map(o=>r.get(o)).filter(o=>!!o).sort(b5).map(o=>x5(o,t,r));return{...e,children:n}}function b5(e,t){return e.name.localeCompare(t.name)}const Di="",Bb=[{value:"all",label:"All time"},{value:"24h",label:"Last 24h",windowMs:1440*60*1e3},{value:"7d",label:"Last 7d",windowMs:10080*60*1e3},{value:"30d",label:"Last 30d",windowMs:720*60*60*1e3}],fx=10;function Sae(e,t,r=new Date){const n=Nae(e),i=Oae(e,n),o=Eae(n.flatMap(g=>g.category?Cae(g.category):[])),l=o.length>0,c=n.some(g=>g.startedAtMs!==void 0),h=Bb.find(g=>g.value===t.timePeriod)??Bb[0],f=h.windowMs===void 0?void 0:r.getTime()-h.windowMs,p=n.filter(g=>t.experiment&&g.experiment!==t.experiment||t.category&&!Pae(g.category,t.category)?!1:f!==void 0?g.startedAtMs!==void 0&&g.startedAtMs>=f:!0);return{buckets:Aae(p.map(g=>g.score)),experimentOptions:i,categoryOptions:o,totalScores:n.length,filteredScores:p.length,categoryAvailable:l,hasTimestampedScores:c}}function Nae(e){return e.runs&&e.runs.length>0?e.runs.flatMap(t=>_ae(t)):e.cells.flatMap(t=>t.tests.flatMap(r=>{const n=j5(r,t.experiment);return n?[n]:[]}))}function _ae(e){const t=Rae(e.started_at);return e.tests.flatMap(r=>{const n=j5(r,e.experiment);return n?[{...n,startedAtMs:t}]:[]})}function j5(e,t){if(!Number.isFinite(e.score))return;const r=Tae(e.category);return{score:e.score,experiment:t,...r&&{category:r}}}function Oae(e,t){const r=new Map,n=new Set(e.experiments);for(const i of e.cells)n.add(i.experiment);for(const i of t)n.add(i.experiment),r.set(i.experiment,(r.get(i.experiment)??0)+1);return[...n].sort((i,o)=>i.localeCompare(o)).map(i=>({value:i,label:i,count:r.get(i)??0}))}function Eae(e){const t=new Map;for(const r of e)t.set(r,(t.get(r)??0)+1);return[...t.entries()].sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>({value:r,label:r,count:n}))}function Aae(e){if(e.length===0)return[];const t=Array.from({length:fx},(r,n)=>({range:`${n*10}-${(n+1)*10}%`,count:0}));for(const r of e){const n=Math.max(0,Math.min(r,1)),i=Math.min(Math.floor(n*fx),fx-1);t[i].count++}return t}function Tae(e){const t=e==null?void 0:e.trim();return t?v5(t):void 0}function Cae(e){const t=e.split("/").filter(r=>r.length>0);return t.map((r,n)=>t.slice(0,n+1).join("/"))}function Pae(e,t){return e!==void 0&&(e===t||e.startsWith(`${t}/`))}function Rae(e){const t=Date.parse(e);return Number.isFinite(t)?t:void 0}const _t={green:"#34d399",red:"#f87171",gray:"#4b5563",cyan:"#22d3ee",gridLine:"#1f2937",labelText:"#9ca3af"},i2=["#22d3ee","#34d399","#facc15","#f87171","#a78bfa","#fb923c","#f472b6","#60a5fa"];function Mae(e){return i2[e%i2.length]}function Dae({data:e,projectId:t}){const[r,n]=S.useState(!0),[i,o]=S.useState(""),l=e.targets,c=Ue(t?MR(t,i||void 0):a6(i||void 0)),h=i?c.data:void 0,f=S.useMemo(()=>Bae(e.runs??[]),[e.runs]);return d.jsxs("div",{className:"rounded-lg border border-gray-800",children:[d.jsxs("button",{type:"button",onClick:()=>n(p=>!p),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-gray-900/30",children:[d.jsx("span",{className:"text-sm font-medium text-gray-300",children:"Analytics"}),d.jsx("span",{className:"text-xs text-gray-500",children:r?"▸ Show":"▾ Hide"})]}),!r&&d.jsxs("div",{className:"space-y-6 border-t border-gray-800 px-4 py-4",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("label",{htmlFor:"baseline-select",className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Baseline target"}),d.jsxs("select",{id:"baseline-select",value:i,onChange:p=>o(p.target.value),className:"rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-100 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:[d.jsx("option",{value:"",children:"Select a baseline…"}),l.map(p=>d.jsx("option",{value:p,children:p},p))]}),i&&c.isLoading&&d.jsx("span",{className:"text-xs text-gray-500",children:"Loading…"})]}),i&&h&&d.jsx(kae,{data:h,baseline:i}),i&&h&&d.jsx(Lae,{data:h,baseline:i}),d.jsx($ae,{data:e}),f.length>1&&l.length>0&&d.jsx(Uae,{data:f,targets:l}),!i&&d.jsx("p",{className:"text-xs text-gray-500",children:"Select a baseline target above to see gain and delta charts."})]})]})}function nS({active:e,payload:t,label:r}){return!e||!(t!=null&&t.length)?null:d.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-900 px-3 py-2 text-xs shadow-xl",children:[r&&d.jsx("div",{className:"mb-1 font-medium text-gray-300",children:r}),t.map((n,i)=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:n.color}}),d.jsxs("span",{className:"text-gray-400",children:[n.name,":"]}),d.jsx("span",{className:"tabular-nums text-gray-200",children:typeof n.value=="number"?n.value.toFixed(3):n.value})]},`${n.name}-${i}`))]})}function nd({title:e,children:t}){return d.jsxs("div",{className:"space-y-3",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-400",children:e}),t]})}function kae({data:e,baseline:t}){const r=S.useMemo(()=>{const i=[];for(const o of e.cells)o.target!==t&&o.delta!==void 0&&i.push({experiment:o.experiment,target:o.target,g:o.normalized_gain??null,delta:o.delta});return i.sort((o,l)=>Math.abs(l.g??0)-Math.abs(o.g??0)),i},[e.cells,t]);if(r.length===0)return d.jsx(nd,{title:"Normalized Gain (g)",children:d.jsx("p",{className:"text-xs text-gray-500",children:"No gain data available. Ensure multiple targets exist."})});const n=r.map(i=>({name:`${i.target} · ${i.experiment}`,g:i.g??0,isNull:i.g===null}));return d.jsx(nd,{title:"Normalized Gain (g)",children:d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:d.jsx(zj,{width:"100%",height:Math.max(200,n.length*32),children:d.jsxs(g5,{data:n,layout:"vertical",margin:{left:120,right:20,top:5,bottom:5},children:[d.jsx(Gp,{strokeDasharray:"3 3",stroke:_t.gridLine,horizontal:!1}),d.jsx(Yp,{type:"number",tick:{fill:_t.labelText,fontSize:11},axisLine:{stroke:_t.gridLine}}),d.jsx(Vp,{type:"category",dataKey:"name",tick:{fill:_t.labelText,fontSize:11},width:120,axisLine:{stroke:_t.gridLine}}),d.jsx(Hw,{content:d.jsx(nS,{})}),d.jsx(eS,{dataKey:"g",name:"Normalized Gain",children:n.map(i=>d.jsx(Kw,{fill:i.isNull?_t.gray:i.g>0?_t.green:i.g<0?_t.red:_t.gray},i.name))})]})})})})}function Lae({data:e,baseline:t}){const r=S.useMemo(()=>e.cells.filter(n=>n.target!==t&&n.delta!==void 0&&n.delta<0).sort((n,i)=>(n.delta??0)-(i.delta??0)),[e.cells,t]);return r.length===0?null:d.jsx(nd,{title:"Regressions vs. Baseline",children:d.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Avg Score"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Delta"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"g"})]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:r.map(n=>{var i;return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:n.experiment}),d.jsx("td",{className:"px-4 py-3 text-gray-300",children:n.target}),d.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[Math.round(n.avg_score*100),"%"]}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:(i=n.delta)==null?void 0:i.toFixed(3)}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:n.normalized_gain!==void 0&&n.normalized_gain!==null?n.normalized_gain.toFixed(3):"—"})]},`${n.experiment}::${n.target}`)})})]})})})}const s2={experiment:Di,category:Di,timePeriod:"all"};function $ae({data:e}){const[t,r]=S.useState(s2),n=S.useMemo(()=>Sae(e,t),[e,t]);S.useEffect(()=>{r(f=>{const p=!f.experiment||n.experimentOptions.some(x=>x.value===f.experiment),g=!f.category||n.categoryOptions.some(x=>x.value===f.category),y=f.timePeriod==="all"||n.hasTimestampedScores;return p&&g&&y?f:{experiment:p?f.experiment:Di,category:g?f.category:Di,timePeriod:y?f.timePeriod:"all"}})},[n.experimentOptions,n.categoryOptions,n.hasTimestampedScores]);const i=(f,p)=>{r(g=>({...g,[f]:p}))},o=()=>r(s2),l=t.experiment!==Di||t.category!==Di||t.timePeriod!=="all",c=n.totalScores>0,h=zae(n,t);return d.jsx(nd,{title:"Score Distribution",children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 px-3 py-3",children:[d.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[d.jsxs(hx,{id:"score-distribution-experiment",label:"Experiment",value:t.experiment,onChange:f=>i("experiment",f),disabled:n.experimentOptions.length===0,children:[d.jsx("option",{value:Di,children:"All experiments"}),n.experimentOptions.map(f=>d.jsxs("option",{value:f.value,children:[f.label," (",f.count,")"]},f.value))]}),d.jsxs(hx,{id:"score-distribution-category",label:"Category",value:t.category,onChange:f=>i("category",f),disabled:!n.categoryAvailable,help:n.categoryAvailable||!c?void 0:"Category metadata is not present in these compare results.",children:[d.jsx("option",{value:Di,children:"All categories"}),n.categoryOptions.map(f=>d.jsxs("option",{value:f.value,children:[f.label," (",f.count,")"]},f.value))]}),d.jsx(hx,{id:"score-distribution-time",label:"Time period",value:t.timePeriod,onChange:f=>i("timePeriod",f),disabled:!n.hasTimestampedScores,help:n.hasTimestampedScores||!c?void 0:"Recent windows need run timestamps from compare data.",children:Bb.map(f=>d.jsx("option",{value:f.value,children:f.label},f.value))})]}),d.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 border-t border-gray-800/70 pt-3 text-xs",children:[d.jsxs("span",{className:"tabular-nums text-gray-400",children:["Showing ",d.jsx("span",{className:"text-gray-200",children:n.filteredScores})," of"," ",d.jsx("span",{className:"text-gray-200",children:n.totalScores})," scores"]}),l&&d.jsx("button",{type:"button",onClick:o,className:"text-gray-500 underline-offset-2 transition-colors hover:text-gray-300 hover:underline",children:"Clear filters"})]})]}),n.buckets.length>0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:d.jsx(zj,{width:"100%",height:200,children:d.jsxs(g5,{data:n.buckets,margin:{left:10,right:10,top:5,bottom:5},children:[d.jsx(Gp,{strokeDasharray:"3 3",stroke:_t.gridLine,vertical:!1}),d.jsx(Yp,{dataKey:"range",tick:{fill:_t.labelText,fontSize:11},axisLine:{stroke:_t.gridLine}}),d.jsx(Vp,{tick:{fill:_t.labelText,fontSize:11},axisLine:{stroke:_t.gridLine}}),d.jsx(Hw,{content:d.jsx(nS,{})}),d.jsx(eS,{dataKey:"count",name:"Tests",fill:_t.cyan,radius:[2,2,0,0]})]})})}):d.jsx(Iae,{message:h})]})})}function hx({id:e,label:t,value:r,onChange:n,disabled:i,help:o,children:l}){return d.jsxs("div",{className:"min-w-0 space-y-1",children:[d.jsx("label",{htmlFor:e,className:"block text-xs font-medium uppercase tracking-wider text-gray-500",children:t}),d.jsx("select",{id:e,value:r,disabled:i,onChange:c=>n(c.target.value),className:"w-full rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-100 transition-colors focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500 disabled:cursor-not-allowed disabled:border-gray-800 disabled:text-gray-600",children:l}),o&&d.jsx("p",{className:"text-xs leading-5 text-gray-500",children:o})]})}function Iae({message:e}){return d.jsx("div",{className:"rounded-lg border border-dashed border-gray-800 bg-gray-900/20 px-4 py-8 text-center",children:d.jsx("p",{className:"text-sm text-gray-400",children:e})})}function zae(e,t){return e.totalScores===0?"No test scores are available in this comparison yet.":t.category&&!e.categoryAvailable?"Category metadata is not available in these compare results.":"No scores match the selected distribution filters."}function Bae(e){if(e.length===0)return[];const t=new Map;for(const n of e){const i=n.started_at.slice(0,10);let o=t.get(i);o||(o=new Map,t.set(i,o));let l=o.get(n.target);l||(l={scoreSum:0,count:0},o.set(n.target,l)),l.scoreSum+=n.avg_score,l.count++}return[...t.keys()].sort().map(n=>{const i={date:n},o=t.get(n);if(!o)return i;for(const[l,c]of o)i[l]=Math.round(c.scoreSum/c.count*1e3)/1e3;return i})}function Uae({data:e,targets:t}){return d.jsx(nd,{title:"Score Trend Over Time",children:d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:d.jsx(zj,{width:"100%",height:250,children:d.jsxs(gae,{data:e,margin:{left:10,right:20,top:5,bottom:5},children:[d.jsx(Gp,{strokeDasharray:"3 3",stroke:_t.gridLine}),d.jsx(Yp,{dataKey:"date",tick:{fill:_t.labelText,fontSize:11},axisLine:{stroke:_t.gridLine}}),d.jsx(Vp,{domain:[0,1],tick:{fill:_t.labelText,fontSize:11},axisLine:{stroke:_t.gridLine}}),d.jsx(Hw,{content:d.jsx(nS,{})}),d.jsx(T3,{wrapperStyle:{fontSize:12,color:_t.labelText}}),t.map((r,n)=>d.jsx(Qk,{type:"monotone",dataKey:r,stroke:Mae(n),strokeWidth:2,dot:{r:3},connectNulls:!0},r))]})})})})}function an({rate:e}){const t=Math.round(e*100);return d.jsxs("div",{className:"relative h-5 w-20 overflow-hidden rounded-full bg-gray-800",children:[d.jsx("div",{className:"absolute inset-y-0 left-0 bg-gradient-to-r from-blue-400 to-blue-600",style:{width:`${t}%`}}),d.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-semibold tabular-nums text-white",children:[t,"%"]})]})}function w5({data:e,isLoading:t,isError:r,error:n,projectId:i}){var f;const[o,l]=S.useState("aggregated"),c=((f=e==null?void 0:e.runs)==null?void 0:f.length)??0,h=e&&e.cells.length>0;return d.jsxs("div",{className:"space-y-4",children:[d.jsx(qae,{mode:o,onModeChange:l,runsCount:c}),t&&d.jsx(rie,{}),!t&&r&&n&&d.jsx(eie,{message:`Failed to load comparison data: ${n.message}`}),!t&&!r&&!h&&d.jsx(tie,{}),!t&&!r&&h&&e&&d.jsxs(d.Fragment,{children:[o==="aggregated"&&d.jsx(Hae,{data:e,projectId:i}),o==="per-run"&&d.jsx(Qae,{data:e})]})]})}function qae({mode:e,onModeChange:t,runsCount:r}){return d.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold text-white",children:"Analyze runs"}),d.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Study one experiment against another, or pit individual runs head-to-head."})]}),d.jsx(Fae,{mode:e,onChange:t,runsCount:r})]})}function Fae({mode:e,onChange:t,runsCount:r}){const n=r===0;return d.jsxs("div",{role:"tablist","aria-label":"Comparison view mode",className:"inline-flex items-center rounded-lg border border-gray-800 bg-gray-900/50 p-1",children:[d.jsx(o2,{active:e==="aggregated",onClick:()=>t("aggregated"),children:"Aggregated"}),d.jsxs(o2,{active:e==="per-run",onClick:()=>t("per-run"),disabled:n,title:n?"No runs available":void 0,children:["Per run",r>0&&d.jsx("span",{className:"ml-1.5 rounded bg-gray-800 px-1.5 py-0.5 text-xs tabular-nums text-gray-400",children:r})]})]})}function o2({active:e,onClick:t,disabled:r,title:n,children:i}){return d.jsx("button",{type:"button",role:"tab","aria-selected":e,onClick:t,disabled:r,title:n,className:`rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${e?"bg-gray-800 text-cyan-400 shadow-sm":"text-gray-400 hover:text-gray-200 disabled:text-gray-600 disabled:hover:text-gray-600"}`,children:i})}function Hae({data:e,projectId:t}){const{experiments:r,targets:n,cells:i}=e,o=S.useMemo(()=>{const l=new Map;for(const c of i)l.set(`${c.experiment}::${c.target}`,c);return l},[i]);return r.length<=1&&n.length<=1?d.jsx(aS,{headline:"Not enough variation to compare",body:`The aggregated matrix requires at least 2 experiments or 2 targets. Currently ${r.length} experiment(s) and ${n.length} target(s).`}):d.jsxs("div",{className:"space-y-3",children:[d.jsx(Jae,{}),d.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:d.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Target ↓ / Experiment →"})}),r.map(l=>d.jsx("th",{className:"px-4 py-3 font-medium text-gray-300",children:l},l))]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(l=>d.jsx(Kae,{target:l,experiments:r,cellMap:o},l))})]})}),d.jsx(Dae,{data:e,projectId:t})]})}function Kae({target:e,experiments:t,cellMap:r}){return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:e}),t.map(n=>{const i=r.get(`${n}::${e}`);return d.jsx("td",{className:"px-4 py-3",children:i?d.jsx(Gae,{cell:i}):d.jsx(Yae,{})},n)})]})}function Gae({cell:e}){const[t,r]=S.useState(!1),n=Math.round(e.avg_score*100),i=Bc(e),o=ur(e);return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("button",{type:"button",className:"group flex w-full flex-col gap-1 rounded-md border border-gray-800 bg-gray-900/40 px-3 py-2 text-left transition-colors hover:border-gray-700 hover:bg-gray-900/70",onClick:()=>r(l=>!l),"aria-expanded":t,children:[d.jsx(an,{rate:e.pass_rate}),d.jsxs("div",{className:"flex items-center gap-2 text-xs tabular-nums text-gray-500",children:[d.jsxs("span",{children:[d.jsx("span",{className:"text-emerald-400",children:e.passed_count}),d.jsx("span",{className:"text-gray-600",children:" / "}),d.jsx("span",{children:i})]}),d.jsx("span",{className:"text-gray-700",children:"·"}),d.jsxs("span",{children:["avg ",n,"%"]}),o>0&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-gray-700",children:"·"}),d.jsxs("span",{className:"text-amber-400",children:[o," errors"]})]})]})]}),t&&d.jsx(Vae,{tests:e.tests})]})}function Yae(){return d.jsx("div",{className:"text-center text-gray-600",children:"—"})}function Vae({tests:e}){return d.jsxs("div",{className:"rounded-md border border-gray-800 bg-gray-950/60 px-3 py-2",children:[d.jsx("div",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Test cases"}),d.jsx("ul",{className:"space-y-1",children:e.map(t=>{const r=t.execution_status==="execution_error";return d.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[d.jsx("span",{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full ${r?"bg-amber-400":t.passed?"bg-emerald-400":"bg-red-400"}`}),d.jsx("span",{className:"flex-1 truncate text-gray-300",title:t.test_id,children:t.test_id}),d.jsx("span",{className:`tabular-nums ${r?"text-amber-400":t.passed?"text-emerald-400":"text-red-400"}`,children:r?"error":`${Math.round(t.score*100)}%`})]},t.test_id)})})]})}function Qae({data:e}){const t=e.runs??[],[r,n]=S.useState(new Set),[i,o]=S.useState(!1),l=f=>{n(p=>{const g=new Set(p);return g.has(f)?g.delete(f):g.add(f),g})},c=()=>n(new Set),h=S.useMemo(()=>t.filter(f=>r.has(f.run_id)),[t,r]);return t.length===0?d.jsx(aS,{headline:"No runs yet",body:"Run an evaluation to populate the per-run view."}):i&&h.length>=2?d.jsx(Wae,{runs:h,onBack:()=>o(!1)}):d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"flex items-center justify-between text-sm text-gray-400",children:d.jsxs("span",{children:[d.jsx("span",{className:"font-medium text-gray-300",children:t.length})," run",t.length===1?"":"s"," — select two or more to compare side-by-side"]})}),d.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"w-10 px-3 py-3","aria-label":"Select"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Timestamp"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Tests"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Avg"})]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:t.map(f=>d.jsx(Xae,{run:f,checked:r.has(f.run_id),onToggle:()=>l(f.run_id)},f.run_id))})]})}),r.size>0&&d.jsxs("div",{role:"toolbar","aria-label":"Selection actions",className:"sticky bottom-4 z-10 flex items-center justify-between gap-3 rounded-lg border border-cyan-900/50 bg-gray-900/95 px-4 py-3 shadow-xl backdrop-blur",children:[d.jsxs("div",{className:"text-sm text-gray-300",children:[d.jsx("span",{className:"font-semibold tabular-nums text-cyan-400",children:r.size})," ","selected"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{type:"button",onClick:c,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200",children:"Clear"}),d.jsxs("button",{type:"button",disabled:r.size<2,onClick:()=>o(!0),className:"inline-flex items-center gap-1.5 rounded-md bg-cyan-500 px-3 py-1.5 text-sm font-medium text-gray-950 transition-colors hover:bg-cyan-400 disabled:cursor-not-allowed disabled:bg-gray-700 disabled:text-gray-500",children:["Compare ",r.size,d.jsx("span",{"aria-hidden":!0,children:"→"})]})]})]})]})}function Xae({run:e,checked:t,onToggle:r}){const n=Math.round(e.avg_score*100),i=Bc(e),o=ur(e),l=nie(e.run_id);return d.jsxs("tr",{className:`transition-colors ${t?"bg-cyan-950/20 hover:bg-cyan-950/30":"hover:bg-gray-900/30"}`,children:[d.jsx("td",{className:"px-3 py-3 align-middle",children:d.jsx("input",{type:"checkbox",className:"h-4 w-4 cursor-pointer rounded border-gray-700 bg-gray-900 text-cyan-500 accent-cyan-500 focus:ring-cyan-500",checked:t,onChange:r,"aria-label":`Select run ${e.run_id}`})}),d.jsxs("td",{className:"px-4 py-3 align-middle",title:e.run_id,children:[d.jsx("div",{className:"font-medium text-gray-200 tabular-nums",children:S5(e.started_at)}),l&&d.jsx("div",{className:"text-xs text-gray-500",children:l})]}),d.jsx("td",{className:"px-4 py-3 align-middle text-gray-300",children:e.experiment}),d.jsx("td",{className:"px-4 py-3 align-middle text-gray-300",children:e.target}),d.jsxs("td",{className:"px-4 py-3 align-middle text-right tabular-nums text-gray-400",children:[d.jsx("div",{children:i}),o>0&&d.jsxs("div",{className:"text-xs text-amber-400",children:[o," errors"]})]}),d.jsx("td",{className:"px-4 py-3 align-middle",children:d.jsx(an,{rate:e.pass_rate})}),d.jsxs("td",{className:"px-4 py-3 align-middle text-right tabular-nums text-gray-400",children:[n,"%"]})]})}function Wae({runs:e,onBack:t}){const r=S.useMemo(()=>{const i=new Set,o=[];for(const l of e)for(const c of l.tests)i.has(c.test_id)||(i.add(c.test_id),o.push(c.test_id));return o},[e]),n=S.useMemo(()=>e.map(i=>{const o=new Map;for(const l of i.tests)o.set(l.test_id,l);return o}),[e]);return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1 text-sm text-cyan-400 transition-colors hover:text-cyan-300",children:[d.jsx("span",{"aria-hidden":!0,children:"←"})," Back to runs"]}),d.jsxs("span",{className:"text-sm text-gray-500",children:[e.length," runs · ",r.length," tests"]})]}),d.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"w-full text-left text-sm",children:[d.jsxs("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:[d.jsxs("tr",{children:[d.jsx("th",{className:"sticky left-0 z-10 bg-gray-900/80 px-4 py-3 font-medium text-gray-400 backdrop-blur",children:"Test case"}),e.map(i=>d.jsx("th",{className:"px-4 py-3 align-bottom",children:d.jsx(Zae,{run:i})},i.run_id))]}),d.jsxs("tr",{className:"border-t border-gray-800/50 bg-gray-900/30",children:[d.jsx("th",{className:"sticky left-0 z-10 bg-gray-900/80 px-4 py-2 text-xs font-medium uppercase tracking-wider text-gray-500 backdrop-blur",children:"Pass rate"}),e.map(i=>d.jsx("th",{className:"px-4 py-2",children:d.jsx(an,{rate:i.pass_rate})},i.run_id))]})]}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:r.map(i=>d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"sticky left-0 z-10 bg-gray-950/70 px-4 py-3 font-medium text-gray-200 backdrop-blur",children:i}),n.map((o,l)=>{const c=o.get(i),h=e[l].run_id;return c?d.jsx("td",{className:"px-4 py-3",children:d.jsx("div",{className:"flex items-center gap-2",children:c.execution_status==="execution_error"?d.jsxs(d.Fragment,{children:[d.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-amber-400"}),d.jsx("span",{className:"tabular-nums text-amber-400",children:"error"})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full ${c.passed?"bg-emerald-400":"bg-red-400"}`}),d.jsxs("span",{className:`tabular-nums ${c.passed?"text-emerald-400":"text-red-400"}`,children:[Math.round(c.score*100),"%"]})]})})},h):d.jsx("td",{className:"px-4 py-3 text-center text-gray-600",children:"—"},h)})]},i))})]})})]})}function Zae({run:e}){return d.jsxs("div",{className:"min-w-[140px] space-y-1",children:[d.jsx("div",{className:"text-sm font-medium text-gray-200 tabular-nums",title:e.run_id,children:S5(e.started_at)}),d.jsxs("div",{className:"text-xs text-gray-500",children:[e.experiment," · ",e.target]})]})}function Jae(){return d.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500",role:"note",children:[d.jsx(wh,{className:"bg-emerald-400",label:"80%+"}),d.jsx(wh,{className:"bg-yellow-400",label:"50–80%"}),d.jsx(wh,{className:"bg-red-400",label:"< 50%"}),d.jsx(wh,{className:"bg-gray-700",label:"no data"})]})}function wh({className:e,label:t}){return d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.jsx("span",{className:`h-2 w-2 rounded-full ${e}`,"aria-hidden":!0}),d.jsx("span",{children:t})]})}function eie({message:e}){return d.jsx("div",{className:"rounded-lg border border-red-900/60 bg-red-950/30 p-4 text-sm text-red-400",children:e})}function tie(){return d.jsx(aS,{headline:"No comparison data yet",body:"Run evaluations with different experiment and target combinations to populate this view."})}function aS({headline:e,body:t}){return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-300",children:e}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:t})]})}function rie(){return d.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:d.jsxs("div",{className:"animate-pulse",children:[d.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>d.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[d.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},e))]})})}function S5(e){try{const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),l=String(t.getMinutes()).padStart(2,"0");return`${r}-${n}-${i} ${o}:${l}`}catch{return e}}function nie(e){const t=e.split("::");return t.length<2?null:t.slice(0,-1).join(" · ")}function aie(e){if(!e)return"No runs";const t=new Date(e);if(Number.isNaN(t.getTime()))return"N/A";const r=Date.now()-t.getTime(),n=Math.floor(r/6e4);if(n<1)return"Just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function iie({project:e,canRemove:t=!1,onRemove:r}){const n=Math.round(e.pass_rate*100),i=ur(e),[o,l]=S.useState(!1),[c,h]=S.useState(!1),[f,p]=S.useState(!1),[g,y]=S.useState(null),x=S.useId(),b=S.useId(),w=S.useRef(null),N=S.useRef(null),_=S.useRef(null);S.useEffect(()=>{if(!o)return;function C(D){var z,k;const M=D.target;(z=w.current)!=null&&z.contains(M)||(k=N.current)!=null&&k.contains(M)||l(!1)}function R(D){var M;D.key==="Escape"&&(l(!1),(M=w.current)==null||M.focus())}return document.addEventListener("pointerdown",C),document.addEventListener("keydown",R),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",R)}},[o]),S.useEffect(()=>{var C;c&&((C=_.current)==null||C.focus())},[c]);function E(){l(!1),y(null),h(!0)}async function T(){if(!(!r||f)){p(!0),y(null);try{await r(e)}catch(C){y(C.message),p(!1)}}}function A(){var C;f||(h(!1),y(null),(C=w.current)==null||C.focus())}return d.jsxs("article",{className:"group relative rounded-lg border border-gray-800 bg-gray-900/50 transition-colors hover:border-cyan-800 hover:bg-gray-900",children:[d.jsxs(Ee,{to:"/projects/$projectId",params:{projectId:e.id},className:"block p-5 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-cyan-500",children:[d.jsx("div",{className:"flex items-start justify-between",children:d.jsxs("div",{className:"min-w-0 flex-1 pr-10",children:[d.jsx("h3",{className:"truncate text-lg font-semibold text-white group-hover:text-cyan-400",children:e.id}),d.jsx("p",{className:"mt-1 truncate text-xs text-gray-500",children:e.path})]})}),d.jsxs("div",{className:"mt-4 grid grid-cols-4 gap-3",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-gray-500",children:"Runs"}),d.jsx("p",{className:"text-lg font-semibold text-white",children:e.run_count})]}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-gray-500",children:"Pass Rate"}),d.jsx("p",{className:`text-lg font-semibold ${e.run_count===0?"text-gray-500":n>=80?"text-emerald-400":n>=50?"text-yellow-400":"text-red-400"}`,children:e.run_count>0?`${n}%`:"--"})]}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-gray-500",children:"Errors"}),d.jsx("p",{className:`text-lg font-semibold ${i>0?"text-amber-300":"text-gray-500"}`,children:i})]}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-gray-500",children:"Last Run"}),d.jsx("p",{className:"text-sm text-gray-300",children:aie(e.last_run)})]})]})]}),t&&r?d.jsxs("div",{className:"absolute right-3 top-3 z-10",children:[d.jsx("button",{ref:w,type:"button","aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?x:void 0,"aria-label":`Open ${e.id} project menu`,onClick:()=>l(C=>!C),className:"flex h-8 w-8 items-center justify-center rounded-md text-lg leading-none text-gray-500 transition-colors hover:bg-gray-800 hover:text-gray-200 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:d.jsx("span",{"aria-hidden":"true",children:"..."})}),o?d.jsx("div",{ref:N,id:x,role:"menu","aria-label":`${e.id} actions`,className:"absolute right-0 top-10 w-44 overflow-hidden rounded-md border border-gray-800 bg-gray-950 py-1 shadow-xl",children:d.jsx("button",{type:"button",role:"menuitem",onClick:E,className:"block w-full px-3 py-2 text-left text-sm text-red-400 transition-colors hover:bg-red-950/30 hover:text-red-300 focus:bg-red-950/30 focus:outline-none",children:"Remove project"})}):null]}):null,c?d.jsx("dialog",{ref:_,open:!0,"aria-modal":"true","aria-labelledby":b,tabIndex:-1,onKeyDown:C=>{C.key==="Escape"&&(C.preventDefault(),A())},className:"fixed inset-0 z-50 flex h-full max-h-none w-full max-w-none items-center justify-center bg-black/70 p-4 text-left text-gray-100 backdrop:bg-black/70",children:d.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-lg border border-gray-800 bg-gray-950 shadow-xl",children:[d.jsx("div",{className:"border-b border-gray-800 px-4 py-3",children:d.jsx("h2",{id:b,className:"text-lg font-semibold text-white",children:"Remove project?"})}),d.jsxs("div",{className:"space-y-3 p-4",children:[d.jsxs("p",{className:"text-sm text-gray-300",children:["Remove ",d.jsx("span",{className:"font-medium text-white",children:e.id})," from this Dashboard registry."]}),d.jsxs("p",{className:"text-sm text-gray-500",children:["The project folder and files stay on disk at ",e.path,"."]}),g?d.jsx("div",{role:"alert",className:"rounded-lg border border-red-900/60 bg-red-950/30 p-3 text-sm text-red-400",children:g}):null]}),d.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-800 bg-gray-900/50 px-4 py-3",children:[d.jsx("button",{type:"button",onClick:A,disabled:f,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),d.jsx("button",{type:"button",onClick:()=>void T(),disabled:f,className:"rounded-md border border-red-900/60 px-3 py-1.5 text-sm font-medium text-red-400 transition-colors hover:border-red-800 hover:bg-red-950/30 hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-50",children:f?"Removing...":"Remove project"})]})]})}):null]})}function sie(e){return e.map(t=>({path:t.path,relativePath:t.relative_path,category:t.category}))}function oie(e){return(e.split(",").at(-1)??"").trim()}function lie(e,t){const r=oie(t).toLowerCase();return r?e.filter(n=>n.relativePath.toLowerCase().includes(r)||n.category.toLowerCase().includes(r)):e}function uie(e,t){const r=e.split(",");return[...(/,\s*$/.test(e)?r:r.slice(0,-1)).map(c=>c.trim()).filter(Boolean).filter(c=>c!==t),t].join(", ")}function cie(e,t,r){return t?e:iS(e,r)}function iS(e,t){return e||String(t??Ic)}function die({suiteFilter:e,testIds:t,target:r,experiment:n,thresholdInput:i,studioThreshold:o,workers:l}){const c={};e.trim()&&(c.suite_filter=e.trim()),t.length>0&&(c.test_ids=t),r&&(c.target=r),n.trim()&&(c.experiment=n.trim());const h=iS(i,o);return h&&(c.threshold=Number.parseFloat(h)),l&&(c.workers=Number.parseInt(l,10)),c}const mx="default";function So({open:e,onClose:t,projectId:r,prefill:n}){const i=ho(),o=po(),[l,c]=S.useState((n==null?void 0:n.suiteFilter)??""),[h,f]=S.useState(""),[p,g]=S.useState((n==null?void 0:n.testIds)??[]),[y,x]=S.useState((n==null?void 0:n.target)??""),[b,w]=S.useState(mx),[N,_]=S.useState(""),[E,T]=S.useState(!1),[A,C]=S.useState(""),[R,D]=S.useState(!1),[M,z]=S.useState(null),[k,H]=S.useState(null),[U,ae]=S.useState(!1),[Z,G]=S.useState(null),{data:L}=R6(r),{data:F}=D6(r),{data:J}=hj(M,r),{data:re}=pt(r),oe=S.useMemo(()=>sie((L==null?void 0:L.eval_files)??[]),[L]),$=S.useMemo(()=>lie(oe,l),[oe,l]),X=S.useMemo(()=>(F==null?void 0:F.targets)??[],[F]),le=S.useMemo(()=>iS(N,re==null?void 0:re.threshold),[re==null?void 0:re.threshold,N]),ue=S.useMemo(()=>cie(N,E,re==null?void 0:re.threshold),[re==null?void 0:re.threshold,N,E]);S.useEffect(()=>{e&&(c((n==null?void 0:n.suiteFilter)??""),g((n==null?void 0:n.testIds)??[]),x((n==null?void 0:n.target)??""),w(mx),f(""),_(""),T(!1),C(""),D(!1),z(null),H(null),ae(!1),G(null))},[e,n]),S.useEffect(()=>{((J==null?void 0:J.status)==="finished"||(J==null?void 0:J.status)==="failed")&&(i.invalidateQueries({queryKey:["runs"]}),i.invalidateQueries({queryKey:["projects"]}))},[J==null?void 0:J.status,i]);const pe=S.useCallback(()=>die({suiteFilter:l,testIds:p,target:y,experiment:b,thresholdInput:N,studioThreshold:re==null?void 0:re.threshold,workers:A}),[b,re==null?void 0:re.threshold,l,y,p,N,A]);S.useEffect(()=>{const te=pe();if(!te.suite_filter&&(!te.test_ids||te.test_ids.length===0)){G(null);return}I6(te,r).then(je=>G(je.command)).catch(()=>G(null))},[pe,r]);function xe(){const te=h.trim();te&&!p.includes(te)&&g([...p,te]),f("")}function we(te){g(p.filter(je=>je!==te))}async function _e(){H(null),ae(!0);try{const te=pe(),je=await $R(te,r);z(je.id)}catch(te){H(te.message)}finally{ae(!1)}}if(!e)return null;if(M&&J){let te=function(){t(),o({to:IB(r)})};return d.jsx(l2,{onClose:t,title:"Eval Run",children:d.jsx(fie,{status:J,onClose:t,onRunInBackground:te,runId:M})})}const de=!!(l.trim()||p.length>0);return d.jsx(l2,{onClose:t,title:"Start",children:d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"suite-filter",className:"mb-1 block text-sm font-medium text-gray-300",children:"Suite Filter"}),d.jsx("input",{id:"suite-filter",type:"text",value:l,onChange:te=>c(te.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"}),oe.length>0&&d.jsx("div",{className:"mt-1.5 max-h-44 overflow-y-auto rounded-md border border-gray-800 bg-gray-950/60 p-1",children:$.length>0?$.map(te=>d.jsxs("button",{type:"button",onClick:()=>c(je=>uie(je,te.relativePath)),className:"block w-full rounded px-2 py-1 text-left text-xs text-gray-400 hover:bg-gray-800 hover:text-gray-200",children:[d.jsx("span",{className:"block truncate",children:te.relativePath}),te.category&&d.jsx("span",{className:"block truncate text-[11px] text-gray-600",children:te.category})]},te.relativePath)):d.jsx("div",{className:"px-2 py-1 text-xs text-gray-500",children:"No matching eval files"})})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"test-id-input",className:"mb-1 block text-sm font-medium text-gray-300",children:"Test ID Filter"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{id:"test-id-input",type:"text",value:h,onChange:te=>f(te.target.value),onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),xe())},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"}),d.jsx("button",{type:"button",onClick:xe,disabled:!h.trim(),className:"rounded-md bg-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-600 disabled:opacity-50",children:"Add"})]}),p.length>0&&d.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:p.map(te=>d.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:[te,d.jsx("button",{type:"button",onClick:()=>we(te),className:"text-cyan-400 hover:text-white",children:"×"})]},te))})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"target-override",className:"mb-1 block text-sm font-medium text-gray-300",children:"Target Override"}),d.jsxs("select",{id:"target-override",value:y,onChange:te=>x(te.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:[d.jsx("option",{value:"",children:"Use eval's configured target"}),X.map(te=>d.jsx("option",{value:te,children:te},te))]})]}),d.jsx("div",{className:"rounded-md border border-gray-800 bg-gray-950/40 p-3",children:d.jsxs("div",{children:[d.jsx("label",{htmlFor:"experiment-input",className:"mb-1 block text-xs font-medium text-gray-400",children:"Experiment"}),d.jsx("input",{id:"experiment-input",type:"text",value:b,onChange:te=>w(te.target.value),placeholder:mx,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"})]})}),d.jsxs("div",{children:[d.jsxs("button",{type:"button",onClick:()=>D(!R),className:"text-sm text-gray-400 hover:text-gray-200",children:[R?"▾":"▸"," Advanced Options"]}),R&&d.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-3",children:[d.jsxs("div",{children:[d.jsx("label",{htmlFor:"threshold-input",className:"mb-1 block text-xs text-gray-400",children:"Threshold (0–1)"}),d.jsx("input",{id:"threshold-input",type:"number",value:ue,onChange:te=>{T(!0),_(te.target.value)},min:"0",max:"1",step:"0.1",placeholder:le,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"})]}),d.jsxs("div",{children:[d.jsx("label",{htmlFor:"workers-input",className:"mb-1 block text-xs text-gray-400",children:"Workers"}),d.jsx("input",{id:"workers-input",type:"number",value:A,onChange:te=>C(te.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"})]})]})]}),Z&&d.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:[d.jsx("div",{className:"mb-1 text-xs text-gray-500",children:"CLI Preview"}),d.jsx("code",{className:"block break-all text-xs text-cyan-300",children:Z})]}),k&&d.jsx("div",{className:"rounded-md border border-red-900/50 bg-red-950/20 p-2 text-sm text-red-400",children:k}),d.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[d.jsx("button",{type:"button",onClick:t,className:"rounded-md bg-gray-700 px-4 py-2 text-sm text-white hover:bg-gray-600",children:"Cancel"}),d.jsx("button",{type:"button",onClick:_e,disabled:!de||U,className:"rounded-md bg-cyan-600 px-4 py-2 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:U?"Launching…":"Start"})]})]})})}function l2({children:e,onClose:t,title:r}){return d.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/60 pt-[10vh]",children:d.jsxs("div",{className:"max-h-[80vh] w-full max-w-lg overflow-y-auto rounded-lg border border-gray-700 bg-gray-900 shadow-xl",children:[d.jsxs("div",{className:"flex items-center justify-between border-b border-gray-800 px-5 py-3",children:[d.jsx("h2",{className:"text-lg font-semibold text-white",children:r}),d.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-white",children:"✕"})]}),d.jsx("div",{className:"px-5 py-4",children:e})]})})}function fie({status:e,onClose:t,onRunInBackground:r,runId:n}){const i=e.status==="finished"||e.status==="failed",o={starting:"text-yellow-400",running:"text-cyan-400",finished:"text-emerald-400",failed:"text-red-400"};return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("span",{className:`text-sm font-medium ${o[e.status]??"text-gray-400"}`,children:[e.status==="running"&&"●"," ",e.status.charAt(0).toUpperCase()+e.status.slice(1)]}),!i&&d.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent"})]}),d.jsx("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:d.jsx("code",{className:"block break-all text-xs text-cyan-300",children:e.command})}),e.stdout&&d.jsx("div",{className:"max-h-48 overflow-y-auto rounded-md bg-gray-950 p-3",children:d.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-300",children:e.stdout.slice(-3e3)})}),e.stderr&&d.jsx("div",{className:"max-h-24 overflow-y-auto rounded-md bg-red-950/20 p-3",children:d.jsx("pre",{className:"whitespace-pre-wrap text-xs text-red-300",children:e.stderr.slice(-2e3)})}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-xs text-gray-500",children:i?d.jsxs(d.Fragment,{children:["Exit code: ",e.exit_code,e.finished_at&&` · ${new Date(e.finished_at).toLocaleTimeString()}`]}):n&&d.jsx("button",{type:"button",onClick:r,className:"text-xs text-gray-400 hover:text-cyan-400",children:"Run in background"})}),i&&d.jsx("button",{type:"button",onClick:t,className:"rounded-md bg-gray-700 px-4 py-2 text-sm text-white hover:bg-gray-600",children:"Close"})]})]})}function px(e){if(e.source==="remote")return"Remote runs cannot be combined or deleted from the local workspace.";if(e.status==="starting"||e.status==="running")return"Running runs cannot be combined or deleted yet."}function hie(e){return`${e} local run${e===1?"":"s"} selected`}function mie(e,t){return`Combined ${e} local run${e===1?"":"s"} into ${t}.`}function pie(e){return`Deleted ${e} local run${e===1?"":"s"}.`}function gie(e){if(!e)return{date:"N/A",full:"N/A"};try{const t=new Date(e);if(Number.isNaN(t.getTime()))return{date:"N/A",full:"N/A"};const r=t.toLocaleString(),n=Date.now()-t.getTime(),i=Math.floor(n/6e4),o=Math.floor(n/36e5);let l;return i<1?l="just now":i<60?l=`${i} min ago`:o<24?l=`${o} hour${o===1?"":"s"} ago`:l=t.toLocaleDateString(),{date:l,full:r}}catch{return{date:"N/A",full:"N/A"}}}function yie(e,t){const r=gie(e.timestamp),n=e.status==="starting"||e.status==="running",i=yj(e,{includePassRate:!1}),o=i.label,l=ur(e),c=e.test_count,h=Math.max(0,e.test_count-l),f=h>0?e.pass_rate>=t:l===0,p=Math.round(e.pass_rate*h),g=h-p,y=IR(e),x=e.runtime_source?pj(e.runtime_source):void 0,b=e.runtime_source?B6(e.runtime_source):void 0;return{run:e,ts:r,isActive:n,label:o,display:i,errors:l,totalCount:c,qualityCount:h,passing:f,passedCount:p,failedCount:g,experimentNamespace:y,runtimeSourceLabel:x,runtimeSourceTitle:b}}function Xp({runs:e,projectId:t,emptyMessage:r,hasNextPage:n=!1,isFetchingNextPage:i=!1,onLoadMore:o,enableCombine:l=!1,remoteBranch:c}){const{data:h}=pt(t),f=ho(),p=(h==null?void 0:h.threshold)??Ic,g=S.useRef(null),y=S.useRef(null),x=S.useRef(!1),[b,w]=S.useState([]),[N,_]=S.useState(null),[E,T]=S.useState(!1),[A,C]=S.useState(!1),R=S.useMemo(()=>e.map(L=>yie(L,p)),[p,e]),D=S.useMemo(()=>e.filter(L=>l&&!px(L)).map(L=>L.filename),[l,e]),M=new Set(b),z=S.useMemo(()=>new Map(e.map(L=>[L.filename,L])),[e]);S.useEffect(()=>{i||(x.current=!1)},[i]),S.useEffect(()=>{if(!n||!o)return;const L=[];if(g.current&&L.push(g.current),y.current&&L.push(y.current),L.length===0)return;const F=new IntersectionObserver(J=>{J.some(re=>re.isIntersecting)&&!i&&!x.current&&(x.current=!0,o())},{rootMargin:"200px 0px"});for(const J of L)F.observe(J);return()=>F.disconnect()},[n,i,o]),S.useEffect(()=>{const L=new Set(D);w(F=>F.filter(J=>L.has(J)))},[D]);async function k(){if(t){await Promise.all([f.invalidateQueries({queryKey:["projects",t,"runs"]}),f.invalidateQueries({queryKey:["projects",t,"tags"]}),f.invalidateQueries({queryKey:["projects",t,"compare"]}),f.invalidateQueries({queryKey:["projects",t,"targets"]})]);return}await Promise.all([f.invalidateQueries({queryKey:["runs"]}),f.invalidateQueries({queryKey:["tags"]}),f.invalidateQueries({queryKey:["compare"]}),f.invalidateQueries({queryKey:["targets"]})])}async function H(){if(b.length<2||E)return;const L=[...b],F=[...new Set(L.map(re=>{var oe,$;return(($=(oe=z.get(re))==null?void 0:oe.experiment)==null?void 0:$.trim())||"default"}).filter(Boolean))].sort();let J;if(F.length>1){const re=window.prompt(`Selected runs span experiments (${F.join(", ")}). Enter a new experiment name for the combined run:`);if(re===null)return;if(J=re.trim(),!J){_({kind:"error",message:"Experiment name is required to combine runs from multiple experiments."});return}}_(null),T(!0);try{let re;try{re=await uE(L,"error",t,void 0,J)}catch(oe){if(!(oe instanceof LR)||oe.status!==409)throw oe;const $=oe.duplicates.length;if(!window.confirm(`${$} duplicate (test_id, target) pair${$===1?"":"s"} found. Replace duplicates with the latest timestamp?`))return;re=await uE(L,"latest",t,void 0,J)}w([]),_({kind:"success",message:mie(L.length,re.display_name),combinedRunId:re.run_id,sourceRunIds:L}),await k()}catch(re){_({kind:"error",message:re.message})}finally{T(!1)}}async function U(){b.length===0||A||await Z(b,"selected")}async function ae(){const L=(N==null?void 0:N.sourceRunIds)??[];L.length===0||A||await Z(L,"combined-sources")}async function Z(L,F){const J=L.length,re=J===1?"run":"runs",oe=F==="combined-sources"?`Delete the ${J} source local ${re} used for the combined run? The combined run will remain.`:`Delete ${J} local ${re}? This removes the run workspace and artifacts from disk.`;if(window.confirm(oe)){_(null),C(!0);try{for(const X of L)await T6(X,t);w([]),_({kind:"success",message:pie(J)}),await k()}catch(X){_({kind:"error",message:X.message})}finally{C(!1)}}}function G(L){w(F=>F.includes(L)?F.filter(J=>J!==L):[...F,L])}return e.length===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:r??d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"text-lg text-gray-400",children:"No evaluation runs found."}),d.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Run an evaluation first:"," ",d.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"agentv eval <eval-file>"})]})]})}):d.jsxs("div",{className:"space-y-3",children:[l&&d.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-gray-800 bg-gray-900/40 px-4 py-3 sm:flex-row sm:items-start sm:justify-between",children:[d.jsxs("div",{className:"min-w-0 space-y-1",children:[d.jsx("p",{className:"text-sm font-medium text-gray-200",children:hie(b.length)}),d.jsx("p",{className:"text-xs text-gray-500",children:"Select completed local runs to combine or delete. Remote runs stay read-only here."}),N&&d.jsx("div",{className:`mt-2 rounded-md border px-3 py-2 text-sm ${N.kind==="success"?"border-emerald-900/60 bg-emerald-950/20 text-emerald-300":"border-red-900/60 bg-red-950/20 text-red-300"}`,role:N.kind==="error"?"alert":"status",children:d.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[d.jsx("span",{children:N.message}),N.combinedRunId?t?d.jsx(Ee,{to:"/projects/$projectId/runs/$runId",params:{projectId:t,runId:N.combinedRunId},className:"font-medium text-cyan-300 hover:text-cyan-200 hover:underline",children:"Open combined run"}):d.jsx(Ee,{to:"/runs/$runId",params:{runId:N.combinedRunId},className:"font-medium text-cyan-300 hover:text-cyan-200 hover:underline",children:"Open combined run"}):null,N.sourceRunIds&&N.sourceRunIds.length>0?d.jsx("button",{type:"button",onClick:()=>void ae(),disabled:A||E,className:"font-medium text-red-300 hover:text-red-200 hover:underline disabled:cursor-not-allowed disabled:text-gray-500",children:A?"Deleting sources...":"Delete source runs"}):null]})})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[d.jsx("button",{type:"button",onClick:()=>void U(),disabled:b.length===0||A||E,className:"whitespace-nowrap rounded-md border border-red-900/70 px-3 py-1.5 text-sm font-medium text-red-300 hover:border-red-700 hover:bg-red-950/40 disabled:cursor-not-allowed disabled:border-gray-800 disabled:text-gray-500",children:A?"Deleting...":"Delete selected"}),d.jsx("button",{type:"button",onClick:()=>void H(),disabled:b.length<2||E||A,className:"whitespace-nowrap rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:bg-gray-700 disabled:text-gray-400",children:E?"Combining...":"Combine selected"})]})]}),d.jsxs("div",{className:"space-y-2 sm:hidden",children:[R.map(L=>{const{run:F,ts:J,label:re,display:oe,errors:$,totalCount:X,passedCount:le,failedCount:ue,experimentNamespace:pe,runtimeSourceLabel:xe,runtimeSourceTitle:we}=L,_e=px(F),de=!_e&&D.includes(F.filename);return d.jsxs("article",{className:"rounded-lg border border-gray-800 bg-gray-900/40 px-3 py-3",children:[d.jsxs("div",{className:"flex items-start gap-3",children:[l&&d.jsx("input",{type:"checkbox",checked:M.has(F.filename),disabled:!de,onChange:()=>G(F.filename),title:_e,"aria-label":_e?`${re}: ${_e}`:`Select ${re}`,className:"mt-1 h-4 w-4 shrink-0 rounded border-gray-700 bg-gray-900 text-cyan-500 disabled:opacity-30"}),d.jsx(d2,{view:L,className:"mt-1 shrink-0"}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx(u2,{projectId:t,runId:F.filename,label:oe.primary,title:oe.title,className:"block truncate text-sm font-medium text-cyan-400 hover:text-cyan-300 hover:underline"}),oe.secondary?d.jsx("p",{className:"mt-0.5 truncate text-xs text-gray-500",title:oe.title,children:oe.secondary}):null,d.jsx(bie,{experimentNamespace:pe,runtimeSourceLabel:xe,runtimeSourceTitle:we}),d.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[d.jsx(c2,{onRemote:F.on_remote===!0,branch:c}),d.jsx("span",{className:"text-xs text-gray-500",title:J.full,children:J.date})]})]})]}),d.jsxs("dl",{className:"mt-3 grid grid-cols-2 gap-x-3 gap-y-2 border-t border-gray-800/70 pt-3",children:[d.jsx(yl,{label:"Pass Rate",valueClassName:"text-gray-300",children:d.jsx(an,{rate:F.pass_rate})}),d.jsx(yl,{label:"Total",valueClassName:"text-gray-300",children:X}),d.jsx(yl,{label:"Passed",valueClassName:"text-emerald-300",children:le}),d.jsx(yl,{label:"Failures",valueClassName:"text-red-400",children:ue>0?ue:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx(yl,{label:"Errors",valueClassName:"text-amber-300",children:$>0?$:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx(yl,{label:"Remote",valueClassName:"text-gray-400",children:F.on_remote===!0?"On remote":"Local only"})]})]},F.filename)}),(n||i)&&d.jsx("div",{ref:y,className:"rounded-lg border border-gray-800 bg-gray-900/40 px-4 py-3 text-center text-xs text-gray-500",children:i?"Loading more runs...":"Scroll to load more..."})]}),d.jsx("div",{className:"hidden max-w-full overflow-x-auto rounded-lg border border-gray-800 sm:block",children:d.jsxs("table",{className:"min-w-[860px] w-full whitespace-nowrap text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[l&&d.jsx("th",{className:"w-10 px-4 py-3"}),d.jsx("th",{className:"w-8 px-4 py-3"}),d.jsx("th",{className:"w-[18rem] px-4 py-3 font-medium text-gray-400",children:"Experiment"}),d.jsx("th",{className:"w-[16rem] px-4 py-3 font-medium text-gray-400",children:"Target"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Remote"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Passed"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Failures"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Errors"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Total"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"When"})]})}),d.jsxs("tbody",{className:"divide-y divide-gray-800/50",children:[R.map(L=>{var je;const{run:F,ts:J,label:re,display:oe,errors:$,totalCount:X,passedCount:le,failedCount:ue,experimentNamespace:pe,runtimeSourceLabel:xe,runtimeSourceTitle:we}=L,_e=px(F),de=!_e&&D.includes(F.filename),te=((je=F.target)==null?void 0:je.trim())||oe.primary;return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[l&&d.jsx("td",{className:"px-4 py-3",children:d.jsx("input",{type:"checkbox",checked:M.has(F.filename),disabled:!de,onChange:()=>G(F.filename),title:_e,"aria-label":_e?`${re}: ${_e}`:`Select ${re}`,className:"h-4 w-4 rounded border-gray-700 bg-gray-900 text-cyan-500 disabled:opacity-30"})}),d.jsx("td",{className:"px-4 py-3 text-center",children:d.jsx(d2,{view:L})}),d.jsx("td",{className:"w-[18rem] max-w-[18rem] px-4 py-3",children:d.jsxs("div",{className:"min-w-0",children:[d.jsx("div",{className:"truncate font-medium text-gray-200",title:`Experiment: ${pe}`,children:pe}),xe?d.jsx("div",{className:"mt-0.5 truncate text-xs text-cyan-300",title:we??xe,children:xe}):null]})}),d.jsx("td",{className:"w-[16rem] max-w-[16rem] px-4 py-3",children:d.jsx("div",{className:"min-w-0",children:d.jsx("div",{className:"flex min-w-0 items-center gap-2",children:d.jsx(u2,{projectId:t,runId:F.filename,label:te,title:oe.title,className:"block min-w-0 truncate font-medium text-cyan-400 hover:text-cyan-300 hover:underline"})})})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(c2,{onRemote:F.on_remote===!0,branch:c})}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-emerald-300",children:le}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:ue>0?ue:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums",children:$>0?d.jsx("span",{className:"text-amber-300",children:$}):d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:X}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(an,{rate:F.pass_rate})}),d.jsx("td",{className:"px-4 py-3 text-gray-400",title:J.full,children:J.date})]},F.filename)}),(n||i)&&d.jsx("tr",{ref:g,children:d.jsx("td",{colSpan:l?11:10,className:"px-4 py-3 text-center text-xs text-gray-500",children:i?"Loading more runs...":"Scroll to load more..."})})]})]})})]})}function u2({projectId:e,runId:t,label:r,title:n,className:i}){return e?d.jsx(Ee,{to:"/projects/$projectId/runs/$runId",params:{projectId:e,runId:t},className:i,title:n,children:r}):d.jsx(Ee,{to:"/runs/$runId",params:{runId:t},className:i,title:n,children:r})}function c2({onRemote:e,branch:t}){return e?d.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-cyan-900/60 bg-cyan-950/20 px-2 py-0.5 text-xs font-medium text-cyan-300",title:t?`On ${t}`:"On the remote results branch","aria-label":t?`On remote branch ${t}`:"On the remote results branch",children:[d.jsx(vie,{}),"Synced"]}):d.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-gray-800 bg-gray-900/70 px-2 py-0.5 text-xs font-medium text-gray-500",title:"Local only — not pushed","aria-label":"Local only — not pushed",children:[d.jsx(xie,{}),"Local only"]})}function vie(){return d.jsxs("svg",{viewBox:"0 0 24 24",className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"M7 18a4 4 0 0 1-.5-7.97A5 5 0 0 1 16 9a3.5 3.5 0 0 1 1 6.86"}),d.jsx("path",{d:"m9 14 2 2 4-4"})]})}function xie(){return d.jsx("svg",{viewBox:"0 0 24 24",className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M7 18a4 4 0 0 1-.5-7.97A5 5 0 0 1 16 9a3.5 3.5 0 0 1 1 6.86"})})}function bie({experimentNamespace:e,runtimeSourceLabel:t,runtimeSourceTitle:r}){return d.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 text-[11px]",children:[d.jsxs("span",{className:"max-w-full truncate rounded-md border border-gray-800 bg-gray-950/50 px-1.5 py-0.5 text-gray-400",title:`Experiment namespace: ${e}`,children:["Experiment: ",e]}),t?d.jsxs("span",{className:"max-w-full truncate rounded-md border border-cyan-900/50 bg-cyan-950/20 px-1.5 py-0.5 text-cyan-300",title:r??t,children:["Runtime: ",t]}):null]})}function d2({view:e,className:t=""}){return e.isActive?d.jsx("span",{className:`inline-block h-2 w-2 animate-pulse rounded-full bg-cyan-400 ${t}`,title:e.run.status==="starting"?"Starting...":"Running...","aria-label":e.run.status==="starting"?"Starting":"Running"}):e.qualityCount===0&&e.errors>0?d.jsx("span",{className:`text-base font-bold text-amber-300 ${t}`,title:"Execution errors",children:"!"}):d.jsx("span",{className:`text-base font-bold ${e.passing?"text-emerald-400":"text-red-400"} ${t}`,children:e.passing?"✓":"✗"})}function yl({label:e,valueClassName:t,children:r}){return d.jsxs("div",{className:"min-w-0",children:[d.jsx("dt",{className:"text-xs text-gray-500",children:e}),d.jsx("dd",{className:`mt-1 min-w-0 text-sm tabular-nums ${t}`,children:r})]})}function N5({remoteStatus:e,syncInFlight:t,onSync:r,projectName:n,syncFeedback:i,onRemoteSummary:o,onConfirmMerge:l,confirmMergeInFlight:c}){var _,E;const h=(e==null?void 0:e.configured)===!0,f=YB(e,t),p=t===!0||!f.canSync,g=f.pendingMerge,y={neutral:"border-gray-700 bg-gray-800/70 text-gray-300",good:"border-emerald-800/70 bg-emerald-950/30 text-emerald-300",info:"border-cyan-800/70 bg-cyan-950/30 text-cyan-300",warn:"border-yellow-800/70 bg-yellow-950/30 text-yellow-300",danger:"border-red-800/70 bg-red-950/30 text-red-300"}[f.tone],x=(i==null?void 0:i.kind)==="success"?"border-emerald-900/60 bg-emerald-950/20 text-emerald-300":(i==null?void 0:i.kind)==="warning"?"border-yellow-900/60 bg-yellow-950/20 text-yellow-300":"border-red-900/60 bg-red-950/20 text-red-300",b=((_=e==null?void 0:e.dirty_paths)==null?void 0:_.length)??0,w=((E=e==null?void 0:e.conflicted_paths)==null?void 0:E.length)??0,N=KB(e,n,o);return d.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-4",children:[d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:"text-sm font-medium text-gray-200",children:"Recent Runs"}),h&&o?d.jsx("p",{className:"mt-0.5 text-xs text-gray-500",children:o}):null]}),h?d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:`inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-medium ${y}`,children:f.label}),r?d.jsx("button",{type:"button",onClick:r,disabled:p,title:f.canSync?void 0:f.nextAction,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:t?"Syncing...":f.actionLabel}):null]}):null]}),h?d.jsxs("div",{className:"space-y-2 text-sm",children:[d.jsx("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-gray-400",children:N.map(T=>d.jsx("span",{children:T},T))}),d.jsx("p",{className:f.tone==="danger"?"text-red-300":"text-gray-400",children:f.summary}),f.nextAction?d.jsx("p",{className:"text-xs text-gray-500",children:f.nextAction}):null,b>0||w>0?d.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[b>0?d.jsxs("span",{className:"rounded-md border border-yellow-900/60 bg-yellow-950/20 px-2 py-0.5 text-yellow-300",children:[b," dirty path",b===1?"":"s"]}):null,w>0?d.jsxs("span",{className:"rounded-md border border-red-900/60 bg-red-950/20 px-2 py-0.5 text-red-300",children:[w," conflicted path",w===1?"":"s"]}):null]}):null]}):d.jsxs("p",{className:"text-sm text-gray-500",children:["Remote results are not configured. Add"," ",d.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:"results"})," to"," ",d.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:".agentv/config.yaml"})," to enable."]}),g?d.jsxs("div",{className:"space-y-2 rounded-md border border-yellow-900/60 bg-yellow-950/20 px-3 py-2.5 text-sm text-yellow-200",children:[d.jsx("p",{className:"font-medium text-yellow-300",children:"Pending merge on GitHub"}),d.jsxs("p",{className:"text-yellow-200/90",children:["Local results were pushed to"," ",d.jsx("code",{className:"rounded bg-yellow-950/60 px-1 font-mono text-xs text-yellow-200",children:g.tempBranch})," ","instead of force-pushing"," ",d.jsx("code",{className:"rounded bg-yellow-950/60 px-1 font-mono text-xs text-yellow-200",children:g.targetBranch}),typeof g.contributedRunCount=="number"?` (${g.contributedRunCount} run${g.contributedRunCount===1?"":"s"})`:"",". Merge it on GitHub, then resync."]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-0.5",children:[g.compareUrl?d.jsx("a",{href:g.compareUrl,target:"_blank",rel:"noreferrer noopener",className:"rounded-md border border-yellow-700 bg-yellow-950/40 px-3 py-1.5 text-sm font-medium text-yellow-200 transition-colors hover:bg-yellow-900/40",children:"Open merge on GitHub ↗"}):null,l?d.jsx("button",{type:"button",onClick:l,disabled:c===!0||t===!0,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:c?"Resyncing...":"I merged it — resync"}):null]})]}):null,i?d.jsx("div",{className:`rounded-md border px-3 py-2 text-sm ${x}`,role:i.kind==="error"?"alert":"status",children:i.message}):null,e!=null&&e.last_error?d.jsxs("div",{className:"rounded-md border border-red-900/60 bg-red-950/20 px-3 py-2 text-sm text-red-300",role:"alert",children:[d.jsx("p",{className:"font-medium",children:"Remote sync error"}),d.jsx("p",{children:e.last_error}),d.jsx("p",{className:"mt-1 text-xs text-red-200/80",children:oj(e)})]}):null,e!=null&&e.git_diff_summary&&f.state!=="clean"?d.jsx("pre",{className:"max-h-32 overflow-auto whitespace-pre-wrap rounded-md border border-gray-800 bg-gray-950/60 px-3 py-2 text-xs text-gray-500",children:e.git_diff_summary}):null]})}function _5({projectId:e,tagKey:t,onTagKeyChange:r}){const{data:n}=Ue(e?n6(e):r6),i=(n==null?void 0:n.keys)??[jl],o=i.includes(t),l=o?t:i.includes(jl)?jl:i[0]??jl;S.useEffect(()=>{n&&!o&&l!==t&&r(l)},[n,o,l,t,r]);const{data:c,isLoading:h}=Ue(e?cj(e,l):uj(l)),f=(c==null?void 0:c.groups)??[];return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("label",{htmlFor:"tag-key-select",className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Group by"}),d.jsx("select",{id:"tag-key-select",value:l,onChange:p=>r(p.target.value),className:"rounded-md border border-gray-700 bg-gray-900 px-2 py-1 text-sm text-gray-200 focus:border-cyan-700 focus:outline-none",children:i.map(p=>d.jsx("option",{value:p,children:Zi(p)},p))})]}),h?d.jsx(jie,{}):f.length===0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsxs("p",{className:"text-lg text-gray-400",children:["No values found for tag `",l,"`"]}),d.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Values will appear here once evaluations are run with a ",d.jsx("code",{children:l})," tag."]})]}):d.jsx("div",{className:"max-w-full overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"min-w-[760px] w-full whitespace-nowrap text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:Zi(l)}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Targets"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Execution Errors"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Last Run"})]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:f.map(p=>{const g=Bc(p),y=ur(p);return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"px-4 py-3",children:e?d.jsx(Ee,{to:"/projects/$projectId/tags/$key/$value",params:{projectId:e,key:l,value:p.name},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:p.name}):d.jsx(Ee,{to:"/tags/$key/$value",params:{key:l,value:p.name},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:p.name})}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:p.run_count}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:p.target_count}),d.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[d.jsx("span",{className:"text-emerald-400",children:p.passed_count}),d.jsx("span",{className:"text-gray-600",children:" / "}),g]}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-amber-400",children:y>0?y:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(an,{rate:p.pass_rate})}),d.jsx("td",{className:"px-4 py-3 text-gray-400",title:f2(p.last_run).full,children:f2(p.last_run).date})]},p.name)})})]})})]})}function f2(e){if(!e)return{date:"N/A",full:"N/A"};try{const t=new Date(e);if(Number.isNaN(t.getTime()))return{date:"N/A",full:"N/A"};const r=t.toLocaleString(),n=Date.now()-t.getTime(),i=Math.floor(n/6e4),o=Math.floor(n/36e5);let l;return i<1?l="just now":i<60?l=`${i} min ago`:o<24?l=`${o} hour${o===1?"":"s"} ago`:l=t.toLocaleDateString(),{date:l,full:r}}catch{return{date:"N/A",full:"N/A"}}}function jie(){return d.jsx("div",{className:"max-w-full overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("div",{className:"min-w-[760px] animate-pulse",children:[d.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>d.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[d.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},e))]})})}const h2="remote::";function wie(e){return e.startsWith(h2)?e.slice(h2.length):e}function Wp(e){const t=new Map;for(const r of e){const n=wie(r.filename),i=t.get(n);if(!i){t.set(n,r);continue}const o=i.source==="remote"&&r.source==="local"?r:i;t.set(n,{...o,on_remote:i.on_remote===!0||r.on_remote===!0})}return[...t.values()]}function O5({projectId:e}={}){var g,y;const[t,r]=S.useState(null),n=Ue(e?E6(e):s6),i=Ue(e?fj(e):lj),o=((g=n.data)==null?void 0:g.targets)??[],l=((y=i.data)==null?void 0:y.runs)??[],c=n.error??i.error,h=n.isLoading||i.isLoading,f=S.useMemo(()=>o.find(x=>x.name===t)??null,[t,o]);S.useEffect(()=>{t&&!o.some(x=>x.name===t)&&r(null)},[t,o]);const p=S.useMemo(()=>{if(!f)return[];const x=new Map;for(const b of l){if((b.target??"default")!==f.name)continue;const N=b.experiment??"default",_=x.get(N)??[];_.push(b),x.set(N,_)}return[...x.entries()].map(([b,w])=>Sie(b,Wp(w))).sort((b,w)=>b.latestTimestamp&&w.latestTimestamp&&b.latestTimestamp!==w.latestTimestamp?w.latestTimestamp.localeCompare(b.latestTimestamp):b.latestTimestamp?-1:w.latestTimestamp?1:b.name.localeCompare(w.name))},[l,f]);return h?d.jsx(Oie,{}):c?d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load targets: ",c.message]}):o.length===0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Targets will appear here once evaluations are run with target labels."})]}):f?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"space-y-3",children:[d.jsx("button",{type:"button",onClick:()=>r(null),className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200",children:"← Back to targets"}),d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:d.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold text-white",children:f.name}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[f.run_count," run",f.run_count===1?"":"s"," ·"," ",f.experiment_count," experiment",f.experiment_count===1?"":"s"," ·"," ",d.jsx("span",{className:"text-emerald-400",children:f.passed_count}),d.jsx("span",{className:"text-gray-600",children:" / "}),Bc(f)," evals passed",ur(f)>0&&d.jsxs("span",{className:"ml-2 text-amber-400",children:["· ",ur(f)," execution errors"]})]})]}),d.jsx("div",{className:"w-full max-w-52",children:d.jsx(an,{rate:f.pass_rate})})]})})]}),p.length===0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-400",children:"No runs found for this target"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This target summary exists, but there are no matching runs to group by experiment."})]}):d.jsx("div",{className:"space-y-6",children:p.map(x=>d.jsxs("section",{className:"space-y-3",children:[d.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-4 sm:flex-row sm:items-center sm:justify-between",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"text-lg font-medium text-gray-200",children:Nie(x.name)}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[x.runs.length," run",x.runs.length===1?"":"s"," ·"," ",d.jsx("span",{className:"text-emerald-400",children:x.passedCount}),d.jsx("span",{className:"text-gray-600",children:" / "}),x.qualityCount," evals passed",x.executionErrorCount>0&&d.jsxs("span",{className:"ml-2 text-amber-400",children:["· ",x.executionErrorCount," execution errors"]}),x.latestTimestamp&&d.jsxs("span",{className:"ml-2 text-gray-500",children:["· Last run ",_ie(x.latestTimestamp)]})]})]}),d.jsx("div",{className:"w-full max-w-52",children:d.jsx(an,{rate:x.passRate})})]}),d.jsx(Xp,{runs:x.runs,projectId:e})]},x.name))})]}):d.jsx("div",{className:"max-w-full overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"min-w-[720px] w-full whitespace-nowrap text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Experiments"}),d.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"}),d.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Execution Errors"})]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:o.map(x=>{const b=Bc(x),w=ur(x);return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"px-4 py-3",children:d.jsx("button",{type:"button",onClick:()=>r(x.name),className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:x.name})}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:x.run_count}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:x.experiment_count}),d.jsx("td",{className:"px-4 py-3",children:d.jsx(an,{rate:x.pass_rate})}),d.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[d.jsx("span",{className:"text-emerald-400",children:x.passed_count}),d.jsx("span",{className:"text-gray-600",children:" / "}),d.jsx("span",{children:b})]}),d.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-amber-400",children:w>0?w:d.jsx("span",{className:"text-gray-600",children:"0"})})]},x.name)})})]})})}function Sie(e,t){let r=0,n=0,i=0,o=0,l=null;for(const c of t){const h=ur(c),f=Math.max(0,c.test_count-h);r+=c.test_count,n+=f,o+=h,i+=Math.round(c.pass_rate*f),c.timestamp&&(!l||c.timestamp>l)&&(l=c.timestamp)}return{name:e,runs:t,latestTimestamp:l,evalCount:r,qualityCount:n,passedCount:i,executionErrorCount:o,passRate:n>0?i/n:0}}function Nie(e){return e==="default"?"Default experiment":e}function _ie(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const r=Date.now()-t.getTime(),n=Math.floor(r/6e4),i=Math.floor(r/36e5);return n<1?"just now":n<60?`${n} min ago`:i<24?`${i} hour${i===1?"":"s"} ago`:t.toLocaleDateString()}function Oie(){return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[d.jsx("div",{className:"h-6 w-40 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"mt-3 h-4 w-72 animate-pulse rounded bg-gray-800"})]}),d.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:d.jsxs("div",{className:"animate-pulse",children:[d.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>d.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[d.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),d.jsx("div",{className:"h-4 w-20 rounded bg-gray-800"})]},e))]})}),d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900/40 p-4",children:[d.jsx("div",{className:"h-5 w-48 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"mt-3 h-4 w-56 animate-pulse rounded bg-gray-800"})]})]})}const m2=[{id:"runs",label:"🏃 Recent Runs"},{id:"tags",label:"🏷️ Tags"},{id:"analytics",label:"📊 Analytics"},{id:"targets",label:"🤖 Targets"}],Eie=dr("/")({component:Aie});function Aie(){const e=po(),n=nj().location.search.tab,{data:i,isLoading:o}=dj(),{data:l,isLoading:c}=pt(),h=(i==null?void 0:i.projects)??[],[f,p]=S.useState(void 0);S.useEffect(()=>{if(o||c)return;const y=l==null?void 0:l.current_project_id;if(!y){p(null);return}const x=LB(y),b=typeof window<"u"&&window.sessionStorage.getItem(x)==="1",w=zB(h.map(N=>N.id),y,b);typeof window<"u"&&w&&window.sessionStorage.setItem(x,"1"),p(w??null)},[l==null?void 0:l.current_project_id,c,h,o]);const g=BB(h.map(y=>y.id),l==null?void 0:l.project_dashboard,f??void 0,n);return S.useEffect(()=>{g.kind==="redirect"&&g.redirectPath&&e({to:g.redirectPath,replace:!0})},[g,e]),o||c||f===void 0?d.jsx(Ub,{}):g.kind==="redirect"?d.jsx(Ub,{}):g.kind==="dashboard"?d.jsx(Tie,{}):d.jsx(Cie,{})}function Tie(){const{data:e}=dj(),{data:t}=pt(),r=ho(),[n,i]=S.useState(!1),[o,l]=S.useState(!1),[c,h]=S.useState(null),f=(e==null?void 0:e.projects)??[],p=(t==null?void 0:t.read_only)===!0;async function g(y){await b6(y.id),r.setQueryData(["projects"],x=>x&&{projects:x.projects.filter(b=>b.id!==y.id)}),h(`Project removed from Dashboard: ${y.id}. Files were left on disk.`),r.invalidateQueries({queryKey:["projects"]})}return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Projects"}),d.jsx("div",{className:"flex gap-2",children:!p&&d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:()=>l(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"Start"}),d.jsx("button",{type:"button",onClick:()=>{h(null),i(!0)},className:"rounded-md bg-cyan-500 px-3 py-1.5 text-sm font-medium text-gray-950 transition-colors hover:bg-cyan-400",children:"Add Project"})]})})]}),c&&d.jsx("div",{className:"rounded-lg border border-cyan-900/60 bg-cyan-950/30 p-3 text-sm text-cyan-300",children:c}),f.length===0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-300",children:"No projects registered yet."}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Add a project path to start browsing runs, tags, analytics, and targets."})]}):d.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:f.map(y=>d.jsx(iie,{project:y,canRemove:!p,onRemove:g},y.id))}),!p&&d.jsx(So,{open:o,onClose:()=>l(!1)}),!p&&d.jsx(f9,{open:n,onClose:()=>i(!1),onAdded:y=>{h(`Project registered: ${y.id}`),r.invalidateQueries({queryKey:["projects"]})}})]})}function Cie(){var ae;const t=nj().location.search,r=t.tab,n=(ae=t.key)!=null&&ae.trim()?t.key:jl,i=po(),o=ho(),{data:l,isLoading:c,error:h,hasNextPage:f,fetchNextPage:p,isFetchingNextPage:g}=h6(),{data:y}=ep(),{data:x}=pt(),[b,w]=S.useState(!1),[N,_]=S.useState(!1),[E,T]=S.useState(!1),[A,C]=S.useState(null),R=(x==null?void 0:x.read_only)===!0,D=m2.some(Z=>Z.id===r)?r:"runs",M=Wp((l==null?void 0:l.runs)??[]),z=M.filter(Z=>Z.on_remote===!0).length,k=(y==null?void 0:y.configured)===!0?AR(z,M.length,y.branch):void 0;async function H(){_(!0),C(null);try{const Z=await DR();o.setQueryData($c().queryKey,Z),C(Hh(Z)),Promise.all([o.invalidateQueries({queryKey:["runs"]}),o.invalidateQueries({queryKey:["tags"]}),o.invalidateQueries({queryKey:["compare"]}),o.invalidateQueries({queryKey:["targets"]}),o.invalidateQueries({queryKey:["remote-status",""]})]).catch(()=>{})}catch(Z){C(Kh(Z,y)),o.invalidateQueries({queryKey:["remote-status",""]}).catch(()=>{})}finally{_(!1)}}S.useEffect(()=>{if((A==null?void 0:A.kind)!=="success")return;const Z=window.setTimeout(()=>C(null),7e3);return()=>window.clearTimeout(Z)},[A]);async function U(){T(!0),C(null);try{const Z=await kR();o.setQueryData($c().queryKey,Z),C(Hh(Z)),Promise.all([o.invalidateQueries({queryKey:["runs"]}),o.invalidateQueries({queryKey:["tags"]}),o.invalidateQueries({queryKey:["compare"]}),o.invalidateQueries({queryKey:["targets"]}),o.invalidateQueries({queryKey:["remote-status",""]})]).catch(()=>{})}catch(Z){C(Kh(Z,y)),o.invalidateQueries({queryKey:["remote-status",""]}).catch(()=>{})}finally{T(!1)}}return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Evaluation Runs"}),(x==null?void 0:x.project_name)&&d.jsx("p",{className:"mt-0.5 text-sm text-gray-500",children:x.project_name})]}),!R&&d.jsx("button",{type:"button",onClick:()=>w(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"Start"})]}),d.jsx("div",{className:"border-b border-gray-800",children:d.jsx("div",{className:"flex flex-wrap gap-1 sm:flex-nowrap",children:m2.map(Z=>d.jsx("button",{type:"button",onClick:()=>i({to:"/",search:Z.id==="tags"?{tab:Z.id,key:n}:{tab:Z.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${D===Z.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:Z.label},Z.id))})}),D==="runs"&&d.jsx(Rie,{runs:M,isLoading:c,error:h,remoteStatus:y,syncInFlight:N,syncFeedback:A,onSyncRemote:H,onConfirmMerge:U,confirmMergeInFlight:E,projectName:x==null?void 0:x.project_name,onRemoteSummary:k,hasNextPage:f,isFetchingNextPage:g,onLoadMore:()=>void p(),readOnly:R}),D==="tags"&&d.jsx(_5,{tagKey:n,onTagKeyChange:Z=>i({to:"/",search:{tab:"tags",key:Z}})}),D==="analytics"&&d.jsx(Pie,{readOnly:R}),D==="targets"&&d.jsx(O5,{}),!R&&d.jsx(So,{open:b,onClose:()=>w(!1)})]})}function Pie({readOnly:e}){const{data:t,isLoading:r,isError:n,error:i}=m6();return d.jsx(w5,{data:t,isLoading:r,isError:n,error:i,readOnly:e})}function Rie({runs:e,isLoading:t,error:r,remoteStatus:n,syncInFlight:i,syncFeedback:o,onSyncRemote:l,onConfirmMerge:c,confirmMergeInFlight:h,projectName:f,onRemoteSummary:p,hasNextPage:g,isFetchingNextPage:y,onLoadMore:x,readOnly:b}){return t?d.jsx(Ub,{}):r?d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",r.message]}):d.jsxs("div",{className:"space-y-4",children:[d.jsx(Mie,{}),d.jsx(N5,{remoteStatus:n,syncInFlight:i,onSync:l,projectName:f,syncFeedback:o,onRemoteSummary:p,onConfirmMerge:c,confirmMergeInFlight:h}),d.jsx(Xp,{runs:e,enableCombine:!b,remoteBranch:n==null?void 0:n.branch,hasNextPage:g,isFetchingNextPage:y,onLoadMore:x})]})}function Mie(){const{data:e}=mj(),t=((e==null?void 0:e.runs)??[]).filter(r=>r.status==="starting"||r.status==="running");return t.length===0?null:d.jsxs("div",{className:"rounded-lg border border-cyan-900/40 bg-cyan-950/10",children:[d.jsx("div",{className:"border-b border-cyan-900/30 px-4 py-2.5",children:d.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-cyan-400",children:"Active"})}),d.jsx("ul",{className:"divide-y divide-gray-800/50",children:t.map(r=>d.jsxs("li",{className:"flex items-center justify-between px-4 py-3",children:[d.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[d.jsx("span",{className:"inline-block h-2 w-2 flex-shrink-0 animate-pulse rounded-full bg-cyan-400"}),d.jsx("span",{className:"truncate font-mono text-sm text-gray-300",children:r.id}),d.jsx("span",{className:"flex-shrink-0 text-xs text-gray-500",children:new Date(r.started_at).toLocaleTimeString()})]}),d.jsx(Ee,{to:"/jobs/$runId",params:{runId:r.id},className:"ml-4 flex-shrink-0 text-xs text-cyan-400 hover:text-cyan-300",children:"View Log →"})]},r.id))})]})}function Ub(){return d.jsx("div",{className:"space-y-2",children:["s1","s2","s3","s4","s5"].map(e=>d.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},e))})}function E5(e){return e==="finished"||e==="failed"}function Die(e,t){return t||!e?!1:!E5(e)}function kie(e,t,r,n){return t||n&&!E5(n)?!1:!!(e.some(i=>i.executionStatus==="execution_error")||r!==void 0&&e.length<r)}function Lie(e){const t={suite_filter:e.suiteFilter,output:e.runDir};return e.target&&(t.target=e.target),e.mode==="resume"?t.resume=!0:t.rerun_failed=!0,t}function $ie(e){const t=!e.ready||e.busy!==null;return[{mode:"rerun",label:"Re-run",title:e.ready?"Re-run failed or missing work, keep passing results":e.disabledReason,disabled:t,testId:"rerun-failed-menu-item"},{mode:"resume",label:"Resume",title:e.ready?"Resume missing or errored work":e.disabledReason,disabled:t,testId:"resume-run-menu-item"}]}function A5({results:e,runDir:t,suiteFilter:r,target:n,projectId:i,isReadOnly:o,plannedTestCount:l,runStatus:c}){const h=po(),f=S.useRef(null),[p,g]=S.useState(null),[y,x]=S.useState(null),[b,w]=S.useState(!1),N=kie(e,o,l,c),_=!!t&&!!r,T=$ie({ready:_,busy:p,disabledReason:t?r?"":"Original eval file path missing from summary.json — cannot determine what to resume":"Run directory unavailable (remote run cannot be resumed in place)"});if(S.useEffect(()=>{if(!b)return;function C(D){f.current&&!f.current.contains(D.target)&&w(!1)}function R(D){D.key==="Escape"&&w(!1)}return document.addEventListener("pointerdown",C),document.addEventListener("keydown",R),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",R)}},[b]),!N)return null;async function A(C){if(!(!_||!t||!r)){w(!1),g(C),x(null);try{const R=Lie({mode:C,runDir:t,suiteFilter:r,target:n}),D=await $R(R,i);h(i?{to:"/projects/$projectId/jobs/$runId",params:{projectId:i,runId:D.id}}:{to:"/jobs/$runId",params:{runId:D.id}})}catch(R){x(R instanceof Error?R.message:"Failed to launch resume"),g(null)}}}return d.jsxs("div",{className:"flex flex-col items-end gap-1",ref:f,children:[d.jsxs("div",{className:"relative",children:[d.jsx("button",{type:"button",onClick:()=>w(C=>!C),disabled:p!==null,"aria-haspopup":"menu","aria-expanded":b,className:"rounded-md border border-gray-700 bg-gray-900 px-3 py-1.5 text-sm font-medium text-gray-200 hover:border-gray-600 hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"run-actions-menu-button",children:p==="resume"?"Resuming...":p==="rerun"?"Re-running...":"Actions"}),b&&d.jsx("div",{className:"absolute left-0 z-20 mt-2 w-48 overflow-hidden rounded-md border border-gray-700 bg-gray-950 py-1 text-sm shadow-xl shadow-black/30 sm:left-auto sm:right-0",role:"menu","aria-label":"Run actions",children:T.map(C=>d.jsx("button",{type:"button",role:"menuitem",onClick:()=>void A(C.mode),disabled:C.disabled,title:C.title,className:"block w-full px-3 py-2 text-left text-gray-200 hover:bg-gray-800 disabled:cursor-not-allowed disabled:text-gray-500","data-testid":C.testId,children:C.label},C.mode))})]}),y&&d.jsx("p",{className:"text-xs text-red-400",children:y})]})}function T5(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function C5(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function Iie(e){const t=C5(e);if(t)try{const r=new URL(t);return!["http:","https:"].includes(r.protocol)||r.username||r.password?void 0:(r.search="",r.hash="",r.toString())}catch{return}}function zie(e){const t=C5(e.provider);return t===void 0||t.toLowerCase()==="phoenix"}function Bie(e){if(e)return{provider:e.external_trace_provider??e["external_trace.provider"],ui_url:e.external_trace_ui_url??e.external_trace_url??e["external_trace.ui_url"]??e["external_trace.url"]}}function Uie(e){const t=e,r=T5(e.metadata)?e.metadata:void 0;return[t.external_trace,t.externalTrace,r==null?void 0:r.external_trace,r==null?void 0:r.externalTrace,Bie(r)]}function qie(e){for(const t of e)for(const r of Uie(t)){if(!T5(r)||!zie(r))continue;const n=Iie(r.ui_url??r.uiUrl??r.url??r.href);if(n)return n}}const P5=[{id:"all",label:"All"},{id:"passing",label:"Passing"},{id:"failing",label:"Failing"},{id:"errors",label:"Errors"},{id:"grader_errors",label:"Grader errors"}],R5="all",M5="all";function zt(e){if(typeof e!="string")return;const t=e.trim();return t||void 0}function p2(e){return[...new Set([...e].filter(t=>t.trim().length>0))].sort((t,r)=>t.localeCompare(r))}function D5(e,t){return zt(e.name)??zt(e.type)??`Grader ${t+1}`}function k5(e,t){var r,n;return e.verdict==="fail"||e.score<t||(r=e.assertions)!=null&&r.some(i=>!i.passed)?!0:((n=e.scores)==null?void 0:n.some(i=>k5(i,t)))??!1}function L5(e){if(!e||e.length===0)return[];const t=[];return e.forEach((r,n)=>{t.push(D5(r,n),r.type??"",r.verdict??"");for(const i of r.assertions??[])t.push(i.text,i.evidence??"");t.push(...L5(r.scores))}),t.filter(r=>r.length>0)}function qb(e){return!e||e.length===0?[]:e.flatMap(t=>[...t.assertions??[],...qb(t.scores)])}function Fie(e){const t=new Set;return e.filter(r=>{const n=`${r.text}\0${r.evidence??""}\0${r.passed}`;return t.has(n)?!1:(t.add(n),!0)})}function Hie(e){const t=new Map;return e==null||e.forEach((r,n)=>{const i=D5(r,n);t.has(i)||t.set(i,r)}),t}function Kie(e){const t=e.tokenUsage;if(!t)return;const r=[t.input,t.output,t.reasoning,t.cached].filter(n=>typeof n=="number"&&Number.isFinite(n));if(r.length!==0)return r.reduce((n,i)=>n+i,0)}function gx(e){return e.filter(t=>typeof t=="number"&&Number.isFinite(t))}function Lh(e){return e.samples??e.attempts??e.trials??[]}function Gie(e,t){return e.status==="passed"?!0:e.status==="failed"||e.status==="skipped"?!1:e.verdict==="pass"?!0:e.verdict==="fail"?!1:typeof e.score=="number"?e.score>=t:!1}function Yie(e){return[e.metrics_path,e.timing_path,e.grading_path,e.transcript_path,e.answer_path].filter(Boolean).length}function Vie(e){const t=zt(e.model);if(t)return t;const r=e.metadata;if(r)return zt(r.model)??zt(r.model_name)??zt(r.target_model)??zt(r.provider_model)}function Qie(e){const t=zt(e.target)??"default",r=zt(e.targetUsed);return r&&r!==t?`${t} -> ${r}`:t}function Xie(e){return zt(e.eval_path)??zt(e.suite)}function Wie(e,t){const r=zt(e.result_dir);return r?`result_dir:${r}`:["result",zt(e.eval_path)??zt(e.suite)??"",e.testId,zt(e.target)??"",zt(e.targetUsed)??"",zt(e.timestamp)??"",String(t)].join(":")}function Zie(e,t,r){var N;const n=VR(e),i=!n&&e.score>=r,o=n?"error":i?"passing":"failing",l=Hie(e.scores),c=[...l.keys()],h=((N=e.scores)==null?void 0:N.some(_=>k5(_,r)))??!1,f=Vie(e),p=Qie(e),g=Xie(e),y=zt(e.suite),x=zt(e.category),b=Kie(e),w=[e.testId,p,f??"",g??"",y??"",x??"",e.executionStatus??"",e.error??"",...L5(e.scores),...(e.assertions??[]).flatMap(_=>[_.text,_.evidence??""])];return{key:Wie(e,t),result:e,index:t,testId:e.testId,status:o,statusLabel:n?"Error":i?"Passing":"Failing",passing:i,executionError:n,graderError:h,targetLabel:p,...f&&{modelLabel:f},...g&&{evalLabel:g},...x&&{categoryLabel:x},...b!==void 0&&{tokenTotal:b},graderNames:c,graderScores:l,searchText:w.join(" ").toLowerCase()}}function Jie(e,t){const r=Lh(e.result).filter(g=>g.sample_path||g.attempt_path||g.run_path||g.verdict);if(r.length<=1)return;const n=r.filter(g=>Gie(g,t)).length,i=r.filter(g=>g.execution_status==="execution_error").length,o=gx(r.map(g=>g.duration_ms)),l=gx(r.map(g=>g.score)),c=gx(r.map(g=>g.total_tool_calls)),h=r.reduce((g,y)=>g+Yie(y),0),f=Fie([...e.result.assertions??[],...qb(e.result.scores),...r.flatMap(g=>[...g.assertions??[],...qb(g.scores)])]),p=f.filter(g=>g.passed).length;return{row:e,trials:r,trialCount:r.length,passedTrials:n,failedTrials:r.length-n,executionErrorTrials:i,passRate:r.length>0?n/r.length:0,meanScore:l.length>0?l.reduce((g,y)=>g+y,0)/l.length:e.result.score,assertionCount:f.length,passedAssertions:p,...f.length>0&&{assertionPassRate:p/f.length},...o.length>0&&{meanDurationMs:o.reduce((g,y)=>g+y,0)/o.length},...c.length>0&&{totalToolCalls:c.reduce((g,y)=>g+y,0)},artifactCount:h}}function ese(e,t){const r=e.some(f=>Lh(f.result).length>1),n=e.some(f=>f.evalLabel),i=e.some(f=>f.categoryLabel),o=e.some(f=>f.result.durationMs!=null||Lh(f.result).some(p=>p.duration_ms!=null)),l=e.some(f=>f.result.costUsd!=null||f.tokenTotal!=null||Lh(f.result).some(p=>p.cost_usd!=null||p.total_tokens!=null||p.token_usage!=null)),c=e.some(f=>f.result.error);return[{id:"status",label:"Status",kind:"base",defaultVisible:!0},...r?[{id:"expander",label:"Expand",kind:"base",defaultVisible:!0}]:[],{id:"test",label:"Test ID",kind:"base",defaultVisible:!0},{id:"target",label:"Target",kind:"base",defaultVisible:!0},...n?[{id:"eval",label:"Eval",kind:"base",defaultVisible:!0}]:[],{id:"score",label:"Score",kind:"base",defaultVisible:!0},...i?[{id:"category",label:"Category",kind:"base",defaultVisible:!1}]:[],...o?[{id:"duration",label:"Duration",kind:"base",defaultVisible:!0}]:[],...l?[{id:"cost_tokens",label:"Cost / Tokens",kind:"base",defaultVisible:!0}]:[],...c?[{id:"error",label:"Error",kind:"base",defaultVisible:!1}]:[],...t.map(f=>({id:`grader:${f}`,label:f,kind:"grader",defaultVisible:!0}))]}function tse(e){return e==="scorer_errors"?"grader_errors":P5.some(t=>t.id===e)?e:"all"}function rse(e){const t=e.filter(r=>r.defaultVisible).map(r=>r.id);return t.length>0?t:e.slice(0,4).map(r=>r.id)}function nse(e,t){if(!t.some(l=>l.id==="expander"))return[...e];if(e.includes("expander")||!e.includes("test"))return[...e];const r=[...e],n=r.indexOf("status"),i=r.indexOf("test"),o=n>=0?n+1:i;return r.splice(o,0,"expander"),r}function ase(e,t,r,n){var p,g;const i=new Set(t.map(y=>y.id)),o=((p=e==null?void 0:e.visibleColumnIds)==null?void 0:p.map(y=>y.startsWith("scorer:")?`grader:${y.slice(7)}`:y).filter(y=>i.has(y)))??[],l=o.length>0?nse(o,t):rse(t),c=e!=null&&e.target&&r.includes(e.target)?e.target:R5,h=(e==null?void 0:e.grader)??(e==null?void 0:e.scorer),f=h&&n.includes(h)?h:M5;return{view:tse(e==null?void 0:e.view),search:((g=e==null?void 0:e.search)==null?void 0:g.trim())??"",target:c,grader:f,visibleColumnIds:l}}function ise(e,t){switch(t){case"passing":return e.status==="passing";case"failing":return e.status==="failing";case"errors":return e.status==="error";case"grader_errors":return e.graderError;case"all":return!0}}function sse(e){return{all:e.length,passing:e.filter(t=>t.status==="passing").length,failing:e.filter(t=>t.status==="failing").length,errors:e.filter(t=>t.status==="error").length,grader_errors:e.filter(t=>t.graderError).length}}function ose(e){const t=e.results.map((y,x)=>Zie(y,x,e.passThreshold)),r=p2(t.map(y=>y.targetLabel)),n=p2(t.flatMap(y=>y.graderNames)),i=ese(t,n),o=ase(e.state,i,r,n),l=o.search.toLowerCase(),c=new Set(o.visibleColumnIds),h=t.filter(y=>!(!ise(y,o.view)||o.target!==R5&&y.targetLabel!==o.target||o.grader!==M5&&!y.graderScores.has(o.grader)||l&&!y.searchText.includes(l))),f=t.map(y=>Jie(y,e.passThreshold)).filter(y=>!!y),p=new Set(h.map(y=>y.key)),g=f.filter(y=>p.has(y.row.key));return{rows:t,filteredRows:h,repeatGroups:f,filteredRepeatGroups:g,columns:i,visibleColumns:i.filter(y=>c.has(y.id)),state:o,targetOptions:r,graderOptions:n,viewCounts:sse(t)}}function lse(e){var r;switch((r=e.split(".").pop())==null?void 0:r.toLowerCase()){case"ts":case"tsx":return"📘";case"json":return"📋";case"log":case"txt":return"📜";case"md":return"📝";default:return"📄"}}function use(e){if(e.type==="file")return e.storage==="git"&&e.ref?e.ref:e.storage&&e.storage!=="local"?e.storage:void 0}function $5(e){const t=[];for(const r of e)r.type==="dir"&&(t.push(r.path),r.children&&t.push(...$5(r.children)));return t}function I5({node:e,selectedPath:t,onSelect:r,openFolders:n,toggleFolder:i,depth:o=0}){const l=e.type==="dir",c=n.has(e.path),h=t===e.path,f=use(e);return d.jsxs("div",{children:[d.jsxs("button",{type:"button",onClick:()=>{l?i(e.path):r(e.path)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors ${h?"bg-cyan-400/20 text-cyan-400":"text-gray-300 hover:bg-gray-800/50 hover:text-gray-200"}`,style:{paddingLeft:`${o*16+8}px`},children:[d.jsx("span",{className:"flex-shrink-0 text-xs",children:l?c?"📂":"📁":lse(e.name)}),d.jsx("span",{className:"truncate",children:e.name}),f&&d.jsx("span",{className:"ml-auto max-w-32 flex-shrink-0 truncate rounded border border-gray-700 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-gray-400",title:[e.kind?`kind: ${e.kind}`:void 0,e.ref?`ref: ${e.ref}`:void 0,e.key?`key: ${e.key}`:void 0].filter(Boolean).join(`
|
|
119
|
+
`),children:f})]}),l&&c&&e.children&&d.jsx("div",{children:e.children.map(p=>d.jsx(I5,{node:p,selectedPath:t,onSelect:r,openFolders:n,toggleFolder:i,depth:o+1},p.path))})]})}function cse({files:e,selectedPath:t,onSelect:r}){const[n,i]=S.useState(()=>new Set($5(e))),o=l=>{i(c=>{const h=new Set(c);return h.has(l)?h.delete(l):h.add(l),h})};return d.jsxs("div",{className:"w-full md:w-64 overflow-y-auto rounded-lg border border-gray-800 bg-gray-900 py-2",children:[e.length===0&&d.jsx("p",{className:"px-4 py-2 text-sm text-gray-500",children:"No files."}),e.map(l=>d.jsx(I5,{node:l,selectedPath:t,onSelect:r,openFolders:n,toggleFolder:o},l.path))]})}const dse="modulepreload",fse=function(e){return"/"+e},g2={},hse=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){let l=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),h=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=l(r.map(f=>{if(f=fse(f),f in g2)return;g2[f]=!0;const p=f.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":dse,p||(y.as="script"),y.crossOrigin="",y.href=f,h&&y.setAttribute("nonce",h),document.head.appendChild(y),p)return new Promise((x,b)=>{y.addEventListener("load",x),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})},mse=S.lazy(()=>hse(()=>import("./index-CbEMiJSb.js"),[]));function pse({value:e,language:t="json",height:r="400px"}){return d.jsx(S.Suspense,{fallback:d.jsx("div",{className:"flex items-center justify-center rounded-lg bg-gray-900 p-8 text-gray-500",children:"Loading editor..."}),children:d.jsx(mse,{height:r,language:t,value:e,theme:"vs-dark",options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:"on",wordWrap:"on",padding:{top:12}}})})}function fo({score:e,className:t=""}){const r=Math.round(Math.max(0,Math.min(1,e))*100);return d.jsxs("div",{className:`flex items-center gap-3 ${t}`,children:[d.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-gray-800",children:d.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-cyan-400 to-blue-500 transition-all duration-300",style:{width:`${r}%`}})}),d.jsxs("span",{className:"w-12 text-right text-sm font-medium tabular-nums text-gray-300",children:[r,"%"]})]})}const gse={system:{container:"border-gray-800 bg-gray-900/70",badge:"border-gray-700 bg-gray-800 text-gray-300",label:"System",accent:"text-gray-400"},user:{container:"border-cyan-900/60 bg-cyan-950/20",badge:"border-cyan-900/60 bg-cyan-950/30 text-cyan-300",label:"User",accent:"text-cyan-300"},assistant:{container:"border-gray-800 bg-gray-900",badge:"border-gray-700 bg-gray-800 text-gray-200",label:"Assistant",accent:"text-gray-300"},tool:{container:"border-amber-900/60 bg-amber-950/20",badge:"border-amber-900/60 bg-amber-950/30 text-amber-300",label:"Tool result",accent:"text-amber-300"},function:{container:"border-amber-900/60 bg-amber-950/20",badge:"border-amber-900/60 bg-amber-950/30 text-amber-300",label:"Function result",accent:"text-amber-300"}};function Fr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function yse(e){return!Fr(e)||e.tool_calls!==void 0&&!Array.isArray(e.tool_calls)?!1:typeof e.test_id=="string"&&typeof e.target=="string"&&typeof e.message_index=="number"&&Number.isFinite(e.message_index)&&typeof e.role=="string"}function y2(e){return Fr(e)&&e.v===1&&typeof e.agent=="string"&&(e.type==="system"||e.type==="user"||e.type==="assistant")&&Array.isArray(e.content)}function vse(e){const t=Fr(e.result)?e.result:void 0,r=xse(e.metadata,t==null?void 0:t.metadata);return{id:typeof e.id=="string"?e.id:void 0,tool:typeof e.tool_name=="string"?e.tool_name:typeof e.name=="string"?e.name:"tool",input:e.input,output:t==null?void 0:t.output,error:t==null?void 0:t.error,status:typeof(t==null?void 0:t.status)=="string"?t.status:void 0,duration_ms:typeof(t==null?void 0:t.duration_ms)=="number"?t.duration_ms:void 0,metadata:r}}function xse(e,t){const r=Fr(e),n=Fr(t);if(r&&n)return{...e,result:t};if(r)return e;if(n)return t}function v2(e,t,r){const n=e.content,i=n.filter(h=>Fr(h)&&h.type==="tool_use").map(vse),o=typeof e.input_tokens=="number"?e.input_tokens:void 0,l=typeof e.output_tokens=="number"?e.output_tokens:void 0,c=o!==void 0||l!==void 0?{input:o??0,output:l??0}:void 0;return{test_id:(r==null?void 0:r.testId)??"",target:(r==null?void 0:r.target)??e.agent,message_index:t,role:e.type,agent:e.agent,model:typeof e.model=="string"?e.model:void 0,content:n,tool_calls:i.length>0?i:void 0,start_time:typeof e.ts=="string"?e.ts:void 0,token_usage:c,metadata:typeof e.id=="string"?{id:e.id}:void 0,source:{provider:e.agent,session_id:"",model:typeof e.model=="string"?e.model:void 0,timestamp:typeof e.ts=="string"?e.ts:void 0}}}function z5(e){const t=e.trim();if(t.startsWith("{"))try{const i=JSON.parse(t);if(Fr(i)&&Array.isArray(i.turns)){const o=typeof i.target=="string"?i.target:void 0,l=Fr(i.metadata)&&typeof i.metadata.test_id=="string"?i.metadata.test_id:void 0;return{entries:i.turns.flatMap((h,f)=>y2(h)?[v2(h,f,{target:o,testId:l})]:[])}}}catch{}const r=[],n=e.split(/\r?\n/);for(let i=0;i<n.length;i+=1){const o=n[i].trim();if(o)try{const l=JSON.parse(o);if(y2(l)){r.push(v2(l,r.length));continue}if(!yse(l))return{entries:r,error:`Line ${i+1} is not a transcript JSONL row.`};r.push(l)}catch(l){return{entries:r,error:`Line ${i+1} is invalid JSON: ${l.message}`}}}return{entries:r}}function Hm(e){if(e!==void 0)return e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function bse(e){if(typeof e=="number")return`$${e.toFixed(4)}`}function sS(e){if(!e)return;const t=[];return typeof e.input=="number"&&t.push(`${e.input} in`),typeof e.output=="number"&&t.push(`${e.output} out`),typeof e.reasoning=="number"&&t.push(`${e.reasoning} reasoning`),typeof e.cached=="number"&&t.push(`${e.cached} cached`),t.length>0?t.join(" / "):void 0}function B5(e){if(e===void 0)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function jse(e){if(Array.isArray(e)){const t=e.map(r=>{if(Fr(r)&&r.type==="text"&&typeof r.text=="string")return r.text;if(Fr(r)&&r.type==="thinking"&&typeof r.text=="string")return`Thinking:
|
|
120
120
|
${r.text}`;if(Fr(r)&&r.type==="image"&&typeof r.source=="string")return`Image: ${r.source}`}).filter(r=>r!==void 0);if(t.length>0)return t.join(`
|
|
121
|
-
`)}return B5(e)}function ad(e,t){for(const r of t){const n=e[r];if(typeof n=="string"&&n.trim())return n}}function Fb(e,t){for(const r of t)if(e[r]!==void 0)return e[r]}function U5(e,t){const r=e[t];return Fr(r)?r:void 0}function wse(e,t){const r=U5(e,"function");return ad(e,["tool","name","tool_name"])??(r?ad(r,["name"]):void 0)??`Tool ${t+1}`}function Sse(e){const t=U5(e,"function");return Fb(e,["input","arguments","args","parameters"])??(t?Fb(t,["arguments"]):void 0)}function Nse(e){return Fb(e,["output","result","content"])}function _se(e,t){return`${e.message_index}-${e.role}-${t}`}function Ose(e){return[...e].sort((t,r)=>t.message_index-r.message_index).map((t,r)=>{const n=gse[t.role]??{container:"border-gray-800 bg-gray-900",badge:"border-gray-700 bg-gray-800 text-gray-300",label:t.role,accent:"text-gray-300"},i=_se(t,r),o=(Array.isArray(t.tool_calls)?t.tool_calls.filter(Fr):[]).map((l,c)=>{const h=ad(l,["id","call_id","tool_call_id"]);return{id:`${i}-tool-${h??c}`,call:l,index:c,name:wse(l,c),status:ad(l,["status"]),duration:typeof l.duration_ms=="number"?Hm(l.duration_ms):void 0}});return{id:i,anchorId:`message-${r+1}`,line:t,ordinal:r,roleStyle:n,content:jse(t.content),duration:Hm(t.duration_ms),tokenUsage:sS(t.token_usage),toolCalls:o}})}function x2(e){const t=new Set;e[0]&&t.add(e[0].id);const r=e[e.length-1];return r&&t.add(r.id),t}function Ese(e){const t=new Map;for(const r of e)t.set(r.line.role,(t.get(r.line.role)??0)+1);return t}function Ase(e){const t=new Map;let r=0;for(const n of e)for(const i of n.toolCalls)r+=1,t.set(i.name,(t.get(i.name)??0)+1);return{total:r,byName:t}}function Tse(e){return e!=null&&!(typeof e=="string"&&e.length===0)}function Is({label:e,value:t,tone:r="default"}){return Tse(t)?d.jsxs("div",{className:"min-w-0 space-y-1",children:[d.jsx("div",{className:r==="error"?"text-xs font-medium text-red-300":"text-xs font-medium text-gray-400",children:e}),d.jsx("pre",{className:"max-h-80 max-w-full overflow-auto rounded-md border border-gray-800 bg-gray-950 p-3 text-xs text-gray-200",children:d.jsx("code",{children:B5(t)})})]}):null}function ir({children:e}){return d.jsx("span",{className:"inline-flex min-w-0 max-w-full break-all rounded-md border border-gray-800 bg-gray-950 px-2 py-0.5 text-xs text-gray-400",children:e})}function Sh({href:e,children:t,download:r=!1}){return e?d.jsx("a",{href:e,target:"_blank",rel:"noreferrer",download:r,className:"rounded-md px-3 py-1.5 text-sm text-cyan-400 transition-colors hover:text-cyan-300 hover:underline",children:t}):null}function yx({path:e,onOpenFile:t,children:r}){return!e||!t?null:d.jsx("button",{type:"button",onClick:()=>t(e),className:"rounded-md border border-gray-700 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300",children:r})}function Cse({toolCall:e,expanded:t,onToggle:r}){const{call:n,index:i,name:o,status:l,duration:c}=e,h=ad(n,["id","call_id","tool_call_id"]),f=Fr(n.metadata)?n.metadata:void 0;return d.jsxs("details",{className:"min-w-0 rounded-md border border-gray-800 bg-gray-950/80 p-3",open:t,"data-testid":`tool-call-${h??i}`,"data-expanded":t?"true":"false",onToggle:p=>r(e.id,p.currentTarget.open),children:[d.jsx("summary",{className:"min-w-0 cursor-pointer list-none text-sm font-medium text-gray-200",children:d.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-xs text-gray-500",children:t?"-":"+"}),d.jsx("span",{children:"Tool call"}),d.jsx("span",{className:"rounded-md border border-amber-900/60 bg-amber-950/30 px-2 py-0.5 text-xs text-amber-300",children:o}),l&&d.jsx("span",{className:"text-xs text-gray-500",children:l}),c&&d.jsx("span",{className:"tabular-nums text-xs text-gray-500",children:c})]})}),d.jsxs("div",{className:"mt-3 min-w-0 space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap gap-2",children:[h&&d.jsxs(ir,{children:["id: ",h]}),c&&d.jsxs(ir,{children:["duration: ",c]}),l&&d.jsxs(ir,{children:["status: ",l]})]}),d.jsx(Is,{label:"Arguments",value:Sse(n)}),d.jsx(Is,{label:"Result",value:Nse(n)}),d.jsx(Is,{label:"Error",value:n.error,tone:"error"}),d.jsx(Is,{label:"Metadata",value:f})]})]})}function Pse({line:e}){const t=Hm(e.duration_ms),r=sS(e.token_usage);return d.jsxs("details",{className:"min-w-0 rounded-md border border-amber-900/50 bg-gray-950/60 p-3",children:[d.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-amber-300",children:[e.name?`Tool result · ${e.name}`:"Tool result",t&&d.jsx("span",{className:"ml-2 tabular-nums text-xs text-gray-500",children:t})]}),d.jsxs("div",{className:"mt-3 min-w-0 space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.name&&d.jsxs(ir,{children:["name: ",e.name]}),t&&d.jsxs(ir,{children:["duration: ",t]}),r&&d.jsxs(ir,{children:["tokens: ",r]})]}),d.jsx(Is,{label:"Result",value:e.content}),d.jsx(Is,{label:"Metadata",value:e.metadata})]})]})}function Rse({message:e,expanded:t,expandedToolIds:r,onToggleMessage:n,onToggleTool:i}){const{line:o,ordinal:l,roleStyle:c,content:h,duration:f,tokenUsage:p,toolCalls:g}=e;return d.jsxs("details",{id:e.anchorId,className:`min-w-0 scroll-mt-6 rounded-lg border ${c.container}`,open:t,"data-testid":`message-row-${l+1}`,"data-expanded":t?"true":"false",onToggle:y=>n(e.id,y.currentTarget.open),children:[d.jsx("summary",{className:"min-w-0 cursor-pointer list-none px-4 py-3",children:d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-xs text-gray-500",children:t?"-":"+"}),d.jsx("span",{className:`rounded-md border px-2 py-0.5 text-xs font-medium ${c.badge}`,children:c.label}),o.name&&d.jsx("span",{className:`truncate text-sm font-medium ${c.accent}`,children:o.name}),g.length>0&&d.jsxs("span",{className:"rounded-md border border-amber-900/60 bg-amber-950/30 px-2 py-0.5 text-xs text-amber-300",children:[g.length," tool ",g.length===1?"call":"calls"]})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-gray-500",children:[d.jsxs("a",{href:`#${e.anchorId}`,className:"tabular-nums text-gray-400 hover:text-cyan-300 hover:underline",onClick:y=>y.stopPropagation(),children:["#",l+1]}),o.start_time&&d.jsx("span",{children:o.start_time}),f&&d.jsx("span",{className:"tabular-nums",children:f}),p&&d.jsx("span",{children:p})]})]})}),d.jsxs("div",{className:"space-y-3 border-t border-gray-800/70 px-4 py-3",children:[o.role==="tool"||o.role==="function"?d.jsx(Pse,{line:o}):h.trim().length>0?d.jsx("pre",{className:"max-w-full whitespace-pre-wrap break-words text-sm leading-6 text-gray-200",children:h}):d.jsx("p",{className:"text-sm text-gray-500",children:"No message content recorded."}),g.length>0&&d.jsx("div",{className:"space-y-2",children:g.map(y=>d.jsx(Cse,{toolCall:y,expanded:r.has(y.id),onToggle:i},y.id))}),o.metadata&&o.role!=="tool"&&o.role!=="function"&&d.jsxs("details",{className:"min-w-0 rounded-md border border-gray-800 bg-gray-950/60 p-3",children:[d.jsx("summary",{className:"cursor-pointer text-xs font-medium text-gray-400",children:"Message metadata"}),d.jsx("div",{className:"mt-3",children:d.jsx(Is,{label:"Metadata",value:o.metadata})})]})]})]})}function Mse({messages:e,transcriptPath:t}){var g,y,x,b;const r=(g=e[0])==null?void 0:g.line,n=((y=r==null?void 0:r.source)==null?void 0:y.provider)??(r==null?void 0:r.agent),i=((x=r==null?void 0:r.source)==null?void 0:x.model)??(r==null?void 0:r.model),o=(b=r==null?void 0:r.source)==null?void 0:b.session_id,l=Hm(r==null?void 0:r.transcript_duration_ms),c=sS(r==null?void 0:r.transcript_token_usage),h=bse(r==null?void 0:r.transcript_cost_usd),f=Ese(e),p=Ase(e);return d.jsxs("div",{className:"flex min-w-0 flex-wrap gap-2",children:[d.jsxs(ir,{children:[e.length," messages"]}),Array.from(f.entries()).map(([w,N])=>d.jsxs(ir,{children:[w,": ",N]},w)),p.total>0&&d.jsxs(ir,{children:[p.total," tool calls"]}),Array.from(p.byName.entries()).map(([w,N])=>d.jsxs(ir,{children:[w,": ",N]},w)),n&&d.jsxs(ir,{children:["provider: ",n]}),i&&d.jsxs(ir,{children:["model: ",i]}),o&&d.jsxs(ir,{children:["session: ",o]}),l&&d.jsxs(ir,{children:["duration: ",l]}),c&&d.jsxs(ir,{children:["tokens: ",c]}),h&&d.jsxs(ir,{children:["cost: ",h]}),t&&d.jsx(ir,{children:t})]})}function Dse(e,t){switch(t){case"messages":return e.filter(r=>r.line.role!=="tool"&&r.line.role!=="function");case"with-tools":return e.filter(r=>r.toolCalls.length>0);case"tool-results":return e.filter(r=>r.line.role==="tool"||r.line.role==="function");case"all":return[...e]}}function Nh({active:e,count:t,children:r,onClick:n}){return d.jsxs("button",{type:"button",onClick:n,className:e?"rounded-md border border-cyan-800 bg-cyan-950/40 px-3 py-1.5 text-sm text-cyan-200":"rounded-md border border-gray-800 bg-gray-950 px-3 py-1.5 text-sm text-gray-400 transition-colors hover:border-gray-700 hover:text-gray-200",children:[r,d.jsx("span",{className:"ml-2 text-xs text-gray-500",children:t})]})}function q5({entries:e,finalAnswer:t,answerPath:r,transcriptPath:n,transcriptRawPath:i,answerHref:o,transcriptHref:l,transcriptDownloadHref:c,transcriptRawHref:h,onOpenFile:f}){const p=S.useMemo(()=>Ose(e),[e]),[g,y]=S.useState(()=>x2(p)),[x,b]=S.useState(()=>new Set),[w,N]=S.useState("all"),_=!!r,E=S.useMemo(()=>p.flatMap(k=>k.toolCalls.map(H=>H.id)),[p]),T=S.useMemo(()=>Dse(p,w),[p,w]),A=p.filter(k=>k.line.role!=="tool"&&k.line.role!=="function").length,C=p.filter(k=>k.line.role==="tool"||k.line.role==="function").length,R=p.filter(k=>k.toolCalls.length>0).length;S.useEffect(()=>{y(x2(p)),b(new Set),N("all")},[p]);function D(k,H){y(U=>{const ae=new Set(U);return H?ae.add(k):ae.delete(k),ae})}function M(k,H){b(U=>{const ae=new Set(U);return H?ae.add(k):ae.delete(k),ae})}function z(){b(new Set(E)),y(k=>{const H=new Set(k);for(const U of p)U.toolCalls.length>0&&H.add(U.id);return H})}return d.jsxs("div",{className:"min-w-0 space-y-4",children:[_&&d.jsxs("section",{className:"min-w-0 rounded-lg border border-emerald-900/50 bg-emerald-950/20 p-4",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h3",{className:"text-sm font-medium text-emerald-300",children:"Final answer"}),d.jsxs("p",{className:"mt-1 text-xs text-gray-500",children:["Highlighted from canonical ",d.jsx("code",{children:"outputs/answer.md"}),"; transcript context stays below."]})]}),d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx(yx,{path:r,onOpenFile:f,children:"Open answer.md in Files"}),d.jsx(Sh,{href:o,children:"Open answer.md"})]})]}),d.jsx("pre",{className:"mt-3 max-h-64 max-w-full overflow-auto whitespace-pre-wrap break-words rounded-md border border-emerald-900/40 bg-gray-950/80 p-3 text-sm leading-6 text-gray-100",children:t&&t.trim().length>0?t:"answer.md is empty."})]}),d.jsx("section",{className:"min-w-0 rounded-lg border border-gray-800 bg-gray-900 p-4",children:d.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0 space-y-2",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Transcript timeline"}),d.jsx(Mse,{messages:p,transcriptPath:n})]}),d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx(yx,{path:n,onOpenFile:f,children:"Open transcript.json in Files"}),d.jsx(Sh,{href:l,children:"Open normalized JSON"}),d.jsx(Sh,{href:c,download:!0,children:"Download normalized JSON"}),d.jsx(yx,{path:i,onOpenFile:f,children:"Open transcript-raw.jsonl in Files"}),d.jsx(Sh,{href:h,children:"Open raw JSONL"}),!i&&d.jsx("span",{className:"rounded-md border border-gray-800 bg-gray-950 px-3 py-1.5 text-sm text-gray-500",children:"Raw JSONL unavailable"})]})]})}),d.jsx("section",{className:"min-w-0 rounded-lg border border-gray-800 bg-gray-900 p-3",children:d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap gap-2",children:[d.jsx(Nh,{active:w==="all",count:p.length,onClick:()=>N("all"),children:"All"}),d.jsx(Nh,{active:w==="messages",count:A,onClick:()=>N("messages"),children:"Messages"}),d.jsx(Nh,{active:w==="with-tools",count:R,onClick:()=>N("with-tools"),children:"Has tools"}),d.jsx(Nh,{active:w==="tool-results",count:C,onClick:()=>N("tool-results"),children:"Tool results"})]}),E.length>0&&d.jsxs("div",{className:"flex min-w-0 flex-wrap gap-2",children:[d.jsx("button",{type:"button",onClick:z,className:"rounded-md border border-gray-700 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-amber-800 hover:text-amber-200",children:"Expand all tool calls"}),d.jsx("button",{type:"button",onClick:()=>b(new Set),className:"rounded-md border border-gray-700 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-gray-600 hover:text-gray-100",children:"Collapse all tool calls"})]})]})}),d.jsx("div",{className:"space-y-3",children:T.map(k=>d.jsx(Rse,{message:k,expanded:g.has(k.id),expandedToolIds:x,onToggleMessage:D,onToggleTool:M},k.id))})]})}function F5(e){for(const t of e){if(t.type==="file")return t.path;if(t.children){const r=F5(t.children);if(r)return r}}return null}function oS(e,t=0){return e.sample_path??e.attempt_path??e.run_path??`sample-${t+1}`}function kse(e,t=0){return typeof e.sample_index=="number"?e.sample_index:typeof e.attempt=="number"?e.attempt+1:t+1}function H5(e,t=0){const r=`Attempt ${kse(e,t)}`;return typeof e.retry_index=="number"&&e.retry_index>0?`${r} retry ${e.retry_index}`:r}function Lse(e){if(e.total_tokens!=null)return e.total_tokens;const t=e.token_usage;if(!t)return;const r=[t.input,t.output,t.reasoning,t.cached].filter(n=>typeof n=="number"&&Number.isFinite(n));return r.length>0?r.reduce((n,i)=>n+i,0):void 0}function eo(e){return e==null||!Number.isFinite(e)?"-":`${Math.round(e*100)}%`}function K5(e){if(e==null)return"-";if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),r=Math.round(e%6e4/1e3);return`${t}m ${r}s`}function $se(e){if(e!=null)return e===0?"$0":e<.01?`$${e.toFixed(5)}`:`$${e.toFixed(4)}`}function Ise(e){if(e!=null)return e>=1e6?`${(e/1e6).toFixed(1)}M tok`:e>=1e3?`${(e/1e3).toFixed(1)}k tok`:`${e} tok`}function zse(e,t){return{...e,score:t.score??e.score,executionStatus:t.execution_status??e.executionStatus,error:t.error,costUsd:t.cost_usd??e.costUsd,durationMs:t.duration_ms??e.durationMs,scores:t.scores,assertions:t.assertions,trials:void 0,aggregation:void 0,grading_path:t.grading_path,timing_path:t.timing_path,metrics_path:t.metrics_path,transcript_path:t.transcript_path,transcript_raw_path:t.transcript_raw_path,output_path:t.answer_path,answer_path:t.answer_path}}function lS({eval:e,runId:t,projectId:r,repeatGroup:n,selectedTrial:i=null,initialTab:o="checks",initialSelectedFilePath:l=null,onSelectTrial:c}){const[h,f]=S.useState(o),[p,g]=S.useState(l),y=i?zse(e,i):e,x=n!=null&&i==null;S.useEffect(()=>{f(o),g(l)},[o,l]);const b=[{id:"checks",label:"Grading"},{id:"transcript",label:"Transcript"},{id:"source",label:"Source"},{id:"files",label:"Files"}],w=N=>{g(N),f("files")};return d.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[d.jsx("div",{className:"min-w-0 border-b border-gray-800",children:d.jsx("div",{className:"flex min-w-0 gap-1 overflow-x-auto px-4",children:b.map(N=>d.jsx("button",{type:"button",onClick:()=>f(N.id),className:`px-4 py-2 text-sm font-medium transition-colors ${h===N.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:N.label},N.id))})}),d.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:[h==="checks"&&d.jsx("div",{className:"min-w-0 overflow-auto p-4",children:x?d.jsx(Hse,{result:e,group:n,onSelectTrial:c}):i?d.jsx(j2,{result:y,trial:i,runId:t,projectId:r,onOpenFile:w}):y.grading_path?d.jsx(j2,{result:y,runId:t,projectId:r,onOpenFile:w}):d.jsx(Y5,{result:y,projectId:r})}),h==="files"&&d.jsx("div",{className:"h-full min-h-0 p-4",children:d.jsx(ioe,{result:y,runId:t,projectId:r,selectedPath:p,onSelectedPathChange:g})}),h==="transcript"&&d.jsx("div",{className:"min-w-0 overflow-auto p-4",children:x?d.jsx(roe,{result:e,group:n,runId:t,projectId:r,onSelectTrial:c}):i?d.jsx(noe,{result:y,trial:i,runId:t,projectId:r,onOpenFile:w}):d.jsx(aoe,{result:y,runId:t,projectId:r,onOpenFile:w})}),h==="source"&&d.jsx("div",{className:"min-w-0 overflow-auto p-4",children:d.jsx(qse,{result:y})})]})]})}function Bse(e){if(e!==void 0)return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Jr({label:e,value:t}){return t===void 0||t===""?null:d.jsxs("div",{className:"min-w-0",children:[d.jsx("dt",{className:"text-xs font-medium uppercase text-gray-500",children:e}),d.jsx("dd",{className:"mt-1 break-words font-mono text-sm text-gray-200",children:String(t)})]})}function G5({file:e}){var r,n;const t=Bse(e.size_bytes);return d.jsxs("dl",{className:"grid gap-3 md:grid-cols-2",children:[d.jsx(Jr,{label:"Path",value:e.display_path}),d.jsx(Jr,{label:"SHA-256",value:e.content_sha256}),d.jsx(Jr,{label:"Size",value:t}),d.jsx(Jr,{label:"Omitted",value:((r=e.omitted)==null?void 0:r.message)??((n=e.omitted)==null?void 0:n.reason)})]})}function Tc({value:e,language:t}){return d.jsx("pre",{className:"max-h-96 overflow-auto rounded-md border border-gray-800 bg-gray-950 p-3 text-xs text-gray-200",children:d.jsx("code",{"data-language":t,children:e})})}function Use({file:e}){const t=`${e.kind}${e.grader_name?` · ${e.grader_name}`:""}`;return d.jsxs("details",{className:"rounded-md border border-gray-800 bg-gray-900 p-3",open:!1,children:[d.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-gray-200",children:[d.jsx("span",{children:t}),d.jsx("span",{className:"ml-3 font-mono text-xs text-gray-500",children:e.display_path})]}),d.jsxs("div",{className:"mt-3 space-y-3",children:[d.jsx(G5,{file:e}),e.command&&e.command.length>0&&d.jsx(Tc,{value:JSON.stringify(e.command,null,2),language:"json"}),e.content&&d.jsx(Tc,{value:e.content})]})]})}function qse({result:e}){var r,n,i;const t=e.source_traceability;return!t||t.status!=="captured"?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-300",children:"Source metadata"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:(t==null?void 0:t.message)??"Source metadata was not captured for this run."})]}):d.jsxs("div",{className:"space-y-6",children:[d.jsxs("section",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-300",children:"Traceability"}),d.jsxs("dl",{className:"grid gap-3 md:grid-cols-2",children:[d.jsx(Jr,{label:"Eval file",value:(r=t.eval_file)==null?void 0:r.display_path}),d.jsx(Jr,{label:"Eval",value:e.eval_path}),d.jsx(Jr,{label:"Test ID",value:t.test_id??e.testId}),d.jsx(Jr,{label:"Legacy suite",value:e.suite}),d.jsx(Jr,{label:"Category",value:e.category}),d.jsx(Jr,{label:"Target",value:e.target})]})]}),((n=t.source_test)==null?void 0:n.yaml)&&d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-300",children:"Source Test"}),d.jsx(Tc,{value:t.source_test.yaml,language:"yaml"})]}),((i=t.eval_file)==null?void 0:i.content)&&d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-300",children:"Eval File Snapshot"}),d.jsx(G5,{file:t.eval_file}),d.jsx(Tc,{value:t.eval_file.content,language:"yaml"})]}),t.graders&&t.graders.length>0&&d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-300",children:"Graders"}),d.jsx("div",{className:"space-y-3",children:t.graders.map(o=>d.jsxs("details",{className:"rounded-md border border-gray-800 bg-gray-900 p-3",children:[d.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-gray-200",children:[o.name,d.jsx("span",{className:"ml-3 font-mono text-xs text-gray-500",children:o.type})]}),d.jsxs("div",{className:"mt-3 space-y-3",children:[d.jsxs("dl",{className:"grid gap-3 md:grid-cols-3",children:[d.jsx(Jr,{label:"Weight",value:o.weight}),d.jsx(Jr,{label:"Required",value:o.required}),d.jsx(Jr,{label:"Min score",value:o.min_score})]}),d.jsx(Tc,{value:JSON.stringify(o.definition,null,2),language:"json"})]})]},`${o.name}-${o.type}`))})]}),t.referenced_files&&t.referenced_files.length>0&&d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-300",children:"Referenced Files"}),d.jsx("div",{className:"space-y-3",children:t.referenced_files.map((o,l)=>d.jsx(Use,{file:o},`${o.kind}-${o.display_path}-${o.grader_name??""}-${l}`))})]})]})}function b2({assertion:e}){return d.jsxs("div",{className:`flex items-start gap-3 rounded-lg border p-3 ${e.passed?"border-emerald-900/50 bg-emerald-950/20":"border-red-900/50 bg-red-950/20"}`,children:[d.jsx("span",{className:`mt-0.5 text-lg ${e.passed?"text-emerald-400":"text-red-400"}`,children:e.passed?"✓":"✗"}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("p",{className:"text-sm text-gray-200",children:[e.text,e.durationMs!=null&&d.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",(e.durationMs/1e3).toFixed(1),"s)"]})]}),e.evidence&&d.jsx("p",{className:"mt-1 text-xs text-gray-400",children:e.evidence})]})]})}function Y5({result:e,projectId:t}){const{data:r}=pt(t),n=(r==null?void 0:r.threshold)??(r==null?void 0:r.pass_threshold)??.8,i=!to(e.score,n)||e.executionStatus==="error"||e.executionStatus==="failed",o=(e.scores??[]).filter(p=>Array.isArray(p.assertions)&&p.assertions.length>0),l=o.length>0,c=e.assertions??[],h=[];e.error&&h.push(e.error),(e.executionStatus==="error"||e.executionStatus==="failed")&&h.push(`Execution status: ${e.executionStatus}`);const f=l?o.flatMap(p=>p.assertions):c;for(const p of f.filter(g=>!g.passed)){const g=p.evidence?`${p.text}: ${p.evidence}`:p.text;h.push(g)}if(e.scores){for(const p of e.scores)if(!to(p.score,n)&&p.details){const g=typeof p.details=="string"?p.details:JSON.stringify(p.details,null,2);h.push(`[${p.name??p.type??"evaluator"}] ${g}`)}}return d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("span",{className:"text-sm font-medium text-gray-400",children:"Overall score"}),d.jsx("div",{className:"flex-1",children:d.jsx(fo,{score:e.score})})]})}),e.scores&&e.scores.length>0&&d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-400",children:"Grader Scores"}),d.jsx("div",{className:"space-y-3",children:e.scores.map((p,g)=>d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("span",{className:"w-40 truncate text-sm text-gray-300",children:p.name??p.type??`Score ${g+1}`}),d.jsx("div",{className:"flex-1",children:d.jsx(fo,{score:p.score})})]},`${p.name??p.type??g}`))})]}),l?d.jsx("div",{className:"space-y-6",children:o.map((p,g)=>{const y=p.name??p.type??`Grader ${g+1}`;return d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:y}),p.assertions.map((x,b)=>d.jsx(b2,{assertion:x},`${x.text}-${b}`))]},`${p.name??p.type??g}`)})}):c.length>0?d.jsx("div",{className:"space-y-2",children:c.map((p,g)=>d.jsx(b2,{assertion:p},`${p.text}-${g}`))}):d.jsx("p",{className:"text-sm text-gray-500",children:"No assertion steps recorded."}),i&&h.length>0&&d.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[d.jsx("h4",{className:"mb-2 text-sm font-medium text-red-400",children:"Failure Reason"}),d.jsx("div",{className:"space-y-2",children:h.map(p=>d.jsx("p",{className:"text-sm text-gray-300",children:p},p))})]})]})}function Ia({label:e,value:t}){return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-3",children:[d.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:e}),d.jsx("div",{className:"mt-1 font-mono text-sm text-gray-200",children:t??"-"})]})}function Fse({trial:e,index:t,onSelectTrial:r}){const n=oS(e,t),i=H5(e,t);return d.jsxs("div",{className:"grid gap-2 rounded-md border border-gray-800 bg-gray-950/50 p-3 text-sm md:grid-cols-[minmax(8rem,1fr)_auto] md:items-center",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("span",{className:"font-medium text-gray-200",children:i}),d.jsx("span",{className:"rounded-md border border-gray-800 px-1.5 py-0.5 text-[11px] font-medium text-gray-500",children:n})]}),d.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-gray-500",children:[d.jsxs("span",{children:[eo(e.score)," score"]}),d.jsx("span",{children:e.verdict??"unknown"}),e.duration_ms!=null?d.jsx("span",{children:K5(e.duration_ms)}):null,e.total_tool_calls!=null?d.jsxs("span",{children:[e.total_tool_calls," tool calls"]}):null]})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 md:justify-end",children:[d.jsx("button",{type:"button",onClick:()=>r==null?void 0:r(e,"checks"),className:"rounded-md border border-gray-700 px-2.5 py-1 text-xs text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300",children:"Grading"}),d.jsx("button",{type:"button",onClick:()=>r==null?void 0:r(e,"files"),disabled:!e.grading_path&&!e.metrics_path&&!e.timing_path,className:"rounded-md border border-gray-700 px-2.5 py-1 text-xs text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300 disabled:cursor-not-allowed disabled:opacity-50",children:"Files"})]})]})}function Hse({result:e,group:t,onSelectTrial:r}){return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsxs("p",{className:"mb-3 text-sm text-gray-400",children:["Aggregate across ",t.trialCount," attempts for this test case."]}),d.jsxs("div",{className:"grid gap-3 md:grid-cols-4",children:[d.jsx(Ia,{label:"Attempt success",value:eo(t.passRate)}),d.jsx(Ia,{label:"Mean score",value:eo(t.meanScore)}),d.jsx(Ia,{label:"Attempts passed",value:`${t.passedTrials}/${t.trialCount}`}),d.jsx(Ia,{label:"Assertion pass",value:eo(t.assertionPassRate)}),t.executionErrorTrials>0?d.jsx(Ia,{label:"Execution errors",value:String(t.executionErrorTrials)}):null]})]}),e.scores&&e.scores.length>0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-400",children:"Aggregate Grader Scores"}),d.jsx("div",{className:"space-y-3",children:e.scores.map((n,i)=>d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("span",{className:"w-40 truncate text-sm text-gray-300",children:n.name??n.type??`Score ${i+1}`}),d.jsx("div",{className:"flex-1",children:d.jsx(fo,{score:n.score})})]},`${n.name??n.type??i}`))})]}):null,d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:"Attempts"}),t.trials.map((n,i)=>d.jsx(Fse,{trial:n,index:i,onSelectTrial:r},oS(n,i)))]})]})}function Km(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Kse(e,t){const r=e[t];return typeof r=="string"&&r.trim().length>0?r:void 0}function Gse(e,t){const r=e[t];return typeof r=="number"&&Number.isFinite(r)?r:void 0}function Yse(e,t){const r=e[t];return typeof r=="boolean"?r:void 0}function Vse(e){if(!Km(e))return;const t=Object.entries(e).filter(r=>typeof r[1]=="number"&&Number.isFinite(r[1]));return t.length>0?Object.fromEntries(t):void 0}function Qse(e){if(Km(e))return Object.keys(e).length>0?e:void 0}function V5(e){if(!Km(e))return null;const t=Array.isArray(e.component_results)?e.component_results.flatMap(i=>{const o=V5(i);return o?[o]:[]}):[],r=Vse(e.named_scores),n=Km(e.metadata)&&Object.keys(e.metadata).length>0?e.metadata:void 0;return{pass:Yse(e,"pass"),score:Gse(e,"score"),reason:Kse(e,"reason"),assertion:Qse(e.assertion),namedScores:r,metadata:n,componentResults:t}}function Xse(e){if(!e)return null;try{const t=V5(JSON.parse(e));return t?{result:t}:{error:"grading.json must contain a JSON object."}}catch(t){return{error:t instanceof Error?t.message:String(t)}}}function Wse(e){return typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function Q5(e){return e===!0?"Pass":e===!1?"Fail":"Unknown"}function X5(e){return e===!0?"border-emerald-900/50 bg-emerald-950/20 text-emerald-300":e===!1?"border-red-900/50 bg-red-950/20 text-red-300":"border-gray-800 bg-gray-950/50 text-gray-300"}function Zse(e,t){if(!e)return{title:t,details:[]};const r=typeof e.metric=="string"&&e.metric||typeof e.type=="string"&&e.type||t,n=[];return typeof e.type=="string"&&e.type!==r&&n.push(`type: ${e.type}`),typeof e.metric=="string"&&e.metric!==r&&n.push(`metric: ${e.metric}`),e.value!==void 0&&n.push(`value: ${Wse(e.value)}`),{title:r,details:n}}function W5({scores:e}){return!e||Object.keys(e).length===0?null:d.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:Object.entries(e).map(([t,r])=>d.jsx(Ia,{label:t,value:eo(r)},t))})}function Z5({metadata:e}){return!e||Object.keys(e).length===0?null:d.jsxs("details",{className:"rounded-lg border border-gray-800 bg-gray-950/50 p-3",children:[d.jsx("summary",{className:"cursor-pointer text-sm font-medium text-gray-300",children:"Metadata"}),d.jsx("pre",{className:"mt-3 max-h-64 overflow-auto text-xs text-gray-300",children:JSON.stringify(e,null,2)})]})}function J5({score:e}){return e==null?d.jsx("div",{className:"h-2 rounded-full bg-gray-800"}):d.jsx(fo,{score:e})}function Jse({result:e}){return d.jsxs("div",{className:"space-y-4 rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(9rem,12rem)_1fr] md:items-center",children:[d.jsx("div",{className:`rounded-lg border px-3 py-2 text-sm font-medium ${X5(e.pass)}`,children:Q5(e.pass)}),d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3 text-xs text-gray-500",children:[d.jsx("span",{children:"Aggregate score"}),d.jsx("span",{className:"font-mono",children:eo(e.score)})]}),d.jsx(J5,{score:e.score})]})]}),e.reason?d.jsx("p",{className:"text-sm text-gray-300",children:e.reason}):null,d.jsx(W5,{scores:e.namedScores}),d.jsx(Z5,{metadata:e.metadata})]})}function eoe({components:e}){return e.length===0?null:d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:"Component Results"}),d.jsx("div",{className:"space-y-2",children:e.map((t,r)=>d.jsx(eL,{component:t,index:r,depth:0},`${t.reason??"component"}-${r}`))})]})}function toe({result:e}){return d.jsxs("div",{className:"space-y-6",children:[d.jsx(Jse,{result:e}),d.jsx(eoe,{components:e.componentResults})]})}function eL({component:e,index:t,depth:r}){const n=Zse(e.assertion,`Component ${t+1}`),i=e.componentResults.length>0,o=d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(10rem,1fr)_minmax(8rem,12rem)] md:items-center",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("span",{className:"font-medium text-gray-200",children:n.title}),d.jsx("span",{className:`rounded-md border px-1.5 py-0.5 text-[11px] font-medium ${X5(e.pass)}`,children:Q5(e.pass)})]}),n.details.length>0?d.jsx("div",{className:"mt-1 flex flex-wrap gap-2 text-xs text-gray-500",children:n.details.map(l=>d.jsx("span",{children:l},l))}):null]}),d.jsxs("div",{className:"min-w-0",children:[d.jsx("div",{className:"mb-1 text-right font-mono text-xs text-gray-500",children:eo(e.score)}),d.jsx(J5,{score:e.score})]})]}),e.reason?d.jsx("p",{className:"text-sm text-gray-300",children:e.reason}):null]});return d.jsxs("details",{open:r===0,className:"rounded-lg border border-gray-800 bg-gray-900 p-3",style:{marginLeft:r>0?`${Math.min(r,4)*1}rem`:void 0},children:[d.jsxs("summary",{className:"flex cursor-pointer list-none items-start gap-3",children:[d.jsx("span",{className:"mt-1 text-xs text-gray-500",children:i?"v":"-"}),o]}),e.namedScores||e.metadata?d.jsxs("div",{className:"mt-3 space-y-3",children:[d.jsx(W5,{scores:e.namedScores}),d.jsx(Z5,{metadata:e.metadata})]}):null,i?d.jsx("div",{className:"mt-3 space-y-2",children:e.componentResults.map((l,c)=>d.jsx(eL,{component:l,index:c,depth:r+1},`${l.reason??"component"}-${c}`))}):null]})}function j2({result:e,trial:t,runId:r,projectId:n,onOpenFile:i}){const o=e.grading_path??(t==null?void 0:t.grading_path),l=e.result_dir,c=e.testId,{data:h,isLoading:f}=n&&o?Ue(Yh(n,r,c,o,l)):Gh(r,c,o??"",l),p=Xse(h==null?void 0:h.content);return o?d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("span",{className:"text-sm font-medium text-gray-400",children:t?"Attempt score":"Overall score"}),d.jsx("div",{className:"flex-1",children:d.jsx(fo,{score:e.score})})]})}),t?d.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[d.jsx(Ia,{label:"Duration",value:K5(t.duration_ms)}),d.jsx(Ia,{label:"Cost",value:$se(t.cost_usd)}),d.jsx(Ia,{label:"Tokens",value:Ise(Lse(t))})]}):null,d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-400",children:"Grading"}),d.jsx("button",{type:"button",onClick:()=>i(o),className:"rounded-md border border-gray-700 px-3 py-1.5 text-xs text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300",children:"Open grading JSON"})]}),f?d.jsx("p",{className:"mt-3 text-sm text-gray-500",children:"Loading grading artifact..."}):null,p!=null&&p.error?d.jsx("p",{className:"mt-3 text-sm text-red-300",children:p.error}):null,!f&&!p?d.jsx("p",{className:"mt-3 text-sm text-gray-500",children:"No grading artifact content available."}):null]}),p!=null&&p.result?d.jsx(toe,{result:p.result}):null]}):d.jsx(Y5,{result:e,projectId:n})}function tL(e,t){if(!t)return!1;for(const r of e)if(r.type==="file"&&r.path===t||r.children&&tL(r.children,t))return!0;return!1}function roe({result:e,group:t,runId:r,projectId:n,onSelectTrial:i}){return d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:"Attempt transcripts"}),t.trials.map((o,l)=>{const c=oS(o,l),h=H5(o,l),f=o.transcript_path,p=f?_n({projectId:n,runId:r,evalId:e.testId,filePath:f,resultDir:e.result_dir,raw:!0}):void 0;return d.jsxs("div",{className:"grid gap-2 rounded-md border border-gray-800 bg-gray-950/50 p-3 text-sm md:grid-cols-[minmax(8rem,1fr)_auto] md:items-center",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("span",{className:"font-medium text-gray-200",children:h}),d.jsx("span",{className:"rounded-md border border-gray-800 px-1.5 py-0.5 text-[11px] font-medium text-gray-500",children:c})]}),d.jsx("div",{className:"mt-1 truncate font-mono text-xs text-gray-500",title:f,children:f??"No transcript artifact"})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 md:justify-end",children:[d.jsx("button",{type:"button",onClick:()=>i==null?void 0:i(o,"transcript"),disabled:!f,className:"rounded-md border border-gray-700 px-2.5 py-1 text-xs text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300 disabled:cursor-not-allowed disabled:opacity-50",children:"View"}),p?d.jsx("a",{href:p,target:"_blank",rel:"noreferrer",className:"rounded-md px-2.5 py-1 text-xs text-cyan-400 transition-colors hover:text-cyan-300 hover:underline",children:"Raw"}):null]})]},c)})]})}function noe({result:e,trial:t,runId:r,projectId:n,onOpenFile:i}){const o=e.testId,l=e.result_dir,c=t.transcript_path,h=t.transcript_raw_path,f=t.answer_path,{data:p,isLoading:g}=n&&c?Ue(Yh(n,r,o,c,l)):Gh(r,o,c??"",l),{data:y}=n&&f?Ue(Yh(n,r,o,f,l)):Gh(r,o,f??"",l),x=(p==null?void 0:p.content)??"",b=S.useMemo(()=>z5(x),[x]);if(!c)return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"No structured transcript"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This attempt does not include a transcript artifact."})]});if(g)return d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4 text-sm text-gray-500",children:"Loading transcript artifact..."});if(b.error)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-red-300",children:"Transcript could not be parsed"}),d.jsx("p",{className:"mt-2 text-sm text-gray-300",children:b.error}),d.jsx("button",{type:"button",onClick:()=>i(c),className:"mt-3 rounded-md border border-gray-700 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300",children:"Open raw JSONL in Files"})]});if(b.entries.length===0)return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Empty transcript"}),d.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:[d.jsx("code",{children:c})," exists but contains no JSONL rows."]})]});const w=f?_n({projectId:n,runId:r,evalId:o,filePath:f,resultDir:l,raw:!0}):void 0,N=_n({projectId:n,runId:r,evalId:o,filePath:c,resultDir:l,raw:!0}),_=_n({projectId:n,runId:r,evalId:o,filePath:c,resultDir:l,download:!0}),E=h?_n({projectId:n,runId:r,evalId:o,filePath:h,resultDir:l,raw:!0}):void 0;return d.jsx(q5,{entries:b.entries,finalAnswer:f?(y==null?void 0:y.content)??e.output:void 0,answerPath:f,transcriptPath:c,transcriptRawPath:h,answerHref:w,transcriptHref:N,transcriptDownloadHref:_,transcriptRawHref:E,onOpenFile:i})}function aoe({result:e,runId:t,projectId:r,onOpenFile:n}){const i=e.testId,o=e.result_dir,{data:l,isLoading:c,error:h}=r?Ue(O6(r,t,i,o)):g6(t,i,o),f=l==null?void 0:l.transcript_path,p=l==null?void 0:l.transcript_raw_path,g=l==null?void 0:l.answer_path,y=(l==null?void 0:l.status)==="ok"?l.content??"":"",x=S.useMemo(()=>z5(y),[y]);if(c)return d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4 text-sm text-gray-500",children:"Loading transcript artifact..."});if(h)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-red-300",children:"Transcript could not be loaded"}),d.jsx("p",{className:"mt-2 text-sm text-gray-300",children:h.message})]});if(!l||l.status==="missing")return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"No structured transcript"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:(l==null?void 0:l.message)??"This run does not include canonical transcript.json. Dashboard does not parse response.md or markdown transcripts for this view."})]});if(l.status==="dangling"||l.status==="unsupported")return d.jsxs("div",{className:"rounded-lg border border-amber-900/50 bg-amber-950/20 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-amber-300",children:l.status==="dangling"?"Transcript artifact unavailable":"Transcript pointer unsupported"}),d.jsx("p",{className:"mt-2 text-sm text-gray-300",children:l.message??"The transcript artifact could not be resolved."}),f?d.jsx("p",{className:"mt-2 font-mono text-xs text-gray-500",children:f}):null,l.pointer?d.jsx("p",{className:"mt-2 font-mono text-xs text-gray-500",children:l.pointer}):null]});if(x.error)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-red-300",children:"Transcript could not be parsed"}),d.jsx("p",{className:"mt-2 text-sm text-gray-300",children:x.error}),d.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:f?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:()=>n(f),className:"rounded-md border border-gray-700 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300",children:"Open raw JSONL in Files"}),d.jsx("a",{href:_n({projectId:r,runId:t,evalId:i,filePath:f,resultDir:o,raw:!0}),target:"_blank",rel:"noreferrer",className:"rounded-md px-3 py-1.5 text-sm text-cyan-400 transition-colors hover:text-cyan-300 hover:underline",children:"Open raw JSONL"})]}):null})]});if(x.entries.length===0)return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Empty transcript"}),d.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:[d.jsx("code",{children:f})," exists but contains no JSONL rows."]})]});const b=g?_n({projectId:r,runId:t,evalId:i,filePath:g,resultDir:o,raw:!0}):void 0,w=f?_n({projectId:r,runId:t,evalId:i,filePath:f,resultDir:o,raw:!0}):void 0,N=f?_n({projectId:r,runId:t,evalId:i,filePath:f,resultDir:o,download:!0}):void 0,_=p?_n({projectId:r,runId:t,evalId:i,filePath:p,resultDir:o,raw:!0}):void 0;return d.jsx(q5,{entries:x.entries,finalAnswer:g?l.answer_content??e.output:void 0,answerPath:g,transcriptPath:f,transcriptRawPath:p,answerHref:b,transcriptHref:w,transcriptDownloadHref:N,transcriptRawHref:_,onOpenFile:n})}function ioe({result:e,runId:t,projectId:r,selectedPath:n,onSelectedPathChange:i}){const o=e.testId,l=e.result_dir,{data:c}=r?Ue(_6(r,t,o,l)):p6(t,o,l),h=(c==null?void 0:c.files)??[],[f,p]=S.useState(null),[g,y]=S.useState(!1),x=n??f,b=tL(h,x)?x:h.length>0?F5(h):null,{data:w,isLoading:N}=r?Ue(Yh(r,t,o,b??"",l)):Gh(t,o,b??"",l);if(h.length===0)return d.jsx("p",{className:"text-sm text-gray-500",children:"No artifact files available."});const _=b?N?"Loading...":(w==null?void 0:w.content)??"":"",E=b?(w==null?void 0:w.language)??"plaintext":"plaintext";return d.jsxs("div",{className:"relative flex h-full min-h-0 min-w-0 gap-4 overflow-hidden",children:[d.jsx("div",{className:`${g?"block":"hidden"} min-h-0 w-full overflow-auto md:block md:w-auto`,children:d.jsx(cse,{files:h,selectedPath:b,onSelect:T=>{p(T),i(T),y(!1)}})}),d.jsx("div",{className:`${g?"hidden":"block"} h-full min-h-0 min-w-0 flex-1 overflow-hidden md:block`,children:d.jsx(pse,{value:_,language:E,height:"100%"})}),d.jsx("button",{type:"button",onClick:()=>y(!g),className:"md:hidden fixed bottom-4 right-4 z-50 flex items-center gap-2 rounded-full bg-gray-800 px-4 py-2.5 text-sm font-medium text-gray-200 shadow-lg border border-gray-700 hover:bg-gray-700 active:bg-gray-600 transition-colors","aria-label":g?"Switch to file content viewer":"Switch to file tree",children:g?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"📄"}),d.jsx("span",{children:"Content"})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"📁"}),d.jsx("span",{children:"Files"})]})})]})}const Nt={view:"results_view",search:"results_q",target:"results_target",grader:"results_grader",legacyScorer:"results_scorer",columns:"results_cols",detail:"results_detail"},soe="✓",ooe="✗";function vx(){var t;if(typeof window>"u")return{};const e=new URLSearchParams(window.location.search);return{view:e.get(Nt.view)??void 0,search:e.get(Nt.search)??void 0,target:e.get(Nt.target)??void 0,grader:e.get(Nt.grader)??e.get(Nt.legacyScorer)??void 0,visibleColumnIds:((t=e.get(Nt.columns))==null?void 0:t.split(",").map(r=>r.trim()).filter(Boolean))??void 0}}function loe(e){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search);e.view==="all"?t.delete(Nt.view):t.set(Nt.view,e.view),e.search?t.set(Nt.search,e.search):t.delete(Nt.search),e.target==="all"?t.delete(Nt.target):t.set(Nt.target,e.target),t.delete(Nt.legacyScorer),e.grader==="all"?t.delete(Nt.grader):t.set(Nt.grader,e.grader),e.visibleColumnIds.length>0?t.set(Nt.columns,e.visibleColumnIds.join(",")):t.delete(Nt.columns);const r=t.toString(),n=`${window.location.pathname}${r?`?${r}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",n)}function w2(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get(Nt.detail)}function _h(e){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search);e?t.set(Nt.detail,e):t.delete(Nt.detail);const r=t.toString(),n=`${window.location.pathname}${r?`?${r}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",n)}function Gm(e){return`${Math.round(e*100)}%`}function uS(e){if(e==null)return"-";if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),r=Math.round(e%6e4/1e3);return`${t}m ${r}s`}function rL(e){if(e!=null)return e===0?"$0":e<.01?`$${e.toFixed(5)}`:`$${e.toFixed(4)}`}function nL(e){if(e!=null)return e>=1e6?`${(e/1e6).toFixed(1)}M tok`:e>=1e3?`${(e/1e3).toFixed(1)}k tok`:`${e} tok`}function uoe(e){if(!e)return;const t=[e.input,e.output,e.reasoning,e.cached].filter(r=>typeof r=="number"&&Number.isFinite(r));return t.length>0?t.reduce((r,n)=>r+n,0):void 0}function aL(e){return e.total_tokens??uoe(e.token_usage)}function Ym(e,t=0){return e.sample_path??e.attempt_path??e.run_path??`sample-${t+1}`}function coe(e){const t=e.tokenUsage;if(!t)return;const r=[t.input!=null?`${t.input} in`:void 0,t.output!=null?`${t.output} out`:void 0,t.reasoning!=null?`${t.reasoning} reason`:void 0,t.cached!=null?`${t.cached} cached`:void 0].filter(n=>!!n);return r.length>0?r.join(" / "):void 0}function doe(e){return e>=.8?"text-emerald-300":e>=.5?"text-yellow-300":"text-red-300"}function iL(e){var t,r;return e.verdict==="fail"||(t=e.assertions)!=null&&t.some(n=>!n.passed)?!0:((r=e.scores)==null?void 0:r.some(iL))??!1}function cS({results:e,runId:t,projectId:r,passThreshold:n,title:i="Results",emptyMessage:o}){const[l,c]=S.useState(()=>vx()),[h,f]=S.useState(()=>w2()),[p,g]=S.useState(null),[y,x]=S.useState(null),[b,w]=S.useState("checks"),[N,_]=S.useState(()=>new Set),E=S.useMemo(()=>ose({results:e,passThreshold:n,state:l}),[n,e,l]),T=new Set(E.state.visibleColumnIds),A=h!=null?E.filteredRows.find(G=>G.key===h)??null:null,C=S.useMemo(()=>new Map(E.repeatGroups.map(G=>[G.row.key,G])),[E.repeatGroups]),R=A?C.get(A.key):void 0,D=R&&p?R.trials.find((G,L)=>Ym(G,L)===p)??null:null;S.useEffect(()=>{const G=()=>{c(vx()),f(w2()),g(null),x(null),w("checks")};return window.addEventListener("popstate",G),()=>window.removeEventListener("popstate",G)},[]),S.useEffect(()=>{!h||A||(_h(null),f(null))},[A,h]);function M(G){const L={...E.state,...G};loe(L),c(vx())}function z(){if(typeof window>"u")return;const G=new URLSearchParams(window.location.search);for(const J of Object.values(Nt))G.delete(J);const L=G.toString(),F=`${window.location.pathname}${L?`?${L}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",F),c({}),f(null),g(null),x(null),w("checks")}function k(G){const L=new Set(E.state.visibleColumnIds);L.has(G)?L.delete(G):L.add(G),M({visibleColumnIds:[...L]})}function H(G){_h(G),f(G),g(null),x(null),w("checks")}function U(G,L,F="checks"){_h(G),f(G),g(Ym(L)),w(F),x(poe(L))}function ae(){_h(null),f(null),g(null),x(null),w("checks")}function Z(G){_(L=>{const F=new Set(L);return F.has(G)?F.delete(G):F.add(G),F})}return e.length===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:o??d.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations found"})}):d.jsxs("section",{className:"space-y-3",children:[d.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-baseline sm:justify-between",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-400",children:i}),d.jsxs("p",{className:"text-xs text-gray-500",children:[E.filteredRows.length," of ",E.rows.length," rows"]})]}),d.jsxs("div",{className:"space-y-3 rounded-lg border border-gray-800 bg-gray-900/40 p-3",children:[d.jsx("div",{className:"flex flex-wrap gap-2",children:P5.map(G=>d.jsxs("button",{type:"button",onClick:()=>M({view:G.id}),className:`inline-flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-sm transition-colors ${E.state.view===G.id?"border-cyan-900/60 bg-cyan-950/30 text-cyan-300":"border-gray-800 bg-gray-950/70 text-gray-400 hover:border-gray-700 hover:text-gray-200"}`,children:[d.jsx("span",{children:G.label}),d.jsx("span",{className:"tabular-nums text-xs text-gray-500",children:E.viewCounts[G.id]})]},G.id))}),d.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(220px,1fr)_minmax(150px,220px)_minmax(150px,220px)_auto_auto]",children:[d.jsxs("label",{className:"min-w-0",children:[d.jsx("span",{className:"sr-only",children:"Search results"}),d.jsx("input",{type:"search",value:E.state.search,onChange:G=>M({search:G.target.value}),placeholder:"Search tests, targets, graders, assertions",className:"w-full rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-100 placeholder:text-gray-600 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500"})]}),d.jsxs("label",{children:[d.jsx("span",{className:"sr-only",children:"Filter by target"}),d.jsxs("select",{value:E.state.target,onChange:G=>M({target:G.target.value}),className:"w-full rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-100 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:[d.jsx("option",{value:"all",children:"All targets"}),E.targetOptions.map(G=>d.jsx("option",{value:G,children:G},G))]})]}),d.jsxs("label",{children:[d.jsx("span",{className:"sr-only",children:"Filter by grader"}),d.jsxs("select",{value:E.state.grader,onChange:G=>M({grader:G.target.value}),className:"w-full rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-100 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:[d.jsx("option",{value:"all",children:"All graders"}),E.graderOptions.map(G=>d.jsx("option",{value:G,children:G},G))]})]}),d.jsxs("details",{className:"group relative",children:[d.jsx("summary",{className:"list-none rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-gray-600 hover:text-gray-100 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:"Display"}),d.jsxs("div",{className:"absolute right-0 z-10 mt-2 w-64 max-w-[calc(100vw-2rem)] rounded-lg border border-gray-800 bg-gray-950 p-3",children:[d.jsx("div",{className:"mb-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Columns"}),d.jsx("div",{className:"max-h-72 space-y-2 overflow-auto pr-1",children:E.columns.map(G=>d.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-300",children:[d.jsx("input",{type:"checkbox",checked:T.has(G.id),onChange:()=>k(G.id),className:"h-4 w-4 rounded border-gray-700 bg-gray-900 text-cyan-500"}),d.jsx("span",{className:"min-w-0 truncate",title:G.label,children:G.label})]},G.id))})]})]}),d.jsx("button",{type:"button",onClick:z,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200",children:"Clear"})]})]}),d.jsxs("div",{className:A?"grid min-w-0 max-w-full gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(360px,42rem)]":"",children:[d.jsx("div",{className:"min-w-0",children:E.filteredRows.length===0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-400",children:"No matching evaluations"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Adjust the result filters or display preset."})]}):d.jsx(foe,{rows:E.filteredRows,visibleColumns:E.visibleColumns,passThreshold:n,selectedRowKey:h,selectedTrialPath:p,repeatGroupsByRowKey:C,expandedRepeatRows:N,onToggleRepeatGroup:Z,onOpenDetail:H,onOpenTrialDetail:U})}),A&&d.jsx(Eoe,{row:A,runId:t,projectId:r,repeatGroup:R,selectedTrial:D,selectedTrialPath:p,initialTab:b,initialFilePath:y,onOpenTrialDetail:(G,L)=>U(A.key,G,L),onClose:ae})]})]})}function foe({rows:e,visibleColumns:t,passThreshold:r,selectedRowKey:n,selectedTrialPath:i,repeatGroupsByRowKey:o,expandedRepeatRows:l,onToggleRepeatGroup:c,onOpenDetail:h,onOpenTrialDetail:f}){return d.jsx("div",{className:"max-w-full overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"w-full whitespace-nowrap text-left text-sm",style:{minWidth:`${Soe(t)}px`},children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsx("tr",{children:t.map(p=>d.jsx("th",{className:Noe(p.id),title:p.label,children:d.jsx("span",{className:woe(p.id)?"sr-only":"block max-w-48 truncate",children:p.label})},p.id))})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:e.map(p=>{const g=o.get(p.key),y=n===p.key&&!i,x=g?l.has(p.key):!1;return d.jsxs(S.Fragment,{children:[d.jsx("tr",{className:`cursor-pointer transition-colors ${y?"bg-cyan-950/20":"hover:bg-gray-900/30"} ${g?"bg-gray-950/20":""}`,onClick:()=>h(p.key),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),h(p.key))},tabIndex:0,"aria-selected":y,children:t.map(b=>d.jsx("td",{className:S2(b.id,"py-3"),children:d.jsx(_oe,{column:b,row:p,repeatGroup:g,repeatExpanded:x,passThreshold:r,isSelected:y,onToggleRepeatGroup:c})},`${p.key}:${b.id}`))}),g&&x?g.trials.map((b,w)=>{const N=Ym(b,w),_=n===p.key&&i===N;return d.jsx("tr",{className:`cursor-pointer bg-gray-950/60 transition-colors ${_?"bg-cyan-950/20":"hover:bg-gray-900/50"}`,"aria-label":`${dS(b,w)} for ${p.testId}`,onClick:()=>f(p.key,b),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),f(p.key,b))},tabIndex:0,"aria-selected":_,children:t.map(E=>d.jsx("td",{className:S2(E.id,"py-2"),children:d.jsx(goe,{column:E,row:p,trial:b,index:w,passThreshold:r})},`${p.key}:${N}:${E.id}`))},`${p.key}:${N}`)}):null]},p.key)})})]})})}function hoe(e,t){return e.verdict==="pass"?!0:e.verdict==="fail"?!1:typeof e.score=="number"?e.score>=t:!1}function moe(e,t=0){return typeof e.sample_index=="number"?e.sample_index:typeof e.attempt=="number"?e.attempt+1:t+1}function dS(e,t=0){const r=`Attempt ${moe(e,t)}`;return typeof e.retry_index=="number"&&e.retry_index>0?`${r} retry ${e.retry_index}`:r}function poe(e){return e.grading_path??e.metrics_path??e.timing_path??e.transcript_path??e.answer_path??null}function sL(e,t){return e?t?`[target:${t}] ${e}`:e:t?`Target error: ${t}`:void 0}function oL(e){var t,r,n,i;return((t=e.target_execution)==null?void 0:t.error_kind)??((r=e.target_execution)==null?void 0:r.errorKind)??((n=e.targetExecution)==null?void 0:n.error_kind)??((i=e.targetExecution)==null?void 0:i.errorKind)}function goe({column:e,row:t,trial:r,index:n,passThreshold:i}){const o=hoe(r,i),l=r.execution_status==="execution_error",c=l?"error":o?"passing":"failing",h=l?"Error":o?"Passing":"Failing",f=dS(r,n),p=Ym(r,n);switch(e.id){case"status":return d.jsx(fS,{status:c,label:h});case"expander":return d.jsx("span",{"aria-hidden":"true",className:"mx-auto block h-7 w-px bg-gray-800"});case"test":return d.jsx(yoe,{label:f,artifactLabel:p,parentTestId:t.testId,trial:r});case"target":return d.jsx(uL,{target:t.targetLabel,tone:"text-gray-500"});case"score":return d.jsx(an,{rate:r.score??0});case"eval":return d.jsx(Al,{value:t.evalLabel,tone:"text-gray-500"});case"category":return d.jsx(Al,{value:t.categoryLabel,tone:"text-gray-500"});case"duration":return d.jsx("span",{className:"text-gray-500",children:uS(r.duration_ms)});case"cost_tokens":return d.jsx(Poe,{trial:r});case"review":return d.jsx("span",{className:"text-gray-700",children:"-"});case"error":return d.jsx(Al,{value:sL(r.error,oL(r)),tone:"text-red-300"});default:return d.jsx("span",{className:"text-gray-700",children:"-"})}}function yoe({label:e,artifactLabel:t,parentTestId:r,trial:n}){return d.jsxs("div",{className:"max-w-[28rem] min-w-0 border-l border-gray-800 pl-3",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[d.jsx("span",{className:"rounded-md border border-gray-800 bg-gray-900 px-1.5 py-0.5 text-[11px] font-medium text-gray-500",children:"Attempt"}),d.jsx("span",{className:"truncate font-medium text-gray-300",title:e,children:e})]}),d.jsxs("div",{className:"mt-0.5 truncate text-xs text-gray-600",title:`${r} · ${t}`,children:["Under ",r," · ",t]}),d.jsx("div",{className:"mt-0.5 flex min-w-0 flex-wrap gap-x-3 gap-y-0.5 text-xs text-gray-600",children:n.total_tool_calls!=null?d.jsxs("span",{children:[n.total_tool_calls," tool calls"]}):null}),n.error?d.jsx("div",{className:"mt-0.5 truncate text-xs text-red-300",title:n.error,children:n.error}):null]})}function fS({status:e,label:t}){const r=e==="passing",n=e==="error"||e==="partial",i=r?soe:ooe,o=r?"text-emerald-300":n?"text-amber-300":"text-red-300";return d.jsx("span",{className:`inline-flex text-base font-semibold ${o}`,title:t,children:i})}function voe({group:e,passThreshold:t}){const n=e.passRate>=t?"passing":e.passedTrials>0?"partial":"failing";return d.jsx(fS,{status:n,label:`${e.passedTrials}/${e.trialCount} attempts passed`})}function xoe({group:e}){const t=e.passedTrials===e.trialCount?"Stable pass":e.passedTrials===0?"Stable fail":"Flaky",r=[`${e.passedTrials}/${e.trialCount} attempts passed`,`${Gm(e.passRate)} success`,`${Gm(e.meanScore)} mean score`,e.executionErrorTrials>0?`${e.executionErrorTrials} execution errors`:void 0,e.assertionPassRate!=null?`${e.passedAssertions}/${e.assertionCount} assertions`:void 0].filter(n=>!!n);return d.jsxs("div",{className:"mt-1 flex max-w-[34rem] flex-wrap items-center gap-x-2 gap-y-1 text-xs",children:[d.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/30 px-1.5 py-0.5 font-medium text-cyan-300",children:"Aggregate case"}),d.jsx("span",{className:t==="Stable pass"?"text-emerald-300":t==="Stable fail"?"text-red-300":"text-yellow-300",children:t}),d.jsx("span",{className:"min-w-0 truncate text-gray-500",title:r.join(" · "),children:r.join(" · ")})]})}function boe({group:e}){return d.jsxs("div",{className:"flex min-w-0 flex-col items-end gap-1",children:[d.jsx(an,{rate:e.passRate}),d.jsx("div",{className:"text-xs text-gray-500",children:"Attempt success"}),d.jsxs("div",{className:"text-xs tabular-nums text-gray-600",children:["Mean score ",Gm(e.meanScore)]})]})}function joe({group:e,row:t}){return d.jsxs("span",{className:"text-gray-400",children:["Avg ",uS(e.meanDurationMs??t.result.durationMs)]})}function lL(e){return["duration","cost_tokens"].includes(e)||e.startsWith("grader:")}function Zp(e){return e==="status"||e==="expander"}function woe(e){return Zp(e)}function Soe(e){const t=e.reduce((r,n)=>r+(Zp(n.id)?44:136),0);return Math.max(760,t)}function Noe(e){return Zp(e)?"w-11 min-w-11 max-w-11 px-2 py-3 text-center font-medium text-gray-400":`px-4 py-3 font-medium text-gray-400 ${lL(e)?"text-right":""}`}function S2(e,t){return Zp(e)?`w-11 min-w-11 max-w-11 px-2 ${t} text-center align-middle`:`px-4 ${t} align-middle ${lL(e)?"text-right tabular-nums":""}`}function _oe({column:e,row:t,repeatGroup:r,repeatExpanded:n,passThreshold:i,isSelected:o,onToggleRepeatGroup:l}){if(e.id.startsWith("grader:")){const c=e.id.slice(7);return d.jsx(Roe,{score:t.graderScores.get(c),passThreshold:i})}switch(e.id){case"status":return r?d.jsx(voe,{group:r,passThreshold:i}):d.jsx(fS,{status:t.status,label:t.statusLabel});case"expander":return r?d.jsx(Aoe,{row:t,repeatExpanded:n,onToggleRepeatGroup:l}):d.jsx("span",{"aria-hidden":"true",className:"block h-5"});case"test":return d.jsx(Ooe,{row:t,repeatGroup:r,isSelected:o});case"target":return d.jsx(uL,{target:t.targetLabel});case"score":return t.executionError?d.jsx("span",{className:"inline-flex rounded-md border border-amber-900/60 bg-amber-950/20 px-2 py-0.5 text-xs font-medium text-amber-300",children:"Execution error"}):r?d.jsx(boe,{group:r}):d.jsx(an,{rate:t.result.score});case"eval":return d.jsx(Al,{value:t.evalLabel});case"category":return d.jsx(Al,{value:t.categoryLabel});case"duration":return r?d.jsx(joe,{group:r,row:t}):d.jsx("span",{className:"text-gray-400",children:uS(t.result.durationMs)});case"cost_tokens":return d.jsx(Coe,{row:t,repeatGroup:r});case"error":return d.jsx(Al,{value:sL(t.result.error,oL(t.result)),tone:"text-red-300"});default:return d.jsx("span",{className:"text-gray-600",children:"-"})}}function Ooe({row:e,repeatGroup:t,isSelected:r}){return d.jsxs("div",{className:"max-w-[24rem] min-w-0",children:[d.jsx("span",{className:`block min-w-0 truncate text-left font-medium ${r?"text-cyan-200":"text-cyan-400"}`,title:e.testId,children:e.testId}),t?d.jsx(xoe,{group:t}):null,e.result.error?d.jsx("div",{className:"mt-0.5 truncate text-xs text-red-300",title:e.result.error,children:e.result.error}):null]})}function Eoe({row:e,runId:t,projectId:r,repeatGroup:n,selectedTrial:i,selectedTrialPath:o,initialTab:l,initialFilePath:c,onOpenTrialDetail:h,onClose:f}){const p=$B(t,e.testId,{projectId:r,resultDir:e.result.result_dir,evalPath:e.result.eval_path}),g=i?`${e.testId} · ${dS(i)}`:e.testId,y=n&&!i,x=`${e.key}:${o??""}:${l}`;return d.jsxs("aside",{ref:Toe,className:"min-w-0 max-w-full overflow-hidden rounded-lg border border-gray-800 bg-gray-950/80 xl:sticky xl:top-4 xl:max-h-[calc(100vh-2rem)]",children:[d.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3 border-b border-gray-800 px-4 py-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Row detail"}),d.jsx("h4",{className:"mt-1 truncate text-base font-semibold text-white",title:g,children:g}),d.jsxs("p",{className:"mt-1 truncate text-xs text-gray-500",title:e.targetLabel,children:[e.targetLabel,e.evalLabel?` · ${e.evalLabel}`:""]})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[d.jsx("a",{href:p,className:"rounded-md border border-gray-800 px-2.5 py-1.5 text-xs text-gray-400 transition-colors hover:border-gray-700 hover:text-gray-200",children:"Full page"}),d.jsx("button",{type:"button",onClick:f,className:"rounded-md border border-gray-800 px-2.5 py-1.5 text-xs text-gray-400 transition-colors hover:border-gray-700 hover:text-gray-200",children:"Close"})]})]}),d.jsx("div",{className:"h-[36rem] min-h-[28rem] min-w-0 overflow-hidden xl:h-[calc(100vh-9rem)]",children:d.jsx(lS,{eval:e.result,runId:t,projectId:r,repeatGroup:y?n:void 0,selectedTrial:i,initialTab:l,initialSelectedFilePath:c,onSelectTrial:h},`${e.key}:${o??"aggregate"}:${c??""}`)})]},x)}function uL({target:e,tone:t="text-gray-300"}){return d.jsx("div",{className:`max-w-[14rem] truncate ${t}`,title:e,children:e})}function Aoe({row:e,repeatExpanded:t,onToggleRepeatGroup:r}){return d.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(e.key)},className:"inline-flex h-6 w-6 items-center justify-center rounded-md border border-gray-800 text-xs text-gray-400 transition-colors hover:border-gray-700 hover:text-gray-200","aria-expanded":t,"aria-label":`${t?"Collapse":"Expand"} attempts for ${e.testId}`,children:t?"-":"+"})}function Toe(e){e&&window.requestAnimationFrame(()=>{e.scrollIntoView({block:"nearest",inline:"nearest"})})}function Coe({row:e,repeatGroup:t}){const r=(t==null?void 0:t.trials.map(f=>f.cost_usd).filter(f=>typeof f=="number"&&Number.isFinite(f)))??[],n=(t==null?void 0:t.trials.map(aL).filter(f=>typeof f=="number"&&Number.isFinite(f)))??[],i=r.length>0?r.reduce((f,p)=>f+p,0):void 0,o=n.length>0?n.reduce((f,p)=>f+p,0):void 0,l=rL(e.result.costUsd??i),c=nL(e.tokenTotal??o),h=coe(e.result);return!l&&!c?d.jsx("span",{className:"text-gray-600",children:"-"}):d.jsxs("div",{className:"min-w-0 text-right",children:[l?d.jsx("div",{className:"tabular-nums text-gray-300",children:l}):null,c?d.jsx("div",{className:"text-xs tabular-nums text-gray-500",title:h,children:c}):null]})}function Poe({trial:e}){const t=rL(e.cost_usd),r=nL(aL(e));return!t&&!r?d.jsx("span",{className:"text-gray-700",children:"-"}):d.jsxs("div",{className:"min-w-0 text-right",children:[t?d.jsx("div",{className:"tabular-nums text-gray-500",children:t}):null,r?d.jsx("div",{className:"text-xs tabular-nums text-gray-600",children:r}):null]})}function Roe({score:e,passThreshold:t}){if(!e)return d.jsx("span",{className:"text-gray-600",children:"-"});const r=e.score<t||iL(e);return d.jsxs("div",{className:"min-w-0 text-right",children:[d.jsx("div",{className:`tabular-nums ${doe(e.score)}`,children:Gm(e.score)}),d.jsx("div",{className:r?"text-xs text-red-300":"text-xs text-gray-500",children:r?"Fail":e.verdict??"Pass"})]})}function Al({value:e,tone:t="text-gray-400"}){return e?d.jsx("span",{className:`block max-w-[14rem] truncate ${t}`,title:e,children:e}):d.jsx("span",{className:"text-gray-600",children:"-"})}function eu({total:e,passed:t,failed:r,passRate:n,executionErrors:i=0,totalCost:o}){const l=Math.round(n*100),c=l>=80?"text-cyan-400":l>=60?"text-amber-400":"text-red-400";return d.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:[d.jsx(vl,{label:"Pass Rate",value:`${l}%`,accent:c,large:!0}),d.jsx("div",{className:"h-6 w-px bg-gray-700"}),d.jsx(vl,{label:"Passed",value:String(t),accent:"text-emerald-400"}),d.jsx(vl,{label:"Failures",value:String(r),accent:"text-red-400"}),i>0&&d.jsx(vl,{label:"Execution Errors",value:String(i),accent:"text-amber-400"}),d.jsx(vl,{label:"Total",value:String(e)}),o!==void 0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-6 w-px bg-gray-700"}),d.jsx(vl,{label:"Cost",value:`$${o.toFixed(4)}`,accent:"text-amber-400"})]})]})}function vl({label:e,value:t,accent:r,large:n}){return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("span",{className:"text-xs text-gray-500",children:e}),d.jsx("span",{className:`tabular-nums font-semibold ${n?"text-2xl":"text-lg"} ${r??"text-white"}`,children:t})]})}function cL({results:e,runId:t,projectId:r}){const{data:n}=pt(r),i=(n==null?void 0:n.threshold)??(n==null?void 0:n.pass_threshold)??.8,[o,l]=S.useState({}),c=qie(e),h=e.length,f=rp(e,i),p=e.reduce((b,w)=>b+(w.costUsd??0),0),g=vae(e,i),y=dL(g,o),x=b=>{l(w=>({...w,[b]:!w[b]}))};return h===0?d.jsxs("div",{className:"space-y-6",children:[d.jsx(eu,{total:0,passed:0,failed:0,passRate:0}),d.jsx(N2,{href:c}),d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations found"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This run has no results yet."})]})]}):d.jsxs("div",{className:"space-y-6",children:[d.jsx(eu,{total:h,passed:f.passed,failed:f.failed,passRate:f.passRate,executionErrors:f.executionErrors,totalCost:p>0?p:void 0}),d.jsx(N2,{href:c}),d.jsxs("div",{children:[d.jsx("h3",{className:"mb-3 text-sm font-medium text-gray-400",children:"Category Breakdown"}),d.jsx("div",{className:"max-w-full overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"min-w-[620px] w-full whitespace-nowrap text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Category"}),d.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Pass Rate"}),d.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Passed"}),d.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Failures"}),d.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Execution Errors"}),d.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Total"})]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:y.map(b=>{const w=o[b.name]===!0;return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"w-[18rem] max-w-[18rem] px-4 py-2.5 font-medium text-gray-200",children:d.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[d.jsx("span",{className:"inline-block h-4 shrink-0",style:{width:`${b.depth*16}px`}}),b.childCount>0?d.jsx("button",{type:"button",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded border border-gray-700 text-xs text-gray-400 hover:border-gray-600 hover:text-gray-200",onClick:()=>x(b.name),"aria-label":`${w?"Collapse":"Expand"} ${b.name}`,"aria-expanded":w,children:w?"-":"+"}):d.jsx("span",{className:"h-5 w-5 shrink-0"}),r?d.jsx(Ee,{to:"/projects/$projectId/runs/$runId/category/$category",params:{projectId:r,runId:t,category:b.name},className:"min-w-0 truncate text-cyan-400 hover:text-cyan-300 hover:underline",title:b.name,children:b.label}):d.jsx(Ee,{to:"/runs/$runId/category/$category",params:{runId:t,category:b.name},className:"min-w-0 truncate text-cyan-400 hover:text-cyan-300 hover:underline",title:b.name,children:b.label}),b.depth>0?d.jsx("span",{className:"truncate text-xs font-normal text-gray-500",children:b.name}):null,b.childCount>0?d.jsx("span",{className:"shrink-0 text-xs font-normal text-gray-500",children:b.childCount}):null]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsx(an,{rate:b.total-b.executionErrors>0?b.passed/(b.total-b.executionErrors):0})}),d.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-emerald-400",children:b.passed}),d.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-red-400",children:b.failed>0?b.failed:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-amber-400",children:b.executionErrors>0?b.executionErrors:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-gray-400",children:b.total})]},b.name)})})]})})]}),d.jsx(cS,{results:e,runId:t,projectId:r,passThreshold:i,title:"All Evals"}),d.jsx(Moe,{runId:t,projectId:r})]})}function dL(e,t){return e.flatMap(r=>[r,...t[r.name]?dL(r.children,t):[]])}function N2({href:e}){return e?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"text-sm font-medium text-gray-200",children:"External trace"}),d.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Phoenix"})]}),d.jsx("a",{href:e,target:"_blank",rel:"noreferrer",className:"inline-flex items-center rounded-md border border-cyan-900/70 px-2.5 py-1 text-sm font-medium text-cyan-300 transition-colors hover:border-cyan-700 hover:bg-cyan-950/40 hover:text-cyan-200 hover:underline",children:"Open in Phoenix"})]})}):null}function Moe({runId:e,projectId:t}){const[r,n]=S.useState(!1),{data:i,isLoading:o,error:l}=t6(e,t);return!o&&!l&&i==null?null:d.jsxs("div",{children:[d.jsxs("button",{type:"button",onClick:()=>n(c=>!c),className:"flex w-full items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 px-4 py-2 text-left text-sm font-medium text-gray-300 transition-colors hover:bg-gray-900","aria-expanded":r,children:[d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx("span",{"aria-hidden":"true",children:r?"▾":"▸"}),"Run Log"]}),d.jsx("span",{className:"text-xs text-gray-500",children:o?"Loading…":l?"Failed to load":i?`${i.length} chars`:""})]}),r&&d.jsx("div",{className:"mt-2 overflow-hidden rounded-lg border border-gray-800 bg-black",children:l?d.jsxs("div",{className:"p-4 text-sm text-red-400",children:["Failed to load run log: ",l.message]}):d.jsx("pre",{className:"max-h-[480px] overflow-auto whitespace-pre-wrap break-words p-4 font-mono text-xs leading-relaxed text-gray-200",children:i??""})})]})}function Jp({status:e}){const t=e==="finished"||e==="failed",n={starting:"text-yellow-400",running:"text-cyan-400",finished:"text-emerald-400",failed:"text-red-400"}[e]??"text-gray-400";return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:`text-sm font-medium ${n}`,children:e.charAt(0).toUpperCase()+e.slice(1)}),!t&&d.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent"})]})}function eg({runId:e,status:t,isReadOnly:r,projectId:n}){const[i,o]=S.useState(!1),[l,c]=S.useState(null);if(!Die(t,r))return null;async function h(){o(!0),c(null);try{await k6(e,n)}catch(f){c(f instanceof Error?f.message:"Failed to stop run"),o(!1)}}return d.jsxs("div",{className:"flex flex-col items-end gap-1",children:[d.jsx("button",{type:"button",onClick:h,disabled:i,className:"inline-flex items-center gap-2 rounded-md border border-gray-700 bg-transparent px-3 py-1.5 text-sm font-medium text-gray-300 hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"stop-run-button",children:i?"Stopping…":d.jsxs(d.Fragment,{children:[d.jsx("span",{"aria-hidden":"true",className:"inline-block h-2.5 w-2.5 rounded-[1px] bg-current"}),"Stop"]})}),l&&d.jsx("p",{className:"text-xs text-red-400",children:l})]})}const fL=dr("/runs/$runId")({component:Doe});function Doe(){var w;const{runId:e}=fL.useParams(),{data:t,isLoading:r,error:n}=md(e),{data:i}=pt(),{data:o}=ep(),[l,c]=S.useState(!1),h=(i==null?void 0:i.read_only)===!0;if(r)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(N=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},N))})]});if(n)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",n.message]});const f=(w=t==null?void 0:t.results)==null?void 0:w[0],p=f==null?void 0:f.target,g=p?{target:p}:void 0,y=t==null?void 0:t.status,x=y==="starting"||y==="running",b=BR({runId:e,results:(t==null?void 0:t.results)??[],source:t==null?void 0:t.source,sourceLabel:t==null?void 0:t.source_label,runtimeSource:t==null?void 0:t.runtime_source,remoteRepo:(t==null?void 0:t.source)==="remote"?o==null?void 0:o.repo:void 0,formatTimestamp:N=>new Date(N).toLocaleString()});return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("h1",{className:"min-w-0 truncate text-xl font-semibold text-white sm:text-2xl",title:b.heading,children:b.heading}),b.sourceBadge?d.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/20 px-2 py-0.5 text-xs font-medium text-cyan-300",children:b.sourceBadge}):null]}),b.meta?d.jsx("p",{className:"mt-1 text-sm text-gray-500",children:b.meta}):null,b.sourceContext.length>0?d.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-gray-500",children:b.sourceContext.map(N=>d.jsxs("span",{children:[d.jsxs("span",{className:"text-gray-600",children:[N.label,":"]})," ",N.value]},`${N.label}:${N.value}`))}):null]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-3 sm:justify-end",children:[!h&&x?d.jsx(eg,{runId:e,status:y,isReadOnly:h}):d.jsx(A5,{results:(t==null?void 0:t.results)??[],runDir:t==null?void 0:t.run_dir,suiteFilter:t==null?void 0:t.suite_filter,target:p??void 0,isReadOnly:h,plannedTestCount:t==null?void 0:t.planned_test_count,runStatus:y}),y&&d.jsx(Jp,{status:y}),!h&&!x&&d.jsx("button",{type:"button",onClick:()=>c(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"Start"})]})]}),d.jsx(cL,{results:(t==null?void 0:t.results)??[],runId:e}),!h&&d.jsx(So,{open:l,onClose:()=>c(!1),prefill:g})]})}const xx=[{id:"runs",label:"🏃 Recent Runs",title:"Recent Runs"},{id:"tags",label:"🏷️ Tags",title:"Tags"},{id:"analytics",label:"📊 Analytics",title:"Analytics"},{id:"targets",label:"🤖 Targets",title:"Targets"}],hL=dr("/projects/$projectId")({component:koe});function koe(){var x,b;const{projectId:e}=hL.useParams(),r=nj().location.search,n=r.tab,i=(x=r.key)!=null&&x.trim()?r.key:jl,o=po(),[l,c]=S.useState(!1),{data:h}=pt(e),f=(h==null?void 0:h.read_only)===!0,p=e,g=xx.some(w=>w.id===n)?n:"runs",y=((b=xx.find(w=>w.id===g))==null?void 0:b.title)??"Recent Runs";return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:y}),!f&&d.jsx("button",{type:"button",onClick:()=>c(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"Start"})]}),d.jsx("div",{className:"border-b border-gray-800 sm:overflow-x-auto",children:d.jsx("div",{className:"flex flex-wrap gap-1 sm:min-w-max sm:flex-nowrap",children:xx.map(w=>d.jsx("button",{type:"button",onClick:()=>o({to:"/projects/$projectId",params:{projectId:e},search:w.id==="tags"?{tab:w.id,key:i}:{tab:w.id}}),className:`shrink-0 px-4 py-2 text-sm font-medium transition-colors ${g===w.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:w.label},w.id))})}),g==="runs"&&d.jsx(Loe,{projectId:e,projectName:p,readOnly:f}),g==="tags"&&d.jsx(_5,{projectId:e,tagKey:i,onTagKeyChange:w=>o({to:"/projects/$projectId",params:{projectId:e},search:{tab:"tags",key:w}})}),g==="analytics"&&d.jsx($oe,{projectId:e,readOnly:f}),g==="targets"&&d.jsx(O5,{projectId:e}),!f&&d.jsx(So,{open:l,onClose:()=>c(!1),projectId:e})]})}function Loe({projectId:e,projectName:t,readOnly:r}){const n=ho(),{data:i,isLoading:o,error:l,hasNextPage:c,fetchNextPage:h,isFetchingNextPage:f}=S6(e),{data:p}=mj(e),{data:g}=ep(e),[y,x]=S.useState(!1),[b,w]=S.useState(!1),[N,_]=S.useState(null),E=((p==null?void 0:p.runs)??[]).filter(M=>M.status==="starting"||M.status==="running"),T=Wp((i==null?void 0:i.runs)??[]),A=T.filter(M=>M.on_remote===!0).length,C=(g==null?void 0:g.configured)===!0?AR(A,T.length,g.branch):void 0;async function R(){x(!0),_(null);try{const M=await DR(e);n.setQueryData($c(e).queryKey,M);const z=Hh(M);_(z),Promise.all([n.invalidateQueries({queryKey:["projects",e,"runs"]}),n.invalidateQueries({queryKey:["projects",e,"tags"]}),n.invalidateQueries({queryKey:["projects",e,"compare"]}),n.invalidateQueries({queryKey:["projects",e,"targets"]}),n.invalidateQueries({queryKey:["remote-status",e]})]).catch(()=>{})}catch(M){_(Kh(M,g)),n.invalidateQueries({queryKey:["remote-status",e]}).catch(()=>{})}finally{x(!1)}}async function D(){w(!0),_(null);try{const M=await kR(e);n.setQueryData($c(e).queryKey,M),_(Hh(M)),Promise.all([n.invalidateQueries({queryKey:["projects",e,"runs"]}),n.invalidateQueries({queryKey:["projects",e,"tags"]}),n.invalidateQueries({queryKey:["projects",e,"compare"]}),n.invalidateQueries({queryKey:["projects",e,"targets"]}),n.invalidateQueries({queryKey:["remote-status",e]})]).catch(()=>{})}catch(M){_(Kh(M,g)),n.invalidateQueries({queryKey:["remote-status",e]}).catch(()=>{})}finally{w(!1)}}return S.useEffect(()=>{if((N==null?void 0:N.kind)!=="success")return;const M=window.setTimeout(()=>_(null),7e3);return()=>window.clearTimeout(M)},[N]),o?d.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(M=>d.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},M))}):l?d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",l.message]}):d.jsxs("div",{className:"space-y-4",children:[E.length>0&&d.jsxs("div",{className:"rounded-lg border border-cyan-900/40 bg-cyan-950/10",children:[d.jsx("div",{className:"border-b border-cyan-900/30 px-4 py-2.5",children:d.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-cyan-400",children:"Active"})}),d.jsx("ul",{className:"divide-y divide-gray-800/50",children:E.map(M=>d.jsxs("li",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[d.jsxs("div",{className:"min-w-0 flex items-center gap-3",children:[d.jsx("span",{className:"inline-block h-2 w-2 flex-shrink-0 animate-pulse rounded-full bg-cyan-400"}),d.jsx("span",{className:"truncate font-mono text-sm text-gray-300",children:M.id}),d.jsx("span",{className:"flex-shrink-0 text-xs text-gray-500",children:new Date(M.started_at).toLocaleTimeString()})]}),d.jsx(Ee,{to:"/projects/$projectId/jobs/$runId",params:{projectId:e,runId:M.id},className:"flex-shrink-0 text-xs text-cyan-400 hover:text-cyan-300",children:"View Log →"})]},M.id))})]}),d.jsx(N5,{remoteStatus:g,syncInFlight:y,onSync:R,projectName:t,syncFeedback:N,onRemoteSummary:C,onConfirmMerge:D,confirmMergeInFlight:b}),d.jsx(Xp,{runs:T,projectId:e,enableCombine:!r,remoteBranch:g==null?void 0:g.branch,hasNextPage:c,isFetchingNextPage:f,onLoadMore:()=>void h()})]})}function $oe({projectId:e,readOnly:t}){const{data:r,isLoading:n,isError:i,error:o}=Ue(MR(e));return d.jsx(w5,{data:r,isLoading:n,isError:i,error:o,projectId:e,readOnly:t})}const mL=dr("/jobs/$runId")({component:Ioe});function Ioe(){const{runId:e}=mL.useParams(),{data:t,isLoading:r,error:n}=hj(e),{data:i}=pt(),o=(i==null?void 0:i.read_only)===!0;if(r)return d.jsxs("div",{className:"space-y-4",children:[d.jsx(bx,{}),d.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"h-64 animate-pulse rounded-lg bg-gray-900"})]});if(n||!t)return d.jsxs("div",{className:"space-y-4",children:[d.jsx(bx,{}),d.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4 text-sm text-red-400",children:n?`Failed to load run: ${n.message}`:"Run not found."})]});const l=t.status==="finished"||t.status==="failed";return d.jsxs("div",{className:"space-y-4",children:[d.jsx(bx,{}),d.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-4",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h1",{className:"truncate font-mono text-base font-semibold text-white",children:e}),d.jsxs("p",{className:"mt-0.5 text-xs text-gray-500",children:["Started ",new Date(t.started_at).toLocaleString(),t.finished_at&&d.jsxs(d.Fragment,{children:[" · ","Finished ",new Date(t.finished_at).toLocaleString()," · ",Math.round((new Date(t.finished_at).getTime()-new Date(t.started_at).getTime())/1e3),"s"]})]})]}),d.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3",children:[d.jsx(eg,{runId:e,status:t.status,isReadOnly:o}),d.jsx(Jp,{status:t.status})]})]}),d.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 px-4 py-3",children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Command"}),d.jsx("code",{className:"break-all text-xs text-cyan-300",children:t.command})]}),t.stdout?d.jsxs("div",{children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Output"}),d.jsx("div",{className:"max-h-[60vh] overflow-y-auto rounded-lg border border-gray-700 bg-gray-950 p-4",children:d.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-gray-200",children:t.stdout})})]}):!l&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[d.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border-2 border-gray-500 border-t-transparent"}),"Waiting for output…"]}),t.stderr&&d.jsxs("div",{children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-red-500",children:"Stderr"}),d.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border border-red-900/40 bg-red-950/20 p-4",children:d.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-red-300",children:t.stderr})})]}),l&&d.jsxs("p",{className:"text-xs text-gray-500",children:["Exit code:"," ",d.jsx("span",{className:t.exit_code===0?"text-emerald-400":"text-red-400",children:t.exit_code})]})]})}function bx(){return d.jsx(Ee,{to:"/",search:{tab:"runs"},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to Runs"})}const zoe=dr("/experiments/$experimentName")({beforeLoad:({params:e})=>{throw Zb({to:"/tags/$key/$value",params:{key:"experiment",value:e.experimentName}})}});function Boe(e){return`(no ${e})`}function Uoe(e,t){var n,i;if(t==="experiment")return e.experiment??((n=e.run_tags)==null?void 0:n.experiment)??"default";const r=(i=e.run_tags)==null?void 0:i[t];return r===void 0||r===""?Boe(t):r}function pL({tagKey:e,tagValue:t,projectId:r}){var x;const{data:n,isLoading:i}=Ue(r?cj(r,e):uj(e)),{data:o,isLoading:l}=Ue(r?fj(r):lj);if(i||l)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-4 gap-4",children:["s1","s2","s3","s4"].map(b=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},b))})]});const h=(x=n==null?void 0:n.groups)==null?void 0:x.find(b=>b.name===t),f=Wp(((o==null?void 0:o.runs)??[]).filter(b=>Uoe(b,e)===t)),p=(h==null?void 0:h.pass_rate)??0,g=f.length,y=(h==null?void 0:h.target_count)??0;return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:Zi(e)}),d.jsx("h1",{className:"text-2xl font-semibold text-white",children:t}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[g," run",g!==1?"s":""," · ",y," target",y!==1?"s":"",(h==null?void 0:h.last_run)&&d.jsxs("span",{className:"ml-2",children:["· Last run: ",_2(h.last_run)]})]})]}),h&&d.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-4",children:[d.jsx(Oh,{label:"Runs",value:String(g)}),d.jsx(Oh,{label:"Targets",value:String(y)}),d.jsx(Oh,{label:"Pass Rate",value:`${Math.round(p*100)}%`,accent:"text-cyan-400"}),d.jsx(Oh,{label:"Last Run",value:_2(h.last_run)})]}),d.jsxs("div",{children:[d.jsx("h2",{className:"mb-4 text-lg font-medium text-gray-200",children:"All Runs"}),d.jsx(Xp,{runs:f,projectId:r,emptyMessage:d.jsxs("div",{children:[d.jsxs("p",{className:"text-lg text-gray-400",children:["No evaluation runs found for ",Zi(e)," ",d.jsx("code",{children:t}),"."]}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Runs will appear here once this value has execution results."})]})})]})]})}function Oh({label:e,value:t,accent:r}){return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("p",{className:"text-sm text-gray-400",children:e}),d.jsx("p",{className:`mt-1 text-2xl font-semibold tabular-nums ${r??"text-white"}`,children:t})]})}function _2(e){if(!e)return"N/A";try{const t=new Date(e);return Number.isNaN(t.getTime())?"N/A":t.toLocaleString()}catch{return"N/A"}}const gL=dr("/tags/$key/$value")({component:qoe});function qoe(){const{key:e,value:t}=gL.useParams();return d.jsx(pL,{tagKey:e,tagValue:t})}const yL=dr("/evals/$runId/$evalId")({component:Foe});function Foe(){const{runId:e,evalId:t}=yL.useParams(),r=typeof window>"u"?void 0:new URLSearchParams(window.location.search).get("result_dir")??void 0,n=typeof window>"u"?void 0:new URLSearchParams(window.location.search).get("eval_path")??void 0,{data:i,isLoading:o,error:l}=md(e),{data:c}=pt(),[h,f]=S.useState(!1),p=(c==null?void 0:c.read_only)===!0;if(o)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(l)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",l.message]});const g=i==null?void 0:i.results.find(b=>Jm(b,t,{resultDir:r,evalPath:n}));if(!g)return d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:d.jsxs("p",{className:"text-gray-400",children:["Eval ",d.jsx("code",{className:"text-cyan-400",children:t})," not found in run"," ",d.jsx("code",{className:"text-cyan-400",children:e}),"."]})});const y=(c==null?void 0:c.threshold)??(c==null?void 0:c.pass_threshold)??.8,x=to(g.score,y)&&g.executionStatus!=="error"&&g.executionStatus!=="failed";return d.jsxs("div",{className:"flex h-full flex-col gap-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",e," / Eval: ",g.eval_path??t]}),d.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-semibold text-white",children:[d.jsx("span",{className:`text-2xl font-bold leading-none ${x?"text-emerald-400":"text-red-400"}`,children:x?"✓":"✗"}),t]})]}),!p&&d.jsx("button",{type:"button",onClick:()=>f(!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"})]}),d.jsx(lS,{eval:g,runId:e}),!p&&d.jsx(So,{open:h,onClose:()=>f(!1),prefill:{testIds:[t],target:g.target}})]})}const vL=dr("/runs/$runId_/suite/$suite")({component:Hoe});function Hoe(){const{runId:e,suite:t}=vL.useParams(),{data:r,isLoading:n,error:i}=md(e),{data:o}=pt(),l=(o==null?void 0:o.threshold)??(o==null?void 0:o.pass_threshold)??.8;if(n)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(g=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},g))})]});if(i)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",i.message]});const c=((r==null?void 0:r.results)??[]).filter(g=>(g.suite??"Uncategorized")===t),h=c.length,f=rp(c,l),p=c.reduce((g,y)=>g+(y.costUsd??0),0);return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:t}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Suite in run: ",e]})]}),d.jsx(eu,{total:h,passed:f.passed,failed:f.failed,passRate:f.passRate,executionErrors:f.executionErrors,totalCost:p>0?p:void 0}),h===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:d.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations in this suite"})}):d.jsx(cS,{results:c,runId:e,passThreshold:l,title:"Suite Evals"})]})}const xL=dr("/runs/$runId_/category/$category")({component:Koe});function Koe(){const{runId:e,category:t}=xL.useParams(),{data:r,isLoading:n,error:i}=PR(e,t);if(n)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(y=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},y))})]});if(i)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load category: ",i.message]});const o=(r==null?void 0:r.suites)??[],l=o.reduce((y,x)=>y+x.total,0),c=o.reduce((y,x)=>y+x.passed,0),h=o.reduce((y,x)=>y+x.failed,0),f=o.reduce((y,x)=>y+ur(x),0),p=l-f,g=p>0?c/p:0;return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:t}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Category in run: ",e]})]}),d.jsx(eu,{total:l,passed:c,failed:h,passRate:g,executionErrors:f}),o.length===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:d.jsx("p",{className:"text-lg text-gray-400",children:"No suites in this category"})}):d.jsxs("div",{className:"space-y-3",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Suites"}),d.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:o.map(y=>d.jsxs(Ee,{to:"/runs/$runId/suite/$suite",params:{runId:e,suite:y.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:y.name}),d.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[y.passed,"/",QR(y)]})]}),d.jsx("div",{className:"mt-2",children:d.jsx(fo,{score:y.avg_score})}),d.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[d.jsxs("span",{className:"text-emerald-400",children:[y.passed," passed"]}),y.failed>0&&d.jsxs("span",{className:"text-red-400",children:[y.failed," failed"]}),ur(y)>0&&d.jsxs("span",{className:"text-amber-400",children:[ur(y)," execution errors"]})]})]},y.name))})]})]})}const bL=dr("/projects/$projectId_/runs/$runId")({component:Goe});function Goe(){var N;const{projectId:e,runId:t}=bL.useParams(),{data:r,isLoading:n,error:i}=pd(e,t),{data:o}=pt(e),{data:l}=ep(e),[c,h]=S.useState(!1),f=(o==null?void 0:o.read_only)===!0;if(n)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(_=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},_))})]});if(i)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",i.message]});const p=(N=r==null?void 0:r.results)==null?void 0:N[0],g=p==null?void 0:p.target,y=g?{target:g}:void 0,x=r==null?void 0:r.status,b=x==="starting"||x==="running",w=BR({runId:t,results:(r==null?void 0:r.results)??[],source:r==null?void 0:r.source,sourceLabel:r==null?void 0:r.source_label,runtimeSource:r==null?void 0:r.runtime_source,remoteRepo:(r==null?void 0:r.source)==="remote"?l==null?void 0:l.repo:void 0,formatTimestamp:_=>new Date(_).toLocaleString()});return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("h1",{className:"min-w-0 truncate text-xl font-semibold text-white sm:text-2xl",title:w.heading,children:w.heading}),w.sourceBadge?d.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/20 px-2 py-0.5 text-xs font-medium text-cyan-300",children:w.sourceBadge}):null]}),w.meta?d.jsx("p",{className:"mt-1 text-sm text-gray-500",children:w.meta}):null,w.sourceContext.length>0?d.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-gray-500",children:w.sourceContext.map(_=>d.jsxs("span",{children:[d.jsxs("span",{className:"text-gray-600",children:[_.label,":"]})," ",_.value]},`${_.label}:${_.value}`))}):null]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-3 sm:justify-end",children:[!f&&b?d.jsx(eg,{runId:t,status:x,isReadOnly:f,projectId:e}):d.jsx(A5,{results:(r==null?void 0:r.results)??[],runDir:r==null?void 0:r.run_dir,suiteFilter:r==null?void 0:r.suite_filter,target:g??void 0,projectId:e,isReadOnly:f,plannedTestCount:r==null?void 0:r.planned_test_count,runStatus:x}),x&&d.jsx(Jp,{status:x}),!f&&!b&&d.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:"Start"})]})]}),d.jsx(cL,{results:(r==null?void 0:r.results)??[],runId:t,projectId:e}),!f&&d.jsx(So,{open:c,onClose:()=>h(!1),projectId:e,prefill:y})]})}const jL=dr("/projects/$projectId_/jobs/$runId")({component:Yoe});function Yoe(){const{projectId:e,runId:t}=jL.useParams(),{data:r,isLoading:n,error:i}=hj(t,e),{data:o}=pt(e),l=(o==null?void 0:o.read_only)===!0;if(n)return d.jsxs("div",{className:"space-y-4",children:[d.jsx(jx,{projectId:e}),d.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"h-64 animate-pulse rounded-lg bg-gray-900"})]});if(i||!r)return d.jsxs("div",{className:"space-y-4",children:[d.jsx(jx,{projectId:e}),d.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4 text-sm text-red-400",children:i?`Failed to load run: ${i.message}`:"Run not found."})]});const c=r.status==="finished"||r.status==="failed";return d.jsxs("div",{className:"space-y-4",children:[d.jsx(jx,{projectId:e}),d.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-4",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h1",{className:"truncate font-mono text-base font-semibold text-white",children:t}),d.jsxs("p",{className:"mt-0.5 text-xs text-gray-500",children:["Started ",new Date(r.started_at).toLocaleString(),r.finished_at&&d.jsxs(d.Fragment,{children:[" · ","Finished ",new Date(r.finished_at).toLocaleString()," · ",Math.round((new Date(r.finished_at).getTime()-new Date(r.started_at).getTime())/1e3),"s"]})]})]}),d.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3",children:[d.jsx(eg,{runId:t,status:r.status,isReadOnly:l,projectId:e}),d.jsx(Jp,{status:r.status})]})]}),d.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 px-4 py-3",children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Command"}),d.jsx("code",{className:"break-all text-xs text-cyan-300",children:r.command})]}),r.stdout?d.jsxs("div",{children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Output"}),d.jsx("div",{className:"max-h-[60vh] overflow-y-auto rounded-lg border border-gray-700 bg-gray-950 p-4",children:d.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-gray-200",children:r.stdout})})]}):!c&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[d.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border-2 border-gray-500 border-t-transparent"}),"Waiting for output…"]}),r.stderr&&d.jsxs("div",{children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-red-500",children:"Stderr"}),d.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border border-red-900/40 bg-red-950/20 p-4",children:d.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-red-300",children:r.stderr})})]}),c&&d.jsxs("p",{className:"text-xs text-gray-500",children:["Exit code:"," ",d.jsx("span",{className:r.exit_code===0?"text-emerald-400":"text-red-400",children:r.exit_code})]})]})}function jx({projectId:e}){return d.jsx(Ee,{to:"/projects/$projectId",params:{projectId:e},search:{tab:"runs"},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to Runs"})}const Voe=dr("/projects/$projectId_/experiments/$experimentName")({beforeLoad:({params:e})=>{throw Zb({to:"/projects/$projectId/tags/$key/$value",params:{projectId:e.projectId,key:"experiment",value:e.experimentName}})}}),wL=dr("/projects/$projectId_/tags/$key/$value")({component:Qoe});function Qoe(){const{projectId:e,key:t,value:r}=wL.useParams();return d.jsx(pL,{tagKey:t,tagValue:r,projectId:e})}const SL=dr("/projects/$projectId_/evals/$runId/$evalId")({component:Xoe});function Xoe(){const{projectId:e,runId:t,evalId:r}=SL.useParams(),n=typeof window>"u"?void 0:new URLSearchParams(window.location.search).get("result_dir")??void 0,i=typeof window>"u"?void 0:new URLSearchParams(window.location.search).get("eval_path")??void 0,{data:o,isLoading:l,error:c}=pd(e,t),{data:h}=pt(e),[f,p]=S.useState(!1),g=(h==null?void 0:h.read_only)===!0;if(l)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(c)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",c.message]});const y=o==null?void 0:o.results.find(w=>Jm(w,r,{resultDir:n,evalPath:i}));if(!y)return d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:d.jsxs("p",{className:"text-gray-400",children:["Eval ",d.jsx("code",{className:"text-cyan-400",children:r})," not found in run"," ",d.jsx("code",{className:"text-cyan-400",children:t}),"."]})});const x=(h==null?void 0:h.threshold)??(h==null?void 0:h.pass_threshold)??.8,b=to(y.score,x)&&y.executionStatus!=="error"&&y.executionStatus!=="failed";return d.jsxs("div",{className:"flex h-full flex-col gap-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",t," / Eval: ",y.eval_path??r]}),d.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-semibold text-white",children:[d.jsx("span",{className:`text-2xl font-bold leading-none ${b?"text-emerald-400":"text-red-400"}`,children:b?"✓":"✗"}),r]})]}),!g&&d.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"})]}),d.jsx(lS,{eval:y,runId:t,projectId:e}),!g&&d.jsx(So,{open:f,onClose:()=>p(!1),projectId:e,prefill:{testIds:[r],target:y.target}})]})}const NL=dr("/projects/$projectId_/runs/$runId_/suite/$suite")({component:Woe});function Woe(){const{projectId:e,runId:t,suite:r}=NL.useParams(),{data:n,isLoading:i,error:o}=pd(e,t),{data:l}=pt(e),c=(l==null?void 0:l.threshold)??(l==null?void 0:l.pass_threshold)??.8;if(i)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(y=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},y))})]});if(o)return d.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 h=((n==null?void 0:n.results)??[]).filter(y=>(y.suite??"Uncategorized")===r),f=h.length,p=rp(h,c),g=h.reduce((y,x)=>y+(x.costUsd??0),0);return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:r}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Suite in run: ",t]})]}),d.jsx(eu,{total:f,passed:p.passed,failed:p.failed,passRate:p.passRate,executionErrors:p.executionErrors,totalCost:g>0?g:void 0}),f===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:d.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations in this suite"})}):d.jsx(cS,{results:h,runId:t,projectId:e,passThreshold:c,title:"Suite Evals"})]})}const _L=dr("/projects/$projectId_/runs/$runId_/category/$category")({component:Zoe});function Zoe(){const{projectId:e,runId:t,category:r}=_L.useParams(),{data:n,isLoading:i,error:o}=Ue(RR(e,t,r));if(i)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(x=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},x))})]});if(o)return d.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 l=(n==null?void 0:n.suites)??[],c=l.reduce((x,b)=>x+b.total,0),h=l.reduce((x,b)=>x+b.passed,0),f=l.reduce((x,b)=>x+b.failed,0),p=l.reduce((x,b)=>x+ur(b),0),g=c-p,y=g>0?h/g:0;return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:r}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Category in run: ",t]})]}),d.jsx(eu,{total:c,passed:h,failed:f,passRate:y,executionErrors:p}),l.length===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:d.jsx("p",{className:"text-lg text-gray-400",children:"No suites in this category"})}):d.jsxs("div",{className:"space-y-3",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Suites"}),d.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:l.map(x=>d.jsxs(Ee,{to:"/projects/$projectId/runs/$runId/suite/$suite",params:{projectId:e,runId:t,suite:x.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"truncate text-sm font-medium text-gray-200",children:x.name}),d.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[x.passed,"/",QR(x)]})]}),d.jsx("div",{className:"mt-2",children:d.jsx(fo,{score:x.avg_score})}),d.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[d.jsxs("span",{className:"text-emerald-400",children:[x.passed," passed"]}),x.failed>0&&d.jsxs("span",{className:"text-red-400",children:[x.failed," failed"]}),ur(x)>0&&d.jsxs("span",{className:"text-amber-400",children:[ur(x)," execution errors"]})]})]},x.name))})]})]})}const Joe=c9.update({id:"/settings",path:"/settings",getParentRoute:()=>Yt}),ele=Eie.update({id:"/",path:"/",getParentRoute:()=>Yt}),tle=fL.update({id:"/runs/$runId",path:"/runs/$runId",getParentRoute:()=>Yt}),rle=hL.update({id:"/projects/$projectId",path:"/projects/$projectId",getParentRoute:()=>Yt}),nle=mL.update({id:"/jobs/$runId",path:"/jobs/$runId",getParentRoute:()=>Yt}),ale=zoe.update({id:"/experiments/$experimentName",path:"/experiments/$experimentName",getParentRoute:()=>Yt}),ile=gL.update({id:"/tags/$key/$value",path:"/tags/$key/$value",getParentRoute:()=>Yt}),sle=yL.update({id:"/evals/$runId/$evalId",path:"/evals/$runId/$evalId",getParentRoute:()=>Yt}),ole=vL.update({id:"/runs/$runId_/suite/$suite",path:"/runs/$runId/suite/$suite",getParentRoute:()=>Yt}),lle=xL.update({id:"/runs/$runId_/category/$category",path:"/runs/$runId/category/$category",getParentRoute:()=>Yt}),ule=bL.update({id:"/projects/$projectId_/runs/$runId",path:"/projects/$projectId/runs/$runId",getParentRoute:()=>Yt}),cle=jL.update({id:"/projects/$projectId_/jobs/$runId",path:"/projects/$projectId/jobs/$runId",getParentRoute:()=>Yt}),dle=Voe.update({id:"/projects/$projectId_/experiments/$experimentName",path:"/projects/$projectId/experiments/$experimentName",getParentRoute:()=>Yt}),fle=wL.update({id:"/projects/$projectId_/tags/$key/$value",path:"/projects/$projectId/tags/$key/$value",getParentRoute:()=>Yt}),hle=SL.update({id:"/projects/$projectId_/evals/$runId/$evalId",path:"/projects/$projectId/evals/$runId/$evalId",getParentRoute:()=>Yt}),mle=NL.update({id:"/projects/$projectId_/runs/$runId_/suite/$suite",path:"/projects/$projectId/runs/$runId/suite/$suite",getParentRoute:()=>Yt}),ple=_L.update({id:"/projects/$projectId_/runs/$runId_/category/$category",path:"/projects/$projectId/runs/$runId/category/$category",getParentRoute:()=>Yt}),gle={IndexRoute:ele,SettingsRoute:Joe,ExperimentsExperimentNameRoute:ale,JobsRunIdRoute:nle,ProjectsProjectIdRoute:rle,RunsRunIdRoute:tle,EvalsRunIdEvalIdRoute:sle,TagsKeyValueRoute:ile,ProjectsProjectIdExperimentsExperimentNameRoute:dle,ProjectsProjectIdJobsRunIdRoute:cle,ProjectsProjectIdRunsRunIdRoute:ule,RunsRunIdCategoryCategoryRoute:lle,RunsRunIdSuiteSuiteRoute:ole,ProjectsProjectIdEvalsRunIdEvalIdRoute:hle,ProjectsProjectIdTagsKeyValueRoute:fle,ProjectsProjectIdRunsRunIdCategoryCategoryRoute:ple,ProjectsProjectIdRunsRunIdSuiteSuiteRoute:mle},yle=Yt._addFileChildren(gle)._addFileTypes(),vle=new Cz({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!0}}}),xle=PB({routeTree:yle}),OL=document.getElementById("root");if(!OL)throw new Error("Root element not found");az.createRoot(OL).render(d.jsx(S.StrictMode,{children:d.jsx(Pz,{client:vle,children:d.jsx(DB,{router:xle})})}));export{Ul as W,S as r};
|
|
121
|
+
`)}return B5(e)}function ad(e,t){for(const r of t){const n=e[r];if(typeof n=="string"&&n.trim())return n}}function Fb(e,t){for(const r of t)if(e[r]!==void 0)return e[r]}function U5(e,t){const r=e[t];return Fr(r)?r:void 0}function wse(e,t){const r=U5(e,"function");return ad(e,["tool","name","tool_name"])??(r?ad(r,["name"]):void 0)??`Tool ${t+1}`}function Sse(e){const t=U5(e,"function");return Fb(e,["input","arguments","args","parameters"])??(t?Fb(t,["arguments"]):void 0)}function Nse(e){return Fb(e,["output","result","content"])}function _se(e,t){return`${e.message_index}-${e.role}-${t}`}function Ose(e){return[...e].sort((t,r)=>t.message_index-r.message_index).map((t,r)=>{const n=gse[t.role]??{container:"border-gray-800 bg-gray-900",badge:"border-gray-700 bg-gray-800 text-gray-300",label:t.role,accent:"text-gray-300"},i=_se(t,r),o=(Array.isArray(t.tool_calls)?t.tool_calls.filter(Fr):[]).map((l,c)=>{const h=ad(l,["id","call_id","tool_call_id"]);return{id:`${i}-tool-${h??c}`,call:l,index:c,name:wse(l,c),status:ad(l,["status"]),duration:typeof l.duration_ms=="number"?Hm(l.duration_ms):void 0}});return{id:i,anchorId:`message-${r+1}`,line:t,ordinal:r,roleStyle:n,content:jse(t.content),duration:Hm(t.duration_ms),tokenUsage:sS(t.token_usage),toolCalls:o}})}function x2(e){const t=new Set;e[0]&&t.add(e[0].id);const r=e[e.length-1];return r&&t.add(r.id),t}function Ese(e){const t=new Map;for(const r of e)t.set(r.line.role,(t.get(r.line.role)??0)+1);return t}function Ase(e){const t=new Map;let r=0;for(const n of e)for(const i of n.toolCalls)r+=1,t.set(i.name,(t.get(i.name)??0)+1);return{total:r,byName:t}}function Tse(e){return e!=null&&!(typeof e=="string"&&e.length===0)}function Is({label:e,value:t,tone:r="default"}){return Tse(t)?d.jsxs("div",{className:"min-w-0 space-y-1",children:[d.jsx("div",{className:r==="error"?"text-xs font-medium text-red-300":"text-xs font-medium text-gray-400",children:e}),d.jsx("pre",{className:"max-h-80 max-w-full overflow-auto rounded-md border border-gray-800 bg-gray-950 p-3 text-xs text-gray-200",children:d.jsx("code",{children:B5(t)})})]}):null}function ir({children:e}){return d.jsx("span",{className:"inline-flex min-w-0 max-w-full break-all rounded-md border border-gray-800 bg-gray-950 px-2 py-0.5 text-xs text-gray-400",children:e})}function Sh({href:e,children:t,download:r=!1}){return e?d.jsx("a",{href:e,target:"_blank",rel:"noreferrer",download:r,className:"rounded-md px-3 py-1.5 text-sm text-cyan-400 transition-colors hover:text-cyan-300 hover:underline",children:t}):null}function yx({path:e,onOpenFile:t,children:r}){return!e||!t?null:d.jsx("button",{type:"button",onClick:()=>t(e),className:"rounded-md border border-gray-700 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300",children:r})}function Cse({toolCall:e,expanded:t,onToggle:r}){const{call:n,index:i,name:o,status:l,duration:c}=e,h=ad(n,["id","call_id","tool_call_id"]),f=Fr(n.metadata)?n.metadata:void 0;return d.jsxs("details",{className:"min-w-0 rounded-md border border-gray-800 bg-gray-950/80 p-3",open:t,"data-testid":`tool-call-${h??i}`,"data-expanded":t?"true":"false",onToggle:p=>r(e.id,p.currentTarget.open),children:[d.jsx("summary",{className:"min-w-0 cursor-pointer list-none text-sm font-medium text-gray-200",children:d.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-xs text-gray-500",children:t?"-":"+"}),d.jsx("span",{children:"Tool call"}),d.jsx("span",{className:"rounded-md border border-amber-900/60 bg-amber-950/30 px-2 py-0.5 text-xs text-amber-300",children:o}),l&&d.jsx("span",{className:"text-xs text-gray-500",children:l}),c&&d.jsx("span",{className:"tabular-nums text-xs text-gray-500",children:c})]})}),d.jsxs("div",{className:"mt-3 min-w-0 space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap gap-2",children:[h&&d.jsxs(ir,{children:["id: ",h]}),c&&d.jsxs(ir,{children:["duration: ",c]}),l&&d.jsxs(ir,{children:["status: ",l]})]}),d.jsx(Is,{label:"Arguments",value:Sse(n)}),d.jsx(Is,{label:"Result",value:Nse(n)}),d.jsx(Is,{label:"Error",value:n.error,tone:"error"}),d.jsx(Is,{label:"Metadata",value:f})]})]})}function Pse({line:e}){const t=Hm(e.duration_ms),r=sS(e.token_usage);return d.jsxs("details",{className:"min-w-0 rounded-md border border-amber-900/50 bg-gray-950/60 p-3",children:[d.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-amber-300",children:[e.name?`Tool result · ${e.name}`:"Tool result",t&&d.jsx("span",{className:"ml-2 tabular-nums text-xs text-gray-500",children:t})]}),d.jsxs("div",{className:"mt-3 min-w-0 space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.name&&d.jsxs(ir,{children:["name: ",e.name]}),t&&d.jsxs(ir,{children:["duration: ",t]}),r&&d.jsxs(ir,{children:["tokens: ",r]})]}),d.jsx(Is,{label:"Result",value:e.content}),d.jsx(Is,{label:"Metadata",value:e.metadata})]})]})}function Rse({message:e,expanded:t,expandedToolIds:r,onToggleMessage:n,onToggleTool:i}){const{line:o,ordinal:l,roleStyle:c,content:h,duration:f,tokenUsage:p,toolCalls:g}=e;return d.jsxs("details",{id:e.anchorId,className:`min-w-0 scroll-mt-6 rounded-lg border ${c.container}`,open:t,"data-testid":`message-row-${l+1}`,"data-expanded":t?"true":"false",onToggle:y=>n(e.id,y.currentTarget.open),children:[d.jsx("summary",{className:"min-w-0 cursor-pointer list-none px-4 py-3",children:d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-xs text-gray-500",children:t?"-":"+"}),d.jsx("span",{className:`rounded-md border px-2 py-0.5 text-xs font-medium ${c.badge}`,children:c.label}),o.name&&d.jsx("span",{className:`truncate text-sm font-medium ${c.accent}`,children:o.name}),g.length>0&&d.jsxs("span",{className:"rounded-md border border-amber-900/60 bg-amber-950/30 px-2 py-0.5 text-xs text-amber-300",children:[g.length," tool ",g.length===1?"call":"calls"]})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-gray-500",children:[d.jsxs("a",{href:`#${e.anchorId}`,className:"tabular-nums text-gray-400 hover:text-cyan-300 hover:underline",onClick:y=>y.stopPropagation(),children:["#",l+1]}),o.start_time&&d.jsx("span",{children:o.start_time}),f&&d.jsx("span",{className:"tabular-nums",children:f}),p&&d.jsx("span",{children:p})]})]})}),d.jsxs("div",{className:"space-y-3 border-t border-gray-800/70 px-4 py-3",children:[o.role==="tool"||o.role==="function"?d.jsx(Pse,{line:o}):h.trim().length>0?d.jsx("pre",{className:"max-w-full whitespace-pre-wrap break-words text-sm leading-6 text-gray-200",children:h}):d.jsx("p",{className:"text-sm text-gray-500",children:"No message content recorded."}),g.length>0&&d.jsx("div",{className:"space-y-2",children:g.map(y=>d.jsx(Cse,{toolCall:y,expanded:r.has(y.id),onToggle:i},y.id))}),o.metadata&&o.role!=="tool"&&o.role!=="function"&&d.jsxs("details",{className:"min-w-0 rounded-md border border-gray-800 bg-gray-950/60 p-3",children:[d.jsx("summary",{className:"cursor-pointer text-xs font-medium text-gray-400",children:"Message metadata"}),d.jsx("div",{className:"mt-3",children:d.jsx(Is,{label:"Metadata",value:o.metadata})})]})]})]})}function Mse({messages:e,transcriptPath:t}){var g,y,x,b;const r=(g=e[0])==null?void 0:g.line,n=((y=r==null?void 0:r.source)==null?void 0:y.provider)??(r==null?void 0:r.agent),i=((x=r==null?void 0:r.source)==null?void 0:x.model)??(r==null?void 0:r.model),o=(b=r==null?void 0:r.source)==null?void 0:b.session_id,l=Hm(r==null?void 0:r.transcript_duration_ms),c=sS(r==null?void 0:r.transcript_token_usage),h=bse(r==null?void 0:r.transcript_cost_usd),f=Ese(e),p=Ase(e);return d.jsxs("div",{className:"flex min-w-0 flex-wrap gap-2",children:[d.jsxs(ir,{children:[e.length," messages"]}),Array.from(f.entries()).map(([w,N])=>d.jsxs(ir,{children:[w,": ",N]},w)),p.total>0&&d.jsxs(ir,{children:[p.total," tool calls"]}),Array.from(p.byName.entries()).map(([w,N])=>d.jsxs(ir,{children:[w,": ",N]},w)),n&&d.jsxs(ir,{children:["provider: ",n]}),i&&d.jsxs(ir,{children:["model: ",i]}),o&&d.jsxs(ir,{children:["session: ",o]}),l&&d.jsxs(ir,{children:["duration: ",l]}),c&&d.jsxs(ir,{children:["tokens: ",c]}),h&&d.jsxs(ir,{children:["cost: ",h]}),t&&d.jsx(ir,{children:t})]})}function Dse(e,t){switch(t){case"messages":return e.filter(r=>r.line.role!=="tool"&&r.line.role!=="function");case"with-tools":return e.filter(r=>r.toolCalls.length>0);case"tool-results":return e.filter(r=>r.line.role==="tool"||r.line.role==="function");case"all":return[...e]}}function Nh({active:e,count:t,children:r,onClick:n}){return d.jsxs("button",{type:"button",onClick:n,className:e?"rounded-md border border-cyan-800 bg-cyan-950/40 px-3 py-1.5 text-sm text-cyan-200":"rounded-md border border-gray-800 bg-gray-950 px-3 py-1.5 text-sm text-gray-400 transition-colors hover:border-gray-700 hover:text-gray-200",children:[r,d.jsx("span",{className:"ml-2 text-xs text-gray-500",children:t})]})}function q5({entries:e,finalAnswer:t,answerPath:r,transcriptPath:n,transcriptRawPath:i,answerHref:o,transcriptHref:l,transcriptDownloadHref:c,transcriptRawHref:h,onOpenFile:f}){const p=S.useMemo(()=>Ose(e),[e]),[g,y]=S.useState(()=>x2(p)),[x,b]=S.useState(()=>new Set),[w,N]=S.useState("all"),_=!!r,E=S.useMemo(()=>p.flatMap(k=>k.toolCalls.map(H=>H.id)),[p]),T=S.useMemo(()=>Dse(p,w),[p,w]),A=p.filter(k=>k.line.role!=="tool"&&k.line.role!=="function").length,C=p.filter(k=>k.line.role==="tool"||k.line.role==="function").length,R=p.filter(k=>k.toolCalls.length>0).length;S.useEffect(()=>{y(x2(p)),b(new Set),N("all")},[p]);function D(k,H){y(U=>{const ae=new Set(U);return H?ae.add(k):ae.delete(k),ae})}function M(k,H){b(U=>{const ae=new Set(U);return H?ae.add(k):ae.delete(k),ae})}function z(){b(new Set(E)),y(k=>{const H=new Set(k);for(const U of p)U.toolCalls.length>0&&H.add(U.id);return H})}return d.jsxs("div",{className:"min-w-0 space-y-4",children:[_&&d.jsxs("section",{className:"min-w-0 rounded-lg border border-emerald-900/50 bg-emerald-950/20 p-4",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h3",{className:"text-sm font-medium text-emerald-300",children:"Final answer"}),d.jsxs("p",{className:"mt-1 text-xs text-gray-500",children:["Highlighted from canonical ",d.jsx("code",{children:"outputs/answer.md"}),"; transcript context stays below."]})]}),d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx(yx,{path:r,onOpenFile:f,children:"Open answer.md in Files"}),d.jsx(Sh,{href:o,children:"Open answer.md"})]})]}),d.jsx("pre",{className:"mt-3 max-h-64 max-w-full overflow-auto whitespace-pre-wrap break-words rounded-md border border-emerald-900/40 bg-gray-950/80 p-3 text-sm leading-6 text-gray-100",children:t&&t.trim().length>0?t:"answer.md is empty."})]}),d.jsx("section",{className:"min-w-0 rounded-lg border border-gray-800 bg-gray-900 p-4",children:d.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0 space-y-2",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Transcript timeline"}),d.jsx(Mse,{messages:p,transcriptPath:n})]}),d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx(yx,{path:n,onOpenFile:f,children:"Open transcript.json in Files"}),d.jsx(Sh,{href:l,children:"Open normalized JSON"}),d.jsx(Sh,{href:c,download:!0,children:"Download normalized JSON"}),d.jsx(yx,{path:i,onOpenFile:f,children:"Open transcript-raw.jsonl in Files"}),d.jsx(Sh,{href:h,children:"Open raw JSONL"}),!i&&d.jsx("span",{className:"rounded-md border border-gray-800 bg-gray-950 px-3 py-1.5 text-sm text-gray-500",children:"Raw JSONL unavailable"})]})]})}),d.jsx("section",{className:"min-w-0 rounded-lg border border-gray-800 bg-gray-900 p-3",children:d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap gap-2",children:[d.jsx(Nh,{active:w==="all",count:p.length,onClick:()=>N("all"),children:"All"}),d.jsx(Nh,{active:w==="messages",count:A,onClick:()=>N("messages"),children:"Messages"}),d.jsx(Nh,{active:w==="with-tools",count:R,onClick:()=>N("with-tools"),children:"Has tools"}),d.jsx(Nh,{active:w==="tool-results",count:C,onClick:()=>N("tool-results"),children:"Tool results"})]}),E.length>0&&d.jsxs("div",{className:"flex min-w-0 flex-wrap gap-2",children:[d.jsx("button",{type:"button",onClick:z,className:"rounded-md border border-gray-700 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-amber-800 hover:text-amber-200",children:"Expand all tool calls"}),d.jsx("button",{type:"button",onClick:()=>b(new Set),className:"rounded-md border border-gray-700 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-gray-600 hover:text-gray-100",children:"Collapse all tool calls"})]})]})}),d.jsx("div",{className:"space-y-3",children:T.map(k=>d.jsx(Rse,{message:k,expanded:g.has(k.id),expandedToolIds:x,onToggleMessage:D,onToggleTool:M},k.id))})]})}function F5(e){for(const t of e){if(t.type==="file")return t.path;if(t.children){const r=F5(t.children);if(r)return r}}return null}function oS(e,t=0){return e.sample_path??e.attempt_path??e.run_path??`sample-${t+1}`}function kse(e,t=0){return typeof e.sample_index=="number"?e.sample_index:typeof e.attempt=="number"?e.attempt+1:t+1}function H5(e,t=0){const r=`Attempt ${kse(e,t)}`;return typeof e.retry_index=="number"&&e.retry_index>0?`${r} retry ${e.retry_index}`:r}function Lse(e){if(e.total_tokens!=null)return e.total_tokens;const t=e.token_usage;if(!t)return;const r=[t.input,t.output,t.reasoning,t.cached].filter(n=>typeof n=="number"&&Number.isFinite(n));return r.length>0?r.reduce((n,i)=>n+i,0):void 0}function eo(e){return e==null||!Number.isFinite(e)?"-":`${Math.round(e*100)}%`}function K5(e){if(e==null)return"-";if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),r=Math.round(e%6e4/1e3);return`${t}m ${r}s`}function $se(e){if(e!=null)return e===0?"$0":e<.01?`$${e.toFixed(5)}`:`$${e.toFixed(4)}`}function Ise(e){if(e!=null)return e>=1e6?`${(e/1e6).toFixed(1)}M tok`:e>=1e3?`${(e/1e3).toFixed(1)}k tok`:`${e} tok`}function zse(e,t){return{...e,score:t.score??e.score,executionStatus:t.execution_status??e.executionStatus,error:t.error,costUsd:t.cost_usd??e.costUsd,durationMs:t.duration_ms??e.durationMs,scores:t.scores,assertions:t.assertions,trials:void 0,aggregation:void 0,grading_path:t.grading_path,timing_path:t.timing_path,metrics_path:t.metrics_path,transcript_path:t.transcript_path,transcript_raw_path:t.transcript_raw_path,output_path:t.answer_path,answer_path:t.answer_path}}function lS({eval:e,runId:t,projectId:r,repeatGroup:n,selectedTrial:i=null,initialTab:o="checks",initialSelectedFilePath:l=null,onSelectTrial:c}){const[h,f]=S.useState(o),[p,g]=S.useState(l),y=i?zse(e,i):e,x=n!=null&&i==null;S.useEffect(()=>{f(o),g(l)},[o,l]);const b=[{id:"checks",label:"Grading"},{id:"transcript",label:"Transcript"},{id:"source",label:"Source"},{id:"files",label:"Files"}],w=N=>{g(N),f("files")};return d.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[d.jsx("div",{className:"min-w-0 border-b border-gray-800",children:d.jsx("div",{className:"flex min-w-0 gap-1 overflow-x-auto px-4",children:b.map(N=>d.jsx("button",{type:"button",onClick:()=>f(N.id),className:`px-4 py-2 text-sm font-medium transition-colors ${h===N.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:N.label},N.id))})}),d.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:[h==="checks"&&d.jsx("div",{className:"min-w-0 overflow-auto p-4",children:x?d.jsx(Hse,{result:e,group:n,onSelectTrial:c}):i?d.jsx(j2,{result:y,trial:i,runId:t,projectId:r,onOpenFile:w}):y.grading_path?d.jsx(j2,{result:y,runId:t,projectId:r,onOpenFile:w}):d.jsx(Y5,{result:y,projectId:r})}),h==="files"&&d.jsx("div",{className:"h-full min-h-0 p-4",children:d.jsx(ioe,{result:y,runId:t,projectId:r,selectedPath:p,onSelectedPathChange:g})}),h==="transcript"&&d.jsx("div",{className:"min-w-0 overflow-auto p-4",children:x?d.jsx(roe,{result:e,group:n,runId:t,projectId:r,onSelectTrial:c}):i?d.jsx(noe,{result:y,trial:i,runId:t,projectId:r,onOpenFile:w}):d.jsx(aoe,{result:y,runId:t,projectId:r,onOpenFile:w})}),h==="source"&&d.jsx("div",{className:"min-w-0 overflow-auto p-4",children:d.jsx(qse,{result:y})})]})]})}function Bse(e){if(e!==void 0)return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Jr({label:e,value:t}){return t===void 0||t===""?null:d.jsxs("div",{className:"min-w-0",children:[d.jsx("dt",{className:"text-xs font-medium uppercase text-gray-500",children:e}),d.jsx("dd",{className:"mt-1 break-words font-mono text-sm text-gray-200",children:String(t)})]})}function G5({file:e}){var r,n;const t=Bse(e.size_bytes);return d.jsxs("dl",{className:"grid gap-3 md:grid-cols-2",children:[d.jsx(Jr,{label:"Path",value:e.display_path}),d.jsx(Jr,{label:"SHA-256",value:e.content_sha256}),d.jsx(Jr,{label:"Size",value:t}),d.jsx(Jr,{label:"Omitted",value:((r=e.omitted)==null?void 0:r.message)??((n=e.omitted)==null?void 0:n.reason)})]})}function Tc({value:e,language:t}){return d.jsx("pre",{className:"max-h-96 overflow-auto rounded-md border border-gray-800 bg-gray-950 p-3 text-xs text-gray-200",children:d.jsx("code",{"data-language":t,children:e})})}function Use({file:e}){const t=`${e.kind}${e.grader_name?` · ${e.grader_name}`:""}`;return d.jsxs("details",{className:"rounded-md border border-gray-800 bg-gray-900 p-3",open:!1,children:[d.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-gray-200",children:[d.jsx("span",{children:t}),d.jsx("span",{className:"ml-3 font-mono text-xs text-gray-500",children:e.display_path})]}),d.jsxs("div",{className:"mt-3 space-y-3",children:[d.jsx(G5,{file:e}),e.command&&e.command.length>0&&d.jsx(Tc,{value:JSON.stringify(e.command,null,2),language:"json"}),e.content&&d.jsx(Tc,{value:e.content})]})]})}function qse({result:e}){var r,n,i;const t=e.source_traceability;return!t||t.status!=="captured"?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-300",children:"Source metadata"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:(t==null?void 0:t.message)??"Source metadata was not captured for this run."})]}):d.jsxs("div",{className:"space-y-6",children:[d.jsxs("section",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-300",children:"Traceability"}),d.jsxs("dl",{className:"grid gap-3 md:grid-cols-2",children:[d.jsx(Jr,{label:"Eval file",value:(r=t.eval_file)==null?void 0:r.display_path}),d.jsx(Jr,{label:"Eval",value:e.eval_path}),d.jsx(Jr,{label:"Test ID",value:t.test_id??e.testId}),d.jsx(Jr,{label:"Legacy suite",value:e.suite}),d.jsx(Jr,{label:"Category",value:e.category}),d.jsx(Jr,{label:"Target",value:e.target})]})]}),((n=t.source_test)==null?void 0:n.yaml)&&d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-300",children:"Source Test"}),d.jsx(Tc,{value:t.source_test.yaml,language:"yaml"})]}),((i=t.eval_file)==null?void 0:i.content)&&d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-300",children:"Eval File Snapshot"}),d.jsx(G5,{file:t.eval_file}),d.jsx(Tc,{value:t.eval_file.content,language:"yaml"})]}),t.graders&&t.graders.length>0&&d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-300",children:"Graders"}),d.jsx("div",{className:"space-y-3",children:t.graders.map(o=>d.jsxs("details",{className:"rounded-md border border-gray-800 bg-gray-900 p-3",children:[d.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-gray-200",children:[o.name,d.jsx("span",{className:"ml-3 font-mono text-xs text-gray-500",children:o.type})]}),d.jsxs("div",{className:"mt-3 space-y-3",children:[d.jsxs("dl",{className:"grid gap-3 md:grid-cols-3",children:[d.jsx(Jr,{label:"Weight",value:o.weight}),d.jsx(Jr,{label:"Required",value:o.required}),d.jsx(Jr,{label:"Min score",value:o.min_score})]}),d.jsx(Tc,{value:JSON.stringify(o.definition,null,2),language:"json"})]})]},`${o.name}-${o.type}`))})]}),t.referenced_files&&t.referenced_files.length>0&&d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-300",children:"Referenced Files"}),d.jsx("div",{className:"space-y-3",children:t.referenced_files.map((o,l)=>d.jsx(Use,{file:o},`${o.kind}-${o.display_path}-${o.grader_name??""}-${l}`))})]})]})}function b2({assertion:e}){return d.jsxs("div",{className:`flex items-start gap-3 rounded-lg border p-3 ${e.passed?"border-emerald-900/50 bg-emerald-950/20":"border-red-900/50 bg-red-950/20"}`,children:[d.jsx("span",{className:`mt-0.5 text-lg ${e.passed?"text-emerald-400":"text-red-400"}`,children:e.passed?"✓":"✗"}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("p",{className:"text-sm text-gray-200",children:[e.text,e.durationMs!=null&&d.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",(e.durationMs/1e3).toFixed(1),"s)"]})]}),e.evidence&&d.jsx("p",{className:"mt-1 text-xs text-gray-400",children:e.evidence})]})]})}function Y5({result:e,projectId:t}){const{data:r}=pt(t),n=(r==null?void 0:r.threshold)??(r==null?void 0:r.pass_threshold)??.8,i=!to(e.score,n)||e.executionStatus==="error"||e.executionStatus==="failed",o=(e.scores??[]).filter(p=>Array.isArray(p.assertions)&&p.assertions.length>0),l=o.length>0,c=e.assertions??[],h=[];e.error&&h.push(e.error),(e.executionStatus==="error"||e.executionStatus==="failed")&&h.push(`Execution status: ${e.executionStatus}`);const f=l?o.flatMap(p=>p.assertions):c;for(const p of f.filter(g=>!g.passed)){const g=p.evidence?`${p.text}: ${p.evidence}`:p.text;h.push(g)}if(e.scores){for(const p of e.scores)if(!to(p.score,n)&&p.details){const g=typeof p.details=="string"?p.details:JSON.stringify(p.details,null,2);h.push(`[${p.name??p.type??"evaluator"}] ${g}`)}}return d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("span",{className:"text-sm font-medium text-gray-400",children:"Overall score"}),d.jsx("div",{className:"flex-1",children:d.jsx(fo,{score:e.score})})]})}),e.scores&&e.scores.length>0&&d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-400",children:"Grader Scores"}),d.jsx("div",{className:"space-y-3",children:e.scores.map((p,g)=>d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("span",{className:"w-40 truncate text-sm text-gray-300",children:p.name??p.type??`Score ${g+1}`}),d.jsx("div",{className:"flex-1",children:d.jsx(fo,{score:p.score})})]},`${p.name??p.type??g}`))})]}),l?d.jsx("div",{className:"space-y-6",children:o.map((p,g)=>{const y=p.name??p.type??`Grader ${g+1}`;return d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:y}),p.assertions.map((x,b)=>d.jsx(b2,{assertion:x},`${x.text}-${b}`))]},`${p.name??p.type??g}`)})}):c.length>0?d.jsx("div",{className:"space-y-2",children:c.map((p,g)=>d.jsx(b2,{assertion:p},`${p.text}-${g}`))}):d.jsx("p",{className:"text-sm text-gray-500",children:"No assertion steps recorded."}),i&&h.length>0&&d.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[d.jsx("h4",{className:"mb-2 text-sm font-medium text-red-400",children:"Failure Reason"}),d.jsx("div",{className:"space-y-2",children:h.map(p=>d.jsx("p",{className:"text-sm text-gray-300",children:p},p))})]})]})}function Ia({label:e,value:t}){return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-3",children:[d.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:e}),d.jsx("div",{className:"mt-1 font-mono text-sm text-gray-200",children:t??"-"})]})}function Fse({trial:e,index:t,onSelectTrial:r}){const n=oS(e,t),i=H5(e,t);return d.jsxs("div",{className:"grid gap-2 rounded-md border border-gray-800 bg-gray-950/50 p-3 text-sm md:grid-cols-[minmax(8rem,1fr)_auto] md:items-center",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("span",{className:"font-medium text-gray-200",children:i}),d.jsx("span",{className:"rounded-md border border-gray-800 px-1.5 py-0.5 text-[11px] font-medium text-gray-500",children:n})]}),d.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-gray-500",children:[d.jsxs("span",{children:[eo(e.score)," score"]}),d.jsx("span",{children:e.verdict??"unknown"}),e.duration_ms!=null?d.jsx("span",{children:K5(e.duration_ms)}):null,e.total_tool_calls!=null?d.jsxs("span",{children:[e.total_tool_calls," tool calls"]}):null]})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 md:justify-end",children:[d.jsx("button",{type:"button",onClick:()=>r==null?void 0:r(e,"checks"),className:"rounded-md border border-gray-700 px-2.5 py-1 text-xs text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300",children:"Grading"}),d.jsx("button",{type:"button",onClick:()=>r==null?void 0:r(e,"files"),disabled:!e.grading_path&&!e.metrics_path&&!e.timing_path,className:"rounded-md border border-gray-700 px-2.5 py-1 text-xs text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300 disabled:cursor-not-allowed disabled:opacity-50",children:"Files"})]})]})}function Hse({result:e,group:t,onSelectTrial:r}){return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsxs("p",{className:"mb-3 text-sm text-gray-400",children:["Aggregate across ",t.trialCount," attempts for this test case."]}),d.jsxs("div",{className:"grid gap-3 md:grid-cols-4",children:[d.jsx(Ia,{label:"Attempt success",value:eo(t.passRate)}),d.jsx(Ia,{label:"Mean score",value:eo(t.meanScore)}),d.jsx(Ia,{label:"Attempts passed",value:`${t.passedTrials}/${t.trialCount}`}),d.jsx(Ia,{label:"Assertion pass",value:eo(t.assertionPassRate)}),t.executionErrorTrials>0?d.jsx(Ia,{label:"Execution errors",value:String(t.executionErrorTrials)}):null]})]}),e.scores&&e.scores.length>0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-400",children:"Aggregate Grader Scores"}),d.jsx("div",{className:"space-y-3",children:e.scores.map((n,i)=>d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("span",{className:"w-40 truncate text-sm text-gray-300",children:n.name??n.type??`Score ${i+1}`}),d.jsx("div",{className:"flex-1",children:d.jsx(fo,{score:n.score})})]},`${n.name??n.type??i}`))})]}):null,d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:"Attempts"}),t.trials.map((n,i)=>d.jsx(Fse,{trial:n,index:i,onSelectTrial:r},oS(n,i)))]})]})}function Km(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Kse(e,t){const r=e[t];return typeof r=="string"&&r.trim().length>0?r:void 0}function Gse(e,t){const r=e[t];return typeof r=="number"&&Number.isFinite(r)?r:void 0}function Yse(e,t){const r=e[t];return typeof r=="boolean"?r:void 0}function Vse(e){if(!Km(e))return;const t=Object.entries(e).filter(r=>typeof r[1]=="number"&&Number.isFinite(r[1]));return t.length>0?Object.fromEntries(t):void 0}function Qse(e){if(Km(e))return Object.keys(e).length>0?e:void 0}function V5(e){if(!Km(e))return null;const t=Array.isArray(e.component_results)?e.component_results.flatMap(i=>{const o=V5(i);return o?[o]:[]}):[],r=Vse(e.named_scores),n=Km(e.metadata)&&Object.keys(e.metadata).length>0?e.metadata:void 0;return{pass:Yse(e,"pass"),score:Gse(e,"score"),reason:Kse(e,"reason"),assertion:Qse(e.assertion),namedScores:r,metadata:n,componentResults:t}}function Xse(e){if(!e)return null;try{const t=V5(JSON.parse(e));return t?{result:t}:{error:"grading.json must contain a JSON object."}}catch(t){return{error:t instanceof Error?t.message:String(t)}}}function Wse(e){return typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function Q5(e){return e===!0?"Pass":e===!1?"Fail":"Unknown"}function X5(e){return e===!0?"border-emerald-900/50 bg-emerald-950/20 text-emerald-300":e===!1?"border-red-900/50 bg-red-950/20 text-red-300":"border-gray-800 bg-gray-950/50 text-gray-300"}function Zse(e,t){if(!e)return{title:t,details:[]};const r=typeof e.metric=="string"&&e.metric||typeof e.type=="string"&&e.type||t,n=[];return typeof e.type=="string"&&e.type!==r&&n.push(`type: ${e.type}`),typeof e.metric=="string"&&e.metric!==r&&n.push(`metric: ${e.metric}`),e.value!==void 0&&n.push(`value: ${Wse(e.value)}`),{title:r,details:n}}function W5({scores:e}){return!e||Object.keys(e).length===0?null:d.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:Object.entries(e).map(([t,r])=>d.jsx(Ia,{label:t,value:eo(r)},t))})}function Z5({metadata:e}){return!e||Object.keys(e).length===0?null:d.jsxs("details",{className:"rounded-lg border border-gray-800 bg-gray-950/50 p-3",children:[d.jsx("summary",{className:"cursor-pointer text-sm font-medium text-gray-300",children:"Metadata"}),d.jsx("pre",{className:"mt-3 max-h-64 overflow-auto text-xs text-gray-300",children:JSON.stringify(e,null,2)})]})}function J5({score:e}){return e==null?d.jsx("div",{className:"h-2 rounded-full bg-gray-800"}):d.jsx(fo,{score:e})}function Jse({result:e}){return d.jsxs("div",{className:"space-y-4 rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(9rem,12rem)_1fr] md:items-center",children:[d.jsx("div",{className:`rounded-lg border px-3 py-2 text-sm font-medium ${X5(e.pass)}`,children:Q5(e.pass)}),d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3 text-xs text-gray-500",children:[d.jsx("span",{children:"Aggregate score"}),d.jsx("span",{className:"font-mono",children:eo(e.score)})]}),d.jsx(J5,{score:e.score})]})]}),e.reason?d.jsx("p",{className:"text-sm text-gray-300",children:e.reason}):null,d.jsx(W5,{scores:e.namedScores}),d.jsx(Z5,{metadata:e.metadata})]})}function eoe({components:e}){return e.length===0?null:d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:"Component Results"}),d.jsx("div",{className:"space-y-2",children:e.map((t,r)=>d.jsx(eL,{component:t,index:r,depth:0},`${t.reason??"component"}-${r}`))})]})}function toe({result:e}){return d.jsxs("div",{className:"space-y-6",children:[d.jsx(Jse,{result:e}),d.jsx(eoe,{components:e.componentResults})]})}function eL({component:e,index:t,depth:r}){const n=Zse(e.assertion,`Component ${t+1}`),i=e.componentResults.length>0,o=d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(10rem,1fr)_minmax(8rem,12rem)] md:items-center",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("span",{className:"font-medium text-gray-200",children:n.title}),d.jsx("span",{className:`rounded-md border px-1.5 py-0.5 text-[11px] font-medium ${X5(e.pass)}`,children:Q5(e.pass)})]}),n.details.length>0?d.jsx("div",{className:"mt-1 flex flex-wrap gap-2 text-xs text-gray-500",children:n.details.map(l=>d.jsx("span",{children:l},l))}):null]}),d.jsxs("div",{className:"min-w-0",children:[d.jsx("div",{className:"mb-1 text-right font-mono text-xs text-gray-500",children:eo(e.score)}),d.jsx(J5,{score:e.score})]})]}),e.reason?d.jsx("p",{className:"text-sm text-gray-300",children:e.reason}):null]});return d.jsxs("details",{open:r===0,className:"rounded-lg border border-gray-800 bg-gray-900 p-3",style:{marginLeft:r>0?`${Math.min(r,4)*1}rem`:void 0},children:[d.jsxs("summary",{className:"flex cursor-pointer list-none items-start gap-3",children:[d.jsx("span",{className:"mt-1 text-xs text-gray-500",children:i?"v":"-"}),o]}),e.namedScores||e.metadata?d.jsxs("div",{className:"mt-3 space-y-3",children:[d.jsx(W5,{scores:e.namedScores}),d.jsx(Z5,{metadata:e.metadata})]}):null,i?d.jsx("div",{className:"mt-3 space-y-2",children:e.componentResults.map((l,c)=>d.jsx(eL,{component:l,index:c,depth:r+1},`${l.reason??"component"}-${c}`))}):null]})}function j2({result:e,trial:t,runId:r,projectId:n,onOpenFile:i}){const o=e.grading_path??(t==null?void 0:t.grading_path),l=e.result_dir,c=e.testId,{data:h,isLoading:f}=n&&o?Ue(Yh(n,r,c,o,l)):Gh(r,c,o??"",l),p=Xse(h==null?void 0:h.content);return o?d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("span",{className:"text-sm font-medium text-gray-400",children:t?"Attempt score":"Overall score"}),d.jsx("div",{className:"flex-1",children:d.jsx(fo,{score:e.score})})]})}),t?d.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[d.jsx(Ia,{label:"Duration",value:K5(t.duration_ms)}),d.jsx(Ia,{label:"Cost",value:$se(t.cost_usd)}),d.jsx(Ia,{label:"Tokens",value:Ise(Lse(t))})]}):null,d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[d.jsx("h4",{className:"text-sm font-medium text-gray-400",children:"Grading"}),d.jsx("button",{type:"button",onClick:()=>i(o),className:"rounded-md border border-gray-700 px-3 py-1.5 text-xs text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300",children:"Open grading JSON"})]}),f?d.jsx("p",{className:"mt-3 text-sm text-gray-500",children:"Loading grading artifact..."}):null,p!=null&&p.error?d.jsx("p",{className:"mt-3 text-sm text-red-300",children:p.error}):null,!f&&!p?d.jsx("p",{className:"mt-3 text-sm text-gray-500",children:"No grading artifact content available."}):null]}),p!=null&&p.result?d.jsx(toe,{result:p.result}):null]}):d.jsx(Y5,{result:e,projectId:n})}function tL(e,t){if(!t)return!1;for(const r of e)if(r.type==="file"&&r.path===t||r.children&&tL(r.children,t))return!0;return!1}function roe({result:e,group:t,runId:r,projectId:n,onSelectTrial:i}){return d.jsxs("section",{className:"space-y-3",children:[d.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:"Attempt transcripts"}),t.trials.map((o,l)=>{const c=oS(o,l),h=H5(o,l),f=o.transcript_path,p=f?_n({projectId:n,runId:r,evalId:e.testId,filePath:f,resultDir:e.result_dir,raw:!0}):void 0;return d.jsxs("div",{className:"grid gap-2 rounded-md border border-gray-800 bg-gray-950/50 p-3 text-sm md:grid-cols-[minmax(8rem,1fr)_auto] md:items-center",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("span",{className:"font-medium text-gray-200",children:h}),d.jsx("span",{className:"rounded-md border border-gray-800 px-1.5 py-0.5 text-[11px] font-medium text-gray-500",children:c})]}),d.jsx("div",{className:"mt-1 truncate font-mono text-xs text-gray-500",title:f,children:f??"No transcript artifact"})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 md:justify-end",children:[d.jsx("button",{type:"button",onClick:()=>i==null?void 0:i(o,"transcript"),disabled:!f,className:"rounded-md border border-gray-700 px-2.5 py-1 text-xs text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300 disabled:cursor-not-allowed disabled:opacity-50",children:"View"}),p?d.jsx("a",{href:p,target:"_blank",rel:"noreferrer",className:"rounded-md px-2.5 py-1 text-xs text-cyan-400 transition-colors hover:text-cyan-300 hover:underline",children:"Raw"}):null]})]},c)})]})}function noe({result:e,trial:t,runId:r,projectId:n,onOpenFile:i}){const o=e.testId,l=e.result_dir,c=t.transcript_path,h=t.transcript_raw_path,f=t.answer_path,{data:p,isLoading:g}=n&&c?Ue(Yh(n,r,o,c,l)):Gh(r,o,c??"",l),{data:y}=n&&f?Ue(Yh(n,r,o,f,l)):Gh(r,o,f??"",l),x=(p==null?void 0:p.content)??"",b=S.useMemo(()=>z5(x),[x]);if(!c)return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"No structured transcript"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This attempt does not include a transcript artifact."})]});if(g)return d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4 text-sm text-gray-500",children:"Loading transcript artifact..."});if(b.error)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-red-300",children:"Transcript could not be parsed"}),d.jsx("p",{className:"mt-2 text-sm text-gray-300",children:b.error}),d.jsx("button",{type:"button",onClick:()=>i(c),className:"mt-3 rounded-md border border-gray-700 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300",children:"Open raw JSONL in Files"})]});if(b.entries.length===0)return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Empty transcript"}),d.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:[d.jsx("code",{children:c})," exists but contains no JSONL rows."]})]});const w=f?_n({projectId:n,runId:r,evalId:o,filePath:f,resultDir:l,raw:!0}):void 0,N=_n({projectId:n,runId:r,evalId:o,filePath:c,resultDir:l,raw:!0}),_=_n({projectId:n,runId:r,evalId:o,filePath:c,resultDir:l,download:!0}),E=h?_n({projectId:n,runId:r,evalId:o,filePath:h,resultDir:l,raw:!0}):void 0;return d.jsx(q5,{entries:b.entries,finalAnswer:f?(y==null?void 0:y.content)??e.output:void 0,answerPath:f,transcriptPath:c,transcriptRawPath:h,answerHref:w,transcriptHref:N,transcriptDownloadHref:_,transcriptRawHref:E,onOpenFile:i})}function aoe({result:e,runId:t,projectId:r,onOpenFile:n}){const i=e.testId,o=e.result_dir,{data:l,isLoading:c,error:h}=r?Ue(O6(r,t,i,o)):g6(t,i,o),f=l==null?void 0:l.transcript_path,p=l==null?void 0:l.transcript_raw_path,g=l==null?void 0:l.answer_path,y=(l==null?void 0:l.status)==="ok"?l.content??"":"",x=S.useMemo(()=>z5(y),[y]);if(c)return d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4 text-sm text-gray-500",children:"Loading transcript artifact..."});if(h)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-red-300",children:"Transcript could not be loaded"}),d.jsx("p",{className:"mt-2 text-sm text-gray-300",children:h.message})]});if(!l||l.status==="missing")return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"No structured transcript"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:(l==null?void 0:l.message)??"This run does not include canonical transcript.json. Dashboard does not parse response.md or markdown transcripts for this view."})]});if(l.status==="dangling"||l.status==="unsupported")return d.jsxs("div",{className:"rounded-lg border border-amber-900/50 bg-amber-950/20 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-amber-300",children:l.status==="dangling"?"Transcript artifact unavailable":"Transcript pointer unsupported"}),d.jsx("p",{className:"mt-2 text-sm text-gray-300",children:l.message??"The transcript artifact could not be resolved."}),f?d.jsx("p",{className:"mt-2 font-mono text-xs text-gray-500",children:f}):null,l.pointer?d.jsx("p",{className:"mt-2 font-mono text-xs text-gray-500",children:l.pointer}):null]});if(x.error)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-red-300",children:"Transcript could not be parsed"}),d.jsx("p",{className:"mt-2 text-sm text-gray-300",children:x.error}),d.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:f?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:()=>n(f),className:"rounded-md border border-gray-700 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-cyan-900/60 hover:text-cyan-300",children:"Open raw JSONL in Files"}),d.jsx("a",{href:_n({projectId:r,runId:t,evalId:i,filePath:f,resultDir:o,raw:!0}),target:"_blank",rel:"noreferrer",className:"rounded-md px-3 py-1.5 text-sm text-cyan-400 transition-colors hover:text-cyan-300 hover:underline",children:"Open raw JSONL"})]}):null})]});if(x.entries.length===0)return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-300",children:"Empty transcript"}),d.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:[d.jsx("code",{children:f})," exists but contains no JSONL rows."]})]});const b=g?_n({projectId:r,runId:t,evalId:i,filePath:g,resultDir:o,raw:!0}):void 0,w=f?_n({projectId:r,runId:t,evalId:i,filePath:f,resultDir:o,raw:!0}):void 0,N=f?_n({projectId:r,runId:t,evalId:i,filePath:f,resultDir:o,download:!0}):void 0,_=p?_n({projectId:r,runId:t,evalId:i,filePath:p,resultDir:o,raw:!0}):void 0;return d.jsx(q5,{entries:x.entries,finalAnswer:g?l.answer_content??e.output:void 0,answerPath:g,transcriptPath:f,transcriptRawPath:p,answerHref:b,transcriptHref:w,transcriptDownloadHref:N,transcriptRawHref:_,onOpenFile:n})}function ioe({result:e,runId:t,projectId:r,selectedPath:n,onSelectedPathChange:i}){const o=e.testId,l=e.result_dir,{data:c}=r?Ue(_6(r,t,o,l)):p6(t,o,l),h=(c==null?void 0:c.files)??[],[f,p]=S.useState(null),[g,y]=S.useState(!1),x=n??f,b=tL(h,x)?x:h.length>0?F5(h):null,{data:w,isLoading:N}=r?Ue(Yh(r,t,o,b??"",l)):Gh(t,o,b??"",l);if(h.length===0)return d.jsx("p",{className:"text-sm text-gray-500",children:"No artifact files available."});const _=b?N?"Loading...":(w==null?void 0:w.content)??"":"",E=b?(w==null?void 0:w.language)??"plaintext":"plaintext";return d.jsxs("div",{className:"relative flex h-full min-h-0 min-w-0 gap-4 overflow-hidden",children:[d.jsx("div",{className:`${g?"block":"hidden"} min-h-0 w-full overflow-auto md:block md:w-auto`,children:d.jsx(cse,{files:h,selectedPath:b,onSelect:T=>{p(T),i(T),y(!1)}})}),d.jsx("div",{className:`${g?"hidden":"block"} h-full min-h-0 min-w-0 flex-1 overflow-hidden md:block`,children:d.jsx(pse,{value:_,language:E,height:"100%"})}),d.jsx("button",{type:"button",onClick:()=>y(!g),className:"md:hidden fixed bottom-4 right-4 z-50 flex items-center gap-2 rounded-full bg-gray-800 px-4 py-2.5 text-sm font-medium text-gray-200 shadow-lg border border-gray-700 hover:bg-gray-700 active:bg-gray-600 transition-colors","aria-label":g?"Switch to file content viewer":"Switch to file tree",children:g?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"📄"}),d.jsx("span",{children:"Content"})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"📁"}),d.jsx("span",{children:"Files"})]})})]})}const Nt={view:"results_view",search:"results_q",target:"results_target",grader:"results_grader",legacyScorer:"results_scorer",columns:"results_cols",detail:"results_detail"},soe="✓",ooe="✗";function vx(){var t;if(typeof window>"u")return{};const e=new URLSearchParams(window.location.search);return{view:e.get(Nt.view)??void 0,search:e.get(Nt.search)??void 0,target:e.get(Nt.target)??void 0,grader:e.get(Nt.grader)??e.get(Nt.legacyScorer)??void 0,visibleColumnIds:((t=e.get(Nt.columns))==null?void 0:t.split(",").map(r=>r.trim()).filter(Boolean))??void 0}}function loe(e){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search);e.view==="all"?t.delete(Nt.view):t.set(Nt.view,e.view),e.search?t.set(Nt.search,e.search):t.delete(Nt.search),e.target==="all"?t.delete(Nt.target):t.set(Nt.target,e.target),t.delete(Nt.legacyScorer),e.grader==="all"?t.delete(Nt.grader):t.set(Nt.grader,e.grader),e.visibleColumnIds.length>0?t.set(Nt.columns,e.visibleColumnIds.join(",")):t.delete(Nt.columns);const r=t.toString(),n=`${window.location.pathname}${r?`?${r}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",n)}function w2(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get(Nt.detail)}function _h(e){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search);e?t.set(Nt.detail,e):t.delete(Nt.detail);const r=t.toString(),n=`${window.location.pathname}${r?`?${r}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",n)}function Gm(e){return`${Math.round(e*100)}%`}function uS(e){if(e==null)return"-";if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),r=Math.round(e%6e4/1e3);return`${t}m ${r}s`}function rL(e){if(e!=null)return e===0?"$0":e<.01?`$${e.toFixed(5)}`:`$${e.toFixed(4)}`}function nL(e){if(e!=null)return e>=1e6?`${(e/1e6).toFixed(1)}M tok`:e>=1e3?`${(e/1e3).toFixed(1)}k tok`:`${e} tok`}function uoe(e){if(!e)return;const t=[e.input,e.output,e.reasoning,e.cached].filter(r=>typeof r=="number"&&Number.isFinite(r));return t.length>0?t.reduce((r,n)=>r+n,0):void 0}function aL(e){return e.total_tokens??uoe(e.token_usage)}function Ym(e,t=0){return e.sample_path??e.attempt_path??e.run_path??`sample-${t+1}`}function coe(e){const t=e.tokenUsage;if(!t)return;const r=[t.input!=null?`${t.input} in`:void 0,t.output!=null?`${t.output} out`:void 0,t.reasoning!=null?`${t.reasoning} reason`:void 0,t.cached!=null?`${t.cached} cached`:void 0].filter(n=>!!n);return r.length>0?r.join(" / "):void 0}function doe(e){return e>=.8?"text-emerald-300":e>=.5?"text-yellow-300":"text-red-300"}function iL(e){var t,r;return e.verdict==="fail"||(t=e.assertions)!=null&&t.some(n=>!n.passed)?!0:((r=e.scores)==null?void 0:r.some(iL))??!1}function cS({results:e,runId:t,projectId:r,passThreshold:n,title:i="Results",emptyMessage:o}){const[l,c]=S.useState(()=>vx()),[h,f]=S.useState(()=>w2()),[p,g]=S.useState(null),[y,x]=S.useState(null),[b,w]=S.useState("checks"),[N,_]=S.useState(()=>new Set),E=S.useMemo(()=>ose({results:e,passThreshold:n,state:l}),[n,e,l]),T=new Set(E.state.visibleColumnIds),A=h!=null?E.filteredRows.find(G=>G.key===h)??null:null,C=S.useMemo(()=>new Map(E.repeatGroups.map(G=>[G.row.key,G])),[E.repeatGroups]),R=A?C.get(A.key):void 0,D=R&&p?R.trials.find((G,L)=>Ym(G,L)===p)??null:null;S.useEffect(()=>{const G=()=>{c(vx()),f(w2()),g(null),x(null),w("checks")};return window.addEventListener("popstate",G),()=>window.removeEventListener("popstate",G)},[]),S.useEffect(()=>{!h||A||(_h(null),f(null))},[A,h]);function M(G){const L={...E.state,...G};loe(L),c(vx())}function z(){if(typeof window>"u")return;const G=new URLSearchParams(window.location.search);for(const J of Object.values(Nt))G.delete(J);const L=G.toString(),F=`${window.location.pathname}${L?`?${L}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",F),c({}),f(null),g(null),x(null),w("checks")}function k(G){const L=new Set(E.state.visibleColumnIds);L.has(G)?L.delete(G):L.add(G),M({visibleColumnIds:[...L]})}function H(G){_h(G),f(G),g(null),x(null),w("checks")}function U(G,L,F="checks"){_h(G),f(G),g(Ym(L)),w(F),x(poe(L))}function ae(){_h(null),f(null),g(null),x(null),w("checks")}function Z(G){_(L=>{const F=new Set(L);return F.has(G)?F.delete(G):F.add(G),F})}return e.length===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:o??d.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations found"})}):d.jsxs("section",{className:"space-y-3",children:[d.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-baseline sm:justify-between",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-400",children:i}),d.jsxs("p",{className:"text-xs text-gray-500",children:[E.filteredRows.length," of ",E.rows.length," rows"]})]}),d.jsxs("div",{className:"space-y-3 rounded-lg border border-gray-800 bg-gray-900/40 p-3",children:[d.jsx("div",{className:"flex flex-wrap gap-2",children:P5.map(G=>d.jsxs("button",{type:"button",onClick:()=>M({view:G.id}),className:`inline-flex items-center gap-2 rounded-md border px-2.5 py-1.5 text-sm transition-colors ${E.state.view===G.id?"border-cyan-900/60 bg-cyan-950/30 text-cyan-300":"border-gray-800 bg-gray-950/70 text-gray-400 hover:border-gray-700 hover:text-gray-200"}`,children:[d.jsx("span",{children:G.label}),d.jsx("span",{className:"tabular-nums text-xs text-gray-500",children:E.viewCounts[G.id]})]},G.id))}),d.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(220px,1fr)_minmax(150px,220px)_minmax(150px,220px)_auto_auto]",children:[d.jsxs("label",{className:"min-w-0",children:[d.jsx("span",{className:"sr-only",children:"Search results"}),d.jsx("input",{type:"search",value:E.state.search,onChange:G=>M({search:G.target.value}),placeholder:"Search tests, targets, graders, assertions",className:"w-full rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-100 placeholder:text-gray-600 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500"})]}),d.jsxs("label",{children:[d.jsx("span",{className:"sr-only",children:"Filter by target"}),d.jsxs("select",{value:E.state.target,onChange:G=>M({target:G.target.value}),className:"w-full rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-100 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:[d.jsx("option",{value:"all",children:"All targets"}),E.targetOptions.map(G=>d.jsx("option",{value:G,children:G},G))]})]}),d.jsxs("label",{children:[d.jsx("span",{className:"sr-only",children:"Filter by grader"}),d.jsxs("select",{value:E.state.grader,onChange:G=>M({grader:G.target.value}),className:"w-full rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-100 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:[d.jsx("option",{value:"all",children:"All graders"}),E.graderOptions.map(G=>d.jsx("option",{value:G,children:G},G))]})]}),d.jsxs("details",{className:"group relative",children:[d.jsx("summary",{className:"list-none rounded-md border border-gray-700 bg-gray-950 px-3 py-1.5 text-sm text-gray-300 transition-colors hover:border-gray-600 hover:text-gray-100 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:"Display"}),d.jsxs("div",{className:"absolute right-0 z-10 mt-2 w-64 max-w-[calc(100vw-2rem)] rounded-lg border border-gray-800 bg-gray-950 p-3",children:[d.jsx("div",{className:"mb-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Columns"}),d.jsx("div",{className:"max-h-72 space-y-2 overflow-auto pr-1",children:E.columns.map(G=>d.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-300",children:[d.jsx("input",{type:"checkbox",checked:T.has(G.id),onChange:()=>k(G.id),className:"h-4 w-4 rounded border-gray-700 bg-gray-900 text-cyan-500"}),d.jsx("span",{className:"min-w-0 truncate",title:G.label,children:G.label})]},G.id))})]})]}),d.jsx("button",{type:"button",onClick:z,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200",children:"Clear"})]})]}),d.jsxs("div",{className:A?"grid min-w-0 max-w-full gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(360px,42rem)]":"",children:[d.jsx("div",{className:"min-w-0",children:E.filteredRows.length===0?d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-400",children:"No matching evaluations"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Adjust the result filters or display preset."})]}):d.jsx(foe,{rows:E.filteredRows,visibleColumns:E.visibleColumns,passThreshold:n,selectedRowKey:h,selectedTrialPath:p,repeatGroupsByRowKey:C,expandedRepeatRows:N,onToggleRepeatGroup:Z,onOpenDetail:H,onOpenTrialDetail:U})}),A&&d.jsx(Eoe,{row:A,runId:t,projectId:r,repeatGroup:R,selectedTrial:D,selectedTrialPath:p,initialTab:b,initialFilePath:y,onOpenTrialDetail:(G,L)=>U(A.key,G,L),onClose:ae})]})]})}function foe({rows:e,visibleColumns:t,passThreshold:r,selectedRowKey:n,selectedTrialPath:i,repeatGroupsByRowKey:o,expandedRepeatRows:l,onToggleRepeatGroup:c,onOpenDetail:h,onOpenTrialDetail:f}){return d.jsx("div",{className:"max-w-full overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"w-full whitespace-nowrap text-left text-sm",style:{minWidth:`${Soe(t)}px`},children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsx("tr",{children:t.map(p=>d.jsx("th",{className:Noe(p.id),title:p.label,children:d.jsx("span",{className:woe(p.id)?"sr-only":"block max-w-48 truncate",children:p.label})},p.id))})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:e.map(p=>{const g=o.get(p.key),y=n===p.key&&!i,x=g?l.has(p.key):!1;return d.jsxs(S.Fragment,{children:[d.jsx("tr",{className:`cursor-pointer transition-colors ${y?"bg-cyan-950/20":"hover:bg-gray-900/30"} ${g?"bg-gray-950/20":""}`,onClick:()=>h(p.key),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),h(p.key))},tabIndex:0,"aria-selected":y,children:t.map(b=>d.jsx("td",{className:S2(b.id,"py-3"),children:d.jsx(_oe,{column:b,row:p,repeatGroup:g,repeatExpanded:x,passThreshold:r,isSelected:y,onToggleRepeatGroup:c})},`${p.key}:${b.id}`))}),g&&x?g.trials.map((b,w)=>{const N=Ym(b,w),_=n===p.key&&i===N;return d.jsx("tr",{className:`cursor-pointer bg-gray-950/60 transition-colors ${_?"bg-cyan-950/20":"hover:bg-gray-900/50"}`,"aria-label":`${dS(b,w)} for ${p.testId}`,onClick:()=>f(p.key,b),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),f(p.key,b))},tabIndex:0,"aria-selected":_,children:t.map(E=>d.jsx("td",{className:S2(E.id,"py-2"),children:d.jsx(goe,{column:E,row:p,trial:b,index:w,passThreshold:r})},`${p.key}:${N}:${E.id}`))},`${p.key}:${N}`)}):null]},p.key)})})]})})}function hoe(e,t){return e.status==="passed"?!0:e.status==="failed"||e.status==="skipped"?!1:e.verdict==="pass"?!0:e.verdict==="fail"?!1:typeof e.score=="number"?e.score>=t:!1}function moe(e,t=0){return typeof e.sample=="number"?e.sample:typeof e.sample_index=="number"?e.sample_index+1:typeof e.attempt=="number"?e.attempt+1:t+1}function dS(e,t=0){const r=`Attempt ${moe(e,t)}`;return typeof e.retry_index=="number"&&e.retry_index>0?`${r} retry ${e.retry_index}`:r}function poe(e){return e.grading_path??e.metrics_path??e.timing_path??e.transcript_path??e.answer_path??null}function sL(e,t){return e?t?`[target:${t}] ${e}`:e:t?`Target error: ${t}`:void 0}function oL(e){var t,r,n,i;return((t=e.target_execution)==null?void 0:t.error_kind)??((r=e.target_execution)==null?void 0:r.errorKind)??((n=e.targetExecution)==null?void 0:n.error_kind)??((i=e.targetExecution)==null?void 0:i.errorKind)}function goe({column:e,row:t,trial:r,index:n,passThreshold:i}){const o=hoe(r,i),l=r.execution_status==="execution_error",c=l?"error":o?"passing":"failing",h=l?"Error":o?"Passing":"Failing",f=dS(r,n),p=Ym(r,n);switch(e.id){case"status":return d.jsx(fS,{status:c,label:h});case"expander":return d.jsx("span",{"aria-hidden":"true",className:"mx-auto block h-7 w-px bg-gray-800"});case"test":return d.jsx(yoe,{label:f,artifactLabel:p,parentTestId:t.testId,trial:r});case"target":return d.jsx(uL,{target:t.targetLabel,tone:"text-gray-500"});case"score":return d.jsx(an,{rate:r.score??0});case"eval":return d.jsx(Al,{value:t.evalLabel,tone:"text-gray-500"});case"category":return d.jsx(Al,{value:t.categoryLabel,tone:"text-gray-500"});case"duration":return d.jsx("span",{className:"text-gray-500",children:uS(r.duration_ms)});case"cost_tokens":return d.jsx(Poe,{trial:r});case"review":return d.jsx("span",{className:"text-gray-700",children:"-"});case"error":return d.jsx(Al,{value:sL(r.error,oL(r)),tone:"text-red-300"});default:return d.jsx("span",{className:"text-gray-700",children:"-"})}}function yoe({label:e,artifactLabel:t,parentTestId:r,trial:n}){return d.jsxs("div",{className:"max-w-[28rem] min-w-0 border-l border-gray-800 pl-3",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[d.jsx("span",{className:"rounded-md border border-gray-800 bg-gray-900 px-1.5 py-0.5 text-[11px] font-medium text-gray-500",children:"Attempt"}),d.jsx("span",{className:"truncate font-medium text-gray-300",title:e,children:e})]}),d.jsxs("div",{className:"mt-0.5 truncate text-xs text-gray-600",title:`${r} · ${t}`,children:["Under ",r," · ",t]}),d.jsx("div",{className:"mt-0.5 flex min-w-0 flex-wrap gap-x-3 gap-y-0.5 text-xs text-gray-600",children:n.total_tool_calls!=null?d.jsxs("span",{children:[n.total_tool_calls," tool calls"]}):null}),n.error?d.jsx("div",{className:"mt-0.5 truncate text-xs text-red-300",title:n.error,children:n.error}):null]})}function fS({status:e,label:t}){const r=e==="passing",n=e==="error"||e==="partial",i=r?soe:ooe,o=r?"text-emerald-300":n?"text-amber-300":"text-red-300";return d.jsx("span",{className:`inline-flex text-base font-semibold ${o}`,title:t,children:i})}function voe({group:e,passThreshold:t}){const n=e.passRate>=t?"passing":e.passedTrials>0?"partial":"failing";return d.jsx(fS,{status:n,label:`${e.passedTrials}/${e.trialCount} attempts passed`})}function xoe({group:e}){const t=e.passedTrials===e.trialCount?"Stable pass":e.passedTrials===0?"Stable fail":"Flaky",r=[`${e.passedTrials}/${e.trialCount} attempts passed`,`${Gm(e.passRate)} success`,`${Gm(e.meanScore)} mean score`,e.executionErrorTrials>0?`${e.executionErrorTrials} execution errors`:void 0,e.assertionPassRate!=null?`${e.passedAssertions}/${e.assertionCount} assertions`:void 0].filter(n=>!!n);return d.jsxs("div",{className:"mt-1 flex max-w-[34rem] flex-wrap items-center gap-x-2 gap-y-1 text-xs",children:[d.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/30 px-1.5 py-0.5 font-medium text-cyan-300",children:"Aggregate case"}),d.jsx("span",{className:t==="Stable pass"?"text-emerald-300":t==="Stable fail"?"text-red-300":"text-yellow-300",children:t}),d.jsx("span",{className:"min-w-0 truncate text-gray-500",title:r.join(" · "),children:r.join(" · ")})]})}function boe({group:e}){return d.jsxs("div",{className:"flex min-w-0 flex-col items-end gap-1",children:[d.jsx(an,{rate:e.passRate}),d.jsx("div",{className:"text-xs text-gray-500",children:"Attempt success"}),d.jsxs("div",{className:"text-xs tabular-nums text-gray-600",children:["Mean score ",Gm(e.meanScore)]})]})}function joe({group:e,row:t}){return d.jsxs("span",{className:"text-gray-400",children:["Avg ",uS(e.meanDurationMs??t.result.durationMs)]})}function lL(e){return["duration","cost_tokens"].includes(e)||e.startsWith("grader:")}function Zp(e){return e==="status"||e==="expander"}function woe(e){return Zp(e)}function Soe(e){const t=e.reduce((r,n)=>r+(Zp(n.id)?44:136),0);return Math.max(760,t)}function Noe(e){return Zp(e)?"w-11 min-w-11 max-w-11 px-2 py-3 text-center font-medium text-gray-400":`px-4 py-3 font-medium text-gray-400 ${lL(e)?"text-right":""}`}function S2(e,t){return Zp(e)?`w-11 min-w-11 max-w-11 px-2 ${t} text-center align-middle`:`px-4 ${t} align-middle ${lL(e)?"text-right tabular-nums":""}`}function _oe({column:e,row:t,repeatGroup:r,repeatExpanded:n,passThreshold:i,isSelected:o,onToggleRepeatGroup:l}){if(e.id.startsWith("grader:")){const c=e.id.slice(7);return d.jsx(Roe,{score:t.graderScores.get(c),passThreshold:i})}switch(e.id){case"status":return r?d.jsx(voe,{group:r,passThreshold:i}):d.jsx(fS,{status:t.status,label:t.statusLabel});case"expander":return r?d.jsx(Aoe,{row:t,repeatExpanded:n,onToggleRepeatGroup:l}):d.jsx("span",{"aria-hidden":"true",className:"block h-5"});case"test":return d.jsx(Ooe,{row:t,repeatGroup:r,isSelected:o});case"target":return d.jsx(uL,{target:t.targetLabel});case"score":return t.executionError?d.jsx("span",{className:"inline-flex rounded-md border border-amber-900/60 bg-amber-950/20 px-2 py-0.5 text-xs font-medium text-amber-300",children:"Execution error"}):r?d.jsx(boe,{group:r}):d.jsx(an,{rate:t.result.score});case"eval":return d.jsx(Al,{value:t.evalLabel});case"category":return d.jsx(Al,{value:t.categoryLabel});case"duration":return r?d.jsx(joe,{group:r,row:t}):d.jsx("span",{className:"text-gray-400",children:uS(t.result.durationMs)});case"cost_tokens":return d.jsx(Coe,{row:t,repeatGroup:r});case"error":return d.jsx(Al,{value:sL(t.result.error,oL(t.result)),tone:"text-red-300"});default:return d.jsx("span",{className:"text-gray-600",children:"-"})}}function Ooe({row:e,repeatGroup:t,isSelected:r}){return d.jsxs("div",{className:"max-w-[24rem] min-w-0",children:[d.jsx("span",{className:`block min-w-0 truncate text-left font-medium ${r?"text-cyan-200":"text-cyan-400"}`,title:e.testId,children:e.testId}),t?d.jsx(xoe,{group:t}):null,e.result.error?d.jsx("div",{className:"mt-0.5 truncate text-xs text-red-300",title:e.result.error,children:e.result.error}):null]})}function Eoe({row:e,runId:t,projectId:r,repeatGroup:n,selectedTrial:i,selectedTrialPath:o,initialTab:l,initialFilePath:c,onOpenTrialDetail:h,onClose:f}){const p=$B(t,e.testId,{projectId:r,resultDir:e.result.result_dir,evalPath:e.result.eval_path}),g=i?`${e.testId} · ${dS(i)}`:e.testId,y=n&&!i,x=`${e.key}:${o??""}:${l}`;return d.jsxs("aside",{ref:Toe,className:"min-w-0 max-w-full overflow-hidden rounded-lg border border-gray-800 bg-gray-950/80 xl:sticky xl:top-4 xl:max-h-[calc(100vh-2rem)]",children:[d.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3 border-b border-gray-800 px-4 py-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Row detail"}),d.jsx("h4",{className:"mt-1 truncate text-base font-semibold text-white",title:g,children:g}),d.jsxs("p",{className:"mt-1 truncate text-xs text-gray-500",title:e.targetLabel,children:[e.targetLabel,e.evalLabel?` · ${e.evalLabel}`:""]})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[d.jsx("a",{href:p,className:"rounded-md border border-gray-800 px-2.5 py-1.5 text-xs text-gray-400 transition-colors hover:border-gray-700 hover:text-gray-200",children:"Full page"}),d.jsx("button",{type:"button",onClick:f,className:"rounded-md border border-gray-800 px-2.5 py-1.5 text-xs text-gray-400 transition-colors hover:border-gray-700 hover:text-gray-200",children:"Close"})]})]}),d.jsx("div",{className:"h-[36rem] min-h-[28rem] min-w-0 overflow-hidden xl:h-[calc(100vh-9rem)]",children:d.jsx(lS,{eval:e.result,runId:t,projectId:r,repeatGroup:y?n:void 0,selectedTrial:i,initialTab:l,initialSelectedFilePath:c,onSelectTrial:h},`${e.key}:${o??"aggregate"}:${c??""}`)})]},x)}function uL({target:e,tone:t="text-gray-300"}){return d.jsx("div",{className:`max-w-[14rem] truncate ${t}`,title:e,children:e})}function Aoe({row:e,repeatExpanded:t,onToggleRepeatGroup:r}){return d.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(e.key)},className:"inline-flex h-6 w-6 items-center justify-center rounded-md border border-gray-800 text-xs text-gray-400 transition-colors hover:border-gray-700 hover:text-gray-200","aria-expanded":t,"aria-label":`${t?"Collapse":"Expand"} attempts for ${e.testId}`,children:t?"-":"+"})}function Toe(e){e&&window.requestAnimationFrame(()=>{e.scrollIntoView({block:"nearest",inline:"nearest"})})}function Coe({row:e,repeatGroup:t}){const r=(t==null?void 0:t.trials.map(f=>f.cost_usd).filter(f=>typeof f=="number"&&Number.isFinite(f)))??[],n=(t==null?void 0:t.trials.map(aL).filter(f=>typeof f=="number"&&Number.isFinite(f)))??[],i=r.length>0?r.reduce((f,p)=>f+p,0):void 0,o=n.length>0?n.reduce((f,p)=>f+p,0):void 0,l=rL(e.result.costUsd??i),c=nL(e.tokenTotal??o),h=coe(e.result);return!l&&!c?d.jsx("span",{className:"text-gray-600",children:"-"}):d.jsxs("div",{className:"min-w-0 text-right",children:[l?d.jsx("div",{className:"tabular-nums text-gray-300",children:l}):null,c?d.jsx("div",{className:"text-xs tabular-nums text-gray-500",title:h,children:c}):null]})}function Poe({trial:e}){const t=rL(e.cost_usd),r=nL(aL(e));return!t&&!r?d.jsx("span",{className:"text-gray-700",children:"-"}):d.jsxs("div",{className:"min-w-0 text-right",children:[t?d.jsx("div",{className:"tabular-nums text-gray-500",children:t}):null,r?d.jsx("div",{className:"text-xs tabular-nums text-gray-600",children:r}):null]})}function Roe({score:e,passThreshold:t}){if(!e)return d.jsx("span",{className:"text-gray-600",children:"-"});const r=e.score<t||iL(e);return d.jsxs("div",{className:"min-w-0 text-right",children:[d.jsx("div",{className:`tabular-nums ${doe(e.score)}`,children:Gm(e.score)}),d.jsx("div",{className:r?"text-xs text-red-300":"text-xs text-gray-500",children:r?"Fail":e.verdict??"Pass"})]})}function Al({value:e,tone:t="text-gray-400"}){return e?d.jsx("span",{className:`block max-w-[14rem] truncate ${t}`,title:e,children:e}):d.jsx("span",{className:"text-gray-600",children:"-"})}function eu({total:e,passed:t,failed:r,passRate:n,executionErrors:i=0,totalCost:o}){const l=Math.round(n*100),c=l>=80?"text-cyan-400":l>=60?"text-amber-400":"text-red-400";return d.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:[d.jsx(vl,{label:"Pass Rate",value:`${l}%`,accent:c,large:!0}),d.jsx("div",{className:"h-6 w-px bg-gray-700"}),d.jsx(vl,{label:"Passed",value:String(t),accent:"text-emerald-400"}),d.jsx(vl,{label:"Failures",value:String(r),accent:"text-red-400"}),i>0&&d.jsx(vl,{label:"Execution Errors",value:String(i),accent:"text-amber-400"}),d.jsx(vl,{label:"Total",value:String(e)}),o!==void 0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-6 w-px bg-gray-700"}),d.jsx(vl,{label:"Cost",value:`$${o.toFixed(4)}`,accent:"text-amber-400"})]})]})}function vl({label:e,value:t,accent:r,large:n}){return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("span",{className:"text-xs text-gray-500",children:e}),d.jsx("span",{className:`tabular-nums font-semibold ${n?"text-2xl":"text-lg"} ${r??"text-white"}`,children:t})]})}function cL({results:e,runId:t,projectId:r}){const{data:n}=pt(r),i=(n==null?void 0:n.threshold)??(n==null?void 0:n.pass_threshold)??.8,[o,l]=S.useState({}),c=qie(e),h=e.length,f=rp(e,i),p=e.reduce((b,w)=>b+(w.costUsd??0),0),g=vae(e,i),y=dL(g,o),x=b=>{l(w=>({...w,[b]:!w[b]}))};return h===0?d.jsxs("div",{className:"space-y-6",children:[d.jsx(eu,{total:0,passed:0,failed:0,passRate:0}),d.jsx(N2,{href:c}),d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[d.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations found"}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This run has no results yet."})]})]}):d.jsxs("div",{className:"space-y-6",children:[d.jsx(eu,{total:h,passed:f.passed,failed:f.failed,passRate:f.passRate,executionErrors:f.executionErrors,totalCost:p>0?p:void 0}),d.jsx(N2,{href:c}),d.jsxs("div",{children:[d.jsx("h3",{className:"mb-3 text-sm font-medium text-gray-400",children:"Category Breakdown"}),d.jsx("div",{className:"max-w-full overflow-x-auto rounded-lg border border-gray-800",children:d.jsxs("table",{className:"min-w-[620px] w-full whitespace-nowrap text-left text-sm",children:[d.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Category"}),d.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Pass Rate"}),d.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Passed"}),d.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Failures"}),d.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Execution Errors"}),d.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Total"})]})}),d.jsx("tbody",{className:"divide-y divide-gray-800/50",children:y.map(b=>{const w=o[b.name]===!0;return d.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[d.jsx("td",{className:"w-[18rem] max-w-[18rem] px-4 py-2.5 font-medium text-gray-200",children:d.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[d.jsx("span",{className:"inline-block h-4 shrink-0",style:{width:`${b.depth*16}px`}}),b.childCount>0?d.jsx("button",{type:"button",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded border border-gray-700 text-xs text-gray-400 hover:border-gray-600 hover:text-gray-200",onClick:()=>x(b.name),"aria-label":`${w?"Collapse":"Expand"} ${b.name}`,"aria-expanded":w,children:w?"-":"+"}):d.jsx("span",{className:"h-5 w-5 shrink-0"}),r?d.jsx(Ee,{to:"/projects/$projectId/runs/$runId/category/$category",params:{projectId:r,runId:t,category:b.name},className:"min-w-0 truncate text-cyan-400 hover:text-cyan-300 hover:underline",title:b.name,children:b.label}):d.jsx(Ee,{to:"/runs/$runId/category/$category",params:{runId:t,category:b.name},className:"min-w-0 truncate text-cyan-400 hover:text-cyan-300 hover:underline",title:b.name,children:b.label}),b.depth>0?d.jsx("span",{className:"truncate text-xs font-normal text-gray-500",children:b.name}):null,b.childCount>0?d.jsx("span",{className:"shrink-0 text-xs font-normal text-gray-500",children:b.childCount}):null]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsx(an,{rate:b.total-b.executionErrors>0?b.passed/(b.total-b.executionErrors):0})}),d.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-emerald-400",children:b.passed}),d.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-red-400",children:b.failed>0?b.failed:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-amber-400",children:b.executionErrors>0?b.executionErrors:d.jsx("span",{className:"text-gray-600",children:"0"})}),d.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-gray-400",children:b.total})]},b.name)})})]})})]}),d.jsx(cS,{results:e,runId:t,projectId:r,passThreshold:i,title:"All Evals"}),d.jsx(Moe,{runId:t,projectId:r})]})}function dL(e,t){return e.flatMap(r=>[r,...t[r.name]?dL(r.children,t):[]])}function N2({href:e}){return e?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"text-sm font-medium text-gray-200",children:"External trace"}),d.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Phoenix"})]}),d.jsx("a",{href:e,target:"_blank",rel:"noreferrer",className:"inline-flex items-center rounded-md border border-cyan-900/70 px-2.5 py-1 text-sm font-medium text-cyan-300 transition-colors hover:border-cyan-700 hover:bg-cyan-950/40 hover:text-cyan-200 hover:underline",children:"Open in Phoenix"})]})}):null}function Moe({runId:e,projectId:t}){const[r,n]=S.useState(!1),{data:i,isLoading:o,error:l}=t6(e,t);return!o&&!l&&i==null?null:d.jsxs("div",{children:[d.jsxs("button",{type:"button",onClick:()=>n(c=>!c),className:"flex w-full items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 px-4 py-2 text-left text-sm font-medium text-gray-300 transition-colors hover:bg-gray-900","aria-expanded":r,children:[d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx("span",{"aria-hidden":"true",children:r?"▾":"▸"}),"Run Log"]}),d.jsx("span",{className:"text-xs text-gray-500",children:o?"Loading…":l?"Failed to load":i?`${i.length} chars`:""})]}),r&&d.jsx("div",{className:"mt-2 overflow-hidden rounded-lg border border-gray-800 bg-black",children:l?d.jsxs("div",{className:"p-4 text-sm text-red-400",children:["Failed to load run log: ",l.message]}):d.jsx("pre",{className:"max-h-[480px] overflow-auto whitespace-pre-wrap break-words p-4 font-mono text-xs leading-relaxed text-gray-200",children:i??""})})]})}function Jp({status:e}){const t=e==="finished"||e==="failed",n={starting:"text-yellow-400",running:"text-cyan-400",finished:"text-emerald-400",failed:"text-red-400"}[e]??"text-gray-400";return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:`text-sm font-medium ${n}`,children:e.charAt(0).toUpperCase()+e.slice(1)}),!t&&d.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent"})]})}function eg({runId:e,status:t,isReadOnly:r,projectId:n}){const[i,o]=S.useState(!1),[l,c]=S.useState(null);if(!Die(t,r))return null;async function h(){o(!0),c(null);try{await k6(e,n)}catch(f){c(f instanceof Error?f.message:"Failed to stop run"),o(!1)}}return d.jsxs("div",{className:"flex flex-col items-end gap-1",children:[d.jsx("button",{type:"button",onClick:h,disabled:i,className:"inline-flex items-center gap-2 rounded-md border border-gray-700 bg-transparent px-3 py-1.5 text-sm font-medium text-gray-300 hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"stop-run-button",children:i?"Stopping…":d.jsxs(d.Fragment,{children:[d.jsx("span",{"aria-hidden":"true",className:"inline-block h-2.5 w-2.5 rounded-[1px] bg-current"}),"Stop"]})}),l&&d.jsx("p",{className:"text-xs text-red-400",children:l})]})}const fL=dr("/runs/$runId")({component:Doe});function Doe(){var w;const{runId:e}=fL.useParams(),{data:t,isLoading:r,error:n}=md(e),{data:i}=pt(),{data:o}=ep(),[l,c]=S.useState(!1),h=(i==null?void 0:i.read_only)===!0;if(r)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(N=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},N))})]});if(n)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",n.message]});const f=(w=t==null?void 0:t.results)==null?void 0:w[0],p=f==null?void 0:f.target,g=p?{target:p}:void 0,y=t==null?void 0:t.status,x=y==="starting"||y==="running",b=BR({runId:e,results:(t==null?void 0:t.results)??[],source:t==null?void 0:t.source,sourceLabel:t==null?void 0:t.source_label,runtimeSource:t==null?void 0:t.runtime_source,remoteRepo:(t==null?void 0:t.source)==="remote"?o==null?void 0:o.repo:void 0,formatTimestamp:N=>new Date(N).toLocaleString()});return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("h1",{className:"min-w-0 truncate text-xl font-semibold text-white sm:text-2xl",title:b.heading,children:b.heading}),b.sourceBadge?d.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/20 px-2 py-0.5 text-xs font-medium text-cyan-300",children:b.sourceBadge}):null]}),b.meta?d.jsx("p",{className:"mt-1 text-sm text-gray-500",children:b.meta}):null,b.sourceContext.length>0?d.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-gray-500",children:b.sourceContext.map(N=>d.jsxs("span",{children:[d.jsxs("span",{className:"text-gray-600",children:[N.label,":"]})," ",N.value]},`${N.label}:${N.value}`))}):null]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-3 sm:justify-end",children:[!h&&x?d.jsx(eg,{runId:e,status:y,isReadOnly:h}):d.jsx(A5,{results:(t==null?void 0:t.results)??[],runDir:t==null?void 0:t.run_dir,suiteFilter:t==null?void 0:t.suite_filter,target:p??void 0,isReadOnly:h,plannedTestCount:t==null?void 0:t.planned_test_count,runStatus:y}),y&&d.jsx(Jp,{status:y}),!h&&!x&&d.jsx("button",{type:"button",onClick:()=>c(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"Start"})]})]}),d.jsx(cL,{results:(t==null?void 0:t.results)??[],runId:e}),!h&&d.jsx(So,{open:l,onClose:()=>c(!1),prefill:g})]})}const xx=[{id:"runs",label:"🏃 Recent Runs",title:"Recent Runs"},{id:"tags",label:"🏷️ Tags",title:"Tags"},{id:"analytics",label:"📊 Analytics",title:"Analytics"},{id:"targets",label:"🤖 Targets",title:"Targets"}],hL=dr("/projects/$projectId")({component:koe});function koe(){var x,b;const{projectId:e}=hL.useParams(),r=nj().location.search,n=r.tab,i=(x=r.key)!=null&&x.trim()?r.key:jl,o=po(),[l,c]=S.useState(!1),{data:h}=pt(e),f=(h==null?void 0:h.read_only)===!0,p=e,g=xx.some(w=>w.id===n)?n:"runs",y=((b=xx.find(w=>w.id===g))==null?void 0:b.title)??"Recent Runs";return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:y}),!f&&d.jsx("button",{type:"button",onClick:()=>c(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"Start"})]}),d.jsx("div",{className:"border-b border-gray-800 sm:overflow-x-auto",children:d.jsx("div",{className:"flex flex-wrap gap-1 sm:min-w-max sm:flex-nowrap",children:xx.map(w=>d.jsx("button",{type:"button",onClick:()=>o({to:"/projects/$projectId",params:{projectId:e},search:w.id==="tags"?{tab:w.id,key:i}:{tab:w.id}}),className:`shrink-0 px-4 py-2 text-sm font-medium transition-colors ${g===w.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:w.label},w.id))})}),g==="runs"&&d.jsx(Loe,{projectId:e,projectName:p,readOnly:f}),g==="tags"&&d.jsx(_5,{projectId:e,tagKey:i,onTagKeyChange:w=>o({to:"/projects/$projectId",params:{projectId:e},search:{tab:"tags",key:w}})}),g==="analytics"&&d.jsx($oe,{projectId:e,readOnly:f}),g==="targets"&&d.jsx(O5,{projectId:e}),!f&&d.jsx(So,{open:l,onClose:()=>c(!1),projectId:e})]})}function Loe({projectId:e,projectName:t,readOnly:r}){const n=ho(),{data:i,isLoading:o,error:l,hasNextPage:c,fetchNextPage:h,isFetchingNextPage:f}=S6(e),{data:p}=mj(e),{data:g}=ep(e),[y,x]=S.useState(!1),[b,w]=S.useState(!1),[N,_]=S.useState(null),E=((p==null?void 0:p.runs)??[]).filter(M=>M.status==="starting"||M.status==="running"),T=Wp((i==null?void 0:i.runs)??[]),A=T.filter(M=>M.on_remote===!0).length,C=(g==null?void 0:g.configured)===!0?AR(A,T.length,g.branch):void 0;async function R(){x(!0),_(null);try{const M=await DR(e);n.setQueryData($c(e).queryKey,M);const z=Hh(M);_(z),Promise.all([n.invalidateQueries({queryKey:["projects",e,"runs"]}),n.invalidateQueries({queryKey:["projects",e,"tags"]}),n.invalidateQueries({queryKey:["projects",e,"compare"]}),n.invalidateQueries({queryKey:["projects",e,"targets"]}),n.invalidateQueries({queryKey:["remote-status",e]})]).catch(()=>{})}catch(M){_(Kh(M,g)),n.invalidateQueries({queryKey:["remote-status",e]}).catch(()=>{})}finally{x(!1)}}async function D(){w(!0),_(null);try{const M=await kR(e);n.setQueryData($c(e).queryKey,M),_(Hh(M)),Promise.all([n.invalidateQueries({queryKey:["projects",e,"runs"]}),n.invalidateQueries({queryKey:["projects",e,"tags"]}),n.invalidateQueries({queryKey:["projects",e,"compare"]}),n.invalidateQueries({queryKey:["projects",e,"targets"]}),n.invalidateQueries({queryKey:["remote-status",e]})]).catch(()=>{})}catch(M){_(Kh(M,g)),n.invalidateQueries({queryKey:["remote-status",e]}).catch(()=>{})}finally{w(!1)}}return S.useEffect(()=>{if((N==null?void 0:N.kind)!=="success")return;const M=window.setTimeout(()=>_(null),7e3);return()=>window.clearTimeout(M)},[N]),o?d.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(M=>d.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},M))}):l?d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",l.message]}):d.jsxs("div",{className:"space-y-4",children:[E.length>0&&d.jsxs("div",{className:"rounded-lg border border-cyan-900/40 bg-cyan-950/10",children:[d.jsx("div",{className:"border-b border-cyan-900/30 px-4 py-2.5",children:d.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-cyan-400",children:"Active"})}),d.jsx("ul",{className:"divide-y divide-gray-800/50",children:E.map(M=>d.jsxs("li",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[d.jsxs("div",{className:"min-w-0 flex items-center gap-3",children:[d.jsx("span",{className:"inline-block h-2 w-2 flex-shrink-0 animate-pulse rounded-full bg-cyan-400"}),d.jsx("span",{className:"truncate font-mono text-sm text-gray-300",children:M.id}),d.jsx("span",{className:"flex-shrink-0 text-xs text-gray-500",children:new Date(M.started_at).toLocaleTimeString()})]}),d.jsx(Ee,{to:"/projects/$projectId/jobs/$runId",params:{projectId:e,runId:M.id},className:"flex-shrink-0 text-xs text-cyan-400 hover:text-cyan-300",children:"View Log →"})]},M.id))})]}),d.jsx(N5,{remoteStatus:g,syncInFlight:y,onSync:R,projectName:t,syncFeedback:N,onRemoteSummary:C,onConfirmMerge:D,confirmMergeInFlight:b}),d.jsx(Xp,{runs:T,projectId:e,enableCombine:!r,remoteBranch:g==null?void 0:g.branch,hasNextPage:c,isFetchingNextPage:f,onLoadMore:()=>void h()})]})}function $oe({projectId:e,readOnly:t}){const{data:r,isLoading:n,isError:i,error:o}=Ue(MR(e));return d.jsx(w5,{data:r,isLoading:n,isError:i,error:o,projectId:e,readOnly:t})}const mL=dr("/jobs/$runId")({component:Ioe});function Ioe(){const{runId:e}=mL.useParams(),{data:t,isLoading:r,error:n}=hj(e),{data:i}=pt(),o=(i==null?void 0:i.read_only)===!0;if(r)return d.jsxs("div",{className:"space-y-4",children:[d.jsx(bx,{}),d.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"h-64 animate-pulse rounded-lg bg-gray-900"})]});if(n||!t)return d.jsxs("div",{className:"space-y-4",children:[d.jsx(bx,{}),d.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4 text-sm text-red-400",children:n?`Failed to load run: ${n.message}`:"Run not found."})]});const l=t.status==="finished"||t.status==="failed";return d.jsxs("div",{className:"space-y-4",children:[d.jsx(bx,{}),d.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-4",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h1",{className:"truncate font-mono text-base font-semibold text-white",children:e}),d.jsxs("p",{className:"mt-0.5 text-xs text-gray-500",children:["Started ",new Date(t.started_at).toLocaleString(),t.finished_at&&d.jsxs(d.Fragment,{children:[" · ","Finished ",new Date(t.finished_at).toLocaleString()," · ",Math.round((new Date(t.finished_at).getTime()-new Date(t.started_at).getTime())/1e3),"s"]})]})]}),d.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3",children:[d.jsx(eg,{runId:e,status:t.status,isReadOnly:o}),d.jsx(Jp,{status:t.status})]})]}),d.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 px-4 py-3",children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Command"}),d.jsx("code",{className:"break-all text-xs text-cyan-300",children:t.command})]}),t.stdout?d.jsxs("div",{children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Output"}),d.jsx("div",{className:"max-h-[60vh] overflow-y-auto rounded-lg border border-gray-700 bg-gray-950 p-4",children:d.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-gray-200",children:t.stdout})})]}):!l&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[d.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border-2 border-gray-500 border-t-transparent"}),"Waiting for output…"]}),t.stderr&&d.jsxs("div",{children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-red-500",children:"Stderr"}),d.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border border-red-900/40 bg-red-950/20 p-4",children:d.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-red-300",children:t.stderr})})]}),l&&d.jsxs("p",{className:"text-xs text-gray-500",children:["Exit code:"," ",d.jsx("span",{className:t.exit_code===0?"text-emerald-400":"text-red-400",children:t.exit_code})]})]})}function bx(){return d.jsx(Ee,{to:"/",search:{tab:"runs"},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to Runs"})}const zoe=dr("/experiments/$experimentName")({beforeLoad:({params:e})=>{throw Zb({to:"/tags/$key/$value",params:{key:"experiment",value:e.experimentName}})}});function Boe(e){return`(no ${e})`}function Uoe(e,t){var n,i;if(t==="experiment")return e.experiment??((n=e.run_tags)==null?void 0:n.experiment)??"default";const r=(i=e.run_tags)==null?void 0:i[t];return r===void 0||r===""?Boe(t):r}function pL({tagKey:e,tagValue:t,projectId:r}){var x;const{data:n,isLoading:i}=Ue(r?cj(r,e):uj(e)),{data:o,isLoading:l}=Ue(r?fj(r):lj);if(i||l)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-4 gap-4",children:["s1","s2","s3","s4"].map(b=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},b))})]});const h=(x=n==null?void 0:n.groups)==null?void 0:x.find(b=>b.name===t),f=Wp(((o==null?void 0:o.runs)??[]).filter(b=>Uoe(b,e)===t)),p=(h==null?void 0:h.pass_rate)??0,g=f.length,y=(h==null?void 0:h.target_count)??0;return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:Zi(e)}),d.jsx("h1",{className:"text-2xl font-semibold text-white",children:t}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[g," run",g!==1?"s":""," · ",y," target",y!==1?"s":"",(h==null?void 0:h.last_run)&&d.jsxs("span",{className:"ml-2",children:["· Last run: ",_2(h.last_run)]})]})]}),h&&d.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-4",children:[d.jsx(Oh,{label:"Runs",value:String(g)}),d.jsx(Oh,{label:"Targets",value:String(y)}),d.jsx(Oh,{label:"Pass Rate",value:`${Math.round(p*100)}%`,accent:"text-cyan-400"}),d.jsx(Oh,{label:"Last Run",value:_2(h.last_run)})]}),d.jsxs("div",{children:[d.jsx("h2",{className:"mb-4 text-lg font-medium text-gray-200",children:"All Runs"}),d.jsx(Xp,{runs:f,projectId:r,emptyMessage:d.jsxs("div",{children:[d.jsxs("p",{className:"text-lg text-gray-400",children:["No evaluation runs found for ",Zi(e)," ",d.jsx("code",{children:t}),"."]}),d.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Runs will appear here once this value has execution results."})]})})]})]})}function Oh({label:e,value:t,accent:r}){return d.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[d.jsx("p",{className:"text-sm text-gray-400",children:e}),d.jsx("p",{className:`mt-1 text-2xl font-semibold tabular-nums ${r??"text-white"}`,children:t})]})}function _2(e){if(!e)return"N/A";try{const t=new Date(e);return Number.isNaN(t.getTime())?"N/A":t.toLocaleString()}catch{return"N/A"}}const gL=dr("/tags/$key/$value")({component:qoe});function qoe(){const{key:e,value:t}=gL.useParams();return d.jsx(pL,{tagKey:e,tagValue:t})}const yL=dr("/evals/$runId/$evalId")({component:Foe});function Foe(){const{runId:e,evalId:t}=yL.useParams(),r=typeof window>"u"?void 0:new URLSearchParams(window.location.search).get("result_dir")??void 0,n=typeof window>"u"?void 0:new URLSearchParams(window.location.search).get("eval_path")??void 0,{data:i,isLoading:o,error:l}=md(e),{data:c}=pt(),[h,f]=S.useState(!1),p=(c==null?void 0:c.read_only)===!0;if(o)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(l)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",l.message]});const g=i==null?void 0:i.results.find(b=>Jm(b,t,{resultDir:r,evalPath:n}));if(!g)return d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:d.jsxs("p",{className:"text-gray-400",children:["Eval ",d.jsx("code",{className:"text-cyan-400",children:t})," not found in run"," ",d.jsx("code",{className:"text-cyan-400",children:e}),"."]})});const y=(c==null?void 0:c.threshold)??(c==null?void 0:c.pass_threshold)??.8,x=to(g.score,y)&&g.executionStatus!=="error"&&g.executionStatus!=="failed";return d.jsxs("div",{className:"flex h-full flex-col gap-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",e," / Eval: ",g.eval_path??t]}),d.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-semibold text-white",children:[d.jsx("span",{className:`text-2xl font-bold leading-none ${x?"text-emerald-400":"text-red-400"}`,children:x?"✓":"✗"}),t]})]}),!p&&d.jsx("button",{type:"button",onClick:()=>f(!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"})]}),d.jsx(lS,{eval:g,runId:e}),!p&&d.jsx(So,{open:h,onClose:()=>f(!1),prefill:{testIds:[t],target:g.target}})]})}const vL=dr("/runs/$runId_/suite/$suite")({component:Hoe});function Hoe(){const{runId:e,suite:t}=vL.useParams(),{data:r,isLoading:n,error:i}=md(e),{data:o}=pt(),l=(o==null?void 0:o.threshold)??(o==null?void 0:o.pass_threshold)??.8;if(n)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(g=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},g))})]});if(i)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",i.message]});const c=((r==null?void 0:r.results)??[]).filter(g=>(g.suite??"Uncategorized")===t),h=c.length,f=rp(c,l),p=c.reduce((g,y)=>g+(y.costUsd??0),0);return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:t}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Suite in run: ",e]})]}),d.jsx(eu,{total:h,passed:f.passed,failed:f.failed,passRate:f.passRate,executionErrors:f.executionErrors,totalCost:p>0?p:void 0}),h===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:d.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations in this suite"})}):d.jsx(cS,{results:c,runId:e,passThreshold:l,title:"Suite Evals"})]})}const xL=dr("/runs/$runId_/category/$category")({component:Koe});function Koe(){const{runId:e,category:t}=xL.useParams(),{data:r,isLoading:n,error:i}=PR(e,t);if(n)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(y=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},y))})]});if(i)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load category: ",i.message]});const o=(r==null?void 0:r.suites)??[],l=o.reduce((y,x)=>y+x.total,0),c=o.reduce((y,x)=>y+x.passed,0),h=o.reduce((y,x)=>y+x.failed,0),f=o.reduce((y,x)=>y+ur(x),0),p=l-f,g=p>0?c/p:0;return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:t}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Category in run: ",e]})]}),d.jsx(eu,{total:l,passed:c,failed:h,passRate:g,executionErrors:f}),o.length===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:d.jsx("p",{className:"text-lg text-gray-400",children:"No suites in this category"})}):d.jsxs("div",{className:"space-y-3",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Suites"}),d.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:o.map(y=>d.jsxs(Ee,{to:"/runs/$runId/suite/$suite",params:{runId:e,suite:y.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:y.name}),d.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[y.passed,"/",QR(y)]})]}),d.jsx("div",{className:"mt-2",children:d.jsx(fo,{score:y.avg_score})}),d.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[d.jsxs("span",{className:"text-emerald-400",children:[y.passed," passed"]}),y.failed>0&&d.jsxs("span",{className:"text-red-400",children:[y.failed," failed"]}),ur(y)>0&&d.jsxs("span",{className:"text-amber-400",children:[ur(y)," execution errors"]})]})]},y.name))})]})]})}const bL=dr("/projects/$projectId_/runs/$runId")({component:Goe});function Goe(){var N;const{projectId:e,runId:t}=bL.useParams(),{data:r,isLoading:n,error:i}=pd(e,t),{data:o}=pt(e),{data:l}=ep(e),[c,h]=S.useState(!1),f=(o==null?void 0:o.read_only)===!0;if(n)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(_=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},_))})]});if(i)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",i.message]});const p=(N=r==null?void 0:r.results)==null?void 0:N[0],g=p==null?void 0:p.target,y=g?{target:g}:void 0,x=r==null?void 0:r.status,b=x==="starting"||x==="running",w=BR({runId:t,results:(r==null?void 0:r.results)??[],source:r==null?void 0:r.source,sourceLabel:r==null?void 0:r.source_label,runtimeSource:r==null?void 0:r.runtime_source,remoteRepo:(r==null?void 0:r.source)==="remote"?l==null?void 0:l.repo:void 0,formatTimestamp:_=>new Date(_).toLocaleString()});return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[d.jsx("h1",{className:"min-w-0 truncate text-xl font-semibold text-white sm:text-2xl",title:w.heading,children:w.heading}),w.sourceBadge?d.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/20 px-2 py-0.5 text-xs font-medium text-cyan-300",children:w.sourceBadge}):null]}),w.meta?d.jsx("p",{className:"mt-1 text-sm text-gray-500",children:w.meta}):null,w.sourceContext.length>0?d.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-gray-500",children:w.sourceContext.map(_=>d.jsxs("span",{children:[d.jsxs("span",{className:"text-gray-600",children:[_.label,":"]})," ",_.value]},`${_.label}:${_.value}`))}):null]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-3 sm:justify-end",children:[!f&&b?d.jsx(eg,{runId:t,status:x,isReadOnly:f,projectId:e}):d.jsx(A5,{results:(r==null?void 0:r.results)??[],runDir:r==null?void 0:r.run_dir,suiteFilter:r==null?void 0:r.suite_filter,target:g??void 0,projectId:e,isReadOnly:f,plannedTestCount:r==null?void 0:r.planned_test_count,runStatus:x}),x&&d.jsx(Jp,{status:x}),!f&&!b&&d.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:"Start"})]})]}),d.jsx(cL,{results:(r==null?void 0:r.results)??[],runId:t,projectId:e}),!f&&d.jsx(So,{open:c,onClose:()=>h(!1),projectId:e,prefill:y})]})}const jL=dr("/projects/$projectId_/jobs/$runId")({component:Yoe});function Yoe(){const{projectId:e,runId:t}=jL.useParams(),{data:r,isLoading:n,error:i}=hj(t,e),{data:o}=pt(e),l=(o==null?void 0:o.read_only)===!0;if(n)return d.jsxs("div",{className:"space-y-4",children:[d.jsx(jx,{projectId:e}),d.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"h-64 animate-pulse rounded-lg bg-gray-900"})]});if(i||!r)return d.jsxs("div",{className:"space-y-4",children:[d.jsx(jx,{projectId:e}),d.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4 text-sm text-red-400",children:i?`Failed to load run: ${i.message}`:"Run not found."})]});const c=r.status==="finished"||r.status==="failed";return d.jsxs("div",{className:"space-y-4",children:[d.jsx(jx,{projectId:e}),d.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-4",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h1",{className:"truncate font-mono text-base font-semibold text-white",children:t}),d.jsxs("p",{className:"mt-0.5 text-xs text-gray-500",children:["Started ",new Date(r.started_at).toLocaleString(),r.finished_at&&d.jsxs(d.Fragment,{children:[" · ","Finished ",new Date(r.finished_at).toLocaleString()," · ",Math.round((new Date(r.finished_at).getTime()-new Date(r.started_at).getTime())/1e3),"s"]})]})]}),d.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3",children:[d.jsx(eg,{runId:t,status:r.status,isReadOnly:l,projectId:e}),d.jsx(Jp,{status:r.status})]})]}),d.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 px-4 py-3",children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Command"}),d.jsx("code",{className:"break-all text-xs text-cyan-300",children:r.command})]}),r.stdout?d.jsxs("div",{children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Output"}),d.jsx("div",{className:"max-h-[60vh] overflow-y-auto rounded-lg border border-gray-700 bg-gray-950 p-4",children:d.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-gray-200",children:r.stdout})})]}):!c&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[d.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border-2 border-gray-500 border-t-transparent"}),"Waiting for output…"]}),r.stderr&&d.jsxs("div",{children:[d.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-red-500",children:"Stderr"}),d.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border border-red-900/40 bg-red-950/20 p-4",children:d.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-red-300",children:r.stderr})})]}),c&&d.jsxs("p",{className:"text-xs text-gray-500",children:["Exit code:"," ",d.jsx("span",{className:r.exit_code===0?"text-emerald-400":"text-red-400",children:r.exit_code})]})]})}function jx({projectId:e}){return d.jsx(Ee,{to:"/projects/$projectId",params:{projectId:e},search:{tab:"runs"},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to Runs"})}const Voe=dr("/projects/$projectId_/experiments/$experimentName")({beforeLoad:({params:e})=>{throw Zb({to:"/projects/$projectId/tags/$key/$value",params:{projectId:e.projectId,key:"experiment",value:e.experimentName}})}}),wL=dr("/projects/$projectId_/tags/$key/$value")({component:Qoe});function Qoe(){const{projectId:e,key:t,value:r}=wL.useParams();return d.jsx(pL,{tagKey:t,tagValue:r,projectId:e})}const SL=dr("/projects/$projectId_/evals/$runId/$evalId")({component:Xoe});function Xoe(){const{projectId:e,runId:t,evalId:r}=SL.useParams(),n=typeof window>"u"?void 0:new URLSearchParams(window.location.search).get("result_dir")??void 0,i=typeof window>"u"?void 0:new URLSearchParams(window.location.search).get("eval_path")??void 0,{data:o,isLoading:l,error:c}=pd(e,t),{data:h}=pt(e),[f,p]=S.useState(!1),g=(h==null?void 0:h.read_only)===!0;if(l)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(c)return d.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",c.message]});const y=o==null?void 0:o.results.find(w=>Jm(w,r,{resultDir:n,evalPath:i}));if(!y)return d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:d.jsxs("p",{className:"text-gray-400",children:["Eval ",d.jsx("code",{className:"text-cyan-400",children:r})," not found in run"," ",d.jsx("code",{className:"text-cyan-400",children:t}),"."]})});const x=(h==null?void 0:h.threshold)??(h==null?void 0:h.pass_threshold)??.8,b=to(y.score,x)&&y.executionStatus!=="error"&&y.executionStatus!=="failed";return d.jsxs("div",{className:"flex h-full flex-col gap-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",t," / Eval: ",y.eval_path??r]}),d.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-semibold text-white",children:[d.jsx("span",{className:`text-2xl font-bold leading-none ${b?"text-emerald-400":"text-red-400"}`,children:b?"✓":"✗"}),r]})]}),!g&&d.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"})]}),d.jsx(lS,{eval:y,runId:t,projectId:e}),!g&&d.jsx(So,{open:f,onClose:()=>p(!1),projectId:e,prefill:{testIds:[r],target:y.target}})]})}const NL=dr("/projects/$projectId_/runs/$runId_/suite/$suite")({component:Woe});function Woe(){const{projectId:e,runId:t,suite:r}=NL.useParams(),{data:n,isLoading:i,error:o}=pd(e,t),{data:l}=pt(e),c=(l==null?void 0:l.threshold)??(l==null?void 0:l.pass_threshold)??.8;if(i)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(y=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},y))})]});if(o)return d.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 h=((n==null?void 0:n.results)??[]).filter(y=>(y.suite??"Uncategorized")===r),f=h.length,p=rp(h,c),g=h.reduce((y,x)=>y+(x.costUsd??0),0);return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:r}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Suite in run: ",t]})]}),d.jsx(eu,{total:f,passed:p.passed,failed:p.failed,passRate:p.passRate,executionErrors:p.executionErrors,totalCost:g>0?g:void 0}),f===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:d.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations in this suite"})}):d.jsx(cS,{results:h,runId:t,projectId:e,passThreshold:c,title:"Suite Evals"})]})}const _L=dr("/projects/$projectId_/runs/$runId_/category/$category")({component:Zoe});function Zoe(){const{projectId:e,runId:t,category:r}=_L.useParams(),{data:n,isLoading:i,error:o}=Ue(RR(e,t,r));if(i)return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),d.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(x=>d.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},x))})]});if(o)return d.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 l=(n==null?void 0:n.suites)??[],c=l.reduce((x,b)=>x+b.total,0),h=l.reduce((x,b)=>x+b.passed,0),f=l.reduce((x,b)=>x+b.failed,0),p=l.reduce((x,b)=>x+ur(b),0),g=c-p,y=g>0?h/g:0;return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-2xl font-semibold text-white",children:r}),d.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Category in run: ",t]})]}),d.jsx(eu,{total:c,passed:h,failed:f,passRate:y,executionErrors:p}),l.length===0?d.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:d.jsx("p",{className:"text-lg text-gray-400",children:"No suites in this category"})}):d.jsxs("div",{className:"space-y-3",children:[d.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Suites"}),d.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:l.map(x=>d.jsxs(Ee,{to:"/projects/$projectId/runs/$runId/suite/$suite",params:{projectId:e,runId:t,suite:x.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"truncate text-sm font-medium text-gray-200",children:x.name}),d.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[x.passed,"/",QR(x)]})]}),d.jsx("div",{className:"mt-2",children:d.jsx(fo,{score:x.avg_score})}),d.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[d.jsxs("span",{className:"text-emerald-400",children:[x.passed," passed"]}),x.failed>0&&d.jsxs("span",{className:"text-red-400",children:[x.failed," failed"]}),ur(x)>0&&d.jsxs("span",{className:"text-amber-400",children:[ur(x)," execution errors"]})]})]},x.name))})]})]})}const Joe=c9.update({id:"/settings",path:"/settings",getParentRoute:()=>Yt}),ele=Eie.update({id:"/",path:"/",getParentRoute:()=>Yt}),tle=fL.update({id:"/runs/$runId",path:"/runs/$runId",getParentRoute:()=>Yt}),rle=hL.update({id:"/projects/$projectId",path:"/projects/$projectId",getParentRoute:()=>Yt}),nle=mL.update({id:"/jobs/$runId",path:"/jobs/$runId",getParentRoute:()=>Yt}),ale=zoe.update({id:"/experiments/$experimentName",path:"/experiments/$experimentName",getParentRoute:()=>Yt}),ile=gL.update({id:"/tags/$key/$value",path:"/tags/$key/$value",getParentRoute:()=>Yt}),sle=yL.update({id:"/evals/$runId/$evalId",path:"/evals/$runId/$evalId",getParentRoute:()=>Yt}),ole=vL.update({id:"/runs/$runId_/suite/$suite",path:"/runs/$runId/suite/$suite",getParentRoute:()=>Yt}),lle=xL.update({id:"/runs/$runId_/category/$category",path:"/runs/$runId/category/$category",getParentRoute:()=>Yt}),ule=bL.update({id:"/projects/$projectId_/runs/$runId",path:"/projects/$projectId/runs/$runId",getParentRoute:()=>Yt}),cle=jL.update({id:"/projects/$projectId_/jobs/$runId",path:"/projects/$projectId/jobs/$runId",getParentRoute:()=>Yt}),dle=Voe.update({id:"/projects/$projectId_/experiments/$experimentName",path:"/projects/$projectId/experiments/$experimentName",getParentRoute:()=>Yt}),fle=wL.update({id:"/projects/$projectId_/tags/$key/$value",path:"/projects/$projectId/tags/$key/$value",getParentRoute:()=>Yt}),hle=SL.update({id:"/projects/$projectId_/evals/$runId/$evalId",path:"/projects/$projectId/evals/$runId/$evalId",getParentRoute:()=>Yt}),mle=NL.update({id:"/projects/$projectId_/runs/$runId_/suite/$suite",path:"/projects/$projectId/runs/$runId/suite/$suite",getParentRoute:()=>Yt}),ple=_L.update({id:"/projects/$projectId_/runs/$runId_/category/$category",path:"/projects/$projectId/runs/$runId/category/$category",getParentRoute:()=>Yt}),gle={IndexRoute:ele,SettingsRoute:Joe,ExperimentsExperimentNameRoute:ale,JobsRunIdRoute:nle,ProjectsProjectIdRoute:rle,RunsRunIdRoute:tle,EvalsRunIdEvalIdRoute:sle,TagsKeyValueRoute:ile,ProjectsProjectIdExperimentsExperimentNameRoute:dle,ProjectsProjectIdJobsRunIdRoute:cle,ProjectsProjectIdRunsRunIdRoute:ule,RunsRunIdCategoryCategoryRoute:lle,RunsRunIdSuiteSuiteRoute:ole,ProjectsProjectIdEvalsRunIdEvalIdRoute:hle,ProjectsProjectIdTagsKeyValueRoute:fle,ProjectsProjectIdRunsRunIdCategoryCategoryRoute:ple,ProjectsProjectIdRunsRunIdSuiteSuiteRoute:mle},yle=Yt._addFileChildren(gle)._addFileTypes(),vle=new Cz({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!0}}}),xle=PB({routeTree:yle}),OL=document.getElementById("root");if(!OL)throw new Error("Root element not found");az.createRoot(OL).render(d.jsx(S.StrictMode,{children:d.jsx(Pz,{client:vle,children:d.jsx(DB,{router:xle})})}));export{Ul as W,S as r};
|