agentv 4.17.1 → 4.19.0-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.
@@ -113,4 +113,4 @@ Error generating stack: `+f.message+`
113
113
  *
114
114
  * This source code is licensed under the MIT license found in the
115
115
  * LICENSE file in the root directory of this source tree.
116
- */var BT;function PQ(){if(BT)return Je;BT=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),x=Symbol.for("react.client.reference");function S(w){if(typeof w=="object"&&w!==null){var O=w.$$typeof;switch(O){case e:switch(w=w.type,w){case n:case i:case r:case d:case h:case g:return w;default:switch(w=w&&w.$$typeof,w){case u:case c:case v:case m:return w;case l:return w;default:return O}}case t:return O}}}return Je.ContextConsumer=l,Je.ContextProvider=u,Je.Element=e,Je.ForwardRef=c,Je.Fragment=n,Je.Lazy=v,Je.Memo=m,Je.Portal=t,Je.Profiler=i,Je.StrictMode=r,Je.Suspense=d,Je.SuspenseList=h,Je.isContextConsumer=function(w){return S(w)===l},Je.isContextProvider=function(w){return S(w)===u},Je.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},Je.isForwardRef=function(w){return S(w)===c},Je.isFragment=function(w){return S(w)===n},Je.isLazy=function(w){return S(w)===v},Je.isMemo=function(w){return S(w)===m},Je.isPortal=function(w){return S(w)===t},Je.isProfiler=function(w){return S(w)===i},Je.isStrictMode=function(w){return S(w)===r},Je.isSuspense=function(w){return S(w)===d},Je.isSuspenseList=function(w){return S(w)===h},Je.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===n||w===i||w===r||w===d||w===h||typeof w=="object"&&w!==null&&(w.$$typeof===v||w.$$typeof===m||w.$$typeof===u||w.$$typeof===l||w.$$typeof===c||w.$$typeof===x||w.getModuleId!==void 0)},Je.typeOf=S,Je}var $T;function CQ(){return $T||($T=1,d0.exports=PQ()),d0.exports}var MQ=CQ(),UT=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",qT=null,h0=null,v4=e=>{if(e===qT&&Array.isArray(h0))return h0;var t=[];return j.Children.forEach(e,n=>{ht(n)||(MQ.isFragment(n)?t=t.concat(v4(n.props.children)):t.push(n))}),h0=t,qT=e,t};function RQ(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>UT(i)):r=[UT(t)],v4(e).forEach(i=>{var l=No(i,"type.displayName")||No(i,"type.name");l&&r.indexOf(l)!==-1&&n.push(i)}),n}var p4=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,m0={},HT;function DQ(){return HT||(HT=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const l=n[Symbol.toStringTag];return l==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${l}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(m0)),m0}var v0,KT;function kQ(){return KT||(KT=1,v0=DQ().isPlainObject),v0}var IQ=kQ();const LQ=Vi(IQ);var FT,YT,GT,VT,QT;function XT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ZT(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?XT(Object(n),!0).forEach(function(r){zQ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zQ(e,t,n){return(t=BQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BQ(e){var t=$Q(e,"string");return typeof t=="symbol"?t:t+""}function $Q(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function am(){return am=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},am.apply(null,arguments)}function ac(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var WT=(e,t,n,r,i)=>{var l=n-r,u;return u=gt(FT||(FT=ac(["M ",",",""])),e,t),u+=gt(YT||(YT=ac(["L ",",",""])),e+n,t),u+=gt(GT||(GT=ac(["L ",",",""])),e+n-l/2,t+i),u+=gt(VT||(VT=ac(["L ",",",""])),e+n-l/2-r,t+i),u+=gt(QT||(QT=ac(["L ",","," Z"])),e,t),u},UQ={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},qQ=e=>{var t=an(e,UQ),{x:n,y:r,upperWidth:i,lowerWidth:l,height:u,className:c}=t,{animationEasing:d,animationDuration:h,animationBegin:m,isUpdateAnimationActive:v}=t,g=j.useRef(null),[x,S]=j.useState(-1),w=j.useRef(i),O=j.useRef(l),_=j.useRef(u),A=j.useRef(n),T=j.useRef(r),N=$m(e,"trapezoid-");if(j.useEffect(()=>{if(g.current&&g.current.getTotalLength)try{var te=g.current.getTotalLength();te&&S(te)}catch{}},[]),n!==+n||r!==+r||i!==+i||l!==+l||u!==+u||i===0&&l===0||u===0)return null;var C=Ve("recharts-trapezoid",c);if(!v)return j.createElement("g",null,j.createElement("path",am({},Sn(t),{className:C,d:WT(n,r,i,l,u)})));var M=w.current,R=O.current,z=_.current,B=A.current,D=T.current,H="0px ".concat(x===-1?1:x,"px"),q="".concat(x,"px ").concat(x,"px"),ae=E2(["strokeDasharray"],h,d);return j.createElement(Bm,{animationId:N,key:N,canBegin:x>0,duration:h,easing:d,isActive:v,begin:m},te=>{var re=bt(M,i,te),U=bt(R,l,te),V=bt(z,u,te),ie=bt(B,n,te),oe=bt(D,r,te);g.current&&(w.current=re,O.current=U,_.current=V,A.current=ie,T.current=oe);var ce=te>0?{transition:ae,strokeDasharray:q}:{strokeDasharray:H};return j.createElement("path",am({},Sn(t),{className:C,d:WT(ie,oe,re,U,V),ref:g,style:ZT(ZT({},ce),t.style)}))})},HQ=["option","shapeType","activeClassName","inActiveClassName"];function KQ(e,t){if(e==null)return{};var n,r,i=FQ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function JT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function im(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?JT(Object(n),!0).forEach(function(r){YQ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function YQ(e,t,n){return(t=GQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GQ(e){var t=VQ(e,"string");return typeof t=="symbol"?t:t+""}function VQ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function QQ(e,t){return im(im({},t),e)}function XQ(e,t){return e==="symbols"}function eP(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return j.createElement(P2,n);case"trapezoid":return j.createElement(qQ,n);case"sector":return j.createElement(R2,n);case"symbols":if(XQ(t))return j.createElement(fx,n);break;case"curve":return j.createElement(_2,n);default:return null}}function ZQ(e){return j.isValidElement(e)?e.props:e}function y4(e){var{option:t,shapeType:n,activeClassName:r="recharts-active-shape",inActiveClassName:i="recharts-shape"}=e,l=KQ(e,HQ),u;if(j.isValidElement(t))u=j.cloneElement(t,im(im({},l),ZQ(t)));else if(typeof t=="function")u=t(l,l.index);else if(LQ(t)&&typeof t!="boolean"){var c=QQ(t,l);u=j.createElement(eP,{shapeType:n,elementProps:c})}else{var d=l;u=j.createElement(eP,{shapeType:n,elementProps:d})}return l.isActive?j.createElement(Zn,{className:r},u):j.createElement(Zn,{className:i},u)}var g4=(e,t,n)=>{var r=ut();return(i,l)=>u=>{e==null||e(i,l,u),r(_D({activeIndex:String(l),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},b4=e=>{var t=ut();return(n,r)=>i=>{e==null||e(n,r,i),t(mY())}},x4=(e,t,n)=>{var r=ut();return(i,l)=>u=>{e==null||e(i,l,u),r(vY({activeIndex:String(l),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function S4(e){var{tooltipEntrySettings:t}=e,n=ut(),r=mn(),i=j.useRef(null);return j.useLayoutEffect(()=>{r||(i.current===null?n(cY(t)):i.current!==t&&n(fY({prev:i.current,next:t})),i.current=t)},[t,n,r]),j.useLayoutEffect(()=>()=>{i.current&&(n(dY(i.current)),i.current=null)},[n]),null}function w4(e){var{legendPayload:t}=e,n=ut(),r=mn(),i=j.useRef(null);return j.useLayoutEffect(()=>{r||(i.current===null?n(eq(t)):i.current!==t&&n(tq({prev:i.current,next:t})),i.current=t)},[n,r,t]),j.useLayoutEffect(()=>()=>{i.current&&(n(nq(i.current)),i.current=null)},[n]),null}var p0,WQ=()=>{var[e]=j.useState(()=>Sc("uid-"));return e},JQ=(p0=eL.useId)!==null&&p0!==void 0?p0:WQ;function eX(e,t){var n=JQ();return t||(e?"".concat(e,"-").concat(n):n)}var tX=j.createContext(void 0),j4=e=>{var{id:t,type:n,children:r}=e,i=eX("recharts-".concat(n),t);return j.createElement(tX.Provider,{value:i},r(i))},nX={cartesianItems:[],polarItems:[]},O4=hn({name:"graphicalItems",initialState:nX,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:st()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=pr(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:st()},removeCartesianGraphicalItem:{reducer(e,t){var n=pr(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:st()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:st()},removePolarGraphicalItem:{reducer(e,t){var n=pr(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:st()},replacePolarGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=pr(e).polarItems.indexOf(n);i>-1&&(e.polarItems[i]=r)},prepare:st()}}}),{addCartesianGraphicalItem:rX,replaceCartesianGraphicalItem:aX,removeCartesianGraphicalItem:iX,addPolarGraphicalItem:Ene,removePolarGraphicalItem:Ane,replacePolarGraphicalItem:Nne}=O4.actions,sX=O4.reducer,lX=e=>{var t=ut(),n=j.useRef(null);return j.useLayoutEffect(()=>{n.current===null?t(rX(e)):n.current!==e&&t(aX({prev:n.current,next:e})),n.current=e},[t,e]),j.useLayoutEffect(()=>()=>{n.current&&(t(iX(n.current)),n.current=null)},[t]),null},_4=j.memo(lX),oX=["points"];function tP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function y0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tP(Object(n),!0).forEach(function(r){uX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function uX(e,t,n){return(t=cX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cX(e){var t=fX(e,"string");return typeof t=="symbol"?t:t+""}function fX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sm(){return sm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sm.apply(null,arguments)}function dX(e,t){if(e==null)return{};var n,r,i=hX(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function hX(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function mX(e){var{option:t,dotProps:n,className:r}=e;if(j.isValidElement(t))return j.cloneElement(t,n);if(typeof t=="function")return t(n);var i=Ve(r,typeof t!="boolean"?t.className:""),l=n??{},{points:u}=l,c=dX(l,oX);return j.createElement(h4,sm({},c,{className:i}))}function vX(e,t){return e==null?!1:t?!0:e.length===1}function pX(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:l,baseProps:u,needClip:c,clipPathId:d,zIndex:h=Ht.scatter}=e;if(!vX(t,n))return null;var m=p4(n),v=$B(n),g=t.map((S,w)=>{var O,_,A=y0(y0(y0({r:3},u),v),{},{index:w,cx:(O=S.x)!==null&&O!==void 0?O:void 0,cy:(_=S.y)!==null&&_!==void 0?_:void 0,dataKey:l,value:S.value,payload:S.payload,points:t});return j.createElement(mX,{key:"dot-".concat(w),option:n,dotProps:A,className:i})}),x={};return c&&d!=null&&(x.clipPath="url(#clipPath-".concat(m?"":"dots-").concat(d,")")),j.createElement(Sr,{zIndex:h},j.createElement(Zn,sm({className:r},x),g))}function nP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nP(Object(n),!0).forEach(function(r){yX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yX(e,t,n){return(t=gX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gX(e){var t=bX(e,"string");return typeof t=="symbol"?t:t+""}function bX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var E4=0,xX={xAxis:{},yAxis:{},zAxis:{}},A4=hn({name:"cartesianAxis",initialState:xX,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:st()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.xAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=r)},prepare:st()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:st()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:st()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.yAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=r)},prepare:st()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:st()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:st()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.zAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=r)},prepare:st()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:st()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var l,u=i.widthHistory||[];if(u.length===3&&u[0]===u[2]&&r===u[1]&&r!==i.width&&Math.abs(r-((l=u[0])!==null&&l!==void 0?l:0))<=1)return;var c=[...u,r].slice(-3);e.yAxis[n]=rP(rP({},i),{},{width:r,widthHistory:c})}}}}),{addXAxis:SX,replaceXAxis:wX,removeXAxis:jX,addYAxis:OX,replaceYAxis:_X,removeYAxis:EX,addZAxis:Tne,replaceZAxis:Pne,removeZAxis:Cne,updateYAxisWidth:AX}=A4.actions,NX=A4.reducer,TX=G([Kt],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),PX=G([TX,Fa,Ya],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),M1=()=>ge(PX),CX=()=>ge(cG);function aP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function g0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aP(Object(n),!0).forEach(function(r){MX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function MX(e,t,n){return(t=RX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function RX(e){var t=DX(e,"string");return typeof t=="symbol"?t:t+""}function DX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var kX=e=>{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:l,clipPath:u}=e;if(i===!1||t.x==null||t.y==null)return null;var c={index:n,dataKey:l,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},d=g0(g0(g0({},c),Kc(i)),dx(i)),h;return j.isValidElement(i)?h=j.cloneElement(i,d):typeof i=="function"?h=i(d):h=j.createElement(h4,d),j.createElement(Zn,{className:"recharts-active-dot",clipPath:u},h)};function IX(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:l,zIndex:u=Ht.activeDot}=e,c=ge(Js),d=CX();if(t==null||d==null)return null;var h=t.find(m=>d.includes(m.payload));return ht(h)?null:j.createElement(Sr,{zIndex:u},j.createElement(kX,{point:h,childIndex:Number(c),mainColor:n,dataKey:i,activeDot:r,clipPath:l}))}var iP=(e,t,n)=>{var r=n??e;if(!ht(r))return Cr(r,t,0)},LX=(e,t,n)=>{var r={},i=e.filter(Ym),l=e.filter(h=>h.stackId==null),u=i.reduce((h,m)=>{var v=h[m.stackId];return v==null&&(v=[]),v.push(m),h[m.stackId]=v,h},r),c=Object.entries(u).map(h=>{var m,[v,g]=h,x=g.map(w=>w.dataKey),S=iP(t,n,(m=g[0])===null||m===void 0?void 0:m.barSize);return{stackId:v,dataKeys:x,barSize:S}}),d=l.map(h=>{var m=[h.dataKey].filter(g=>g!=null),v=iP(t,n,h.barSize);return{stackId:void 0,dataKeys:m,barSize:v}});return[...c,...d]};function sP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sP(Object(n),!0).forEach(function(r){zX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zX(e,t,n){return(t=BX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BX(e){var t=$X(e,"string");return typeof t=="symbol"?t:t+""}function $X(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function UX(e,t,n,r,i){var l,u=r.length;if(!(u<1)){var c=Cr(e,n,0,!0),d,h=[];if($e((l=r[0])===null||l===void 0?void 0:l.barSize)){var m=!1,v=n/u,g=r.reduce((A,T)=>A+(T.barSize||0),0);g+=(u-1)*c,g>=n&&(g-=(u-1)*c,c=0),g>=n&&v>0&&(m=!0,v*=.9,g=u*v);var x=(n-g)/2>>0,S={offset:x-c,size:0};d=r.reduce((A,T)=>{var N,C={stackId:T.stackId,dataKeys:T.dataKeys,position:{offset:S.offset+S.size+c,size:m?v:(N=T.barSize)!==null&&N!==void 0?N:0}},M=[...A,C];return S=C.position,M},h)}else{var w=Cr(t,n,0,!0);n-2*w-(u-1)*c<=0&&(c=0);var O=(n-2*w-(u-1)*c)/u;O>1&&(O>>=0);var _=$e(i)?Math.min(O,i):O;d=r.reduce((A,T,N)=>[...A,{stackId:T.stackId,dataKeys:T.dataKeys,position:{offset:w+(O+c)*N+(O-_)/2,size:_}}],h)}return d}}var qX=(e,t,n,r,i,l,u)=>{var c=ht(u)?t:u,d=UX(n,r,i!==l?i:l,e,c);return i!==l&&d!=null&&(d=d.map(h=>Gd(Gd({},h),{},{position:Gd(Gd({},h.position),{},{offset:h.position.offset-i/2})}))),d},HX=(e,t)=>{var n=Bx(t);if(!(!e||n==null||t==null)){var{stackId:r}=t;if(r!=null){var i=e[r];if(i){var{stackedData:l}=i;if(l)return l.find(u=>u.key===n)}}}},KX=(e,t)=>{if(!(e==null||t==null)){var n=e.find(r=>r.stackId===t.stackId&&t.dataKey!=null&&r.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function FX(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&$e(e.zIndex)?e.zIndex:t}var YX=e=>{var{chartData:t}=e,n=ut(),r=mn();return j.useEffect(()=>r?()=>{}:(n(xT(t)),()=>{n(xT(void 0))}),[t,n,r]),null},lP={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},N4=hn({name:"brush",initialState:lP,reducers:{setBrushSettings(e,t){return t.payload==null?lP:t.payload}}}),{setBrushSettings:Mne}=N4.actions,GX=N4.reducer;function VX(e){return(e%180+180)%180}var QX=function(t){var{width:n,height:r}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,l=VX(i),u=l*Math.PI/180,c=Math.atan(r/n),d=u>c&&u<Math.PI-c?r/Math.sin(u):n/Math.cos(u);return Math.abs(d)},XX={dots:[],areas:[],lines:[]},T4=hn({name:"referenceElements",initialState:XX,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=pr(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=pr(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=pr(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:Rne,removeDot:Dne,addArea:kne,removeArea:Ine,addLine:Lne,removeLine:zne}=T4.actions,ZX=T4.reducer,WX=j.createContext(void 0),JX=e=>{var{children:t}=e,[n]=j.useState("".concat(Sc("recharts"),"-clip")),r=M1();if(r==null)return null;var{x:i,y:l,width:u,height:c}=r;return j.createElement(WX.Provider,{value:n},j.createElement("defs",null,j.createElement("clipPath",{id:n},j.createElement("rect",{x:i,y:l,height:c,width:u}))),t)};function P4(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];i!==void 0&&n.push(i)}return n}function eZ(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return QX(r,n)}function tZ(e,t,n){var r=n==="width",{x:i,y:l,width:u,height:c}=e;return t===1?{start:r?i:l,end:r?i+u:l+c}:{start:r?i+u:l+c,end:r?i:l}}function kc(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var l=n();return e*(t-e*l/2-r)>=0&&e*(t+e*l/2-i)<=0}function nZ(e,t){return P4(e,t+1)}function rZ(e,t,n,r,i){for(var l=(r||[]).slice(),{start:u,end:c}=t,d=0,h=1,m=u,v=function(){var S=r==null?void 0:r[d];if(S===void 0)return{v:P4(r,h)};var w=d,O,_=()=>(O===void 0&&(O=n(S,w)),O),A=S.coordinate,T=d===0||kc(e,A,_,m,c);T||(d=0,m=u,h+=1),T&&(m=A+e*(_()/2+i),d+=h)},g;h<=l.length;)if(g=v(),g)return g.v;return[]}function aZ(e,t,n,r,i){var l=(r||[]).slice(),u=l.length;if(u===0)return[];for(var{start:c,end:d}=t,h=1;h<=u;h++){for(var m=(u-1)%h,v=c,g=!0,x=function(){var N=r[w];if(N==null)return 0;var C=w,M,R=()=>(M===void 0&&(M=n(N,C)),M),z=N.coordinate,B=w===m||kc(e,z,R,v,d);if(!B)return g=!1,1;B&&(v=z+e*(R()/2+i))},S,w=m;w<u&&(S=x(),!(S!==0&&S===1));w+=h);if(g){for(var O=[],_=m;_<u;_+=h){var A=r[_];A!=null&&O.push(A)}return O}}return[]}function oP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function cn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oP(Object(n),!0).forEach(function(r){iZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function iZ(e,t,n){return(t=sZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sZ(e){var t=lZ(e,"string");return typeof t=="symbol"?t:t+""}function lZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oZ(e,t,n,r,i){for(var l=(r||[]).slice(),u=l.length,{start:c}=t,{end:d}=t,h=function(g){var x=l[g];if(x==null)return 1;var S=x,w,O=()=>(w===void 0&&(w=n(x,g)),w);if(g===u-1){var _=e*(S.coordinate+e*O()/2-d);l[g]=S=cn(cn({},S),{},{tickCoord:_>0?S.coordinate-_*e:S.coordinate})}else l[g]=S=cn(cn({},S),{},{tickCoord:S.coordinate});if(S.tickCoord!=null){var A=kc(e,S.tickCoord,O,c,d);A&&(d=S.tickCoord-e*(O()/2+i),l[g]=cn(cn({},S),{},{isShow:!0}))}},m=u-1;m>=0;m--)h(m);return l}function uZ(e,t,n,r,i,l){var u=(r||[]).slice(),c=u.length,{start:d,end:h}=t;if(l){var m=r[c-1];if(m!=null){var v=n(m,c-1),g=e*(m.coordinate+e*v/2-h);if(u[c-1]=m=cn(cn({},m),{},{tickCoord:g>0?m.coordinate-g*e:m.coordinate}),m.tickCoord!=null){var x=kc(e,m.tickCoord,()=>v,d,h);x&&(h=m.tickCoord-e*(v/2+i),u[c-1]=cn(cn({},m),{},{isShow:!0}))}}}for(var S=l?c-1:c,w=function(A){var T=u[A];if(T==null)return 1;var N=T,C,M=()=>(C===void 0&&(C=n(T,A)),C);if(A===0){var R=e*(N.coordinate-e*M()/2-d);u[A]=N=cn(cn({},N),{},{tickCoord:R<0?N.coordinate-R*e:N.coordinate})}else u[A]=N=cn(cn({},N),{},{tickCoord:N.coordinate});if(N.tickCoord!=null){var z=kc(e,N.tickCoord,M,d,h);z&&(d=N.tickCoord+e*(M()/2+i),u[A]=cn(cn({},N),{},{isShow:!0}))}},O=0;O<S;O++)w(O);return u}function R1(e,t,n){var{tick:r,ticks:i,viewBox:l,minTickGap:u,orientation:c,interval:d,tickFormatter:h,unit:m,angle:v}=e;if(!i||!i.length||!r)return[];if(pe(d)||Zc.isSsr){var g;return(g=nZ(i,pe(d)?d:0))!==null&&g!==void 0?g:[]}var x=[],S=c==="top"||c==="bottom"?"width":"height",w=m&&S==="width"?mc(m,{fontSize:t,letterSpacing:n}):{width:0,height:0},O=(C,M)=>{var R=typeof h=="function"?h(C.value,M):C.value;return S==="width"?eZ(mc(R,{fontSize:t,letterSpacing:n}),w,v):mc(R,{fontSize:t,letterSpacing:n})[S]},_=i[0],A=i[1],T=i.length>=2&&_!=null&&A!=null?kn(A.coordinate-_.coordinate):1,N=tZ(l,T,S);return d==="equidistantPreserveStart"?rZ(T,N,O,i,u):d==="equidistantPreserveEnd"?aZ(T,N,O,i,u):(d==="preserveStart"||d==="preserveStartEnd"?x=uZ(T,N,O,i,u,d==="preserveStartEnd"):x=oZ(T,N,O,i,u),x.filter(C=>C.isShow))}var cZ=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:l=0}=e,u=0;if(t){Array.from(t).forEach(m=>{if(m){var v=m.getBoundingClientRect();v.width>u&&(u=v.width)}});var c=n?n.getBoundingClientRect().width:0,d=i+l,h=u+d+c+(n?r:0);return Math.round(h)}return 0},fZ={xAxis:{},yAxis:{}},C4=hn({name:"renderedTicks",initialState:fZ,reducers:{setRenderedTicks:(e,t)=>{var{axisType:n,axisId:r,ticks:i}=t.payload;e[n][r]=i},removeRenderedTicks:(e,t)=>{var{axisType:n,axisId:r}=t.payload;delete e[n][r]}}}),{setRenderedTicks:dZ,removeRenderedTicks:hZ}=C4.actions,mZ=C4.reducer,vZ=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function pZ(e,t){if(e==null)return{};var n,r,i=yZ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function yZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function el(){return el=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},el.apply(null,arguments)}function uP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uP(Object(n),!0).forEach(function(r){gZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function gZ(e,t,n){return(t=bZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bZ(e){var t=xZ(e,"string");return typeof t=="symbol"?t:t+""}function xZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;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:Ht.axis};function SZ(e){var{x:t,y:n,width:r,height:i,orientation:l,mirror:u,axisLine:c,otherSvgProps:d}=e;if(!c)return null;var h=yt(yt(yt({},d),Pr(c)),{},{fill:"none"});if(l==="top"||l==="bottom"){var m=+(l==="top"&&!u||l==="bottom"&&u);h=yt(yt({},h),{},{x1:t,y1:n+m*i,x2:t+r,y2:n+m*i})}else{var v=+(l==="left"&&!u||l==="right"&&u);h=yt(yt({},h),{},{x1:t+v*r,y1:n,x2:t+v*r,y2:n+i})}return j.createElement("line",el({},h,{className:Ve("recharts-cartesian-axis-line",No(c,"className"))}))}function wZ(e,t,n,r,i,l,u,c,d){var h,m,v,g,x,S,w=c?-1:1,O=e.tickSize||u,_=pe(e.tickCoord)?e.tickCoord:e.coordinate;switch(l){case"top":h=m=e.coordinate,g=n+ +!c*i,v=g-w*O,S=v-w*d,x=_;break;case"left":v=g=e.coordinate,m=t+ +!c*r,h=m-w*O,x=h-w*d,S=_;break;case"right":v=g=e.coordinate,m=t+ +c*r,h=m+w*O,x=h+w*d,S=_;break;default:h=m=e.coordinate,g=n+ +c*i,v=g+w*O,S=v+w*d,x=_;break}return{line:{x1:h,y1:v,x2:m,y2:g},tick:{x,y:S}}}function jZ(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function OZ(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function _Z(e){var{option:t,tickProps:n,value:r}=e,i,l=Ve(n.className,"recharts-cartesian-axis-tick-value");if(j.isValidElement(t))i=j.cloneElement(t,yt(yt({},n),{},{className:l}));else if(typeof t=="function")i=t(yt(yt({},n),{},{className:l}));else{var u="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(u=Ve(u,TQ(t))),i=j.createElement(P1,el({},n,{className:u}),r)}return i}function EZ(e){var{ticks:t,axisType:n,axisId:r}=e,i=ut();return j.useEffect(()=>{if(r==null||n==null)return rl;var l=t.map(u=>({value:u.value,coordinate:u.coordinate,offset:u.offset,index:u.index}));return i(dZ({ticks:l,axisId:r,axisType:n})),()=>{i(hZ({axisId:r,axisType:n}))}},[i,t,r,n]),null}var AZ=j.forwardRef((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:l,tickFormatter:u,unit:c,padding:d,tickTextProps:h,orientation:m,mirror:v,x:g,y:x,width:S,height:w,tickSize:O,tickMargin:_,fontSize:A,letterSpacing:T,getTicksConfig:N,events:C,axisType:M,axisId:R}=e,z=R1(yt(yt({},N),{},{ticks:n}),A,T),B=Pr(N),D=Kc(r),H=r4(B.textAnchor)?B.textAnchor:jZ(m,v),q=OZ(m,v),ae={};typeof i=="object"&&(ae=i);var te=yt(yt({},B),{},{fill:"none"},ae),re=z.map(ie=>yt({entry:ie},wZ(ie,g,x,S,w,m,O,v,_))),U=re.map(ie=>{var{entry:oe,line:ce}=ie;return j.createElement(Zn,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(oe.value,"-").concat(oe.coordinate,"-").concat(oe.tickCoord)},i&&j.createElement("line",el({},te,ce,{className:Ve("recharts-cartesian-axis-tick-line",No(i,"className"))})))}),V=re.map((ie,oe)=>{var ce,I,{entry:Z,tick:se}=ie,X=yt(yt(yt(yt({verticalAnchor:q},B),{},{textAnchor:H,stroke:"none",fill:l},se),{},{index:oe,payload:Z,visibleTicksCount:z.length,tickFormatter:u,padding:d},h),{},{angle:(ce=(I=h==null?void 0:h.angle)!==null&&I!==void 0?I:B.angle)!==null&&ce!==void 0?ce:0}),ve=yt(yt({},X),D);return j.createElement(Zn,el({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(Z.value,"-").concat(Z.coordinate,"-").concat(Z.tickCoord)},bm(C,Z,oe)),r&&j.createElement(_Z,{option:r,tickProps:ve,value:"".concat(typeof u=="function"?u(Z.value,oe):Z.value).concat(c||"")}))});return j.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(M,"-ticks")},j.createElement(EZ,{ticks:z,axisId:R,axisType:M}),V.length>0&&j.createElement(Sr,{zIndex:Ht.label},j.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(M,"-tick-labels"),ref:t},V)),U.length>0&&j.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(M,"-tick-lines")},U))}),NZ=j.forwardRef((e,t)=>{var{axisLine:n,width:r,height:i,className:l,hide:u,ticks:c,axisType:d,axisId:h}=e,m=pZ(e,vZ),[v,g]=j.useState(""),[x,S]=j.useState(""),w=j.useRef(null);j.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var _;return cZ({ticks:w.current,label:(_=e.labelRef)===null||_===void 0?void 0:_.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var O=j.useCallback(_=>{if(_){var A=_.getElementsByClassName("recharts-cartesian-axis-tick-value");w.current=A;var T=A[0];if(T){var N=window.getComputedStyle(T),C=N.fontSize,M=N.letterSpacing;(C!==v||M!==x)&&(g(C),S(M))}}},[v,x]);return u||r!=null&&r<=0||i!=null&&i<=0?null:j.createElement(Sr,{zIndex:e.zIndex},j.createElement(Zn,{className:Ve("recharts-cartesian-axis",l)},j.createElement(SZ,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:Pr(e)}),j.createElement(AZ,{ref:O,axisType:d,events:m,fontSize:v,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:h}),j.createElement(cQ,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},j.createElement(xQ,{label:e.label,labelRef:e.labelRef}),e.children)))}),D1=j.forwardRef((e,t)=>{var n=an(e,ka);return j.createElement(NZ,el({},n,{ref:t}))});D1.displayName="CartesianAxis";var TZ=["x1","y1","x2","y2","key"],PZ=["offset"],CZ=["xAxisId","yAxisId"],MZ=["xAxisId","yAxisId"];function cP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function fn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cP(Object(n),!0).forEach(function(r){RZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function RZ(e,t,n){return(t=DZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DZ(e){var t=kZ(e,"string");return typeof t=="symbol"?t:t+""}function kZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ts(){return Ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ts.apply(null,arguments)}function lm(e,t){if(e==null)return{};var n,r,i=IZ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function IZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var LZ=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:n,x:r,y:i,width:l,height:u,ry:c}=e;return j.createElement("rect",{x:r,y:i,ry:c,width:l,height:u,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function M4(e){var{option:t,lineItemProps:n}=e,r;if(j.isValidElement(t))r=j.cloneElement(t,n);else if(typeof t=="function")r=t(n);else{var i,{x1:l,y1:u,x2:c,y2:d,key:h}=n,m=lm(n,TZ),v=(i=Pr(m))!==null&&i!==void 0?i:{},{offset:g}=v,x=lm(v,PZ);r=j.createElement("line",Ts({},x,{x1:l,y1:u,x2:c,y2:d,fill:"none",key:h}))}return r}function zZ(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:l,yAxisId:u}=e,c=lm(e,CZ),d=i.map((h,m)=>{var v=fn(fn({},c),{},{x1:t,y1:h,x2:t+n,y2:h,key:"line-".concat(m),index:m});return j.createElement(M4,{key:"line-".concat(m),option:r,lineItemProps:v})});return j.createElement("g",{className:"recharts-cartesian-grid-horizontal"},d)}function BZ(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:l,yAxisId:u}=e,c=lm(e,MZ),d=i.map((h,m)=>{var v=fn(fn({},c),{},{x1:h,y1:t,x2:h,y2:t+n,key:"line-".concat(m),index:m});return j.createElement(M4,{option:r,lineItemProps:v,key:"line-".concat(m)})});return j.createElement("g",{className:"recharts-cartesian-grid-vertical"},d)}function $Z(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:l,height:u,horizontalPoints:c,horizontal:d=!0}=e;if(!d||!t||!t.length||c==null)return null;var h=c.map(v=>Math.round(v+i-i)).sort((v,g)=>v-g);i!==h[0]&&h.unshift(0);var m=h.map((v,g)=>{var x=h[g+1],S=x==null,w=S?i+u-v:x-v;if(w<=0)return null;var O=g%t.length;return j.createElement("rect",{key:"react-".concat(g),y:v,x:r,height:w,width:l,stroke:"none",fill:t[O],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return j.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},m)}function UZ(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:l,width:u,height:c,verticalPoints:d}=e;if(!t||!n||!n.length)return null;var h=d.map(v=>Math.round(v+i-i)).sort((v,g)=>v-g);i!==h[0]&&h.unshift(0);var m=h.map((v,g)=>{var x=h[g+1],S=x==null,w=S?i+u-v:x-v;if(w<=0)return null;var O=g%n.length;return j.createElement("rect",{key:"react-".concat(g),x:v,y:l,width:w,height:c,stroke:"none",fill:n[O],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return j.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},m)}var qZ=(e,t)=>{var{xAxis:n,width:r,height:i,offset:l}=e;return s2(R1(fn(fn(fn({},ka),n),{},{ticks:l2(n),viewBox:{x:0,y:0,width:r,height:i}})),l.left,l.left+l.width,t)},HZ=(e,t)=>{var{yAxis:n,width:r,height:i,offset:l}=e;return s2(R1(fn(fn(fn({},ka),n),{},{ticks:l2(n),viewBox:{x:0,y:0,width:r,height:i}})),l.top,l.top+l.height,t)},KZ={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ht.grid};function iv(e){var t=_x(),n=Ex(),r=d2(),i=fn(fn({},an(e,KZ)),{},{x:pe(e.x)?e.x:r.left,y:pe(e.y)?e.y:r.top,width:pe(e.width)?e.width:r.width,height:pe(e.height)?e.height:r.height}),{xAxisId:l,yAxisId:u,x:c,y:d,width:h,height:m,syncWithTicks:v,horizontalValues:g,verticalValues:x}=i,S=mn(),w=ge(B=>lT(B,"xAxis",l,S)),O=ge(B=>lT(B,"yAxis",u,S));if(!ta(h)||!ta(m)||!pe(c)||!pe(d))return null;var _=i.verticalCoordinatesGenerator||qZ,A=i.horizontalCoordinatesGenerator||HZ,{horizontalPoints:T,verticalPoints:N}=i;if((!T||!T.length)&&typeof A=="function"){var C=g&&g.length,M=A({yAxis:O?fn(fn({},O),{},{ticks:C?g:O.ticks}):void 0,width:t??h,height:n??m,offset:r},C?!0:v);Mh(Array.isArray(M),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof M,"]")),Array.isArray(M)&&(T=M)}if((!N||!N.length)&&typeof _=="function"){var R=x&&x.length,z=_({xAxis:w?fn(fn({},w),{},{ticks:R?x:w.ticks}):void 0,width:t??h,height:n??m,offset:r},R?!0:v);Mh(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof z,"]")),Array.isArray(z)&&(N=z)}return j.createElement(Sr,{zIndex:i.zIndex},j.createElement("g",{className:"recharts-cartesian-grid"},j.createElement(LZ,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),j.createElement($Z,Ts({},i,{horizontalPoints:T})),j.createElement(UZ,Ts({},i,{verticalPoints:N})),j.createElement(zZ,Ts({},i,{offset:r,horizontalPoints:T,xAxis:w,yAxis:O})),j.createElement(BZ,Ts({},i,{offset:r,verticalPoints:N,xAxis:w,yAxis:O}))))}iv.displayName="CartesianGrid";var FZ={},R4=hn({name:"errorBars",initialState:FZ,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(l=>l.dataKey===r.dataKey&&l.direction===r.direction?i:l))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:Bne,replaceErrorBar:$ne,removeErrorBar:Une}=R4.actions,YZ=R4.reducer,GZ=["children"];function VZ(e,t){if(e==null)return{};var n,r,i=QZ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function QZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var XZ={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},ZZ=j.createContext(XZ);function D4(e){var{children:t}=e,n=VZ(e,GZ);return j.createElement(ZZ.Provider,{value:n},t)}function k1(e,t){var n,r,i=ge(h=>Va(h,e)),l=ge(h=>Qa(h,t)),u=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:Rt.allowDataOverflow,c=(r=l==null?void 0:l.allowDataOverflow)!==null&&r!==void 0?r:Dt.allowDataOverflow,d=u||c;return{needClip:d,needClipX:u,needClipY:c}}function k4(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=M1(),{needClipX:l,needClipY:u,needClip:c}=k1(t,n);if(!c||!i)return null;var{x:d,y:h,width:m,height:v}=i;return j.createElement("clipPath",{id:"clipPath-".concat(r)},j.createElement("rect",{x:l?d:d-m/2,y:u?h:h-v/2,width:l?m:m*2,height:u?v:v*2}))}var I4=(e,t,n,r)=>Yi(e,"xAxis",t,r),L4=(e,t,n,r)=>Fi(e,"xAxis",t,r),z4=(e,t,n,r)=>Yi(e,"yAxis",n,r),B4=(e,t,n,r)=>Fi(e,"yAxis",n,r),WZ=G([Qe,I4,z4,L4,B4],(e,t,n,r,i)=>Ka(e,"xAxis")?Po(t,r,!1):Po(n,i,!1)),JZ=(e,t,n,r,i)=>i;function eW(e){return e.type==="line"}var tW=G([tv,JZ],(e,t)=>e.filter(eW).find(n=>n.id===t)),nW=G([Qe,I4,z4,L4,B4,tW,WZ,Wc],(e,t,n,r,i,l,u,c)=>{var{chartData:d,dataStartIndex:h,dataEndIndex:m}=c;if(!(l==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||u==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:v,data:g}=l,x;if(g!=null&&g.length>0?x=g:x=d==null?void 0:d.slice(h,m+1),x!=null)return jW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:v,bandSize:u,displayedData:x})}});function rW(e){var t=Kc(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:l}=t,u=Number(i),c=Number(l);return(Number.isNaN(u)||u<0)&&(u=n),(Number.isNaN(c)||c<0)&&(c=r),{r:u,strokeWidth:c}}return{r:n,strokeWidth:r}}var aW=["id"],iW=["type","layout","connectNulls","needClip","shape"],sW=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Ic(){return Ic=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ic.apply(null,arguments)}function fP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Vr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fP(Object(n),!0).forEach(function(r){lW(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function lW(e,t,n){return(t=oW(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oW(e){var t=uW(e,"string");return typeof t=="symbol"?t:t+""}function uW(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function I1(e,t){if(e==null)return{};var n,r,i=cW(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function cW(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var fW=e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:l}=e;return[{inactive:l,dataKey:t,type:i,color:r,value:Pm(n,t),payload:e}]},dW=j.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:l,name:u,hide:c,unit:d,tooltipType:h,id:m}=e,v={dataDefinedOnItem:n,getPosition:rl,settings:{stroke:r,strokeWidth:i,fill:l,dataKey:t,nameKey:void 0,name:Pm(u,t),hide:c,type:h,color:r,unit:d,graphicalItemId:m}};return j.createElement(S4,{tooltipEntrySettings:v})}),$4=(e,t)=>"".concat(t,"px ").concat(e,"px");function hW(e,t){for(var n=e.length%2!==0?[...e,0]:e,r=[],i=0;i<t;++i)r.push(...n);return r}var mW=(e,t,n)=>{var r=n.reduce((g,x)=>g+x,0);if(!r)return $4(t,e);for(var i=Math.floor(e/r),l=e%r,u=[],c=0,d=0;c<n.length;d+=(h=n[c])!==null&&h!==void 0?h:0,++c){var h,m=n[c];if(m!=null&&d+m>l){u=[...n.slice(0,c),l-d];break}}var v=u.length%2===0?[0,t]:[t];return[...hW(n,i),...u,...v].map(g=>"".concat(g,"px")).join(", ")};function vW(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:l,needClip:u}=r,{id:c}=r,d=I1(r,aW),h=Pr(d);return j.createElement(pX,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:l,baseProps:h,needClip:u,clipPathId:t})}function pW(e){var{showLabels:t,children:n,points:r}=e,i=j.useMemo(()=>r==null?void 0:r.map(l=>{var u,c,d={x:(u=l.x)!==null&&u!==void 0?u:0,y:(c=l.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Vr(Vr({},d),{},{value:l.value,payload:l.payload,viewBox:d,parentViewBox:void 0,fill:void 0})}),[r]);return j.createElement(c4,{value:t?i:void 0},n)}function dP(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:l}=e,{type:u,layout:c,connectNulls:d,needClip:h,shape:m}=l,v=I1(l,iW),g=Vr(Vr({},Sn(v)),{},{fill:"none",className:"recharts-line-curve",clipPath:h?"url(#clipPath-".concat(t,")"):void 0,points:r,type:u,layout:c,connectNulls:d,strokeDasharray:i??l.strokeDasharray});return j.createElement(j.Fragment,null,(r==null?void 0:r.length)>1&&j.createElement(y4,Ic({shapeType:"curve",option:m},g,{pathRef:n})),j.createElement(vW,{points:r,clipPathId:t,props:l}))}function yW(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function gW(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:l}=e,{points:u,strokeDasharray:c,isAnimationActive:d,animationBegin:h,animationDuration:m,animationEasing:v,animateNewValues:g,width:x,height:S,onAnimationEnd:w,onAnimationStart:O}=n,_=i.current,A=$m(u,"recharts-line-"),T=j.useRef(A),[N,C]=j.useState(!1),M=!N,R=j.useCallback(()=>{typeof w=="function"&&w(),C(!1)},[w]),z=j.useCallback(()=>{typeof O=="function"&&O(),C(!0)},[O]),B=yW(r.current),D=j.useRef(0);T.current!==A&&(D.current=l.current,T.current=A);var H=D.current;return j.createElement(pW,{points:u,showLabels:M},n.children,j.createElement(Bm,{animationId:A,begin:h,duration:m,isActive:d,easing:v,onAnimationEnd:R,onAnimationStart:z,key:A},q=>{var ae=bt(H,B+H,q),te=Math.min(ae,B),re;if(d)if(c){var U="".concat(c).split(/[,\s]+/gim).map(oe=>parseFloat(oe));re=mW(te,B,U)}else re=$4(B,te);else re=c==null?void 0:String(c);if(q>0&&B>0&&(i.current=u,l.current=Math.max(l.current,te)),_){var V=_.length/u.length,ie=q===1?u:u.map((oe,ce)=>{var I=Math.floor(ce*V);if(_[I]){var Z=_[I];return Vr(Vr({},oe),{},{x:bt(Z.x,oe.x,q),y:bt(Z.y,oe.y,q)})}return g?Vr(Vr({},oe),{},{x:bt(x*2,oe.x,q),y:bt(S/2,oe.y,q)}):Vr(Vr({},oe),{},{x:oe.x,y:oe.y})});return i.current=ie,j.createElement(dP,{props:n,points:ie,clipPathId:t,pathRef:r,strokeDasharray:re})}return j.createElement(dP,{props:n,points:u,clipPathId:t,pathRef:r,strokeDasharray:re})}),j.createElement(d4,{label:n.label}))}function bW(e){var{clipPathId:t,props:n}=e,r=j.useRef(null),i=j.useRef(0),l=j.useRef(null);return j.createElement(gW,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:l})}var xW=(e,t)=>{var n,r;return{x:(n=e.x)!==null&&n!==void 0?n:void 0,y:(r=e.y)!==null&&r!==void 0?r:void 0,value:e.value,errorVal:jt(e.payload,t)}};class SW extends j.Component{render(){var{hide:t,dot:n,points:r,className:i,xAxisId:l,yAxisId:u,top:c,left:d,width:h,height:m,id:v,needClip:g,zIndex:x}=this.props;if(t)return null;var S=Ve("recharts-line",i),w=v,{r:O,strokeWidth:_}=rW(n),A=p4(n),T=O*2+_,N=g?"url(#clipPath-".concat(A?"":"dots-").concat(w,")"):void 0;return j.createElement(Sr,{zIndex:x},j.createElement(Zn,{className:S},g&&j.createElement("defs",null,j.createElement(k4,{clipPathId:w,xAxisId:l,yAxisId:u}),!A&&j.createElement("clipPath",{id:"clipPath-dots-".concat(w)},j.createElement("rect",{x:d-T/2,y:c-T/2,width:h+T,height:m+T}))),j.createElement(D4,{xAxisId:l,yAxisId:u,data:r,dataPointFormatter:xW,errorBarOffset:0},j.createElement(bW,{props:this.props,clipPathId:w}))),j.createElement(IX,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:N}))}}var U4={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:Ht.line,type:"linear"};function wW(e){var t=an(e,U4),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:l,animationEasing:u,connectNulls:c,dot:d,hide:h,isAnimationActive:m,label:v,legendType:g,xAxisId:x,yAxisId:S,id:w}=t,O=I1(t,sW),{needClip:_}=k1(x,S),A=M1(),T=al(),N=mn(),C=ge(D=>nW(D,x,S,N,w));if(T!=="horizontal"&&T!=="vertical"||C==null||A==null)return null;var{height:M,width:R,x:z,y:B}=A;return j.createElement(SW,Ic({},O,{id:w,connectNulls:c,dot:d,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:l,animationEasing:u,isAnimationActive:m,hide:h,label:v,legendType:g,xAxisId:x,yAxisId:S,points:C,layout:T,height:M,width:R,left:z,top:B,needClip:_}))}function jW(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:l,dataKey:u,bandSize:c,displayedData:d}=e;return d.map((h,m)=>{var v=jt(h,u);if(t==="horizontal"){var g=JE({axis:n,ticks:i,bandSize:c,entry:h,index:m}),x=ht(v)?null:r.scale.map(v);return{x:g,y:x??null,value:v,payload:h}}var S=ht(v)?null:n.scale.map(v),w=JE({axis:r,ticks:l,bandSize:c,entry:h,index:m});return S==null||w==null?null:{x:S,y:w,value:v,payload:h}}).filter(Boolean)}function OW(e){var t=an(e,U4),n=mn();return j.createElement(j4,{id:t.id,type:"line"},r=>j.createElement(j.Fragment,null,j.createElement(w4,{legendPayload:fW(t)}),j.createElement(dW,{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:r}),j.createElement(_4,{type:"line",id:r,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),j.createElement(wW,Ic({},t,{id:r}))))}var q4=j.memo(OW,Uo);q4.displayName="Line";function ol(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:E4}function ul(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:E4}var _W="Invariant failed";function EW(e,t){throw new Error(_W)}function Cb(){return Cb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Cb.apply(null,arguments)}function L1(e){return j.createElement(y4,Cb({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},e))}var AW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(r,i)=>{if(pe(t))return t;var l=pe(r)||ht(r);return l?t(r,i):(l||EW(),n)}},NW=(e,t,n)=>n,TW=(e,t)=>t,uf=G([tv,TW],(e,t)=>e.filter(n=>n.type==="bar").find(n=>n.id===t)),PW=G([uf],e=>e==null?void 0:e.maxBarSize),CW=(e,t,n,r)=>r,MW=G([Qe,tv,ol,ul,NW],(e,t,n,r,i)=>t.filter(l=>e==="horizontal"?l.xAxisId===n:l.yAxisId===r).filter(l=>l.isPanorama===i).filter(l=>l.hide===!1).filter(l=>l.type==="bar")),RW=(e,t,n)=>{var r=Qe(e),i=ol(e,t),l=ul(e,t);if(!(i==null||l==null))return r==="horizontal"?Eb(e,"yAxis",l,n):Eb(e,"xAxis",i,n)},DW=(e,t)=>{var n=Qe(e),r=ol(e,t),i=ul(e,t);if(!(r==null||i==null))return n==="horizontal"?sT(e,"xAxis",r):sT(e,"yAxis",i)},kW=G([MW,yH,DW],LX),IW=(e,t,n)=>{var r,i,l=uf(e,t);if(l==null)return 0;var u=ol(e,t),c=ul(e,t);if(u==null||c==null)return 0;var d=Qe(e),h=Y2(e),{maxBarSize:m}=l,v=ht(m)?h:m,g,x;return d==="horizontal"?(g=Yi(e,"xAxis",u,n),x=Fi(e,"xAxis",u,n)):(g=Yi(e,"yAxis",c,n),x=Fi(e,"yAxis",c,n)),(r=(i=Po(g,x,!0))!==null&&i!==void 0?i:v)!==null&&r!==void 0?r:0},H4=(e,t,n)=>{var r=Qe(e),i=ol(e,t),l=ul(e,t);if(!(i==null||l==null)){var u,c;return r==="horizontal"?(u=Yi(e,"xAxis",i,n),c=Fi(e,"xAxis",i,n)):(u=Yi(e,"yAxis",l,n),c=Fi(e,"yAxis",l,n)),Po(u,c)}},LW=G([kW,Y2,pH,G2,IW,H4,PW],qX),zW=(e,t,n)=>{var r=ol(e,t);if(r!=null)return Yi(e,"xAxis",r,n)},BW=(e,t,n)=>{var r=ul(e,t);if(r!=null)return Yi(e,"yAxis",r,n)},$W=(e,t,n)=>{var r=ol(e,t);if(r!=null)return Fi(e,"xAxis",r,n)},UW=(e,t,n)=>{var r=ul(e,t);if(r!=null)return Fi(e,"yAxis",r,n)},qW=G([LW,uf],KX),HW=G([RW,uf],HX),KW=G([Kt,Sx,zW,BW,$W,UW,qW,Qe,oH,H4,HW,uf,CW],(e,t,n,r,i,l,u,c,d,h,m,v,g)=>{var{chartData:x,dataStartIndex:S,dataEndIndex:w}=d;if(!(v==null||u==null||t==null||c!=="horizontal"&&c!=="vertical"||n==null||r==null||i==null||l==null||h==null)){var{data:O}=v,_;if(O!=null&&O.length>0?_=O:_=x==null?void 0:x.slice(S,w+1),_!=null)return gJ({layout:c,barSettings:v,pos:u,parentViewBox:t,bandSize:h,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:l,stackedData:m,displayedData:_,offset:e,cells:g,dataStartIndex:S})}}),FW=["index"];function Mb(){return Mb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mb.apply(null,arguments)}function YW(e,t){if(e==null)return{};var n,r,i=GW(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function GW(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var K4=j.createContext(void 0),VW=e=>{var t=j.useContext(K4);if(t!=null)return t.stackId;if(e!=null)return tU(e)},QW=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),XW=e=>{var t=j.useContext(K4);if(t!=null){var{stackId:n}=t;return"url(#".concat(QW(n,e),")")}},F4=e=>{var{index:t}=e,n=YW(e,FW),r=XW(t);return j.createElement(Zn,Mb({className:"recharts-bar-stack-layer",clipPath:r},n))},ZW=["onMouseEnter","onMouseLeave","onClick"],WW=["value","background","tooltipPosition"],JW=["id"],eJ=["onMouseEnter","onClick","onMouseLeave"];function Gi(){return Gi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gi.apply(null,arguments)}function hP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function gn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hP(Object(n),!0).forEach(function(r){tJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tJ(e,t,n){return(t=nJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nJ(e){var t=rJ(e,"string");return typeof t=="symbol"?t:t+""}function rJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function om(e,t){if(e==null)return{};var n,r,i=aJ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function aJ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var iJ=e=>{var{dataKey:t,name:n,fill:r,legendType:i,hide:l}=e;return[{inactive:l,dataKey:t,type:i,color:r,value:Pm(n,t),payload:e}]},sJ=j.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:l,hide:u,unit:c,tooltipType:d,id:h}=e,m={dataDefinedOnItem:void 0,getPosition:rl,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:Pm(l,t),hide:u,type:d,color:i,unit:c,graphicalItemId:h}};return j.createElement(S4,{tooltipEntrySettings:m})});function lJ(e){var t=ge(Js),{data:n,dataKey:r,background:i,allOtherBarProps:l}=e,{onMouseEnter:u,onMouseLeave:c,onClick:d}=l,h=om(l,ZW),m=g4(u,r,l.id),v=b4(c),g=x4(d,r,l.id);if(!i||n==null)return null;var x=Kc(i);return j.createElement(Sr,{zIndex:FX(i,Ht.barBackground)},n.map((S,w)=>{var{value:O,background:_,tooltipPosition:A}=S,T=om(S,WW);if(!_)return null;var N=m(S,w),C=v(S,w),M=g(S,w),R=gn(gn(gn(gn(gn({option:i,isActive:String(w)===t},T),{},{fill:"#eee"},_),x),bm(h,S,w)),{},{onMouseEnter:N,onMouseLeave:C,onClick:M,dataKey:r,index:w,className:"recharts-bar-background-rectangle"});return j.createElement(L1,Gi({key:"background-bar-".concat(w)},R))}))}function oJ(e){var{showLabels:t,children:n,rects:r}=e,i=r==null?void 0:r.map(l=>{var u={x:l.x,y:l.y,width:l.width,lowerWidth:l.width,upperWidth:l.width,height:l.height};return gn(gn({},u),{},{value:l.value,payload:l.payload,parentViewBox:l.parentViewBox,viewBox:u,fill:l.fill})});return j.createElement(c4,{value:t?i:void 0},n)}function uJ(e){var{shape:t,activeBar:n,baseProps:r,entry:i,index:l,dataKey:u}=e,c=ge(Js),d=ge(UD),h=n&&String(i.originalDataIndex)===c&&(d==null||u===d),[m,v]=j.useState(!1),[g,x]=j.useState(!1);j.useEffect(()=>{var T;return h?(v(!0),T=requestAnimationFrame(()=>{x(!0)})):x(!1),()=>{cancelAnimationFrame(T)}},[h]);var S=j.useCallback(()=>{h||v(!1)},[h]),w=h&&g,O=h||m,_;h?n===!0?_=t:_=n:_=t;var A=j.createElement(L1,Gi({},r,{name:String(r.name)},i,{isActive:w,option:_,index:l,dataKey:u,onTransitionEnd:S}));return O?j.createElement(Sr,{zIndex:Ht.activeBar},j.createElement(F4,{index:i.originalDataIndex},A)):A}function cJ(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:l}=e;return j.createElement(L1,Gi({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:l}))}function fJ(e){var t,{data:n,props:r}=e,i=(t=Pr(r))!==null&&t!==void 0?t:{},{id:l}=i,u=om(i,JW),{shape:c,dataKey:d,activeBar:h}=r,{onMouseEnter:m,onClick:v,onMouseLeave:g}=r,x=om(r,eJ),S=g4(m,d,l),w=b4(g),O=x4(v,d,l);return n?j.createElement(j.Fragment,null,n.map((_,A)=>j.createElement(F4,Gi({index:_.originalDataIndex,key:"rectangle-".concat(_==null?void 0:_.x,"-").concat(_==null?void 0:_.y,"-").concat(_==null?void 0:_.value,"-").concat(A),className:"recharts-bar-rectangle"},bm(x,_,A),{onMouseEnter:S(_,A),onMouseLeave:w(_,A),onClick:O(_,A)}),h?j.createElement(uJ,{shape:c,activeBar:h,baseProps:u,entry:_,index:A,dataKey:d}):j.createElement(cJ,{shape:c,baseProps:u,entry:_,index:A,dataKey:d})))):null}function dJ(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:l,animationBegin:u,animationDuration:c,animationEasing:d,onAnimationEnd:h,onAnimationStart:m}=t,v=n.current,g=$m(t,"recharts-bar-"),[x,S]=j.useState(!1),w=!x,O=j.useCallback(()=>{typeof h=="function"&&h(),S(!1)},[h]),_=j.useCallback(()=>{typeof m=="function"&&m(),S(!0)},[m]);return j.createElement(oJ,{showLabels:w,rects:r},j.createElement(Bm,{animationId:g,begin:u,duration:c,isActive:l,easing:d,onAnimationEnd:O,onAnimationStart:_,key:g},A=>{var T=A===1?r:r==null?void 0:r.map((N,C)=>{var M=v&&v[C];if(M)return gn(gn({},N),{},{x:bt(M.x,N.x,A),y:bt(M.y,N.y,A),width:bt(M.width,N.width,A),height:bt(M.height,N.height,A)});if(i==="horizontal"){var R=bt(0,N.height,A),z=bt(N.stackedBarStart,N.y,A);return gn(gn({},N),{},{y:z,height:R})}var B=bt(0,N.width,A),D=bt(N.stackedBarStart,N.x,A);return gn(gn({},N),{},{width:B,x:D})});return A>0&&(n.current=T??null),T==null?null:j.createElement(Zn,null,j.createElement(fJ,{props:t,data:T}))}),j.createElement(d4,{label:t.label}),t.children)}function hJ(e){var t=j.useRef(null);return j.createElement(dJ,{previousRectanglesRef:t,props:e})}var Y4=0,mJ=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:jt(e,t)}};class vJ extends j.PureComponent{render(){var{hide:t,data:n,dataKey:r,className:i,xAxisId:l,yAxisId:u,needClip:c,background:d,id:h}=this.props;if(t||n==null)return null;var m=Ve("recharts-bar",i),v=h;return j.createElement(Zn,{className:m,id:h},c&&j.createElement("defs",null,j.createElement(k4,{clipPathId:v,xAxisId:l,yAxisId:u})),j.createElement(Zn,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(v,")"):void 0},j.createElement(lJ,{data:n,dataKey:r,background:d,allOtherBarProps:this.props}),j.createElement(hJ,this.props)))}}var pJ={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:Y4,xAxisId:0,yAxisId:0,zIndex:Ht.bar};function yJ(e){var{xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:l,activeBar:u,animationBegin:c,animationDuration:d,animationEasing:h,isAnimationActive:m}=e,{needClip:v}=k1(t,n),g=al(),x=mn(),S=RQ(e.children,T1),w=ge(A=>KW(A,e.id,x,S));if(g!=="vertical"&&g!=="horizontal")return null;var O,_=w==null?void 0:w[0];return _==null||_.height==null||_.width==null?O=0:O=g==="vertical"?_.height/2:_.width/2,j.createElement(D4,{xAxisId:t,yAxisId:n,data:w,dataPointFormatter:mJ,errorBarOffset:O},j.createElement(vJ,Gi({},e,{layout:g,needClip:v,data:w,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:l,activeBar:u,animationBegin:c,animationDuration:d,animationEasing:h,isAnimationActive:m})))}function gJ(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r,hasCustomShape:i},pos:l,bandSize:u,xAxis:c,yAxis:d,xAxisTicks:h,yAxisTicks:m,stackedData:v,displayedData:g,offset:x,cells:S,parentViewBox:w,dataStartIndex:O}=e,_=t==="horizontal"?d:c,A=v?_.scale.domain():null,T=nU({numericAxis:_}),N=_.scale.map(T);return g.map((C,M)=>{var R,z,B,D,H,q;if(v){var ae=v[M+O];if(ae==null)return null;R=X$(ae,A)}else R=jt(C,n),Array.isArray(R)||(R=[T,R]);var te=AW(r,Y4)(R[1],M);if(t==="horizontal"){var re,U=d.scale.map(R[0]),V=d.scale.map(R[1]);if(U==null||V==null)return null;z=eA({axis:c,ticks:h,bandSize:u,offset:l.offset,entry:C,index:M}),B=(re=V??U)!==null&&re!==void 0?re:void 0,D=l.size;var ie=U-V;if(H=Jr(ie)?0:ie,q={x:z,y:x.top,width:D,height:x.height},Math.abs(te)>0&&Math.abs(H)<Math.abs(te)){var oe=kn(H||te)*(Math.abs(te)-Math.abs(H));B-=oe,H+=oe}}else{var ce=c.scale.map(R[0]),I=c.scale.map(R[1]);if(ce==null||I==null)return null;if(z=ce,B=eA({axis:d,ticks:m,bandSize:u,offset:l.offset,entry:C,index:M}),D=I-ce,H=l.size,q={x:x.left,y:B,width:x.width,height:H},Math.abs(te)>0&&Math.abs(D)<Math.abs(te)){var Z=kn(D||te)*(Math.abs(te)-Math.abs(D));D+=Z}}if(z==null||B==null||D==null||H==null||!i&&(D===0||H===0))return null;var se=gn(gn({},C),{},{stackedBarStart:N,x:z,y:B,width:D,height:H,value:v?R:R[1],payload:C,background:q,tooltipPosition:{x:z+D/2,y:B+H/2},parentViewBox:w,originalDataIndex:M},S&&S[M]&&S[M].props);return se}).filter(Boolean)}function bJ(e){var t=an(e,pJ),n=VW(t.stackId),r=mn();return j.createElement(j4,{id:t.id,type:"bar"},i=>j.createElement(j.Fragment,null,j.createElement(w4,{legendPayload:iJ(t)}),j.createElement(sJ,{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}),j.createElement(_4,{type:"bar",id:i,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null}),j.createElement(Sr,{zIndex:t.zIndex},j.createElement(yJ,Gi({},t,{id:i})))))}var z1=j.memo(bJ,Uo);z1.displayName="Bar";var xJ=["domain","range"],SJ=["domain","range"];function mP(e,t){if(e==null)return{};var n,r,i=wJ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function wJ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function vP(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 G4(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=mP(e,xJ),{domain:l,range:u}=t,c=mP(t,SJ);return!vP(n,l)||!vP(r,u)?!1:Uo(i,c)}var jJ=["type"],OJ=["dangerouslySetInnerHTML","ticks","scale"],_J=["id","scale"];function Rb(){return Rb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rb.apply(null,arguments)}function pP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pP(Object(n),!0).forEach(function(r){EJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function EJ(e,t,n){return(t=AJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AJ(e){var t=NJ(e,"string");return typeof t=="symbol"?t:t+""}function NJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Db(e,t){if(e==null)return{};var n,r,i=TJ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function TJ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function PJ(e){var t=ut(),n=j.useRef(null),r=h2(),{type:i}=e,l=Db(e,jJ),u=Hm(r,"xAxis",i),c=j.useMemo(()=>{if(u!=null)return yP(yP({},l),{},{type:u})},[l,u]);return j.useLayoutEffect(()=>{c!=null&&(n.current===null?t(SX(c)):n.current!==c&&t(wX({prev:n.current,next:c})),n.current=c)},[c,t]),j.useLayoutEffect(()=>()=>{n.current&&(t(jX(n.current)),n.current=null)},[t]),null}var CJ=e=>{var{xAxisId:t,className:n}=e,r=ge(Sx),i=mn(),l="xAxis",u=ge(_=>bD(_,l,t,i)),c=ge(_=>pD(_,t)),d=ge(_=>WF(_,t)),h=ge(_=>zR(_,t));if(c==null||d==null||h==null)return null;var{dangerouslySetInnerHTML:m,ticks:v,scale:g}=e,x=Db(e,OJ),{id:S,scale:w}=h,O=Db(h,_J);return j.createElement(D1,Rb({},x,O,{x:d.x,y:d.y,width:c.width,height:c.height,className:Ve("recharts-".concat(l," ").concat(l),n),viewBox:r,ticks:u,axisType:l,axisId:t}))},MJ={allowDataOverflow:Rt.allowDataOverflow,allowDecimals:Rt.allowDecimals,allowDuplicatedCategory:Rt.allowDuplicatedCategory,angle:Rt.angle,axisLine:ka.axisLine,height:Rt.height,hide:!1,includeHidden:Rt.includeHidden,interval:Rt.interval,label:!1,minTickGap:Rt.minTickGap,mirror:Rt.mirror,orientation:Rt.orientation,padding:Rt.padding,reversed:Rt.reversed,scale:Rt.scale,tick:Rt.tick,tickCount:Rt.tickCount,tickLine:ka.tickLine,tickSize:ka.tickSize,type:Rt.type,niceTicks:Rt.niceTicks,xAxisId:0},RJ=e=>{var t=an(e,MJ);return j.createElement(j.Fragment,null,j.createElement(PJ,{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}),j.createElement(CJ,t))},sv=j.memo(RJ,G4);sv.displayName="XAxis";var DJ=["type"],kJ=["dangerouslySetInnerHTML","ticks","scale"],IJ=["id","scale"];function kb(){return kb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kb.apply(null,arguments)}function gP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function bP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gP(Object(n),!0).forEach(function(r){LJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function LJ(e,t,n){return(t=zJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zJ(e){var t=BJ(e,"string");return typeof t=="symbol"?t:t+""}function BJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ib(e,t){if(e==null)return{};var n,r,i=$J(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function $J(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function UJ(e){var t=ut(),n=j.useRef(null),r=h2(),{type:i}=e,l=Ib(e,DJ),u=Hm(r,"yAxis",i),c=j.useMemo(()=>{if(u!=null)return bP(bP({},l),{},{type:u})},[u,l]);return j.useLayoutEffect(()=>{c!=null&&(n.current===null?t(OX(c)):n.current!==c&&t(_X({prev:n.current,next:c})),n.current=c)},[c,t]),j.useLayoutEffect(()=>()=>{n.current&&(t(EX(n.current)),n.current=null)},[t]),null}function qJ(e){var{yAxisId:t,className:n,width:r,label:i}=e,l=j.useRef(null),u=j.useRef(null),c=ge(Sx),d=mn(),h=ut(),m="yAxis",v=ge(M=>yD(M,t)),g=ge(M=>eY(M,t)),x=ge(M=>bD(M,m,t,d)),S=ge(M=>BR(M,t));if(j.useLayoutEffect(()=>{if(!(r!=="auto"||!v||C1(i)||j.isValidElement(i)||S==null)){var M=l.current;if(M){var R=M.getCalculatedWidth();Math.round(v.width)!==Math.round(R)&&h(AX({id:t,width:R}))}}},[x,v,h,i,t,r,S]),v==null||g==null||S==null)return null;var{dangerouslySetInnerHTML:w,ticks:O,scale:_}=e,A=Ib(e,kJ),{id:T,scale:N}=S,C=Ib(S,IJ);return j.createElement(D1,kb({},A,C,{ref:l,labelRef:u,x:g.x,y:g.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:v.width,height:v.height,className:Ve("recharts-".concat(m," ").concat(m),n),viewBox:c,ticks:x,axisType:m,axisId:t}))}var HJ={allowDataOverflow:Dt.allowDataOverflow,allowDecimals:Dt.allowDecimals,allowDuplicatedCategory:Dt.allowDuplicatedCategory,angle:Dt.angle,axisLine:ka.axisLine,hide:!1,includeHidden:Dt.includeHidden,interval:Dt.interval,label:!1,minTickGap:Dt.minTickGap,mirror:Dt.mirror,orientation:Dt.orientation,padding:Dt.padding,reversed:Dt.reversed,scale:Dt.scale,tick:Dt.tick,tickCount:Dt.tickCount,tickLine:ka.tickLine,tickSize:ka.tickSize,type:Dt.type,niceTicks:Dt.niceTicks,width:Dt.width,yAxisId:0},KJ=e=>{var t=an(e,HJ);return j.createElement(j.Fragment,null,j.createElement(UJ,{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}),j.createElement(qJ,t))},lv=j.memo(KJ,G4);lv.displayName="YAxis";var FJ=(e,t)=>t,B1=G([FJ,Qe,eR,Yt,LD,Xa,jG,Kt],PG);function YJ(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function $1(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(YJ(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var l=e.currentTarget;n=l.offsetWidth>0?t.width/l.offsetWidth:1,r=l.offsetHeight>0?t.height/l.offsetHeight:1}var u=(c,d)=>({relativeX:Math.round((c-t.left)/n),relativeY:Math.round((d-t.top)/r)});return"touches"in e?Array.from(e.touches).map(c=>u(c.clientX,c.clientY)):u(e.clientX,e.clientY)}var V4=Wn("mouseClick"),Q4=Gc();Q4.startListening({actionCreator:V4,effect:(e,t)=>{var n=e.payload,r=B1(t.getState(),$1(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(pY({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var Lb=Wn("mouseMove"),X4=Gc(),no=null,ys=null,b0=null;X4.startListening({actionCreator:Lb,effect:(e,t)=>{var n=e.payload,r=t.getState(),{throttleDelay:i,throttledEvents:l}=r.eventSettings,u=l==="all"||(l==null?void 0:l.includes("mousemove"));no!==null&&(cancelAnimationFrame(no),no=null),ys!==null&&(typeof i!="number"||!u)&&(clearTimeout(ys),ys=null),b0=$1(n);var c=()=>{var d=t.getState(),h=lf(d,d.tooltip.settings.shared);if(!b0){no=null,ys=null;return}if(h==="axis"){var m=B1(d,b0);(m==null?void 0:m.activeIndex)!=null?t.dispatch(AD({activeIndex:m.activeIndex,activeDataKey:void 0,activeCoordinate:m.activeCoordinate})):t.dispatch(ED())}no=null,ys=null};if(!u){c();return}i==="raf"?no=requestAnimationFrame(c):typeof i=="number"&&ys===null&&(ys=setTimeout(c,i))}});function GJ(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 xP={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},Z4=hn({name:"rootProps",initialState:xP,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:xP.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}}}),VJ=Z4.reducer,{updateOptions:QJ}=Z4.actions,XJ=null,ZJ={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)},W4=hn({name:"polarOptions",initialState:XJ,reducers:ZJ}),{updatePolarOptions:qne}=W4.actions,WJ=W4.reducer,J4=Wn("keyDown"),e3=Wn("focus"),t3=Wn("blur"),ov=Gc(),ro=null,gs=null,Vd=null;ov.startListening({actionCreator:J4,effect:(e,t)=>{Vd=e.payload,ro!==null&&(cancelAnimationFrame(ro),ro=null);var n=t.getState(),{throttleDelay:r,throttledEvents:i}=n.eventSettings,l=i==="all"||i.includes("keydown");gs!==null&&(typeof r!="number"||!l)&&(clearTimeout(gs),gs=null);var u=()=>{try{var c=t.getState(),d=c.rootProps.accessibilityLayer!==!1;if(!d)return;var{keyboardInteraction:h}=c.tooltip,m=Vd;if(m!=="ArrowRight"&&m!=="ArrowLeft"&&m!=="Enter")return;var v=hc(h,Ws(c),Io(c),Lo(c)),g=v==null?-1:Number(v),x=!Number.isFinite(g)||g<0,S=Xa(c),w=Ws(c),O=lf(c,c.tooltip.settings.shared);if(m==="Enter"){if(x)return;var _=nm(c,O,"hover",String(h.index));t.dispatch(tm({active:!h.active,activeIndex:h.index,activeCoordinate:_}));return}var A=iY(c),T=A==="left-to-right"?1:-1,N=m==="ArrowRight"?1:-1,C;if(x){var M=Io(c),R=Lo(c),z=N*T,B=te=>({active:!1,index:String(te),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(C=-1,z>0){for(var D=0;D<w.length;D++)if(hc(B(D),w,M,R)!=null){C=D;break}}else for(var H=w.length-1;H>=0;H--)if(hc(B(H),w,M,R)!=null){C=H;break}if(C<0)return}else{C=g+N*T;var q=(S==null?void 0:S.length)||w.length;if(q===0||C>=q||C<0)return}var ae=nm(c,O,"hover",String(C));t.dispatch(tm({active:!0,activeIndex:C.toString(),activeCoordinate:ae}))}finally{ro=null,gs=null}};if(!l){u();return}r==="raf"?ro=requestAnimationFrame(u):typeof r=="number"&&gs===null&&(u(),Vd=null,gs=setTimeout(()=>{Vd?u():(gs=null,ro=null)},r))}});ov.startListening({actionCreator:e3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var l="0",u=lf(n,n.tooltip.settings.shared),c=nm(n,u,"hover",String(l));t.dispatch(tm({active:!0,activeIndex:l,activeCoordinate:c}))}}}});ov.startListening({actionCreator:t3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;i.active&&t.dispatch(tm({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function n3(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(n,r)=>{if(r==="currentTarget")return t;var i=Reflect.get(n,r);return typeof i=="function"?i.bind(n):i}})}var dr=Wn("externalEvent"),r3=Gc(),Qd=new Map,ic=new Map,x0=new Map;r3.startListening({actionCreator:dr,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){var i=r.type,l=n3(r);x0.set(i,{handler:n,reactEvent:l});var u=Qd.get(i);u!==void 0&&(cancelAnimationFrame(u),Qd.delete(i));var c=t.getState(),{throttleDelay:d,throttledEvents:h}=c.eventSettings,m=h,v=m==="all"||(m==null?void 0:m.includes(i)),g=ic.get(i);g!==void 0&&(typeof d!="number"||!v)&&(clearTimeout(g),ic.delete(i));var x=()=>{var O=x0.get(i);try{if(!O)return;var{handler:_,reactEvent:A}=O,T=t.getState(),N={activeCoordinate:lG(T),activeDataKey:UD(T),activeIndex:Js(T),activeLabel:$D(T),activeTooltipIndex:Js(T),isTooltipActive:oG(T)};_&&_(N,A)}finally{Qd.delete(i),ic.delete(i),x0.delete(i)}};if(!v){x();return}if(d==="raf"){var S=requestAnimationFrame(x);Qd.set(i,S)}else if(typeof d=="number"){if(!ic.has(i)){x();var w=setTimeout(x,d);ic.set(i,w)}}else x()}}});var JJ=G([Qo],e=>e.tooltipItemPayloads),eee=G([JJ,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(l=>l.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),a3=Wn("touchMove"),i3=Gc(),bs=null,wi=null,SP=null,sc=null;i3.startListening({actionCreator:a3,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){sc=n3(n);var r=t.getState(),{throttleDelay:i,throttledEvents:l}=r.eventSettings,u=l==="all"||l.includes("touchmove");bs!==null&&(cancelAnimationFrame(bs),bs=null),wi!==null&&(typeof i!="number"||!u)&&(clearTimeout(wi),wi=null),SP=Array.from(n.touches).map(d=>$1({clientX:d.clientX,clientY:d.clientY,currentTarget:n.currentTarget}));var c=()=>{if(sc!=null){var d=t.getState(),h=lf(d,d.tooltip.settings.shared);if(h==="axis"){var m,v=(m=SP)===null||m===void 0?void 0:m[0];if(v==null){bs=null,wi=null;return}var g=B1(d,v);(g==null?void 0:g.activeIndex)!=null&&t.dispatch(AD({activeIndex:g.activeIndex,activeDataKey:void 0,activeCoordinate:g.activeCoordinate}))}else if(h==="item"){var x,S=sc.touches[0];if(document.elementFromPoint==null||S==null)return;var w=document.elementFromPoint(S.clientX,S.clientY);if(!w||!w.getAttribute)return;var O=w.getAttribute(uU),_=(x=w.getAttribute(cU))!==null&&x!==void 0?x:void 0,A=ll(d).find(C=>C.id===_);if(O==null||A==null||_==null)return;var{dataKey:T}=A,N=eee(d,O,_);t.dispatch(_D({activeDataKey:T,activeIndex:O,activeCoordinate:N,activeGraphicalItemId:_}))}bs=null,wi=null}};if(!u){c();return}i==="raf"?bs=requestAnimationFrame(c):typeof i=="number"&&wi===null&&(c(),sc=null,wi=setTimeout(()=>{sc?c():(wi=null,bs=null)},i))}}});var s3={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},l3=hn({name:"eventSettings",initialState:s3,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:tee}=l3.actions,nee=l3.reducer,ree=CM({brush:GX,cartesianAxis:NX,chartData:sV,errorBars:YZ,eventSettings:nee,graphicalItems:sX,layout:F$,legend:rq,options:tV,polarAxis:NQ,polarOptions:WJ,referenceElements:ZX,renderedTicks:mZ,rootProps:VJ,tooltip:yY,zIndex:HG}),aee=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return p$({reducer:ree,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([Q4.middleware,X4.middleware,ov.middleware,r3.middleware,i3.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(YM({type:"raf"}))},devTools:{serialize:{replacer:GJ},name:"recharts-".concat(n)}})};function iee(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=mn(),l=j.useRef(null);if(i)return n;l.current==null&&(l.current=aee(t,r));var u=mx;return j.createElement(bq,{context:u,store:l.current},n)}function see(e){var{layout:t,margin:n}=e,r=ut(),i=mn();return j.useEffect(()=>{i||(r(q$(t)),r(U$(n)))},[r,i,t,n]),null}var lee=j.memo(see,Uo);function oee(e){var t=ut();return j.useEffect(()=>{t(QJ(e))},[t,e]),null}var uee=e=>{var t=ut();return j.useEffect(()=>{t(tee(e))},[t,e]),null},cee=j.memo(uee,Uo);function wP(e){var{zIndex:t,isPanorama:n}=e,r=j.useRef(null),i=ut();return j.useLayoutEffect(()=>(r.current&&i(UG({zIndex:t,element:r.current,isPanorama:n})),()=>{i(qG({zIndex:t,isPanorama:n}))}),[i,t,n]),j.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(t)})}function jP(e){var{children:t,isPanorama:n}=e,r=ge(MG);if(!r||r.length===0)return t;var i=r.filter(u=>u<0),l=r.filter(u=>u>0);return j.createElement(j.Fragment,null,i.map(u=>j.createElement(wP,{key:u,zIndex:u,isPanorama:n})),t,l.map(u=>j.createElement(wP,{key:u,zIndex:u,isPanorama:n})))}var fee=["children"];function dee(e,t){if(e==null)return{};var n,r,i=hee(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function hee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function um(){return um=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},um.apply(null,arguments)}var mee={width:"100%",height:"100%",display:"block"},vee=j.forwardRef((e,t)=>{var n=_x(),r=Ex(),i=O2();if(!ta(n)||!ta(r))return null;var{children:l,otherAttributes:u,title:c,desc:d}=e,h,m;return u!=null&&(typeof u.tabIndex=="number"?h=u.tabIndex:h=i?0:void 0,typeof u.role=="string"?m=u.role:m=i?"application":void 0),j.createElement(ax,um({},u,{title:c,desc:d,role:m,tabIndex:h,width:n,height:r,style:mee,ref:t}),l)}),pee=e=>{var{children:t}=e,n=ge(Dm);if(!n)return null;var{width:r,height:i,y:l,x:u}=n;return j.createElement(ax,{width:r,height:i,x:u,y:l},t)},OP=j.forwardRef((e,t)=>{var{children:n}=e,r=dee(e,fee),i=mn();return i?j.createElement(pee,null,j.createElement(jP,{isPanorama:!0},n)):j.createElement(vee,um({ref:t},r),j.createElement(jP,{isPanorama:!1},n))});function yee(){var e=ut(),[t,n]=j.useState(null),r=ge(oU);return j.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),l=i.width/t.offsetWidth;$e(l)&&l!==r&&e(K$(l))}},[t,e,r]),n}function _P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function gee(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_P(Object(n),!0).forEach(function(r){bee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_P(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function bee(e,t,n){return(t=xee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xee(e){var t=See(e,"string");return typeof t=="symbol"?t:t+""}function See(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ki(){return Ki=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ki.apply(null,arguments)}var wee=()=>(vV(),null);function cm(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var jee=j.forwardRef((e,t)=>{var n,r,i=j.useRef(null),[l,u]=j.useState({containerWidth:cm((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:cm((r=e.style)===null||r===void 0?void 0:r.height)}),c=j.useCallback((h,m)=>{u(v=>{var g=Math.round(h),x=Math.round(m);return v.containerWidth===g&&v.containerHeight===x?v:{containerWidth:g,containerHeight:x}})},[]),d=j.useCallback(h=>{if(typeof t=="function"&&t(h),i.current!=null&&(i.current.disconnect(),i.current=null),h!=null&&typeof ResizeObserver<"u"){var{width:m,height:v}=h.getBoundingClientRect();c(m,v);var g=S=>{var w=S[0];if(w!=null){var{width:O,height:_}=w.contentRect;c(O,_)}},x=new ResizeObserver(g);x.observe(h),i.current=x}},[t,c]);return j.useEffect(()=>()=>{var h=i.current;h!=null&&h.disconnect()},[c]),j.createElement(j.Fragment,null,j.createElement(Qc,{width:l.containerWidth,height:l.containerHeight}),j.createElement("div",Ki({ref:d},e)))}),Oee=j.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,l]=j.useState({containerWidth:cm(n),containerHeight:cm(r)}),u=j.useCallback((d,h)=>{l(m=>{var v=Math.round(d),g=Math.round(h);return m.containerWidth===v&&m.containerHeight===g?m:{containerWidth:v,containerHeight:g}})},[]),c=j.useCallback(d=>{if(typeof t=="function"&&t(d),d!=null){var{width:h,height:m}=d.getBoundingClientRect();u(h,m)}},[t,u]);return j.createElement(j.Fragment,null,j.createElement(Qc,{width:i.containerWidth,height:i.containerHeight}),j.createElement("div",Ki({ref:c},e)))}),_ee=j.forwardRef((e,t)=>{var{width:n,height:r}=e;return j.createElement(j.Fragment,null,j.createElement(Qc,{width:n,height:r}),j.createElement("div",Ki({ref:t},e)))}),Eee=j.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?j.createElement(Oee,Ki({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?j.createElement(_ee,Ki({},e,{width:n,height:r,ref:t})):j.createElement(j.Fragment,null,j.createElement(Qc,{width:n,height:r}),j.createElement("div",Ki({ref:t},e)))});function Aee(e){return e?jee:Eee}var Nee=j.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:l,onContextMenu:u,onDoubleClick:c,onMouseDown:d,onMouseEnter:h,onMouseLeave:m,onMouseMove:v,onMouseUp:g,onTouchEnd:x,onTouchMove:S,onTouchStart:w,style:O,width:_,responsive:A,dispatchTouchEvents:T=!0}=e,N=j.useRef(null),C=ut(),[M,R]=j.useState(null),[z,B]=j.useState(null),D=yee(),H=wx(),q=(H==null?void 0:H.width)>0?H.width:_,ae=(H==null?void 0:H.height)>0?H.height:i,te=j.useCallback(fe=>{D(fe),typeof t=="function"&&t(fe),R(fe),B(fe),fe!=null&&(N.current=fe)},[D,t,R,B]),re=j.useCallback(fe=>{C(V4(fe)),C(dr({handler:l,reactEvent:fe}))},[C,l]),U=j.useCallback(fe=>{C(Lb(fe)),C(dr({handler:h,reactEvent:fe}))},[C,h]),V=j.useCallback(fe=>{C(ED()),C(dr({handler:m,reactEvent:fe}))},[C,m]),ie=j.useCallback(fe=>{C(Lb(fe)),C(dr({handler:v,reactEvent:fe}))},[C,v]),oe=j.useCallback(()=>{C(e3())},[C]),ce=j.useCallback(()=>{C(t3())},[C]),I=j.useCallback(fe=>{C(J4(fe.key))},[C]),Z=j.useCallback(fe=>{C(dr({handler:u,reactEvent:fe}))},[C,u]),se=j.useCallback(fe=>{C(dr({handler:c,reactEvent:fe}))},[C,c]),X=j.useCallback(fe=>{C(dr({handler:d,reactEvent:fe}))},[C,d]),ve=j.useCallback(fe=>{C(dr({handler:g,reactEvent:fe}))},[C,g]),we=j.useCallback(fe=>{C(dr({handler:w,reactEvent:fe}))},[C,w]),je=j.useCallback(fe=>{T&&C(a3(fe)),C(dr({handler:S,reactEvent:fe}))},[C,T,S]),Me=j.useCallback(fe=>{C(dr({handler:x,reactEvent:fe}))},[C,x]),ue=Aee(A);return j.createElement(VD.Provider,{value:M},j.createElement(YC.Provider,{value:z},j.createElement(ue,{width:q??(O==null?void 0:O.width),height:ae??(O==null?void 0:O.height),className:Ve("recharts-wrapper",r),style:gee({position:"relative",cursor:"default",width:q,height:ae},O),onClick:re,onContextMenu:Z,onDoubleClick:se,onFocus:oe,onBlur:ce,onKeyDown:I,onMouseDown:X,onMouseEnter:U,onMouseLeave:V,onMouseMove:ie,onMouseUp:ve,onTouchEnd:Me,onTouchMove:je,onTouchStart:we,ref:te},j.createElement(wee,null),n)))}),Tee=["width","height","responsive","children","className","style","compact","title","desc"];function Pee(e,t){if(e==null)return{};var n,r,i=Cee(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Cee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Mee=j.forwardRef((e,t)=>{var{width:n,height:r,responsive:i,children:l,className:u,style:c,compact:d,title:h,desc:m}=e,v=Pee(e,Tee),g=Pr(v);return d?j.createElement(j.Fragment,null,j.createElement(Qc,{width:n,height:r}),j.createElement(OP,{otherAttributes:g,title:h,desc:m},l)):j.createElement(Nee,{className:u,style:c,width:n,height:r,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},j.createElement(OP,{otherAttributes:g,title:h,desc:m,ref:t},j.createElement(JX,null,l)))});function zb(){return zb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zb.apply(null,arguments)}function EP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ree(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?EP(Object(n),!0).forEach(function(r){Dee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Dee(e,t,n){return(t=kee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kee(e){var t=Iee(e,"string");return typeof t=="symbol"?t:t+""}function Iee(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Lee={top:5,right:5,bottom:5,left:5},zee=Ree({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:Lee,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},s3),o3=j.forwardRef(function(t,n){var r,i=an(t.categoricalChartProps,zee),{chartName:l,defaultTooltipEventType:u,validateTooltipEventTypes:c,tooltipPayloadSearcher:d,categoricalChartProps:h}=t,m={chartName:l,defaultTooltipEventType:u,validateTooltipEventTypes:c,tooltipPayloadSearcher:d,eventEmitter:void 0};return j.createElement(iee,{preloadedState:{options:m},reduxStoreName:(r=h.id)!==null&&r!==void 0?r:l},j.createElement(YX,{chartData:h.data}),j.createElement(lee,{layout:i.layout,margin:i.margin}),j.createElement(cee,{throttleDelay:i.throttleDelay,throttledEvents:i.throttledEvents}),j.createElement(oee,{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}),j.createElement(Mee,zb({},i,{ref:n})))}),Bee=["axis"],$ee=j.forwardRef((e,t)=>j.createElement(o3,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Bee,tooltipPayloadSearcher:QD,categoricalChartProps:e,ref:t})),Uee=["axis","item"],u3=j.forwardRef((e,t)=>j.createElement(o3,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Uee,tooltipPayloadSearcher:QD,categoricalChartProps:e,ref:t}));const wt={green:"#34d399",red:"#f87171",gray:"#4b5563",cyan:"#22d3ee",gridLine:"#1f2937",labelText:"#9ca3af"},AP=["#22d3ee","#34d399","#facc15","#f87171","#a78bfa","#fb923c","#f472b6","#60a5fa"];function qee(e){return AP[e%AP.length]}function Hee({data:e,benchmarkId:t}){const[n,r]=j.useState(!0),[i,l]=j.useState(""),u=e.targets,c=ot(t?BC(t,i||void 0):F5(i||void 0)),d=i?c.data:void 0,h=j.useMemo(()=>Vee(e.runs??[]),[e.runs]);return p.jsxs("div",{className:"rounded-lg border border-gray-800",children:[p.jsxs("button",{type:"button",onClick:()=>r(m=>!m),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-gray-900/30",children:[p.jsx("span",{className:"text-sm font-medium text-gray-300",children:"Analytics"}),p.jsx("span",{className:"text-xs text-gray-500",children:n?"▸ Show":"▾ Hide"})]}),!n&&p.jsxs("div",{className:"space-y-6 border-t border-gray-800 px-4 py-4",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("label",{htmlFor:"baseline-select",className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Baseline target"}),p.jsxs("select",{id:"baseline-select",value:i,onChange:m=>l(m.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:[p.jsx("option",{value:"",children:"Select a baseline…"}),u.map(m=>p.jsx("option",{value:m,children:m},m))]}),i&&c.isLoading&&p.jsx("span",{className:"text-xs text-gray-500",children:"Loading…"})]}),i&&d&&p.jsx(Kee,{data:d,baseline:i}),e.runs&&e.runs.length>0&&u.length>1&&p.jsx(Fee,{runs:e.runs,targets:u}),i&&d&&p.jsx(Yee,{data:d,baseline:i}),p.jsx(Gee,{data:e}),h.length>1&&u.length>0&&p.jsx(Qee,{data:h,targets:u}),!i&&p.jsx("p",{className:"text-xs text-gray-500",children:"Select a baseline target above to see gain and delta charts."})]})]})}function U1({active:e,payload:t,label:n}){return!e||!(t!=null&&t.length)?null:p.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-900 px-3 py-2 text-xs shadow-xl",children:[n&&p.jsx("div",{className:"mb-1 font-medium text-gray-300",children:n}),t.map((r,i)=>p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:r.color}}),p.jsxs("span",{className:"text-gray-400",children:[r.name,":"]}),p.jsx("span",{className:"tabular-nums text-gray-200",children:typeof r.value=="number"?r.value.toFixed(3):r.value})]},`${r.name}-${i}`))]})}function zo({title:e,children:t}){return p.jsxs("div",{className:"space-y-3",children:[p.jsx("h3",{className:"text-sm font-medium text-gray-400",children:e}),t]})}function Kee({data:e,baseline:t}){const n=j.useMemo(()=>{const i=[];for(const l of e.cells)l.target!==t&&l.delta!==void 0&&i.push({experiment:l.experiment,target:l.target,g:l.normalized_gain??null,delta:l.delta});return i.sort((l,u)=>Math.abs(u.g??0)-Math.abs(l.g??0)),i},[e.cells,t]);if(n.length===0)return p.jsx(zo,{title:"Normalized Gain (g)",children:p.jsx("p",{className:"text-xs text-gray-500",children:"No gain data available. Ensure multiple targets exist."})});const r=n.map(i=>({name:`${i.target} · ${i.experiment}`,g:i.g??0,isNull:i.g===null}));return p.jsx(zo,{title:"Normalized Gain (g)",children:p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:p.jsx(jx,{width:"100%",height:Math.max(200,r.length*32),children:p.jsxs(u3,{data:r,layout:"vertical",margin:{left:120,right:20,top:5,bottom:5},children:[p.jsx(iv,{strokeDasharray:"3 3",stroke:wt.gridLine,horizontal:!1}),p.jsx(sv,{type:"number",tick:{fill:wt.labelText,fontSize:11},axisLine:{stroke:wt.gridLine}}),p.jsx(lv,{type:"category",dataKey:"name",tick:{fill:wt.labelText,fontSize:11},width:120,axisLine:{stroke:wt.gridLine}}),p.jsx(N1,{content:p.jsx(U1,{})}),p.jsx(z1,{dataKey:"g",name:"Normalized Gain",children:r.map(i=>p.jsx(T1,{fill:i.isNull?wt.gray:i.g>0?wt.green:i.g<0?wt.red:wt.gray},i.name))})]})})})})}function Fee({runs:e,targets:t}){const{tags:n,grid:r}=j.useMemo(()=>{const i=new Map;for(const c of e)for(const d of c.tags??[]){let h=i.get(d);h||(h=new Map,i.set(d,h));let m=h.get(c.target);m||(m={passed:0,total:0},h.set(c.target,m)),m.passed+=c.passed_count,m.total+=c.eval_count}const l=[...i.keys()].sort(),u=l.map(c=>{const d={tag:c},h=i.get(c);if(!h)return d;for(const m of t){const v=h.get(m);d[m]=v&&v.total>0?v.passed/v.total:-1}return d});return{tags:l,grid:u}},[e,t]);return n.length===0?null:p.jsx(zo,{title:"Pass Rate by Tag × Target",children:p.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Tag"}),t.map(i=>p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:i},i))]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:r.map(i=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:i.tag}),t.map(l=>{const u=i[l];if(u<0)return p.jsx("td",{className:"px-4 py-3 text-center text-gray-600",children:"—"},l);const c=Math.round(u*100),d=u>=.8?"bg-emerald-400/20 text-emerald-400":u>=.5?"bg-yellow-400/20 text-yellow-400":"bg-red-400/20 text-red-400";return p.jsx("td",{className:"px-4 py-3",children:p.jsxs("span",{className:`inline-block rounded px-2 py-0.5 text-xs tabular-nums font-medium ${d}`,children:[c,"%"]})},l)})]},i.tag))})]})})})}function Yee({data:e,baseline:t}){const n=j.useMemo(()=>e.cells.filter(r=>r.target!==t&&r.delta!==void 0&&r.delta<0).sort((r,i)=>(r.delta??0)-(i.delta??0)),[e.cells,t]);return n.length===0?null:p.jsx(zo,{title:"Regressions vs. Baseline",children:p.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Avg Score"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Delta"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"g"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(r=>{var i;return p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:r.experiment}),p.jsx("td",{className:"px-4 py-3 text-gray-300",children:r.target}),p.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[Math.round(r.avg_score*100),"%"]}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:(i=r.delta)==null?void 0:i.toFixed(3)}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:r.normalized_gain!==void 0&&r.normalized_gain!==null?r.normalized_gain.toFixed(3):"—"})]},`${r.experiment}::${r.target}`)})})]})})})}function Gee({data:e}){const t=j.useMemo(()=>{const n=[];for(const i of e.cells)for(const l of i.tests)n.push(l.score);if(n.length===0)return[];const r=Array.from({length:10},(i,l)=>({range:`${l*10}–${(l+1)*10}%`,count:0}));for(const i of n){const l=Math.min(Math.floor(i*10),9);r[l].count++}return r},[e.cells]);return t.length===0?null:p.jsx(zo,{title:"Score Distribution",children:p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:p.jsx(jx,{width:"100%",height:200,children:p.jsxs(u3,{data:t,margin:{left:10,right:10,top:5,bottom:5},children:[p.jsx(iv,{strokeDasharray:"3 3",stroke:wt.gridLine,vertical:!1}),p.jsx(sv,{dataKey:"range",tick:{fill:wt.labelText,fontSize:11},axisLine:{stroke:wt.gridLine}}),p.jsx(lv,{tick:{fill:wt.labelText,fontSize:11},axisLine:{stroke:wt.gridLine}}),p.jsx(N1,{content:p.jsx(U1,{})}),p.jsx(z1,{dataKey:"count",name:"Tests",fill:wt.cyan,radius:[2,2,0,0]})]})})})})}function Vee(e){if(e.length===0)return[];const t=new Map;for(const r of e){const i=r.started_at.slice(0,10);let l=t.get(i);l||(l=new Map,t.set(i,l));let u=l.get(r.target);u||(u={scoreSum:0,count:0},l.set(r.target,u)),u.scoreSum+=r.avg_score,u.count++}return[...t.keys()].sort().map(r=>{const i={date:r},l=t.get(r);if(!l)return i;for(const[u,c]of l)i[u]=Math.round(c.scoreSum/c.count*1e3)/1e3;return i})}function Qee({data:e,targets:t}){return p.jsx(zo,{title:"Score Trend Over Time",children:p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:p.jsx(jx,{width:"100%",height:250,children:p.jsxs($ee,{data:e,margin:{left:10,right:20,top:5,bottom:5},children:[p.jsx(iv,{strokeDasharray:"3 3",stroke:wt.gridLine}),p.jsx(sv,{dataKey:"date",tick:{fill:wt.labelText,fontSize:11},axisLine:{stroke:wt.gridLine}}),p.jsx(lv,{domain:[0,1],tick:{fill:wt.labelText,fontSize:11},axisLine:{stroke:wt.gridLine}}),p.jsx(N1,{content:p.jsx(U1,{})}),p.jsx(w2,{wrapperStyle:{fontSize:12,color:wt.labelText}}),t.map((n,r)=>p.jsx(q4,{type:"monotone",dataKey:n,stroke:qee(r),strokeWidth:2,dot:{r:3},connectNulls:!0},n))]})})})})}function qa({rate:e}){const t=Math.round(e*100);return p.jsxs("div",{className:"relative h-5 w-20 overflow-hidden rounded-full bg-gray-800",children:[p.jsx("div",{className:"absolute inset-y-0 left-0 bg-gradient-to-r from-blue-400 to-blue-600",style:{width:`${t}%`}}),p.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-semibold tabular-nums text-white",children:[t,"%"]})]})}function c3({data:e,isLoading:t,isError:n,error:r,benchmarkId:i,readOnly:l}){var A,T;const[u,c]=j.useState("aggregated"),[d,h]=j.useState([]),{allTags:m,tagCounts:v}=j.useMemo(()=>{const N=new Map;for(const C of(e==null?void 0:e.runs)??[])for(const M of C.tags??[])N.set(M,(N.get(M)??0)+1);return{allTags:[...N.keys()].sort(),tagCounts:N}},[e==null?void 0:e.runs]),g=j.useMemo(()=>{if(!e||d.length===0)return e;const N=new Set(d),C=(e.runs??[]).filter(D=>(D.tags??[]).some(H=>N.has(H))),M=new Map,R=new Set,z=new Set;for(const D of C){R.add(D.experiment),z.add(D.target);const H=`${D.experiment}::${D.target}`,q=M.get(H)??{experiment:D.experiment,target:D.target,eval_count:0,passed_count:0,score_sum:0,tests:[]};q.eval_count+=D.eval_count,q.passed_count+=D.passed_count,q.score_sum+=D.avg_score*D.eval_count;for(const ae of D.tests)q.tests.push(ae);M.set(H,q)}const B=[...M.values()].map(D=>{const H=new Map;for(const q of D.tests)H.set(q.test_id,q);return{experiment:D.experiment,target:D.target,eval_count:D.eval_count,passed_count:D.passed_count,pass_rate:D.eval_count>0?D.passed_count/D.eval_count:0,avg_score:D.eval_count>0?D.score_sum/D.eval_count:0,tests:[...H.values()].slice(-100)}});return{...e,experiments:[...R].sort(),targets:[...z].sort(),cells:B,runs:C}},[e,d]),x=N=>{h(C=>C.includes(N)?C.filter(M=>M!==N):[...C,N])},S=()=>h([]),w=((A=g==null?void 0:g.runs)==null?void 0:A.length)??0,O=e&&e.cells.length>0,_=d.length>0&&g&&(((T=g.runs)==null?void 0:T.length)??0)===0;return p.jsxs("div",{className:"space-y-4",children:[p.jsx(Zee,{mode:u,onModeChange:c,runsCount:w}),t&&p.jsx(dte,{}),!t&&n&&r&&p.jsx(cte,{message:`Failed to load comparison data: ${r.message}`}),!t&&!n&&!O&&p.jsx(fte,{}),!t&&!n&&O&&p.jsxs(p.Fragment,{children:[m.length>0&&p.jsx(Xee,{allTags:m,tagCounts:v,selected:d,onToggle:x,onClear:S}),_?p.jsx(uv,{headline:`No runs match ${d.map(N=>`\`${N}\``).join(" + ")}`,body:"Clear the filter or pick a different tag combination.",action:{label:"Clear filter",onClick:S}}):g&&p.jsxs(p.Fragment,{children:[u==="aggregated"&&p.jsx(Jee,{data:g,benchmarkId:i}),u==="per-run"&&p.jsx(ate,{data:g,benchmarkId:i,readOnly:l??!1})]})]})]})}function Xee({allTags:e,tagCounts:t,selected:n,onToggle:r,onClear:i}){const l=new Set(n),u=n.length>0;return p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900/40 px-4 py-3",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Filter by tag"}),e.map(c=>{const d=l.has(c),h=t.get(c)??0;return p.jsxs("button",{type:"button",onClick:()=>r(c),"aria-pressed":d,className:`inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 text-xs font-medium transition-colors ${d?"border-cyan-900/60 bg-cyan-950/30 text-cyan-300 hover:border-cyan-800/80":"border-gray-700 text-gray-400 hover:border-gray-600 hover:text-gray-200"}`,children:[p.jsx("span",{children:c}),p.jsx("span",{className:`rounded px-1 text-[0.65rem] tabular-nums ${d?"bg-cyan-900/50 text-cyan-200":"bg-gray-800 text-gray-500"}`,children:h})]},c)}),u&&p.jsx("button",{type:"button",onClick:i,className:"ml-1 text-xs text-gray-500 underline-offset-2 transition-colors hover:text-gray-300 hover:underline",children:"Clear"})]}),p.jsxs("p",{className:"mt-2 text-xs text-gray-500",children:["Showing runs with ",p.jsx("span",{className:"text-gray-400",children:"any"})," selected tag."]})]})}function Zee({mode:e,onModeChange:t,runsCount:n}){return p.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-xl font-semibold text-white",children:"Analyze runs"}),p.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Study one experiment against another, or pit individual runs head-to-head."})]}),p.jsx(Wee,{mode:e,onChange:t,runsCount:n})]})}function Wee({mode:e,onChange:t,runsCount:n}){const r=n===0;return p.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:[p.jsx(NP,{active:e==="aggregated",onClick:()=>t("aggregated"),children:"Aggregated"}),p.jsxs(NP,{active:e==="per-run",onClick:()=>t("per-run"),disabled:r,title:r?"No runs available":void 0,children:["Per run",n>0&&p.jsx("span",{className:"ml-1.5 rounded bg-gray-800 px-1.5 py-0.5 text-xs tabular-nums text-gray-400",children:n})]})]})}function NP({active:e,onClick:t,disabled:n,title:r,children:i}){return p.jsx("button",{type:"button",role:"tab","aria-selected":e,onClick:t,disabled:n,title:r,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 Jee({data:e,benchmarkId:t}){const{experiments:n,targets:r,cells:i}=e,l=j.useMemo(()=>{const u=new Map;for(const c of i)u.set(`${c.experiment}::${c.target}`,c);return u},[i]);return n.length<=1&&r.length<=1?p.jsx(uv,{headline:"Not enough variation to compare",body:`The aggregated matrix requires at least 2 experiments or 2 targets. Currently ${n.length} experiment(s) and ${r.length} target(s).`}):p.jsxs("div",{className:"space-y-3",children:[p.jsx(ute,{}),p.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:p.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Target ↓ / Experiment →"})}),n.map(u=>p.jsx("th",{className:"px-4 py-3 font-medium text-gray-300",children:u},u))]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:r.map(u=>p.jsx(ete,{target:u,experiments:n,cellMap:l},u))})]})}),p.jsx(Hee,{data:e,benchmarkId:t})]})}function ete({target:e,experiments:t,cellMap:n}){return p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:e}),t.map(r=>{const i=n.get(`${r}::${e}`);return p.jsx("td",{className:"px-4 py-3",children:i?p.jsx(tte,{cell:i}):p.jsx(nte,{})},r)})]})}function tte({cell:e}){const[t,n]=j.useState(!1),r=Math.round(e.avg_score*100);return p.jsxs("div",{className:"space-y-2",children:[p.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:()=>n(i=>!i),"aria-expanded":t,children:[p.jsx(qa,{rate:e.pass_rate}),p.jsxs("div",{className:"flex items-center gap-2 text-xs tabular-nums text-gray-500",children:[p.jsxs("span",{children:[p.jsx("span",{className:"text-emerald-400",children:e.passed_count}),p.jsx("span",{className:"text-gray-600",children:" / "}),p.jsx("span",{children:e.eval_count})]}),p.jsx("span",{className:"text-gray-700",children:"·"}),p.jsxs("span",{children:["avg ",r,"%"]})]})]}),t&&p.jsx(rte,{tests:e.tests})]})}function nte(){return p.jsx("div",{className:"text-center text-gray-600",children:"—"})}function rte({tests:e}){return p.jsxs("div",{className:"rounded-md border border-gray-800 bg-gray-950/60 px-3 py-2",children:[p.jsx("div",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Test cases"}),p.jsx("ul",{className:"space-y-1",children:e.map(t=>p.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[p.jsx("span",{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full ${t.passed?"bg-emerald-400":"bg-red-400"}`}),p.jsx("span",{className:"flex-1 truncate text-gray-300",title:t.test_id,children:t.test_id}),p.jsxs("span",{className:`tabular-nums ${t.passed?"text-emerald-400":"text-red-400"}`,children:[Math.round(t.score*100),"%"]})]},t.test_id))})]})}function ate({data:e,benchmarkId:t,readOnly:n}){const r=e.runs??[],[i,l]=j.useState(new Set),[u,c]=j.useState(!1),[d,h]=j.useState(null),m=x=>{l(S=>{const w=new Set(S);return w.has(x)?w.delete(x):w.add(x),w})},v=()=>l(new Set),g=j.useMemo(()=>r.filter(x=>i.has(x.run_id)),[r,i]);return r.length===0?p.jsx(uv,{headline:"No runs yet",body:"Run an evaluation to populate the per-run view."}):u&&g.length>=2?p.jsx(lte,{runs:g,onBack:()=>c(!1)}):p.jsxs("div",{className:"space-y-3",children:[p.jsx("div",{className:"flex items-center justify-between text-sm text-gray-400",children:p.jsxs("span",{children:[p.jsx("span",{className:"font-medium text-gray-300",children:r.length})," run",r.length===1?"":"s"," — select two or more to compare side-by-side"]})}),p.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"w-10 px-3 py-3","aria-label":"Select"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Timestamp"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Tags"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Tests"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass rate"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Avg"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:r.map(x=>p.jsx(ite,{run:x,checked:i.has(x.run_id),onToggle:()=>m(x.run_id),editing:d===x.run_id,onStartEdit:()=>h(x.run_id),onEndEdit:()=>h(null),benchmarkId:t,readOnly:n},x.run_id))})]})}),i.size>0&&p.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:[p.jsxs("div",{className:"text-sm text-gray-300",children:[p.jsx("span",{className:"font-semibold tabular-nums text-cyan-400",children:i.size})," ","selected"]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{type:"button",onClick:v,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200",children:"Clear"}),p.jsxs("button",{type:"button",disabled:i.size<2,onClick:()=>c(!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 ",i.size,p.jsx("span",{"aria-hidden":!0,children:"→"})]})]})]})]})}function ite({run:e,checked:t,onToggle:n,editing:r,onStartEdit:i,onEndEdit:l,benchmarkId:u,readOnly:c}){const d=Math.round(e.avg_score*100),h=!c&&e.source!=="remote",m=j.useRef(null),v=e.tags??[],g=v[0]??e.run_id,x=hte(e.run_id),S=j.useRef(r);return j.useEffect(()=>{var w;S.current&&!r&&((w=m.current)==null||w.focus()),S.current=r},[r]),p.jsxs(p.Fragment,{children:[p.jsxs("tr",{className:`transition-colors ${t?"bg-cyan-950/20 hover:bg-cyan-950/30":"hover:bg-gray-900/30"}`,children:[p.jsx("td",{className:"px-3 py-3 align-middle",children:p.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:n,"aria-label":`Select run ${g}`})}),p.jsxs("td",{className:"px-4 py-3 align-middle",title:e.run_id,children:[p.jsx("div",{className:"font-medium text-gray-200 tabular-nums",children:f3(e.started_at)}),x&&p.jsx("div",{className:"text-xs text-gray-500",children:x})]}),p.jsx("td",{className:"px-4 py-3 align-middle",children:h?p.jsx("button",{ref:m,type:"button",onClick:w=>{w.stopPropagation(),i()},className:v.length>0?"inline-flex flex-wrap items-center gap-1 rounded-md px-1 py-0.5 transition-colors hover:bg-gray-800/60":"rounded-md border border-dashed border-gray-700 px-2 py-0.5 text-xs text-gray-500 transition-colors hover:border-cyan-800 hover:text-cyan-400","aria-label":v.length>0?"Edit tags":"Add tags",children:v.length>0?v.map(w=>p.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/30 px-2 py-0.5 text-xs font-medium text-cyan-300",children:w},w)):p.jsx(p.Fragment,{children:"+ tags"})}):v.length>0?p.jsx("div",{className:"inline-flex flex-wrap items-center gap-1",children:v.map(w=>p.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/30 px-2 py-0.5 text-xs font-medium text-cyan-300",children:w},w))}):p.jsx("span",{className:"text-gray-600",children:"—"})}),p.jsx("td",{className:"px-4 py-3 align-middle text-gray-300",children:e.experiment}),p.jsx("td",{className:"px-4 py-3 align-middle text-gray-300",children:e.target}),p.jsx("td",{className:"px-4 py-3 align-middle text-right tabular-nums text-gray-400",children:e.eval_count}),p.jsx("td",{className:"px-4 py-3 align-middle",children:p.jsx(qa,{rate:e.pass_rate})}),p.jsxs("td",{className:"px-4 py-3 align-middle text-right tabular-nums text-gray-400",children:[d,"%"]})]}),r&&p.jsx("tr",{className:"bg-gray-950/80",children:p.jsx("td",{colSpan:8,className:"px-4 py-3",children:p.jsx(ste,{runId:e.run_id,currentTags:v,benchmarkId:u,onClose:l})})})]})}function ste({runId:e,currentTags:t,benchmarkId:n,onClose:r}){const[i,l]=j.useState(t),[u,c]=j.useState(""),[d,h]=j.useState(null),m=Ha(),v=j.useRef(null);j.useEffect(()=>{var A;(A=v.current)==null||A.focus()},[]);const g=I0({mutationFn:()=>vB(e,i,n),onSuccess:()=>{m.invalidateQueries({queryKey:["compare"]}),m.invalidateQueries({queryKey:["runs"]}),n&&(m.invalidateQueries({queryKey:["benchmarks",n,"compare"]}),m.invalidateQueries({queryKey:["benchmarks",n,"runs"]})),r()},onError:A=>h(A.message)}),x=I0({mutationFn:()=>pB(e,n),onSuccess:()=>{m.invalidateQueries({queryKey:["compare"]}),m.invalidateQueries({queryKey:["runs"]}),n&&(m.invalidateQueries({queryKey:["benchmarks",n,"compare"]}),m.invalidateQueries({queryKey:["benchmarks",n,"runs"]})),r()},onError:A=>h(A.message)}),S=g.isPending||x.isPending,w=i.length!==t.length||i.some((A,T)=>A!==t[T]),O=()=>{const A=u.trim();if(A!==""){if(i.includes(A)){c("");return}l([...i,A]),c(""),h(null)}},_=A=>{l(i.filter(T=>T!==A))};return p.jsxs("div",{className:"space-y-2 rounded-md border border-gray-800 bg-gray-900/60 p-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-gray-400",children:"Tag run"}),p.jsx("span",{className:"text-xs text-gray-500",children:"Multi-valued. Enter or comma adds; Backspace removes the last chip."})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-md border border-gray-700 bg-gray-950 px-2 py-1.5 focus-within:border-cyan-500 focus-within:ring-1 focus-within:ring-cyan-500",children:[i.map(A=>p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-cyan-900/60 bg-cyan-950/30 px-2 py-0.5 text-xs font-medium text-cyan-300",children:[A,p.jsx("button",{type:"button",onClick:()=>_(A),disabled:S,className:"text-cyan-500 transition-colors hover:text-cyan-200 disabled:opacity-50","aria-label":`Remove tag ${A}`,children:"×"})]},A)),p.jsx("input",{ref:v,type:"text",className:"flex-1 min-w-[140px] bg-transparent text-sm text-gray-100 placeholder:text-gray-600 focus:outline-none disabled:opacity-50",placeholder:i.length===0?"e.g. baseline, v2-prompt, slow":"Add tag…",value:u,onChange:A=>{h(null),c(A.target.value)},maxLength:60,disabled:S,onKeyDown:A=>{A.key==="Enter"||A.key===","?(A.preventDefault(),O()):A.key==="Backspace"&&u===""&&i.length>0?(A.preventDefault(),l(i.slice(0,-1))):A.key==="Escape"&&r()},onBlur:O})]}),p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[p.jsx("button",{type:"button",onClick:r,disabled:S,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200 disabled:opacity-50",children:"Cancel"}),t.length>0&&p.jsx("button",{type:"button",onClick:()=>{S||x.mutate()},disabled:S,className:"rounded-md border border-red-900/60 px-3 py-1.5 text-sm text-red-400 transition-colors hover:border-red-800 hover:bg-red-950/30 hover:text-red-300 disabled:opacity-50",children:"Clear all"}),p.jsx("button",{type:"button",disabled:!w||S,onClick:()=>{S||!w||g.mutate()},className:"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:g.isPending?"Saving…":"Save"})]}),d&&p.jsx("div",{className:"rounded-md border border-red-900/60 bg-red-950/30 px-3 py-1.5 text-xs text-red-400",children:d})]})}function lte({runs:e,onBack:t}){const n=j.useMemo(()=>{const i=new Set,l=[];for(const u of e)for(const c of u.tests)i.has(c.test_id)||(i.add(c.test_id),l.push(c.test_id));return l},[e]),r=j.useMemo(()=>e.map(i=>{const l=new Map;for(const u of i.tests)l.set(u.test_id,u);return l}),[e]);return p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.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:[p.jsx("span",{"aria-hidden":!0,children:"←"})," Back to runs"]}),p.jsxs("span",{className:"text-sm text-gray-500",children:[e.length," runs · ",n.length," tests"]})]}),p.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsxs("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:[p.jsxs("tr",{children:[p.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=>p.jsx("th",{className:"px-4 py-3 align-bottom",children:p.jsx(ote,{run:i})},i.run_id))]}),p.jsxs("tr",{className:"border-t border-gray-800/50 bg-gray-900/30",children:[p.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=>p.jsx("th",{className:"px-4 py-2",children:p.jsx(qa,{rate:i.pass_rate})},i.run_id))]})]}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(i=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.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}),r.map((l,u)=>{const c=l.get(i),d=e[u].run_id;return c?p.jsx("td",{className:"px-4 py-3",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full ${c.passed?"bg-emerald-400":"bg-red-400"}`}),p.jsxs("span",{className:`tabular-nums ${c.passed?"text-emerald-400":"text-red-400"}`,children:[Math.round(c.score*100),"%"]})]})},d):p.jsx("td",{className:"px-4 py-3 text-center text-gray-600",children:"—"},d)})]},i))})]})})]})}function ote({run:e}){const t=e.tags??[];return p.jsxs("div",{className:"min-w-[140px] space-y-1",children:[p.jsx("div",{className:"text-sm font-medium text-gray-200 tabular-nums",title:e.run_id,children:f3(e.started_at)}),t.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(n=>p.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/30 px-1.5 py-0.5 text-[0.7rem] font-medium text-cyan-300",children:n},n))}),p.jsxs("div",{className:"text-xs text-gray-500",children:[e.experiment," · ",e.target]})]})}function ute(){return p.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500",role:"note",children:[p.jsx(Xd,{className:"bg-emerald-400",label:"80%+"}),p.jsx(Xd,{className:"bg-yellow-400",label:"50–80%"}),p.jsx(Xd,{className:"bg-red-400",label:"< 50%"}),p.jsx(Xd,{className:"bg-gray-700",label:"no data"})]})}function Xd({className:e,label:t}){return p.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[p.jsx("span",{className:`h-2 w-2 rounded-full ${e}`,"aria-hidden":!0}),p.jsx("span",{children:t})]})}function cte({message:e}){return p.jsx("div",{className:"rounded-lg border border-red-900/60 bg-red-950/30 p-4 text-sm text-red-400",children:e})}function fte(){return p.jsx(uv,{headline:"No comparison data yet",body:"Run evaluations with different experiment and target combinations to populate this view."})}function uv({headline:e,body:t,action:n}){return p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[p.jsx("p",{className:"text-lg text-gray-300",children:e}),p.jsx("p",{className:"mt-2 text-sm text-gray-500",children:t}),n&&p.jsx("button",{type:"button",onClick:n.onClick,className:"mt-4 inline-flex items-center rounded-md bg-cyan-500 px-3 py-1.5 text-sm font-medium text-gray-950 transition-colors hover:bg-cyan-400",children:n.label})]})}function dte(){return p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("div",{className:"animate-pulse",children:[p.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>p.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[p.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},e))]})})}function f3(e){try{const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),l=String(t.getHours()).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0");return`${n}-${r}-${i} ${l}:${u}`}catch{return e}}function hte(e){const t=e.split("::");return t.length<2?null:t.slice(0,-1).join(" · ")}function mte(){const{data:e,isLoading:t}=ex();if(t)return p.jsx(vte,{});const n=(e==null?void 0:e.experiments)??[];return n.length===0?p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[p.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"}),p.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Experiments will appear here once evaluations are run with experiment labels."})]}):p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Targets"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Last Run"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(r=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3",children:p.jsx(Ie,{to:"/experiments/$experimentName",params:{experimentName:r.name},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:r.name})}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.run_count}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.target_count}),p.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[p.jsx("span",{className:"text-emerald-400",children:r.passed_count}),p.jsx("span",{className:"text-gray-600",children:" / "}),r.eval_count]}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(qa,{rate:r.pass_rate})}),p.jsx("td",{className:"px-4 py-3 text-gray-400",title:TP(r.last_run).full,children:TP(r.last_run).date})]},r.name))})]})})}function TP(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 n=t.toLocaleString(),r=Date.now()-t.getTime(),i=Math.floor(r/6e4),l=Math.floor(r/36e5);let u;return i<1?u="just now":i<60?u=`${i} min ago`:l<24?u=`${l} hour${l===1?"":"s"} ago`:u=t.toLocaleDateString(),{date:u,full:n}}catch{return{date:"N/A",full:"N/A"}}}function vte(){return p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("div",{className:"animate-pulse",children:[p.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>p.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[p.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},e))]})})}function pte(e){if(!e)return"No runs";const t=new Date(e);if(Number.isNaN(t.getTime()))return"N/A";const n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return"Just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function yte({project:e}){const t=Math.round(e.pass_rate*100);return p.jsxs(Ie,{to:"/projects/$benchmarkId",params:{benchmarkId:e.id},className:"group block rounded-lg border border-gray-800 bg-gray-900/50 p-5 transition-colors hover:border-cyan-800 hover:bg-gray-900",children:[p.jsx("div",{className:"flex items-start justify-between",children:p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("h3",{className:"truncate text-lg font-semibold text-white group-hover:text-cyan-400",children:e.name}),p.jsx("p",{className:"mt-1 truncate text-xs text-gray-500",children:e.path})]})}),p.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-3",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-gray-500",children:"Runs"}),p.jsx("p",{className:"text-lg font-semibold text-white",children:e.run_count})]}),p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-gray-500",children:"Pass Rate"}),p.jsx("p",{className:`text-lg font-semibold ${e.run_count===0?"text-gray-500":t>=80?"text-emerald-400":t>=50?"text-yellow-400":"text-red-400"}`,children:e.run_count>0?`${t}%`:"--"})]}),p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-gray-500",children:"Last Run"}),p.jsx("p",{className:"text-sm text-gray-300",children:pte(e.last_run)})]})]})]})}function cl({open:e,onClose:t,benchmarkId:n,prefill:r}){const i=Ha(),l=qc(),[u,c]=j.useState((r==null?void 0:r.suiteFilter)??""),[d,h]=j.useState(""),[m,v]=j.useState((r==null?void 0:r.testIds)??[]),[g,x]=j.useState((r==null?void 0:r.target)??""),[S,w]=j.useState(""),[O,_]=j.useState(""),[A,T]=j.useState(!1),[N,C]=j.useState(!1),[M,R]=j.useState(null),[z,B]=j.useState(null),[D,H]=j.useState(!1),[q,ae]=j.useState(null),{data:te}=bB(n),{data:re}=SB(n),{data:U}=UC(M),V=j.useMemo(()=>(te==null?void 0:te.eval_files)??[],[te]),ie=j.useMemo(()=>(re==null?void 0:re.targets)??[],[re]);j.useEffect(()=>{e&&(c((r==null?void 0:r.suiteFilter)??""),v((r==null?void 0:r.testIds)??[]),x((r==null?void 0:r.target)??""),h(""),w(""),_(""),T(!1),C(!1),R(null),B(null),H(!1),ae(null))},[e,r]),j.useEffect(()=>{((U==null?void 0:U.status)==="finished"||(U==null?void 0:U.status)==="failed")&&(i.invalidateQueries({queryKey:["runs"]}),i.invalidateQueries({queryKey:["projects"]}))},[U==null?void 0:U.status,i]);const oe=j.useCallback(()=>{const X={};return u.trim()&&(X.suite_filter=u.trim()),m.length>0&&(X.test_ids=m),g&&(X.target=g),S&&(X.threshold=Number.parseFloat(S)),O&&(X.workers=Number.parseInt(O,10)),A&&(X.dry_run=!0),X},[u,m,g,S,O,A]);j.useEffect(()=>{const X=oe();if(!X.suite_filter&&(!X.test_ids||X.test_ids.length===0)){ae(null);return}_B(X,n).then(ve=>ae(ve.command)).catch(()=>ae(null))},[oe,n]);function ce(){const X=d.trim();X&&!m.includes(X)&&v([...m,X]),h("")}function I(X){v(m.filter(ve=>ve!==X))}async function Z(){B(null),H(!0);try{const X=oe(),ve=await wB(X,n);R(ve.id)}catch(X){B(X.message)}finally{H(!1)}}if(!e)return null;if(M&&U){let X=function(){t(),l({to:"/",search:{tab:"runs"}})};return p.jsx(PP,{onClose:t,title:"Eval Run",children:p.jsx(gte,{status:U,onClose:t,onRunInBackground:X,runId:M})})}const se=!!(u.trim()||m.length>0);return p.jsx(PP,{onClose:t,title:"Run Eval",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"suite-filter",className:"mb-1 block text-sm font-medium text-gray-300",children:"Suite Filter"}),p.jsx("input",{id:"suite-filter",type:"text",value:u,onChange:X=>c(X.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"}),V.length>0&&!u&&p.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[V.slice(0,5).map(X=>p.jsx("button",{type:"button",onClick:()=>c(ve=>ve?`${ve}, ${X.relative_path}`:X.relative_path),className:"rounded bg-gray-800 px-2 py-0.5 text-xs text-gray-400 hover:bg-gray-700 hover:text-gray-200",children:X.relative_path},X.relative_path)),V.length>5&&p.jsxs("span",{className:"px-1 text-xs text-gray-500",children:["+",V.length-5," more"]})]})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"test-id-input",className:"mb-1 block text-sm font-medium text-gray-300",children:"Test ID Filter"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{id:"test-id-input",type:"text",value:d,onChange:X=>h(X.target.value),onKeyDown:X=>{X.key==="Enter"&&(X.preventDefault(),ce())},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"}),p.jsx("button",{type:"button",onClick:ce,disabled:!d.trim(),className:"rounded-md bg-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-600 disabled:opacity-50",children:"Add"})]}),m.length>0&&p.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:m.map(X=>p.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:[X,p.jsx("button",{type:"button",onClick:()=>I(X),className:"text-cyan-400 hover:text-white",children:"×"})]},X))})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"target-override",className:"mb-1 block text-sm font-medium text-gray-300",children:"Target Override"}),p.jsxs("select",{id:"target-override",value:g,onChange:X=>x(X.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:[p.jsx("option",{value:"",children:"Use eval's configured target"}),ie.map(X=>p.jsx("option",{value:X,children:X},X))]})]}),p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>C(!N),className:"text-sm text-gray-400 hover:text-gray-200",children:[N?"▾":"▸"," Advanced Options"]}),N&&p.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-3",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"threshold-input",className:"mb-1 block text-xs text-gray-400",children:"Threshold (0–1)"}),p.jsx("input",{id:"threshold-input",type:"number",value:S,onChange:X=>w(X.target.value),min:"0",max:"1",step:"0.1",placeholder:"0.8",className:"w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"workers-input",className:"mb-1 block text-xs text-gray-400",children:"Workers"}),p.jsx("input",{id:"workers-input",type:"number",value:O,onChange:X=>_(X.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"})]}),p.jsx("div",{className:"col-span-2",children:p.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-400",children:[p.jsx("input",{type:"checkbox",checked:A,onChange:X=>T(X.target.checked),className:"rounded border-gray-600 bg-gray-800"}),"Dry run (mock provider responses)"]})})]})]}),q&&p.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:[p.jsx("div",{className:"mb-1 text-xs text-gray-500",children:"CLI Preview"}),p.jsx("code",{className:"block break-all text-xs text-cyan-300",children:q})]}),z&&p.jsx("div",{className:"rounded-md border border-red-900/50 bg-red-950/20 p-2 text-sm text-red-400",children:z}),p.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[p.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"}),p.jsx("button",{type:"button",onClick:Z,disabled:!se||D,className:"rounded-md bg-cyan-600 px-4 py-2 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:D?"Launching…":"Run Now"})]})]})})}function PP({children:e,onClose:t,title:n}){return p.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/60 pt-[10vh]",children:p.jsxs("div",{className:"w-full max-w-lg rounded-lg border border-gray-700 bg-gray-900 shadow-xl",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-gray-800 px-5 py-3",children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:n}),p.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-white",children:"✕"})]}),p.jsx("div",{className:"px-5 py-4",children:e})]})})}function gte({status:e,onClose:t,onRunInBackground:n,runId:r}){const i=e.status==="finished"||e.status==="failed",l={starting:"text-yellow-400",running:"text-cyan-400",finished:"text-emerald-400",failed:"text-red-400"};return p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("span",{className:`text-sm font-medium ${l[e.status]??"text-gray-400"}`,children:[e.status==="running"&&"●"," ",e.status.charAt(0).toUpperCase()+e.status.slice(1)]}),!i&&p.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent"})]}),p.jsx("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:p.jsx("code",{className:"block break-all text-xs text-cyan-300",children:e.command})}),e.stdout&&p.jsx("div",{className:"max-h-48 overflow-y-auto rounded-md bg-gray-950 p-3",children:p.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-300",children:e.stdout.slice(-3e3)})}),e.stderr&&p.jsx("div",{className:"max-h-24 overflow-y-auto rounded-md bg-red-950/20 p-3",children:p.jsx("pre",{className:"whitespace-pre-wrap text-xs text-red-300",children:e.stderr.slice(-2e3)})}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-xs text-gray-500",children:i?p.jsxs(p.Fragment,{children:["Exit code: ",e.exit_code,e.finished_at&&` · ${new Date(e.finished_at).toLocaleTimeString()}`]}):r&&p.jsx("button",{type:"button",onClick:n,className:"text-xs text-gray-400 hover:text-cyan-400",children:"Run in background"})}),i&&p.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 bte(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 n=t.toLocaleString(),r=Date.now()-t.getTime(),i=Math.floor(r/6e4),l=Math.floor(r/36e5);let u;return i<1?u="just now":i<60?u=`${i} min ago`:l<24?u=`${l} hour${l===1?"":"s"} ago`:u=t.toLocaleDateString(),{date:u,full:n}}catch{return{date:"N/A",full:"N/A"}}}function xte(e){const t=[e.target,e.experiment].filter(n=>n&&n!=="default"&&n!=="-");return t.length>0?t.join(" · "):e.target?e.target:e.display_name??e.filename}function q1({runs:e,benchmarkId:t,emptyMessage:n}){const{data:r}=rn(),i=(r==null?void 0:r.threshold)??vh;return e.length===0?p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:n??p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-lg text-gray-400",children:"No evaluation runs found."}),p.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Run an evaluation first:"," ",p.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"agentv eval <eval-file>"})]})]})}):p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"w-8 px-4 py-3"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Run"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Passed"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Failed"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Total"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"When"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:e.map(l=>{const u=bte(l.timestamp),c=l.pass_rate>=i,d=xte(l),h=Math.round(l.pass_rate*l.test_count),m=l.test_count-h;return p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 text-center",children:p.jsx("span",{className:`text-base font-bold ${c?"text-emerald-400":"text-red-400"}`,children:c?"✓":"✗"})}),p.jsx("td",{className:"px-4 py-3",children:t?p.jsx(Ie,{to:"/projects/$benchmarkId/runs/$runId",params:{benchmarkId:t,runId:l.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:d}):p.jsx(Ie,{to:"/runs/$runId",params:{runId:l.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:d})}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-emerald-300",children:h}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:m>0?m:p.jsx("span",{className:"text-gray-600",children:"0"})}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:l.test_count}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(qa,{rate:l.pass_rate})}),p.jsx("td",{className:"px-4 py-3 text-gray-400",title:u.full,children:u.date})]},l.filename)})})]})})}function Ste(e){if(!e)return"Never synced";const t=new Date(e);return Number.isNaN(t.getTime())?"Never synced":`Last synced ${t.toLocaleString()}`}function d3({filter:e,onFilterChange:t,remoteStatus:n,syncInFlight:r,onSync:i}){const l=(n==null?void 0:n.configured)===!0,u=l&&(n==null?void 0:n.available)!==!0;return p.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-4",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[p.jsx("div",{className:"flex flex-wrap items-center gap-2",children:["all","local","remote"].map(c=>{const d=c==="remote"&&!l;return p.jsx("button",{type:"button",onClick:()=>t(c),title:d?"Remote results are not configured":void 0,className:`rounded-full px-3 py-1 text-sm font-medium transition-colors ${e===c?"bg-cyan-500/20 text-cyan-300":d?"bg-gray-800 text-gray-600":"bg-gray-800 text-gray-400 hover:text-gray-200"}`,children:c==="all"?"All Sources":c==="local"?"Local Only":"Remote Only"},c)})}),l&&i?p.jsx("button",{type:"button",onClick:i,disabled:r,className:"rounded-md border border-cyan-800 bg-cyan-950/40 px-3 py-1.5 text-sm font-medium text-cyan-300 transition-colors hover:bg-cyan-900/50 disabled:cursor-not-allowed disabled:opacity-60",children:r?"Syncing…":"Sync Remote Results"}):null]}),l?p.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-gray-400",children:[p.jsx("span",{children:Ste(n==null?void 0:n.last_synced_at)}),n!=null&&n.repo?p.jsxs("span",{children:["Repo: ",n.repo]}):null,u?p.jsx("span",{className:"text-yellow-400",children:"Remote cache unavailable"}):null]}):e==="all"?p.jsxs("p",{className:"text-sm text-gray-500",children:["Remote results are not configured. Add"," ",p.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:"results.export"})," to"," ",p.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:".agentv/config.yaml"})," to enable."]}):null,n!=null&&n.last_error?p.jsx("div",{className:"rounded-md border border-yellow-900/50 bg-yellow-950/20 px-3 py-2 text-sm text-yellow-300",children:n.last_error}):null]})}function wte(){const{data:e,isLoading:t}=tB();if(t)return p.jsx(jte,{});const n=(e==null?void 0:e.targets)??[];return n.length===0?p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[p.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"}),p.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Targets will appear here once evaluations are run with target labels."})]}):p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Experiments"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(r=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:r.name}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.run_count}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.experiment_count}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(qa,{rate:r.pass_rate})}),p.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[p.jsx("span",{className:"text-emerald-400",children:r.passed_count}),p.jsx("span",{className:"text-gray-600",children:"/"}),p.jsx("span",{children:r.eval_count})]})]},r.name))})]})})}function jte(){return p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("div",{className:"animate-pulse",children:[p.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>p.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[p.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-20 rounded bg-gray-800"})]},e))]})})}const CP=[{id:"runs",label:"🏃 Recent Runs"},{id:"experiments",label:"🧪 Experiments"},{id:"analytics",label:"📊 Analytics"},{id:"targets",label:"🤖 Targets"}],Ote=Rr("/")({component:_te});function _te(){const{data:e,isLoading:t}=tx(),{data:n,isLoading:r}=rn(),i=((e==null?void 0:e.projects.length)??0)>0,l=n==null?void 0:n.multi_project_dashboard;return t||r?p.jsx(h3,{}):l===!0||l===void 0&&i?p.jsx(Ete,{}):p.jsx(Ate,{})}function Ete(){const{data:e}=tx(),{data:t}=rn(),n=Ha(),[r,i]=j.useState(""),[l,u]=j.useState(""),[c,d]=j.useState(null),[h,m]=j.useState(!1),[v,g]=j.useState(!1),x=(e==null?void 0:e.projects)??[],S=(t==null?void 0:t.read_only)===!0;async function w(_){if(_.preventDefault(),!!r.trim()){d(null);try{await lB(r.trim()),i(""),m(!1),n.invalidateQueries({queryKey:["benchmarks"]})}catch(A){d(A.message)}}}async function O(_){if(_.preventDefault(),!!l.trim()){d(null);try{const A=await oB(l.trim());u(""),A.length===0&&d("No projects with .agentv/ found in that directory."),n.invalidateQueries({queryKey:["benchmarks"]})}catch(A){d(A.message)}}}return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Benchmarks"}),p.jsx("div",{className:"flex gap-2",children:!S&&p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button",onClick:()=>g(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"}),p.jsx("button",{type:"button",onClick:()=>m(!h),className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:h?"Cancel":"Add Benchmark"})]})})]}),c&&p.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-3 text-sm text-red-400",children:c}),!S&&h&&p.jsxs("div",{className:"space-y-3 rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[p.jsxs("form",{onSubmit:w,className:"flex gap-2",children:[p.jsx("input",{type:"text",value:r,onChange:_=>i(_.target.value),placeholder:"Benchmark path (e.g., /home/user/projects/my-evals)",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),p.jsx("button",{type:"submit",className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:"Add"})]}),p.jsxs("form",{onSubmit:O,className:"flex gap-2",children:[p.jsx("input",{type:"text",value:l,onChange:_=>u(_.target.value),placeholder:"Discover benchmarks in directory...",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),p.jsx("button",{type:"submit",className:"rounded-md bg-gray-700 px-3 py-1.5 text-sm font-medium text-white hover:bg-gray-600",children:"Discover"})]})]}),p.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:x.map(_=>p.jsx(yte,{project:_},_.id))}),!S&&p.jsx(cl,{open:v,onClose:()=>g(!1)})]})}function Ate(){const n=RC().location.search.tab,r=qc(),i=Ha(),{data:l,isLoading:u,error:c}=Jb(),{data:d}=LC(),{data:h}=rn(),[m,v]=j.useState(!1),[g,x]=j.useState("all"),[S,w]=j.useState(!1),O=(h==null?void 0:h.read_only)===!0,_=CP.some(N=>N.id===n)?n:"experiments",A=g==="all"?(l==null?void 0:l.runs)??[]:((l==null?void 0:l.runs)??[]).filter(N=>N.source===g);async function T(){w(!0);try{await $C(),await Promise.all([i.invalidateQueries({queryKey:["runs"]}),i.invalidateQueries({queryKey:["experiments"]}),i.invalidateQueries({queryKey:["compare"]}),i.invalidateQueries({queryKey:["targets"]}),i.invalidateQueries({queryKey:["remote-status",""]})])}finally{w(!1)}}return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Evaluation Runs"}),(h==null?void 0:h.project_name)&&p.jsx("p",{className:"mt-0.5 text-sm text-gray-500",children:h.project_name})]}),!O&&p.jsx("button",{type:"button",onClick:()=>v(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"})]}),p.jsx("div",{className:"border-b border-gray-800",children:p.jsx("div",{className:"flex gap-1",children:CP.map(N=>p.jsx("button",{type:"button",onClick:()=>r({to:"/",search:{tab:N.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${_===N.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:N.label},N.id))})}),_==="runs"&&p.jsx(Tte,{runs:A,isLoading:u,error:c,sourceFilter:g,onSourceFilterChange:x,remoteStatus:d,syncInFlight:S,onSyncRemote:T}),_==="experiments"&&p.jsx(mte,{}),_==="analytics"&&p.jsx(Nte,{readOnly:O}),_==="targets"&&p.jsx(wte,{}),!O&&p.jsx(cl,{open:m,onClose:()=>v(!1)})]})}function Nte({readOnly:e}){const{data:t,isLoading:n,isError:r,error:i}=eB();return p.jsx(c3,{data:t,isLoading:n,isError:r,error:i,readOnly:e})}function Tte({runs:e,isLoading:t,error:n,sourceFilter:r,onSourceFilterChange:i,remoteStatus:l,syncInFlight:u,onSyncRemote:c}){return t?p.jsx(h3,{}):n?p.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",n.message]}):p.jsxs("div",{className:"space-y-4",children:[p.jsx(Pte,{}),p.jsx(d3,{filter:r,onFilterChange:i,remoteStatus:l,syncInFlight:u,onSync:c}),p.jsx(q1,{runs:e,emptyMessage:r==="remote"?l!=null&&l.configured?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-lg text-gray-400",children:"No remote runs found."}),p.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Sync remote results or run an eval with"," ",p.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"auto_push: true"})," ","in your config."]})]}):p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-lg text-gray-400",children:"Remote results are not configured."}),p.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Add"," ",p.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"results.export"})," ","to"," ",p.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:".agentv/config.yaml"})," ","to enable remote result syncing."]})]}):void 0})]})}function Pte(){const{data:e}=qC(),t=((e==null?void 0:e.runs)??[]).filter(n=>n.status==="starting"||n.status==="running");return t.length===0?null:p.jsxs("div",{className:"rounded-lg border border-cyan-900/40 bg-cyan-950/10",children:[p.jsx("div",{className:"border-b border-cyan-900/30 px-4 py-2.5",children:p.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-cyan-400",children:"Active"})}),p.jsx("ul",{className:"divide-y divide-gray-800/50",children:t.map(n=>p.jsxs("li",{className:"flex items-center justify-between px-4 py-3",children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[p.jsx("span",{className:"inline-block h-2 w-2 flex-shrink-0 animate-pulse rounded-full bg-cyan-400"}),p.jsx("span",{className:"truncate font-mono text-sm text-gray-300",children:n.id}),p.jsx("span",{className:"flex-shrink-0 text-xs text-gray-500",children:new Date(n.started_at).toLocaleTimeString()})]}),p.jsx(Ie,{to:"/jobs/$runId",params:{runId:n.id},className:"ml-4 flex-shrink-0 text-xs text-cyan-400 hover:text-cyan-300",children:"View Log →"})]},n.id))})]})}function h3(){return p.jsx("div",{className:"space-y-2",children:["s1","s2","s3","s4","s5"].map(e=>p.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},e))})}function fm({total:e,passed:t,failed:n,passRate:r,totalCost:i}){const l=Math.round(r*100),u=l>=80?"text-cyan-400":l>=60?"text-amber-400":"text-red-400";return p.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:[p.jsx(lc,{label:"Pass Rate",value:`${l}%`,accent:u,large:!0}),p.jsx("div",{className:"h-6 w-px bg-gray-700"}),p.jsx(lc,{label:"Passed",value:String(t),accent:"text-emerald-400"}),p.jsx(lc,{label:"Failed",value:String(n),accent:"text-red-400"}),p.jsx(lc,{label:"Total",value:String(e)}),i!==void 0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"h-6 w-px bg-gray-700"}),p.jsx(lc,{label:"Cost",value:`$${i.toFixed(4)}`,accent:"text-amber-400"})]})]})}function lc({label:e,value:t,accent:n,large:r}){return p.jsxs("div",{className:"flex flex-col",children:[p.jsx("span",{className:"text-xs text-gray-500",children:e}),p.jsx("span",{className:`tabular-nums font-semibold ${r?"text-2xl":"text-lg"} ${n??"text-white"}`,children:t})]})}function Cte(e,t){const n=new Map;for(const r of e){const i=r.category??"Uncategorized",l=r.suite??"Uncategorized";n.has(i)||n.set(i,new Map);const u=n.get(i),c=u.get(l)??{passed:0,failed:0,total:0,scoreSum:0};c.total+=1,c.scoreSum+=r.score,La(r.score,t)?c.passed+=1:c.failed+=1,u.set(l,c)}return Array.from(n.entries()).map(([r,i])=>{const l=Array.from(i.entries()).map(([m,v])=>({name:m,...v,avgScore:v.total>0?v.scoreSum/v.total:0})).sort((m,v)=>m.name.localeCompare(v.name)),u=l.reduce((m,v)=>m+v.total,0),c=l.reduce((m,v)=>m+v.passed,0),d=l.reduce((m,v)=>m+v.failed,0),h=l.reduce((m,v)=>m+v.avgScore*v.total,0);return{name:r,suites:l,total:u,passed:c,failed:d,avgScore:u>0?h/u:0}}).sort((r,i)=>r.name.localeCompare(i.name))}function m3({results:e,runId:t,benchmarkId:n}){const{data:r}=rn(),i=(r==null?void 0:r.threshold)??(r==null?void 0:r.pass_threshold)??.8,l=e.length,u=e.filter(v=>La(v.score,i)).length,c=l-u,d=l>0?u/l:0,h=e.reduce((v,g)=>v+(g.costUsd??0),0),m=Cte(e,i);return l===0?p.jsxs("div",{className:"space-y-6",children:[p.jsx(fm,{total:0,passed:0,failed:0,passRate:0}),p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[p.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations found"}),p.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This run has no results yet."})]})]}):p.jsxs("div",{className:"space-y-6",children:[p.jsx(fm,{total:l,passed:u,failed:c,passRate:d,totalCost:h>0?h:void 0}),p.jsxs("div",{children:[p.jsx("h3",{className:"mb-3 text-sm font-medium text-gray-400",children:"Category Breakdown"}),p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Category"}),p.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Pass Rate"}),p.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Passed"}),p.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Failed"}),p.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Total"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:m.map(v=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-2.5 font-medium text-gray-200",children:v.name}),p.jsx("td",{className:"px-4 py-2.5",children:p.jsx(qa,{rate:v.total>0?v.passed/v.total:0})}),p.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-emerald-400",children:v.passed}),p.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-red-400",children:v.failed>0?v.failed:p.jsx("span",{className:"text-gray-600",children:"0"})}),p.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-gray-400",children:v.total})]},v.name))})]})})]}),p.jsxs("div",{children:[p.jsx("h3",{className:"mb-3 text-sm font-medium text-gray-400",children:"All Evals"}),p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"w-8 px-4 py-3"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),p.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:e.map((v,g)=>{const x=v.executionStatus==="execution_error",S=La(v.score,i);return p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 text-center",children:x?p.jsx("span",{className:"text-base font-bold text-red-400",children:"!"}):p.jsx("span",{className:`text-base font-bold ${S?"text-emerald-400":"text-red-400"}`,children:S?"✓":"✗"})}),p.jsx("td",{className:"px-4 py-3",children:n?p.jsx(Ie,{to:"/projects/$benchmarkId/evals/$runId/$evalId",params:{benchmarkId:n,runId:t,evalId:v.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:v.testId}):p.jsx(Ie,{to:"/evals/$runId/$evalId",params:{runId:t,evalId:v.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:v.testId})}),p.jsx("td",{className:"px-4 py-3 text-gray-400",children:v.target??"-"}),p.jsx("td",{className:"px-4 py-3",children:x?p.jsx("span",{className:"inline-flex rounded-full bg-red-900/50 px-2 py-0.5 text-xs font-medium text-red-400",children:"ERR"}):p.jsx(qa,{rate:v.score})}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:v.durationMs!=null?`${(v.durationMs/1e3).toFixed(1)}s`:"-"}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:v.costUsd!=null?`$${v.costUsd.toFixed(4)}`:"-"})]},`${v.testId}-${g}`)})})]})})]})]})}const v3=Rr("/runs/$runId")({component:Mte});function Mte(){var w;const{runId:e}=v3.useParams(),{data:t,isLoading:n,error:r}=Hc(e),{data:i}=rn(),[l,u]=j.useState(!1),c=(i==null?void 0:i.read_only)===!0;if(n)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(O=>p.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},O))})]});if(r)return p.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",r.message]});const d=(w=t==null?void 0:t.results)==null?void 0:w[0],h=d==null?void 0:d.target,m=d==null?void 0:d.experiment,v=d==null?void 0:d.timestamp,g=h?{target:h}:void 0,x=(()=>{const O=[m,h].filter(_=>_&&_!=="default");return O.length>0?O.join(" · "):e})(),S=[h,m&&m!=="default"?m:null,v?new Date(v).toLocaleString():null,t==null?void 0:t.source].filter(Boolean).join(" · ");return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:x}),p.jsx("p",{className:"mt-1 text-sm text-gray-500",children:S})]}),!c&&p.jsx("button",{type:"button",onClick:()=>u(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Re-run with Filters"})]}),p.jsx(m3,{results:(t==null?void 0:t.results)??[],runId:e}),!c&&p.jsx(cl,{open:l,onClose:()=>u(!1),prefill:g})]})}const MP=[{id:"runs",label:"Recent Runs"},{id:"experiments",label:"Experiments"},{id:"analytics",label:"Analytics"},{id:"targets",label:"Targets"}],p3=Rr("/projects/$benchmarkId")({component:Rte});function Rte(){const{benchmarkId:e}=p3.useParams(),r=RC().location.search.tab,i=qc(),[l,u]=j.useState(!1),{data:c}=rn(),d=(c==null?void 0:c.read_only)===!0,h=MP.some(m=>m.id===r)?r:"experiments";return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:e}),!d&&p.jsx("button",{type:"button",onClick:()=>u(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"})]}),p.jsx("div",{className:"border-b border-gray-800",children:p.jsx("div",{className:"flex gap-1",children:MP.map(m=>p.jsx("button",{type:"button",onClick:()=>i({to:"/projects/$benchmarkId",params:{benchmarkId:e},search:{tab:m.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${h===m.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:m.label},m.id))})}),h==="runs"&&p.jsx(Dte,{benchmarkId:e}),h==="experiments"&&p.jsx(kte,{benchmarkId:e}),h==="analytics"&&p.jsx(Ite,{benchmarkId:e,readOnly:d}),h==="targets"&&p.jsx(Lte,{benchmarkId:e}),!d&&p.jsx(cl,{open:l,onClose:()=>u(!1),benchmarkId:e})]})}function Dte({benchmarkId:e}){const t=Ha(),{data:n,isLoading:r,error:i}=zC(e),{data:l}=LC(e),[u,c]=j.useState("all"),[d,h]=j.useState(!1),m=u==="all"?(n==null?void 0:n.runs)??[]:((n==null?void 0:n.runs)??[]).filter(g=>g.source===u);async function v(){h(!0);try{await $C(e),await Promise.all([t.invalidateQueries({queryKey:["benchmarks",e,"runs"]}),t.invalidateQueries({queryKey:["benchmarks",e,"experiments"]}),t.invalidateQueries({queryKey:["benchmarks",e,"compare"]}),t.invalidateQueries({queryKey:["benchmarks",e,"targets"]}),t.invalidateQueries({queryKey:["remote-status",e]})])}finally{h(!1)}}return r?p.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(g=>p.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},g))}):i?p.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",i.message]}):p.jsxs("div",{className:"space-y-4",children:[p.jsx(d3,{filter:u,onFilterChange:c,remoteStatus:l,syncInFlight:d,onSync:v}),p.jsx(q1,{runs:m,benchmarkId:e})]})}function kte({benchmarkId:e}){const{data:t,isLoading:n}=ot(hB(e)),r=(t==null?void 0:t.experiments)??[];return n?p.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(i=>p.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},i))}):r.length===0?p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:p.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"})}):p.jsx("div",{className:"space-y-2",children:r.map(i=>p.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[p.jsxs("div",{children:[p.jsx("p",{className:"font-medium text-white",children:i.name}),p.jsxs("p",{className:"text-sm text-gray-400",children:[i.run_count," run",i.run_count!==1?"s":""]})]}),p.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(i.pass_rate*100),"%"]})]},i.name))})}function Ite({benchmarkId:e,readOnly:t}){const{data:n,isLoading:r,isError:i,error:l}=ot(BC(e));return p.jsx(c3,{data:n,isLoading:r,isError:i,error:l,benchmarkId:e,readOnly:t})}function Lte({benchmarkId:e}){const{data:t,isLoading:n}=ot(mB(e)),r=(t==null?void 0:t.targets)??[];return n?p.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(i=>p.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},i))}):r.length===0?p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:p.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"})}):p.jsx("div",{className:"space-y-2",children:r.map(i=>p.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[p.jsxs("div",{children:[p.jsx("p",{className:"font-medium text-white",children:i.name}),p.jsxs("p",{className:"text-sm text-gray-400",children:[i.run_count," run",i.run_count!==1?"s":""," · ",i.experiment_count," ","experiment",i.experiment_count!==1?"s":""]})]}),p.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(i.pass_rate*100),"%"]})]},i.name))})}const y3=Rr("/jobs/$runId")({component:zte});function zte(){const{runId:e}=y3.useParams(),{data:t,isLoading:n,error:r}=UC(e);if(n)return p.jsxs("div",{className:"space-y-4",children:[p.jsx(S0,{}),p.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"h-64 animate-pulse rounded-lg bg-gray-900"})]});if(r||!t)return p.jsxs("div",{className:"space-y-4",children:[p.jsx(S0,{}),p.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4 text-sm text-red-400",children:r?`Failed to load run: ${r.message}`:"Run not found."})]});const i=t.status==="finished"||t.status==="failed",u={starting:"text-yellow-400",running:"text-cyan-400",finished:"text-emerald-400",failed:"text-red-400"}[t.status]??"text-gray-400";return p.jsxs("div",{className:"space-y-4",children:[p.jsx(S0,{}),p.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-4",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("h1",{className:"truncate font-mono text-base font-semibold text-white",children:e}),p.jsxs("p",{className:"mt-0.5 text-xs text-gray-500",children:["Started ",new Date(t.started_at).toLocaleString(),t.finished_at&&p.jsxs(p.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"]})]})]}),p.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2",children:[p.jsx("span",{className:`text-sm font-medium ${u}`,children:t.status.charAt(0).toUpperCase()+t.status.slice(1)}),!i&&p.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent"})]})]}),p.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 px-4 py-3",children:[p.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Command"}),p.jsx("code",{className:"break-all text-xs text-cyan-300",children:t.command})]}),t.stdout?p.jsxs("div",{children:[p.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Output"}),p.jsx("div",{className:"max-h-[60vh] overflow-y-auto rounded-lg border border-gray-700 bg-gray-950 p-4",children:p.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-gray-200",children:t.stdout})})]}):!i&&p.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[p.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&&p.jsxs("div",{children:[p.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-red-500",children:"Stderr"}),p.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border border-red-900/40 bg-red-950/20 p-4",children:p.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-red-300",children:t.stderr})})]}),i&&p.jsxs("p",{className:"text-xs text-gray-500",children:["Exit code:"," ",p.jsx("span",{className:t.exit_code===0?"text-emerald-400":"text-red-400",children:t.exit_code})]})]})}function S0(){return p.jsx(Ie,{to:"/",search:{tab:"runs"},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to Runs"})}const g3=Rr("/experiments/$experimentName")({component:Bte});function Bte(){var v;const{experimentName:e}=g3.useParams(),{data:t,isLoading:n}=ex(),{data:r,isLoading:i}=Jb();if(n||i)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"grid grid-cols-4 gap-4",children:["s1","s2","s3","s4"].map(g=>p.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},g))})]});const u=(v=t==null?void 0:t.experiments)==null?void 0:v.find(g=>g.name===e),c=(r==null?void 0:r.runs)??[],d=(u==null?void 0:u.pass_rate)??0,h=(u==null?void 0:u.run_count)??0,m=(u==null?void 0:u.target_count)??0;return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:e}),p.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[h," run",h!==1?"s":""," · ",m," target",m!==1?"s":"",(u==null?void 0:u.last_run)&&p.jsxs("span",{className:"ml-2",children:["· Last run: ",RP(u.last_run)]})]})]}),u&&p.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-4",children:[p.jsx(Zd,{label:"Runs",value:String(h)}),p.jsx(Zd,{label:"Targets",value:String(m)}),p.jsx(Zd,{label:"Pass Rate",value:`${Math.round(d*100)}%`,accent:"text-cyan-400"}),p.jsx(Zd,{label:"Last Run",value:RP(u.last_run)})]}),p.jsxs("div",{children:[p.jsx("h2",{className:"mb-4 text-lg font-medium text-gray-200",children:"All Runs"}),p.jsx(q1,{runs:c})]})]})}function Zd({label:e,value:t,accent:n}){return p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[p.jsx("p",{className:"text-sm text-gray-400",children:e}),p.jsx("p",{className:`mt-1 text-2xl font-semibold tabular-nums ${n??"text-white"}`,children:t})]})}function RP(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"}}async function $te(e,t){const n=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviews:[{test_id:e,comment:t}]})});if(!n.ok)throw new Error(`Failed to save feedback: ${n.status}`);return n.json()}function Ute({testId:e}){var m;const{data:t}=J5(),n=Ha(),r=(m=t==null?void 0:t.reviews)==null?void 0:m.find(v=>v.test_id===e),[i,l]=j.useState((r==null?void 0:r.comment)??""),[u,c]=j.useState(!1);j.useEffect(()=>{l((r==null?void 0:r.comment)??""),c(!1)},[r==null?void 0:r.comment]);const d=I0({mutationFn:()=>$te(e,i),onSuccess:()=>{n.invalidateQueries({queryKey:["feedback"]}),c(!0),setTimeout(()=>c(!1),2e3)}}),h=j.useCallback(()=>{d.mutate()},[d]);return p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[p.jsx("h4",{className:"mb-2 text-sm font-medium text-gray-400",children:"Feedback"}),p.jsx("textarea",{value:i,onChange:v=>{l(v.target.value),c(!1)},placeholder:"Add feedback for this test...",className:"w-full rounded-md border border-gray-700 bg-gray-800 p-3 text-sm text-gray-200 placeholder-gray-500 focus:border-cyan-400 focus:outline-none",rows:3}),p.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[p.jsx("button",{type:"button",onClick:h,disabled:d.isPending,className:"rounded-md bg-cyan-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:d.isPending?"Saving...":"Save Feedback"}),u&&p.jsx("span",{className:"text-sm text-emerald-400",children:"Saved"}),d.isError&&p.jsx("span",{className:"text-sm text-red-400",children:"Error saving feedback"})]})]})}function qte(e){var n;switch((n=e.split(".").pop())==null?void 0:n.toLowerCase()){case"ts":case"tsx":return"📘";case"json":return"📋";case"log":case"txt":return"📜";case"md":return"📝";default:return"📄"}}function b3(e){const t=[];for(const n of e)n.type==="dir"&&(t.push(n.path),n.children&&t.push(...b3(n.children)));return t}function x3({node:e,selectedPath:t,onSelect:n,openFolders:r,toggleFolder:i,depth:l=0}){const u=e.type==="dir",c=r.has(e.path),d=t===e.path;return p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>{u?i(e.path):n(e.path)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors ${d?"bg-cyan-400/20 text-cyan-400":"text-gray-300 hover:bg-gray-800/50 hover:text-gray-200"}`,style:{paddingLeft:`${l*16+8}px`},children:[p.jsx("span",{className:"flex-shrink-0 text-xs",children:u?c?"📂":"📁":qte(e.name)}),p.jsx("span",{className:"truncate",children:e.name})]}),u&&c&&e.children&&p.jsx("div",{children:e.children.map(h=>p.jsx(x3,{node:h,selectedPath:t,onSelect:n,openFolders:r,toggleFolder:i,depth:l+1},h.path))})]})}function Hte({files:e,selectedPath:t,onSelect:n}){const[r,i]=j.useState(()=>new Set(b3(e))),l=u=>{i(c=>{const d=new Set(c);return d.has(u)?d.delete(u):d.add(u),d})};return p.jsxs("div",{className:"w-64 overflow-y-auto rounded-lg border border-gray-800 bg-gray-900 py-2",children:[e.length===0&&p.jsx("p",{className:"px-4 py-2 text-sm text-gray-500",children:"No files."}),e.map(u=>p.jsx(x3,{node:u,selectedPath:t,onSelect:n,openFolders:r,toggleFolder:l},u.path))]})}const Kte="modulepreload",Fte=function(e){return"/"+e},DP={},Yte=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let u=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=u(n.map(h=>{if(h=Fte(h),h in DP)return;DP[h]=!0;const m=h.endsWith(".css"),v=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${v}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":Kte,m||(g.as="script"),g.crossOrigin="",g.href=h,d&&g.setAttribute("nonce",d),document.head.appendChild(g),m)return new Promise((x,S)=>{g.addEventListener("load",x),g.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(u){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=u,window.dispatchEvent(c),!c.defaultPrevented)throw u}return i.then(u=>{for(const c of u||[])c.status==="rejected"&&l(c.reason);return t().catch(l)})},Gte=j.lazy(()=>Yte(()=>import("./index-vZYHIvCH.js"),[]));function Vte({value:e,language:t="json",height:n="400px"}){return p.jsx(j.Suspense,{fallback:p.jsx("div",{className:"flex items-center justify-center rounded-lg bg-gray-900 p-8 text-gray-500",children:"Loading editor..."}),children:p.jsx(Gte,{height:n,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 Bb({score:e,className:t=""}){const n=Math.round(Math.max(0,Math.min(1,e))*100);return p.jsxs("div",{className:`flex items-center gap-3 ${t}`,children:[p.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-gray-800",children:p.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-cyan-400 to-blue-500 transition-all duration-300",style:{width:`${n}%`}})}),p.jsxs("span",{className:"w-12 text-right text-sm font-medium tabular-nums text-gray-300",children:[n,"%"]})]})}function S3(e){for(const t of e){if(t.type==="file")return t.path;if(t.children){const n=S3(t.children);if(n)return n}}return null}function w3({eval:e,runId:t,benchmarkId:n}){const[r,i]=j.useState("checks"),{data:l}=rn(),u=(l==null?void 0:l.read_only)===!0,c=[{id:"checks",label:"Checks"},{id:"files",label:"Files"},...u?[]:[{id:"feedback",label:"Feedback"}]];return p.jsxs("div",{className:"flex min-h-full flex-col",children:[p.jsx("div",{className:"flex items-start justify-between border-b border-gray-800 px-4 py-3",children:p.jsxs("div",{children:[p.jsx("h3",{className:"text-lg font-medium",children:e.testId}),p.jsxs("p",{className:"mt-0.5 text-sm text-gray-400",children:[e.target&&p.jsxs("span",{children:["Target: ",e.target]}),e.durationMs!=null&&p.jsxs("span",{className:"ml-4",children:[(e.durationMs/1e3).toFixed(1),"s"]}),e.costUsd!=null&&p.jsxs("span",{className:"ml-4",children:["$",e.costUsd.toFixed(4)]})]})]})}),p.jsx("div",{className:"border-b border-gray-800",children:p.jsx("div",{className:"flex gap-1 px-4",children:c.map(d=>p.jsx("button",{type:"button",onClick:()=>i(d.id),className:`px-4 py-2 text-sm font-medium transition-colors ${r===d.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:d.label},d.id))})}),p.jsxs("div",{className:"min-h-0 flex-1",children:[r==="checks"&&p.jsx("div",{className:"overflow-auto p-4",children:p.jsx(Qte,{result:e})}),r==="files"&&p.jsx("div",{className:"h-full p-4",children:p.jsx(Xte,{result:e,runId:t,benchmarkId:n})}),!u&&r==="feedback"&&p.jsx("div",{className:"p-4",children:p.jsx(Ute,{testId:e.testId})})]})]})}function kP({assertion:e}){return p.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:[p.jsx("span",{className:`mt-0.5 text-lg ${e.passed?"text-emerald-400":"text-red-400"}`,children:e.passed?"✓":"✗"}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("p",{className:"text-sm text-gray-200",children:[e.text,e.durationMs!=null&&p.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",(e.durationMs/1e3).toFixed(1),"s)"]})]}),e.evidence&&p.jsx("p",{className:"mt-1 text-xs text-gray-400",children:e.evidence})]})]})}function Qte({result:e}){const{data:t}=rn(),n=(t==null?void 0:t.threshold)??(t==null?void 0:t.pass_threshold)??.8,r=!La(e.score,n)||e.executionStatus==="error"||e.executionStatus==="failed",i=(e.scores??[]).filter(h=>Array.isArray(h.assertions)&&h.assertions.length>0),l=i.length>0,u=e.assertions??[],c=[];e.error&&c.push(e.error),(e.executionStatus==="error"||e.executionStatus==="failed")&&c.push(`Execution status: ${e.executionStatus}`);const d=l?i.flatMap(h=>h.assertions):u;for(const h of d.filter(m=>!m.passed)){const m=h.evidence?`${h.text}: ${h.evidence}`:h.text;c.push(m)}if(e.scores){for(const h of e.scores)if(!La(h.score,n)&&h.details){const m=typeof h.details=="string"?h.details:JSON.stringify(h.details,null,2);c.push(`[${h.name??h.type??"evaluator"}] ${m}`)}}return p.jsxs("div",{className:"space-y-6",children:[p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("span",{className:"text-sm font-medium text-gray-400",children:"Overall score"}),p.jsx("div",{className:"flex-1",children:p.jsx(Bb,{score:e.score})})]})}),e.scores&&e.scores.length>0&&p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[p.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-400",children:"Evaluator Scores"}),p.jsx("div",{className:"space-y-3",children:e.scores.map((h,m)=>p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("span",{className:"w-40 truncate text-sm text-gray-300",children:h.name??h.type??`Score ${m+1}`}),p.jsx("div",{className:"flex-1",children:p.jsx(Bb,{score:h.score})})]},`${h.name??h.type??m}`))})]}),l?p.jsx("div",{className:"space-y-6",children:i.map((h,m)=>{const v=h.name??h.type??`Evaluator ${m+1}`;return p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:v}),h.assertions.map((g,x)=>p.jsx(kP,{assertion:g},`${g.text}-${x}`))]},`${h.name??h.type??m}`)})}):u.length>0?p.jsx("div",{className:"space-y-2",children:u.map((h,m)=>p.jsx(kP,{assertion:h},`${h.text}-${m}`))}):p.jsx("p",{className:"text-sm text-gray-500",children:"No assertion steps recorded."}),r&&c.length>0&&p.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[p.jsx("h4",{className:"mb-2 text-sm font-medium text-red-400",children:"Failure Reason"}),p.jsx("div",{className:"space-y-2",children:c.map(h=>p.jsx("p",{className:"text-sm text-gray-300",children:h},h))})]})]})}function Xte({result:e,runId:t,benchmarkId:n}){const r=e.testId,{data:i}=n?ot(fB(n,t,r)):nB(t,r),l=(i==null?void 0:i.files)??[],[u,c]=j.useState(null),d=u??(l.length>0?S3(l):null),{data:h,isLoading:m}=n?ot(dB(n,t,r,d??"")):rB(t,r,d??"");if(l.length===0)return p.jsx("p",{className:"text-sm text-gray-500",children:"No artifact files available."});const v=d?m?"Loading...":(h==null?void 0:h.content)??"":"",g=d?(h==null?void 0:h.language)??"plaintext":"plaintext";return p.jsxs("div",{className:"flex h-full min-h-[400px] gap-4",children:[p.jsx(Hte,{files:l,selectedPath:d,onSelect:c}),p.jsx("div",{className:"flex-1",children:p.jsx(Vte,{value:v,language:g,height:"100%"})})]})}const j3=Rr("/evals/$runId/$evalId")({component:Zte});function Zte(){const{runId:e,evalId:t}=j3.useParams(),{data:n,isLoading:r,error:i}=Hc(e),{data:l}=rn(),[u,c]=j.useState(!1),d=(l==null?void 0:l.read_only)===!0;if(r)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(i)return p.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",i.message]});const h=n==null?void 0:n.results.find(m=>m.testId===t);return h?p.jsxs("div",{className:"flex h-full flex-col gap-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",e," / Eval: ",t]}),p.jsx("h1",{className:"text-2xl font-semibold text-white",children:t})]}),!d&&p.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:"▶ Run this Test"})]}),p.jsx(w3,{eval:h,runId:e}),!d&&p.jsx(cl,{open:u,onClose:()=>c(!1),prefill:{testIds:[t],target:h.target}})]}):p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:p.jsxs("p",{className:"text-gray-400",children:["Eval ",p.jsx("code",{className:"text-cyan-400",children:t})," not found in run"," ",p.jsx("code",{className:"text-cyan-400",children:e}),"."]})})}const O3=Rr("/runs/$runId_/suite/$suite")({component:Wte});function Wte(){const{runId:e,suite:t}=O3.useParams(),{data:n,isLoading:r,error:i}=Hc(e),{data:l}=rn(),u=(l==null?void 0:l.threshold)??(l==null?void 0:l.pass_threshold)??.8;if(r)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(x=>p.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},x))})]});if(i)return p.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=((n==null?void 0:n.results)??[]).filter(x=>(x.suite??"Uncategorized")===t),d=c.length,h=c.filter(x=>La(x.score,u)).length,m=d-h,v=d>0?h/d:0,g=c.reduce((x,S)=>x+(S.costUsd??0),0);return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:t}),p.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Suite in run: ",e]})]}),p.jsx(fm,{total:d,passed:h,failed:m,passRate:v,totalCost:g>0?g:void 0}),d===0?p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:p.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations in this suite"})}):p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),p.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:c.map((x,S)=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3",children:p.jsx(Ie,{to:"/evals/$runId/$evalId",params:{runId:e,evalId:x.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:x.testId})}),p.jsx("td",{className:"px-4 py-3 text-gray-400",children:x.target??"-"}),p.jsx("td",{className:"px-4 py-3",children:x.executionStatus==="execution_error"?p.jsx("span",{className:"inline-flex rounded-full px-2 py-0.5 text-xs font-medium bg-red-900/50 text-red-400",children:"ERR"}):p.jsx(qa,{rate:x.score})}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:x.durationMs!=null?`${(x.durationMs/1e3).toFixed(1)}s`:"-"}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:x.costUsd!=null?`$${x.costUsd.toFixed(4)}`:"-"})]},`${x.testId}-${S}`))})]})})]})}const _3=Rr("/runs/$runId_/category/$category")({component:Jte});function Jte(){const{runId:e,category:t}=_3.useParams(),{data:n,isLoading:r,error:i}=IC(e,t);if(r)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(m=>p.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},m))})]});if(i)return p.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 l=(n==null?void 0:n.suites)??[],u=l.reduce((m,v)=>m+v.total,0),c=l.reduce((m,v)=>m+v.passed,0),d=u-c,h=u>0?c/u:0;return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:t}),p.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Category in run: ",e]})]}),p.jsx(fm,{total:u,passed:c,failed:d,passRate:h}),l.length===0?p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:p.jsx("p",{className:"text-lg text-gray-400",children:"No suites in this category"})}):p.jsxs("div",{className:"space-y-3",children:[p.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Suites"}),p.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:l.map(m=>p.jsxs(Ie,{to:"/runs/$runId/suite/$suite",params:{runId:e,suite:m.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:m.name}),p.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[m.passed,"/",m.total]})]}),p.jsx("div",{className:"mt-2",children:p.jsx(Bb,{score:m.avg_score})}),p.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[p.jsxs("span",{className:"text-emerald-400",children:[m.passed," passed"]}),m.failed>0&&p.jsxs("span",{className:"text-red-400",children:[m.failed," failed"]})]})]},m.name))})]})]})}const E3=Rr("/projects/$benchmarkId_/runs/$runId")({component:ene});function ene(){var O;const{benchmarkId:e,runId:t}=E3.useParams(),{data:n,isLoading:r,error:i}=nx(e,t),{data:l}=rn(),[u,c]=j.useState(!1),d=(l==null?void 0:l.read_only)===!0;if(r)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(_=>p.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},_))})]});if(i)return p.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 h=(O=n==null?void 0:n.results)==null?void 0:O[0],m=h==null?void 0:h.target,v=h==null?void 0:h.experiment,g=h==null?void 0:h.timestamp,x=m?{target:m}:void 0,S=(()=>{const _=[v,m].filter(A=>A&&A!=="default");return _.length>0?_.join(" · "):t})(),w=[m,v&&v!=="default"?v:null,g?new Date(g).toLocaleString():null,n==null?void 0:n.source].filter(Boolean).join(" · ");return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:S}),p.jsx("p",{className:"mt-1 text-sm text-gray-500",children:w})]}),!d&&p.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:"▶ Re-run with Filters"})]}),p.jsx(m3,{results:(n==null?void 0:n.results)??[],runId:t,benchmarkId:e}),!d&&p.jsx(cl,{open:u,onClose:()=>c(!1),benchmarkId:e,prefill:x})]})}const A3=Rr("/projects/$benchmarkId_/evals/$runId/$evalId")({component:tne});function tne(){const{benchmarkId:e,runId:t,evalId:n}=A3.useParams(),{data:r,isLoading:i,error:l}=nx(e,t),{data:u}=rn(),[c,d]=j.useState(!1),h=(u==null?void 0:u.read_only)===!0;if(i)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(l)return p.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 m=r==null?void 0:r.results.find(v=>v.testId===n);return m?p.jsxs("div",{className:"flex h-full flex-col gap-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",t," / Eval: ",n]}),p.jsx("h1",{className:"text-2xl font-semibold text-white",children:n})]}),!h&&p.jsx("button",{type:"button",onClick:()=>d(!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"})]}),p.jsx(w3,{eval:m,runId:t,benchmarkId:e}),!h&&p.jsx(cl,{open:c,onClose:()=>d(!1),benchmarkId:e,prefill:{testIds:[n],target:m.target}})]}):p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:p.jsxs("p",{className:"text-gray-400",children:["Eval ",p.jsx("code",{className:"text-cyan-400",children:n})," not found in run"," ",p.jsx("code",{className:"text-cyan-400",children:t}),"."]})})}const nne=kB.update({id:"/settings",path:"/settings",getParentRoute:()=>br}),rne=Ote.update({id:"/",path:"/",getParentRoute:()=>br}),ane=v3.update({id:"/runs/$runId",path:"/runs/$runId",getParentRoute:()=>br}),ine=p3.update({id:"/projects/$benchmarkId",path:"/projects/$benchmarkId",getParentRoute:()=>br}),sne=y3.update({id:"/jobs/$runId",path:"/jobs/$runId",getParentRoute:()=>br}),lne=g3.update({id:"/experiments/$experimentName",path:"/experiments/$experimentName",getParentRoute:()=>br}),one=j3.update({id:"/evals/$runId/$evalId",path:"/evals/$runId/$evalId",getParentRoute:()=>br}),une=O3.update({id:"/runs/$runId_/suite/$suite",path:"/runs/$runId/suite/$suite",getParentRoute:()=>br}),cne=_3.update({id:"/runs/$runId_/category/$category",path:"/runs/$runId/category/$category",getParentRoute:()=>br}),fne=E3.update({id:"/projects/$benchmarkId_/runs/$runId",path:"/projects/$benchmarkId/runs/$runId",getParentRoute:()=>br}),dne=A3.update({id:"/projects/$benchmarkId_/evals/$runId/$evalId",path:"/projects/$benchmarkId/evals/$runId/$evalId",getParentRoute:()=>br}),hne={IndexRoute:rne,SettingsRoute:nne,ExperimentsExperimentNameRoute:lne,JobsRunIdRoute:sne,ProjectsBenchmarkIdRoute:ine,RunsRunIdRoute:ane,EvalsRunIdEvalIdRoute:one,ProjectsBenchmarkIdRunsRunIdRoute:fne,RunsRunIdCategoryCategoryRoute:cne,RunsRunIdSuiteSuiteRoute:une,ProjectsBenchmarkIdEvalsRunIdEvalIdRoute:dne},mne=br._addFileChildren(hne)._addFileTypes(),vne=new CL({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!0}}}),pne=R5({routeTree:mne}),N3=document.getElementById("root");if(!N3)throw new Error("Root element not found");sL.createRoot(N3).render(p.jsx(j.StrictMode,{children:p.jsx(ML,{client:vne,children:p.jsx(I5,{router:pne})})}));export{_o as W,j as r};
116
+ */var BT;function PQ(){if(BT)return Je;BT=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),x=Symbol.for("react.client.reference");function S(w){if(typeof w=="object"&&w!==null){var O=w.$$typeof;switch(O){case e:switch(w=w.type,w){case n:case i:case r:case d:case h:case g:return w;default:switch(w=w&&w.$$typeof,w){case u:case c:case v:case m:return w;case l:return w;default:return O}}case t:return O}}}return Je.ContextConsumer=l,Je.ContextProvider=u,Je.Element=e,Je.ForwardRef=c,Je.Fragment=n,Je.Lazy=v,Je.Memo=m,Je.Portal=t,Je.Profiler=i,Je.StrictMode=r,Je.Suspense=d,Je.SuspenseList=h,Je.isContextConsumer=function(w){return S(w)===l},Je.isContextProvider=function(w){return S(w)===u},Je.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},Je.isForwardRef=function(w){return S(w)===c},Je.isFragment=function(w){return S(w)===n},Je.isLazy=function(w){return S(w)===v},Je.isMemo=function(w){return S(w)===m},Je.isPortal=function(w){return S(w)===t},Je.isProfiler=function(w){return S(w)===i},Je.isStrictMode=function(w){return S(w)===r},Je.isSuspense=function(w){return S(w)===d},Je.isSuspenseList=function(w){return S(w)===h},Je.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===n||w===i||w===r||w===d||w===h||typeof w=="object"&&w!==null&&(w.$$typeof===v||w.$$typeof===m||w.$$typeof===u||w.$$typeof===l||w.$$typeof===c||w.$$typeof===x||w.getModuleId!==void 0)},Je.typeOf=S,Je}var $T;function CQ(){return $T||($T=1,d0.exports=PQ()),d0.exports}var MQ=CQ(),UT=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",qT=null,h0=null,v4=e=>{if(e===qT&&Array.isArray(h0))return h0;var t=[];return j.Children.forEach(e,n=>{ht(n)||(MQ.isFragment(n)?t=t.concat(v4(n.props.children)):t.push(n))}),h0=t,qT=e,t};function RQ(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(i=>UT(i)):r=[UT(t)],v4(e).forEach(i=>{var l=No(i,"type.displayName")||No(i,"type.name");l&&r.indexOf(l)!==-1&&n.push(i)}),n}var p4=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,m0={},HT;function DQ(){return HT||(HT=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){var i;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const l=n[Symbol.toStringTag];return l==null||!((i=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&i.writable)?!1:n.toString()===`[object ${l}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}e.isPlainObject=t})(m0)),m0}var v0,KT;function kQ(){return KT||(KT=1,v0=DQ().isPlainObject),v0}var IQ=kQ();const LQ=Vi(IQ);var FT,YT,GT,VT,QT;function XT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ZT(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?XT(Object(n),!0).forEach(function(r){zQ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zQ(e,t,n){return(t=BQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BQ(e){var t=$Q(e,"string");return typeof t=="symbol"?t:t+""}function $Q(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function am(){return am=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},am.apply(null,arguments)}function ac(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var WT=(e,t,n,r,i)=>{var l=n-r,u;return u=gt(FT||(FT=ac(["M ",",",""])),e,t),u+=gt(YT||(YT=ac(["L ",",",""])),e+n,t),u+=gt(GT||(GT=ac(["L ",",",""])),e+n-l/2,t+i),u+=gt(VT||(VT=ac(["L ",",",""])),e+n-l/2-r,t+i),u+=gt(QT||(QT=ac(["L ",","," Z"])),e,t),u},UQ={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},qQ=e=>{var t=an(e,UQ),{x:n,y:r,upperWidth:i,lowerWidth:l,height:u,className:c}=t,{animationEasing:d,animationDuration:h,animationBegin:m,isUpdateAnimationActive:v}=t,g=j.useRef(null),[x,S]=j.useState(-1),w=j.useRef(i),O=j.useRef(l),_=j.useRef(u),A=j.useRef(n),T=j.useRef(r),N=$m(e,"trapezoid-");if(j.useEffect(()=>{if(g.current&&g.current.getTotalLength)try{var te=g.current.getTotalLength();te&&S(te)}catch{}},[]),n!==+n||r!==+r||i!==+i||l!==+l||u!==+u||i===0&&l===0||u===0)return null;var C=Ve("recharts-trapezoid",c);if(!v)return j.createElement("g",null,j.createElement("path",am({},Sn(t),{className:C,d:WT(n,r,i,l,u)})));var M=w.current,R=O.current,z=_.current,B=A.current,D=T.current,H="0px ".concat(x===-1?1:x,"px"),q="".concat(x,"px ").concat(x,"px"),ae=E2(["strokeDasharray"],h,d);return j.createElement(Bm,{animationId:N,key:N,canBegin:x>0,duration:h,easing:d,isActive:v,begin:m},te=>{var re=bt(M,i,te),U=bt(R,l,te),V=bt(z,u,te),ie=bt(B,n,te),oe=bt(D,r,te);g.current&&(w.current=re,O.current=U,_.current=V,A.current=ie,T.current=oe);var ce=te>0?{transition:ae,strokeDasharray:q}:{strokeDasharray:H};return j.createElement("path",am({},Sn(t),{className:C,d:WT(ie,oe,re,U,V),ref:g,style:ZT(ZT({},ce),t.style)}))})},HQ=["option","shapeType","activeClassName","inActiveClassName"];function KQ(e,t){if(e==null)return{};var n,r,i=FQ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function JT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function im(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?JT(Object(n),!0).forEach(function(r){YQ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function YQ(e,t,n){return(t=GQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GQ(e){var t=VQ(e,"string");return typeof t=="symbol"?t:t+""}function VQ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function QQ(e,t){return im(im({},t),e)}function XQ(e,t){return e==="symbols"}function eP(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return j.createElement(P2,n);case"trapezoid":return j.createElement(qQ,n);case"sector":return j.createElement(R2,n);case"symbols":if(XQ(t))return j.createElement(fx,n);break;case"curve":return j.createElement(_2,n);default:return null}}function ZQ(e){return j.isValidElement(e)?e.props:e}function y4(e){var{option:t,shapeType:n,activeClassName:r="recharts-active-shape",inActiveClassName:i="recharts-shape"}=e,l=KQ(e,HQ),u;if(j.isValidElement(t))u=j.cloneElement(t,im(im({},l),ZQ(t)));else if(typeof t=="function")u=t(l,l.index);else if(LQ(t)&&typeof t!="boolean"){var c=QQ(t,l);u=j.createElement(eP,{shapeType:n,elementProps:c})}else{var d=l;u=j.createElement(eP,{shapeType:n,elementProps:d})}return l.isActive?j.createElement(Zn,{className:r},u):j.createElement(Zn,{className:i},u)}var g4=(e,t,n)=>{var r=ut();return(i,l)=>u=>{e==null||e(i,l,u),r(_D({activeIndex:String(l),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},b4=e=>{var t=ut();return(n,r)=>i=>{e==null||e(n,r,i),t(mY())}},x4=(e,t,n)=>{var r=ut();return(i,l)=>u=>{e==null||e(i,l,u),r(vY({activeIndex:String(l),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function S4(e){var{tooltipEntrySettings:t}=e,n=ut(),r=mn(),i=j.useRef(null);return j.useLayoutEffect(()=>{r||(i.current===null?n(cY(t)):i.current!==t&&n(fY({prev:i.current,next:t})),i.current=t)},[t,n,r]),j.useLayoutEffect(()=>()=>{i.current&&(n(dY(i.current)),i.current=null)},[n]),null}function w4(e){var{legendPayload:t}=e,n=ut(),r=mn(),i=j.useRef(null);return j.useLayoutEffect(()=>{r||(i.current===null?n(eq(t)):i.current!==t&&n(tq({prev:i.current,next:t})),i.current=t)},[n,r,t]),j.useLayoutEffect(()=>()=>{i.current&&(n(nq(i.current)),i.current=null)},[n]),null}var p0,WQ=()=>{var[e]=j.useState(()=>Sc("uid-"));return e},JQ=(p0=eL.useId)!==null&&p0!==void 0?p0:WQ;function eX(e,t){var n=JQ();return t||(e?"".concat(e,"-").concat(n):n)}var tX=j.createContext(void 0),j4=e=>{var{id:t,type:n,children:r}=e,i=eX("recharts-".concat(n),t);return j.createElement(tX.Provider,{value:i},r(i))},nX={cartesianItems:[],polarItems:[]},O4=hn({name:"graphicalItems",initialState:nX,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:st()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=pr(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:st()},removeCartesianGraphicalItem:{reducer(e,t){var n=pr(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:st()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:st()},removePolarGraphicalItem:{reducer(e,t){var n=pr(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:st()},replacePolarGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=pr(e).polarItems.indexOf(n);i>-1&&(e.polarItems[i]=r)},prepare:st()}}}),{addCartesianGraphicalItem:rX,replaceCartesianGraphicalItem:aX,removeCartesianGraphicalItem:iX,addPolarGraphicalItem:Ene,removePolarGraphicalItem:Ane,replacePolarGraphicalItem:Nne}=O4.actions,sX=O4.reducer,lX=e=>{var t=ut(),n=j.useRef(null);return j.useLayoutEffect(()=>{n.current===null?t(rX(e)):n.current!==e&&t(aX({prev:n.current,next:e})),n.current=e},[t,e]),j.useLayoutEffect(()=>()=>{n.current&&(t(iX(n.current)),n.current=null)},[t]),null},_4=j.memo(lX),oX=["points"];function tP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function y0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tP(Object(n),!0).forEach(function(r){uX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function uX(e,t,n){return(t=cX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cX(e){var t=fX(e,"string");return typeof t=="symbol"?t:t+""}function fX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sm(){return sm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sm.apply(null,arguments)}function dX(e,t){if(e==null)return{};var n,r,i=hX(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function hX(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function mX(e){var{option:t,dotProps:n,className:r}=e;if(j.isValidElement(t))return j.cloneElement(t,n);if(typeof t=="function")return t(n);var i=Ve(r,typeof t!="boolean"?t.className:""),l=n??{},{points:u}=l,c=dX(l,oX);return j.createElement(h4,sm({},c,{className:i}))}function vX(e,t){return e==null?!1:t?!0:e.length===1}function pX(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:l,baseProps:u,needClip:c,clipPathId:d,zIndex:h=Ht.scatter}=e;if(!vX(t,n))return null;var m=p4(n),v=$B(n),g=t.map((S,w)=>{var O,_,A=y0(y0(y0({r:3},u),v),{},{index:w,cx:(O=S.x)!==null&&O!==void 0?O:void 0,cy:(_=S.y)!==null&&_!==void 0?_:void 0,dataKey:l,value:S.value,payload:S.payload,points:t});return j.createElement(mX,{key:"dot-".concat(w),option:n,dotProps:A,className:i})}),x={};return c&&d!=null&&(x.clipPath="url(#clipPath-".concat(m?"":"dots-").concat(d,")")),j.createElement(Sr,{zIndex:h},j.createElement(Zn,sm({className:r},x),g))}function nP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nP(Object(n),!0).forEach(function(r){yX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yX(e,t,n){return(t=gX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gX(e){var t=bX(e,"string");return typeof t=="symbol"?t:t+""}function bX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var E4=0,xX={xAxis:{},yAxis:{},zAxis:{}},A4=hn({name:"cartesianAxis",initialState:xX,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:st()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.xAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=r)},prepare:st()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:st()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:st()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.yAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=r)},prepare:st()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:st()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:st()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;e.zAxis[n.id]!==void 0&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=r)},prepare:st()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:st()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var l,u=i.widthHistory||[];if(u.length===3&&u[0]===u[2]&&r===u[1]&&r!==i.width&&Math.abs(r-((l=u[0])!==null&&l!==void 0?l:0))<=1)return;var c=[...u,r].slice(-3);e.yAxis[n]=rP(rP({},i),{},{width:r,widthHistory:c})}}}}),{addXAxis:SX,replaceXAxis:wX,removeXAxis:jX,addYAxis:OX,replaceYAxis:_X,removeYAxis:EX,addZAxis:Tne,replaceZAxis:Pne,removeZAxis:Cne,updateYAxisWidth:AX}=A4.actions,NX=A4.reducer,TX=G([Kt],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),PX=G([TX,Fa,Ya],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),M1=()=>ge(PX),CX=()=>ge(cG);function aP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function g0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aP(Object(n),!0).forEach(function(r){MX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function MX(e,t,n){return(t=RX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function RX(e){var t=DX(e,"string");return typeof t=="symbol"?t:t+""}function DX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var kX=e=>{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:l,clipPath:u}=e;if(i===!1||t.x==null||t.y==null)return null;var c={index:n,dataKey:l,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},d=g0(g0(g0({},c),Kc(i)),dx(i)),h;return j.isValidElement(i)?h=j.cloneElement(i,d):typeof i=="function"?h=i(d):h=j.createElement(h4,d),j.createElement(Zn,{className:"recharts-active-dot",clipPath:u},h)};function IX(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:l,zIndex:u=Ht.activeDot}=e,c=ge(Js),d=CX();if(t==null||d==null)return null;var h=t.find(m=>d.includes(m.payload));return ht(h)?null:j.createElement(Sr,{zIndex:u},j.createElement(kX,{point:h,childIndex:Number(c),mainColor:n,dataKey:i,activeDot:r,clipPath:l}))}var iP=(e,t,n)=>{var r=n??e;if(!ht(r))return Cr(r,t,0)},LX=(e,t,n)=>{var r={},i=e.filter(Ym),l=e.filter(h=>h.stackId==null),u=i.reduce((h,m)=>{var v=h[m.stackId];return v==null&&(v=[]),v.push(m),h[m.stackId]=v,h},r),c=Object.entries(u).map(h=>{var m,[v,g]=h,x=g.map(w=>w.dataKey),S=iP(t,n,(m=g[0])===null||m===void 0?void 0:m.barSize);return{stackId:v,dataKeys:x,barSize:S}}),d=l.map(h=>{var m=[h.dataKey].filter(g=>g!=null),v=iP(t,n,h.barSize);return{stackId:void 0,dataKeys:m,barSize:v}});return[...c,...d]};function sP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sP(Object(n),!0).forEach(function(r){zX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zX(e,t,n){return(t=BX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BX(e){var t=$X(e,"string");return typeof t=="symbol"?t:t+""}function $X(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function UX(e,t,n,r,i){var l,u=r.length;if(!(u<1)){var c=Cr(e,n,0,!0),d,h=[];if($e((l=r[0])===null||l===void 0?void 0:l.barSize)){var m=!1,v=n/u,g=r.reduce((A,T)=>A+(T.barSize||0),0);g+=(u-1)*c,g>=n&&(g-=(u-1)*c,c=0),g>=n&&v>0&&(m=!0,v*=.9,g=u*v);var x=(n-g)/2>>0,S={offset:x-c,size:0};d=r.reduce((A,T)=>{var N,C={stackId:T.stackId,dataKeys:T.dataKeys,position:{offset:S.offset+S.size+c,size:m?v:(N=T.barSize)!==null&&N!==void 0?N:0}},M=[...A,C];return S=C.position,M},h)}else{var w=Cr(t,n,0,!0);n-2*w-(u-1)*c<=0&&(c=0);var O=(n-2*w-(u-1)*c)/u;O>1&&(O>>=0);var _=$e(i)?Math.min(O,i):O;d=r.reduce((A,T,N)=>[...A,{stackId:T.stackId,dataKeys:T.dataKeys,position:{offset:w+(O+c)*N+(O-_)/2,size:_}}],h)}return d}}var qX=(e,t,n,r,i,l,u)=>{var c=ht(u)?t:u,d=UX(n,r,i!==l?i:l,e,c);return i!==l&&d!=null&&(d=d.map(h=>Gd(Gd({},h),{},{position:Gd(Gd({},h.position),{},{offset:h.position.offset-i/2})}))),d},HX=(e,t)=>{var n=Bx(t);if(!(!e||n==null||t==null)){var{stackId:r}=t;if(r!=null){var i=e[r];if(i){var{stackedData:l}=i;if(l)return l.find(u=>u.key===n)}}}},KX=(e,t)=>{if(!(e==null||t==null)){var n=e.find(r=>r.stackId===t.stackId&&t.dataKey!=null&&r.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function FX(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&$e(e.zIndex)?e.zIndex:t}var YX=e=>{var{chartData:t}=e,n=ut(),r=mn();return j.useEffect(()=>r?()=>{}:(n(xT(t)),()=>{n(xT(void 0))}),[t,n,r]),null},lP={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},N4=hn({name:"brush",initialState:lP,reducers:{setBrushSettings(e,t){return t.payload==null?lP:t.payload}}}),{setBrushSettings:Mne}=N4.actions,GX=N4.reducer;function VX(e){return(e%180+180)%180}var QX=function(t){var{width:n,height:r}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,l=VX(i),u=l*Math.PI/180,c=Math.atan(r/n),d=u>c&&u<Math.PI-c?r/Math.sin(u):n/Math.cos(u);return Math.abs(d)},XX={dots:[],areas:[],lines:[]},T4=hn({name:"referenceElements",initialState:XX,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=pr(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=pr(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=pr(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:Rne,removeDot:Dne,addArea:kne,removeArea:Ine,addLine:Lne,removeLine:zne}=T4.actions,ZX=T4.reducer,WX=j.createContext(void 0),JX=e=>{var{children:t}=e,[n]=j.useState("".concat(Sc("recharts"),"-clip")),r=M1();if(r==null)return null;var{x:i,y:l,width:u,height:c}=r;return j.createElement(WX.Provider,{value:n},j.createElement("defs",null,j.createElement("clipPath",{id:n},j.createElement("rect",{x:i,y:l,height:c,width:u}))),t)};function P4(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];i!==void 0&&n.push(i)}return n}function eZ(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return QX(r,n)}function tZ(e,t,n){var r=n==="width",{x:i,y:l,width:u,height:c}=e;return t===1?{start:r?i:l,end:r?i+u:l+c}:{start:r?i+u:l+c,end:r?i:l}}function kc(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var l=n();return e*(t-e*l/2-r)>=0&&e*(t+e*l/2-i)<=0}function nZ(e,t){return P4(e,t+1)}function rZ(e,t,n,r,i){for(var l=(r||[]).slice(),{start:u,end:c}=t,d=0,h=1,m=u,v=function(){var S=r==null?void 0:r[d];if(S===void 0)return{v:P4(r,h)};var w=d,O,_=()=>(O===void 0&&(O=n(S,w)),O),A=S.coordinate,T=d===0||kc(e,A,_,m,c);T||(d=0,m=u,h+=1),T&&(m=A+e*(_()/2+i),d+=h)},g;h<=l.length;)if(g=v(),g)return g.v;return[]}function aZ(e,t,n,r,i){var l=(r||[]).slice(),u=l.length;if(u===0)return[];for(var{start:c,end:d}=t,h=1;h<=u;h++){for(var m=(u-1)%h,v=c,g=!0,x=function(){var N=r[w];if(N==null)return 0;var C=w,M,R=()=>(M===void 0&&(M=n(N,C)),M),z=N.coordinate,B=w===m||kc(e,z,R,v,d);if(!B)return g=!1,1;B&&(v=z+e*(R()/2+i))},S,w=m;w<u&&(S=x(),!(S!==0&&S===1));w+=h);if(g){for(var O=[],_=m;_<u;_+=h){var A=r[_];A!=null&&O.push(A)}return O}}return[]}function oP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function cn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oP(Object(n),!0).forEach(function(r){iZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function iZ(e,t,n){return(t=sZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sZ(e){var t=lZ(e,"string");return typeof t=="symbol"?t:t+""}function lZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oZ(e,t,n,r,i){for(var l=(r||[]).slice(),u=l.length,{start:c}=t,{end:d}=t,h=function(g){var x=l[g];if(x==null)return 1;var S=x,w,O=()=>(w===void 0&&(w=n(x,g)),w);if(g===u-1){var _=e*(S.coordinate+e*O()/2-d);l[g]=S=cn(cn({},S),{},{tickCoord:_>0?S.coordinate-_*e:S.coordinate})}else l[g]=S=cn(cn({},S),{},{tickCoord:S.coordinate});if(S.tickCoord!=null){var A=kc(e,S.tickCoord,O,c,d);A&&(d=S.tickCoord-e*(O()/2+i),l[g]=cn(cn({},S),{},{isShow:!0}))}},m=u-1;m>=0;m--)h(m);return l}function uZ(e,t,n,r,i,l){var u=(r||[]).slice(),c=u.length,{start:d,end:h}=t;if(l){var m=r[c-1];if(m!=null){var v=n(m,c-1),g=e*(m.coordinate+e*v/2-h);if(u[c-1]=m=cn(cn({},m),{},{tickCoord:g>0?m.coordinate-g*e:m.coordinate}),m.tickCoord!=null){var x=kc(e,m.tickCoord,()=>v,d,h);x&&(h=m.tickCoord-e*(v/2+i),u[c-1]=cn(cn({},m),{},{isShow:!0}))}}}for(var S=l?c-1:c,w=function(A){var T=u[A];if(T==null)return 1;var N=T,C,M=()=>(C===void 0&&(C=n(T,A)),C);if(A===0){var R=e*(N.coordinate-e*M()/2-d);u[A]=N=cn(cn({},N),{},{tickCoord:R<0?N.coordinate-R*e:N.coordinate})}else u[A]=N=cn(cn({},N),{},{tickCoord:N.coordinate});if(N.tickCoord!=null){var z=kc(e,N.tickCoord,M,d,h);z&&(d=N.tickCoord+e*(M()/2+i),u[A]=cn(cn({},N),{},{isShow:!0}))}},O=0;O<S;O++)w(O);return u}function R1(e,t,n){var{tick:r,ticks:i,viewBox:l,minTickGap:u,orientation:c,interval:d,tickFormatter:h,unit:m,angle:v}=e;if(!i||!i.length||!r)return[];if(pe(d)||Zc.isSsr){var g;return(g=nZ(i,pe(d)?d:0))!==null&&g!==void 0?g:[]}var x=[],S=c==="top"||c==="bottom"?"width":"height",w=m&&S==="width"?mc(m,{fontSize:t,letterSpacing:n}):{width:0,height:0},O=(C,M)=>{var R=typeof h=="function"?h(C.value,M):C.value;return S==="width"?eZ(mc(R,{fontSize:t,letterSpacing:n}),w,v):mc(R,{fontSize:t,letterSpacing:n})[S]},_=i[0],A=i[1],T=i.length>=2&&_!=null&&A!=null?kn(A.coordinate-_.coordinate):1,N=tZ(l,T,S);return d==="equidistantPreserveStart"?rZ(T,N,O,i,u):d==="equidistantPreserveEnd"?aZ(T,N,O,i,u):(d==="preserveStart"||d==="preserveStartEnd"?x=uZ(T,N,O,i,u,d==="preserveStartEnd"):x=oZ(T,N,O,i,u),x.filter(C=>C.isShow))}var cZ=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:l=0}=e,u=0;if(t){Array.from(t).forEach(m=>{if(m){var v=m.getBoundingClientRect();v.width>u&&(u=v.width)}});var c=n?n.getBoundingClientRect().width:0,d=i+l,h=u+d+c+(n?r:0);return Math.round(h)}return 0},fZ={xAxis:{},yAxis:{}},C4=hn({name:"renderedTicks",initialState:fZ,reducers:{setRenderedTicks:(e,t)=>{var{axisType:n,axisId:r,ticks:i}=t.payload;e[n][r]=i},removeRenderedTicks:(e,t)=>{var{axisType:n,axisId:r}=t.payload;delete e[n][r]}}}),{setRenderedTicks:dZ,removeRenderedTicks:hZ}=C4.actions,mZ=C4.reducer,vZ=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function pZ(e,t){if(e==null)return{};var n,r,i=yZ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function yZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function el(){return el=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},el.apply(null,arguments)}function uP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uP(Object(n),!0).forEach(function(r){gZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function gZ(e,t,n){return(t=bZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bZ(e){var t=xZ(e,"string");return typeof t=="symbol"?t:t+""}function xZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;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:Ht.axis};function SZ(e){var{x:t,y:n,width:r,height:i,orientation:l,mirror:u,axisLine:c,otherSvgProps:d}=e;if(!c)return null;var h=yt(yt(yt({},d),Pr(c)),{},{fill:"none"});if(l==="top"||l==="bottom"){var m=+(l==="top"&&!u||l==="bottom"&&u);h=yt(yt({},h),{},{x1:t,y1:n+m*i,x2:t+r,y2:n+m*i})}else{var v=+(l==="left"&&!u||l==="right"&&u);h=yt(yt({},h),{},{x1:t+v*r,y1:n,x2:t+v*r,y2:n+i})}return j.createElement("line",el({},h,{className:Ve("recharts-cartesian-axis-line",No(c,"className"))}))}function wZ(e,t,n,r,i,l,u,c,d){var h,m,v,g,x,S,w=c?-1:1,O=e.tickSize||u,_=pe(e.tickCoord)?e.tickCoord:e.coordinate;switch(l){case"top":h=m=e.coordinate,g=n+ +!c*i,v=g-w*O,S=v-w*d,x=_;break;case"left":v=g=e.coordinate,m=t+ +!c*r,h=m-w*O,x=h-w*d,S=_;break;case"right":v=g=e.coordinate,m=t+ +c*r,h=m+w*O,x=h+w*d,S=_;break;default:h=m=e.coordinate,g=n+ +c*i,v=g+w*O,S=v+w*d,x=_;break}return{line:{x1:h,y1:v,x2:m,y2:g},tick:{x,y:S}}}function jZ(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function OZ(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function _Z(e){var{option:t,tickProps:n,value:r}=e,i,l=Ve(n.className,"recharts-cartesian-axis-tick-value");if(j.isValidElement(t))i=j.cloneElement(t,yt(yt({},n),{},{className:l}));else if(typeof t=="function")i=t(yt(yt({},n),{},{className:l}));else{var u="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(u=Ve(u,TQ(t))),i=j.createElement(P1,el({},n,{className:u}),r)}return i}function EZ(e){var{ticks:t,axisType:n,axisId:r}=e,i=ut();return j.useEffect(()=>{if(r==null||n==null)return rl;var l=t.map(u=>({value:u.value,coordinate:u.coordinate,offset:u.offset,index:u.index}));return i(dZ({ticks:l,axisId:r,axisType:n})),()=>{i(hZ({axisId:r,axisType:n}))}},[i,t,r,n]),null}var AZ=j.forwardRef((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:l,tickFormatter:u,unit:c,padding:d,tickTextProps:h,orientation:m,mirror:v,x:g,y:x,width:S,height:w,tickSize:O,tickMargin:_,fontSize:A,letterSpacing:T,getTicksConfig:N,events:C,axisType:M,axisId:R}=e,z=R1(yt(yt({},N),{},{ticks:n}),A,T),B=Pr(N),D=Kc(r),H=r4(B.textAnchor)?B.textAnchor:jZ(m,v),q=OZ(m,v),ae={};typeof i=="object"&&(ae=i);var te=yt(yt({},B),{},{fill:"none"},ae),re=z.map(ie=>yt({entry:ie},wZ(ie,g,x,S,w,m,O,v,_))),U=re.map(ie=>{var{entry:oe,line:ce}=ie;return j.createElement(Zn,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(oe.value,"-").concat(oe.coordinate,"-").concat(oe.tickCoord)},i&&j.createElement("line",el({},te,ce,{className:Ve("recharts-cartesian-axis-tick-line",No(i,"className"))})))}),V=re.map((ie,oe)=>{var ce,I,{entry:Z,tick:se}=ie,X=yt(yt(yt(yt({verticalAnchor:q},B),{},{textAnchor:H,stroke:"none",fill:l},se),{},{index:oe,payload:Z,visibleTicksCount:z.length,tickFormatter:u,padding:d},h),{},{angle:(ce=(I=h==null?void 0:h.angle)!==null&&I!==void 0?I:B.angle)!==null&&ce!==void 0?ce:0}),ve=yt(yt({},X),D);return j.createElement(Zn,el({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(Z.value,"-").concat(Z.coordinate,"-").concat(Z.tickCoord)},bm(C,Z,oe)),r&&j.createElement(_Z,{option:r,tickProps:ve,value:"".concat(typeof u=="function"?u(Z.value,oe):Z.value).concat(c||"")}))});return j.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(M,"-ticks")},j.createElement(EZ,{ticks:z,axisId:R,axisType:M}),V.length>0&&j.createElement(Sr,{zIndex:Ht.label},j.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(M,"-tick-labels"),ref:t},V)),U.length>0&&j.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(M,"-tick-lines")},U))}),NZ=j.forwardRef((e,t)=>{var{axisLine:n,width:r,height:i,className:l,hide:u,ticks:c,axisType:d,axisId:h}=e,m=pZ(e,vZ),[v,g]=j.useState(""),[x,S]=j.useState(""),w=j.useRef(null);j.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var _;return cZ({ticks:w.current,label:(_=e.labelRef)===null||_===void 0?void 0:_.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var O=j.useCallback(_=>{if(_){var A=_.getElementsByClassName("recharts-cartesian-axis-tick-value");w.current=A;var T=A[0];if(T){var N=window.getComputedStyle(T),C=N.fontSize,M=N.letterSpacing;(C!==v||M!==x)&&(g(C),S(M))}}},[v,x]);return u||r!=null&&r<=0||i!=null&&i<=0?null:j.createElement(Sr,{zIndex:e.zIndex},j.createElement(Zn,{className:Ve("recharts-cartesian-axis",l)},j.createElement(SZ,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:Pr(e)}),j.createElement(AZ,{ref:O,axisType:d,events:m,fontSize:v,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:h}),j.createElement(cQ,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},j.createElement(xQ,{label:e.label,labelRef:e.labelRef}),e.children)))}),D1=j.forwardRef((e,t)=>{var n=an(e,ka);return j.createElement(NZ,el({},n,{ref:t}))});D1.displayName="CartesianAxis";var TZ=["x1","y1","x2","y2","key"],PZ=["offset"],CZ=["xAxisId","yAxisId"],MZ=["xAxisId","yAxisId"];function cP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function fn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cP(Object(n),!0).forEach(function(r){RZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function RZ(e,t,n){return(t=DZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DZ(e){var t=kZ(e,"string");return typeof t=="symbol"?t:t+""}function kZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ts(){return Ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ts.apply(null,arguments)}function lm(e,t){if(e==null)return{};var n,r,i=IZ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function IZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var LZ=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:n,x:r,y:i,width:l,height:u,ry:c}=e;return j.createElement("rect",{x:r,y:i,ry:c,width:l,height:u,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function M4(e){var{option:t,lineItemProps:n}=e,r;if(j.isValidElement(t))r=j.cloneElement(t,n);else if(typeof t=="function")r=t(n);else{var i,{x1:l,y1:u,x2:c,y2:d,key:h}=n,m=lm(n,TZ),v=(i=Pr(m))!==null&&i!==void 0?i:{},{offset:g}=v,x=lm(v,PZ);r=j.createElement("line",Ts({},x,{x1:l,y1:u,x2:c,y2:d,fill:"none",key:h}))}return r}function zZ(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:l,yAxisId:u}=e,c=lm(e,CZ),d=i.map((h,m)=>{var v=fn(fn({},c),{},{x1:t,y1:h,x2:t+n,y2:h,key:"line-".concat(m),index:m});return j.createElement(M4,{key:"line-".concat(m),option:r,lineItemProps:v})});return j.createElement("g",{className:"recharts-cartesian-grid-horizontal"},d)}function BZ(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:l,yAxisId:u}=e,c=lm(e,MZ),d=i.map((h,m)=>{var v=fn(fn({},c),{},{x1:h,y1:t,x2:h,y2:t+n,key:"line-".concat(m),index:m});return j.createElement(M4,{option:r,lineItemProps:v,key:"line-".concat(m)})});return j.createElement("g",{className:"recharts-cartesian-grid-vertical"},d)}function $Z(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:l,height:u,horizontalPoints:c,horizontal:d=!0}=e;if(!d||!t||!t.length||c==null)return null;var h=c.map(v=>Math.round(v+i-i)).sort((v,g)=>v-g);i!==h[0]&&h.unshift(0);var m=h.map((v,g)=>{var x=h[g+1],S=x==null,w=S?i+u-v:x-v;if(w<=0)return null;var O=g%t.length;return j.createElement("rect",{key:"react-".concat(g),y:v,x:r,height:w,width:l,stroke:"none",fill:t[O],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return j.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},m)}function UZ(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:l,width:u,height:c,verticalPoints:d}=e;if(!t||!n||!n.length)return null;var h=d.map(v=>Math.round(v+i-i)).sort((v,g)=>v-g);i!==h[0]&&h.unshift(0);var m=h.map((v,g)=>{var x=h[g+1],S=x==null,w=S?i+u-v:x-v;if(w<=0)return null;var O=g%n.length;return j.createElement("rect",{key:"react-".concat(g),x:v,y:l,width:w,height:c,stroke:"none",fill:n[O],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return j.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},m)}var qZ=(e,t)=>{var{xAxis:n,width:r,height:i,offset:l}=e;return s2(R1(fn(fn(fn({},ka),n),{},{ticks:l2(n),viewBox:{x:0,y:0,width:r,height:i}})),l.left,l.left+l.width,t)},HZ=(e,t)=>{var{yAxis:n,width:r,height:i,offset:l}=e;return s2(R1(fn(fn(fn({},ka),n),{},{ticks:l2(n),viewBox:{x:0,y:0,width:r,height:i}})),l.top,l.top+l.height,t)},KZ={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ht.grid};function iv(e){var t=_x(),n=Ex(),r=d2(),i=fn(fn({},an(e,KZ)),{},{x:pe(e.x)?e.x:r.left,y:pe(e.y)?e.y:r.top,width:pe(e.width)?e.width:r.width,height:pe(e.height)?e.height:r.height}),{xAxisId:l,yAxisId:u,x:c,y:d,width:h,height:m,syncWithTicks:v,horizontalValues:g,verticalValues:x}=i,S=mn(),w=ge(B=>lT(B,"xAxis",l,S)),O=ge(B=>lT(B,"yAxis",u,S));if(!ta(h)||!ta(m)||!pe(c)||!pe(d))return null;var _=i.verticalCoordinatesGenerator||qZ,A=i.horizontalCoordinatesGenerator||HZ,{horizontalPoints:T,verticalPoints:N}=i;if((!T||!T.length)&&typeof A=="function"){var C=g&&g.length,M=A({yAxis:O?fn(fn({},O),{},{ticks:C?g:O.ticks}):void 0,width:t??h,height:n??m,offset:r},C?!0:v);Mh(Array.isArray(M),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof M,"]")),Array.isArray(M)&&(T=M)}if((!N||!N.length)&&typeof _=="function"){var R=x&&x.length,z=_({xAxis:w?fn(fn({},w),{},{ticks:R?x:w.ticks}):void 0,width:t??h,height:n??m,offset:r},R?!0:v);Mh(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof z,"]")),Array.isArray(z)&&(N=z)}return j.createElement(Sr,{zIndex:i.zIndex},j.createElement("g",{className:"recharts-cartesian-grid"},j.createElement(LZ,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),j.createElement($Z,Ts({},i,{horizontalPoints:T})),j.createElement(UZ,Ts({},i,{verticalPoints:N})),j.createElement(zZ,Ts({},i,{offset:r,horizontalPoints:T,xAxis:w,yAxis:O})),j.createElement(BZ,Ts({},i,{offset:r,verticalPoints:N,xAxis:w,yAxis:O}))))}iv.displayName="CartesianGrid";var FZ={},R4=hn({name:"errorBars",initialState:FZ,reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(l=>l.dataKey===r.dataKey&&l.direction===r.direction?i:l))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(i=>i.dataKey!==r.dataKey||i.direction!==r.direction))}}}),{addErrorBar:Bne,replaceErrorBar:$ne,removeErrorBar:Une}=R4.actions,YZ=R4.reducer,GZ=["children"];function VZ(e,t){if(e==null)return{};var n,r,i=QZ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function QZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var XZ={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},ZZ=j.createContext(XZ);function D4(e){var{children:t}=e,n=VZ(e,GZ);return j.createElement(ZZ.Provider,{value:n},t)}function k1(e,t){var n,r,i=ge(h=>Va(h,e)),l=ge(h=>Qa(h,t)),u=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:Rt.allowDataOverflow,c=(r=l==null?void 0:l.allowDataOverflow)!==null&&r!==void 0?r:Dt.allowDataOverflow,d=u||c;return{needClip:d,needClipX:u,needClipY:c}}function k4(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=M1(),{needClipX:l,needClipY:u,needClip:c}=k1(t,n);if(!c||!i)return null;var{x:d,y:h,width:m,height:v}=i;return j.createElement("clipPath",{id:"clipPath-".concat(r)},j.createElement("rect",{x:l?d:d-m/2,y:u?h:h-v/2,width:l?m:m*2,height:u?v:v*2}))}var I4=(e,t,n,r)=>Yi(e,"xAxis",t,r),L4=(e,t,n,r)=>Fi(e,"xAxis",t,r),z4=(e,t,n,r)=>Yi(e,"yAxis",n,r),B4=(e,t,n,r)=>Fi(e,"yAxis",n,r),WZ=G([Qe,I4,z4,L4,B4],(e,t,n,r,i)=>Ka(e,"xAxis")?Po(t,r,!1):Po(n,i,!1)),JZ=(e,t,n,r,i)=>i;function eW(e){return e.type==="line"}var tW=G([tv,JZ],(e,t)=>e.filter(eW).find(n=>n.id===t)),nW=G([Qe,I4,z4,L4,B4,tW,WZ,Wc],(e,t,n,r,i,l,u,c)=>{var{chartData:d,dataStartIndex:h,dataEndIndex:m}=c;if(!(l==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||u==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:v,data:g}=l,x;if(g!=null&&g.length>0?x=g:x=d==null?void 0:d.slice(h,m+1),x!=null)return jW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:v,bandSize:u,displayedData:x})}});function rW(e){var t=Kc(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:l}=t,u=Number(i),c=Number(l);return(Number.isNaN(u)||u<0)&&(u=n),(Number.isNaN(c)||c<0)&&(c=r),{r:u,strokeWidth:c}}return{r:n,strokeWidth:r}}var aW=["id"],iW=["type","layout","connectNulls","needClip","shape"],sW=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Ic(){return Ic=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ic.apply(null,arguments)}function fP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Vr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fP(Object(n),!0).forEach(function(r){lW(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function lW(e,t,n){return(t=oW(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oW(e){var t=uW(e,"string");return typeof t=="symbol"?t:t+""}function uW(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function I1(e,t){if(e==null)return{};var n,r,i=cW(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function cW(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var fW=e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:l}=e;return[{inactive:l,dataKey:t,type:i,color:r,value:Pm(n,t),payload:e}]},dW=j.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:l,name:u,hide:c,unit:d,tooltipType:h,id:m}=e,v={dataDefinedOnItem:n,getPosition:rl,settings:{stroke:r,strokeWidth:i,fill:l,dataKey:t,nameKey:void 0,name:Pm(u,t),hide:c,type:h,color:r,unit:d,graphicalItemId:m}};return j.createElement(S4,{tooltipEntrySettings:v})}),$4=(e,t)=>"".concat(t,"px ").concat(e,"px");function hW(e,t){for(var n=e.length%2!==0?[...e,0]:e,r=[],i=0;i<t;++i)r.push(...n);return r}var mW=(e,t,n)=>{var r=n.reduce((g,x)=>g+x,0);if(!r)return $4(t,e);for(var i=Math.floor(e/r),l=e%r,u=[],c=0,d=0;c<n.length;d+=(h=n[c])!==null&&h!==void 0?h:0,++c){var h,m=n[c];if(m!=null&&d+m>l){u=[...n.slice(0,c),l-d];break}}var v=u.length%2===0?[0,t]:[t];return[...hW(n,i),...u,...v].map(g=>"".concat(g,"px")).join(", ")};function vW(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:l,needClip:u}=r,{id:c}=r,d=I1(r,aW),h=Pr(d);return j.createElement(pX,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:l,baseProps:h,needClip:u,clipPathId:t})}function pW(e){var{showLabels:t,children:n,points:r}=e,i=j.useMemo(()=>r==null?void 0:r.map(l=>{var u,c,d={x:(u=l.x)!==null&&u!==void 0?u:0,y:(c=l.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Vr(Vr({},d),{},{value:l.value,payload:l.payload,viewBox:d,parentViewBox:void 0,fill:void 0})}),[r]);return j.createElement(c4,{value:t?i:void 0},n)}function dP(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:l}=e,{type:u,layout:c,connectNulls:d,needClip:h,shape:m}=l,v=I1(l,iW),g=Vr(Vr({},Sn(v)),{},{fill:"none",className:"recharts-line-curve",clipPath:h?"url(#clipPath-".concat(t,")"):void 0,points:r,type:u,layout:c,connectNulls:d,strokeDasharray:i??l.strokeDasharray});return j.createElement(j.Fragment,null,(r==null?void 0:r.length)>1&&j.createElement(y4,Ic({shapeType:"curve",option:m},g,{pathRef:n})),j.createElement(vW,{points:r,clipPathId:t,props:l}))}function yW(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function gW(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:l}=e,{points:u,strokeDasharray:c,isAnimationActive:d,animationBegin:h,animationDuration:m,animationEasing:v,animateNewValues:g,width:x,height:S,onAnimationEnd:w,onAnimationStart:O}=n,_=i.current,A=$m(u,"recharts-line-"),T=j.useRef(A),[N,C]=j.useState(!1),M=!N,R=j.useCallback(()=>{typeof w=="function"&&w(),C(!1)},[w]),z=j.useCallback(()=>{typeof O=="function"&&O(),C(!0)},[O]),B=yW(r.current),D=j.useRef(0);T.current!==A&&(D.current=l.current,T.current=A);var H=D.current;return j.createElement(pW,{points:u,showLabels:M},n.children,j.createElement(Bm,{animationId:A,begin:h,duration:m,isActive:d,easing:v,onAnimationEnd:R,onAnimationStart:z,key:A},q=>{var ae=bt(H,B+H,q),te=Math.min(ae,B),re;if(d)if(c){var U="".concat(c).split(/[,\s]+/gim).map(oe=>parseFloat(oe));re=mW(te,B,U)}else re=$4(B,te);else re=c==null?void 0:String(c);if(q>0&&B>0&&(i.current=u,l.current=Math.max(l.current,te)),_){var V=_.length/u.length,ie=q===1?u:u.map((oe,ce)=>{var I=Math.floor(ce*V);if(_[I]){var Z=_[I];return Vr(Vr({},oe),{},{x:bt(Z.x,oe.x,q),y:bt(Z.y,oe.y,q)})}return g?Vr(Vr({},oe),{},{x:bt(x*2,oe.x,q),y:bt(S/2,oe.y,q)}):Vr(Vr({},oe),{},{x:oe.x,y:oe.y})});return i.current=ie,j.createElement(dP,{props:n,points:ie,clipPathId:t,pathRef:r,strokeDasharray:re})}return j.createElement(dP,{props:n,points:u,clipPathId:t,pathRef:r,strokeDasharray:re})}),j.createElement(d4,{label:n.label}))}function bW(e){var{clipPathId:t,props:n}=e,r=j.useRef(null),i=j.useRef(0),l=j.useRef(null);return j.createElement(gW,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:l})}var xW=(e,t)=>{var n,r;return{x:(n=e.x)!==null&&n!==void 0?n:void 0,y:(r=e.y)!==null&&r!==void 0?r:void 0,value:e.value,errorVal:jt(e.payload,t)}};class SW extends j.Component{render(){var{hide:t,dot:n,points:r,className:i,xAxisId:l,yAxisId:u,top:c,left:d,width:h,height:m,id:v,needClip:g,zIndex:x}=this.props;if(t)return null;var S=Ve("recharts-line",i),w=v,{r:O,strokeWidth:_}=rW(n),A=p4(n),T=O*2+_,N=g?"url(#clipPath-".concat(A?"":"dots-").concat(w,")"):void 0;return j.createElement(Sr,{zIndex:x},j.createElement(Zn,{className:S},g&&j.createElement("defs",null,j.createElement(k4,{clipPathId:w,xAxisId:l,yAxisId:u}),!A&&j.createElement("clipPath",{id:"clipPath-dots-".concat(w)},j.createElement("rect",{x:d-T/2,y:c-T/2,width:h+T,height:m+T}))),j.createElement(D4,{xAxisId:l,yAxisId:u,data:r,dataPointFormatter:xW,errorBarOffset:0},j.createElement(bW,{props:this.props,clipPathId:w}))),j.createElement(IX,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:N}))}}var U4={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:Ht.line,type:"linear"};function wW(e){var t=an(e,U4),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:l,animationEasing:u,connectNulls:c,dot:d,hide:h,isAnimationActive:m,label:v,legendType:g,xAxisId:x,yAxisId:S,id:w}=t,O=I1(t,sW),{needClip:_}=k1(x,S),A=M1(),T=al(),N=mn(),C=ge(D=>nW(D,x,S,N,w));if(T!=="horizontal"&&T!=="vertical"||C==null||A==null)return null;var{height:M,width:R,x:z,y:B}=A;return j.createElement(SW,Ic({},O,{id:w,connectNulls:c,dot:d,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:l,animationEasing:u,isAnimationActive:m,hide:h,label:v,legendType:g,xAxisId:x,yAxisId:S,points:C,layout:T,height:M,width:R,left:z,top:B,needClip:_}))}function jW(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:l,dataKey:u,bandSize:c,displayedData:d}=e;return d.map((h,m)=>{var v=jt(h,u);if(t==="horizontal"){var g=JE({axis:n,ticks:i,bandSize:c,entry:h,index:m}),x=ht(v)?null:r.scale.map(v);return{x:g,y:x??null,value:v,payload:h}}var S=ht(v)?null:n.scale.map(v),w=JE({axis:r,ticks:l,bandSize:c,entry:h,index:m});return S==null||w==null?null:{x:S,y:w,value:v,payload:h}}).filter(Boolean)}function OW(e){var t=an(e,U4),n=mn();return j.createElement(j4,{id:t.id,type:"line"},r=>j.createElement(j.Fragment,null,j.createElement(w4,{legendPayload:fW(t)}),j.createElement(dW,{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:r}),j.createElement(_4,{type:"line",id:r,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),j.createElement(wW,Ic({},t,{id:r}))))}var q4=j.memo(OW,Uo);q4.displayName="Line";function ol(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:E4}function ul(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(i=>i.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:E4}var _W="Invariant failed";function EW(e,t){throw new Error(_W)}function Cb(){return Cb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Cb.apply(null,arguments)}function L1(e){return j.createElement(y4,Cb({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},e))}var AW=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(r,i)=>{if(pe(t))return t;var l=pe(r)||ht(r);return l?t(r,i):(l||EW(),n)}},NW=(e,t,n)=>n,TW=(e,t)=>t,uf=G([tv,TW],(e,t)=>e.filter(n=>n.type==="bar").find(n=>n.id===t)),PW=G([uf],e=>e==null?void 0:e.maxBarSize),CW=(e,t,n,r)=>r,MW=G([Qe,tv,ol,ul,NW],(e,t,n,r,i)=>t.filter(l=>e==="horizontal"?l.xAxisId===n:l.yAxisId===r).filter(l=>l.isPanorama===i).filter(l=>l.hide===!1).filter(l=>l.type==="bar")),RW=(e,t,n)=>{var r=Qe(e),i=ol(e,t),l=ul(e,t);if(!(i==null||l==null))return r==="horizontal"?Eb(e,"yAxis",l,n):Eb(e,"xAxis",i,n)},DW=(e,t)=>{var n=Qe(e),r=ol(e,t),i=ul(e,t);if(!(r==null||i==null))return n==="horizontal"?sT(e,"xAxis",r):sT(e,"yAxis",i)},kW=G([MW,yH,DW],LX),IW=(e,t,n)=>{var r,i,l=uf(e,t);if(l==null)return 0;var u=ol(e,t),c=ul(e,t);if(u==null||c==null)return 0;var d=Qe(e),h=Y2(e),{maxBarSize:m}=l,v=ht(m)?h:m,g,x;return d==="horizontal"?(g=Yi(e,"xAxis",u,n),x=Fi(e,"xAxis",u,n)):(g=Yi(e,"yAxis",c,n),x=Fi(e,"yAxis",c,n)),(r=(i=Po(g,x,!0))!==null&&i!==void 0?i:v)!==null&&r!==void 0?r:0},H4=(e,t,n)=>{var r=Qe(e),i=ol(e,t),l=ul(e,t);if(!(i==null||l==null)){var u,c;return r==="horizontal"?(u=Yi(e,"xAxis",i,n),c=Fi(e,"xAxis",i,n)):(u=Yi(e,"yAxis",l,n),c=Fi(e,"yAxis",l,n)),Po(u,c)}},LW=G([kW,Y2,pH,G2,IW,H4,PW],qX),zW=(e,t,n)=>{var r=ol(e,t);if(r!=null)return Yi(e,"xAxis",r,n)},BW=(e,t,n)=>{var r=ul(e,t);if(r!=null)return Yi(e,"yAxis",r,n)},$W=(e,t,n)=>{var r=ol(e,t);if(r!=null)return Fi(e,"xAxis",r,n)},UW=(e,t,n)=>{var r=ul(e,t);if(r!=null)return Fi(e,"yAxis",r,n)},qW=G([LW,uf],KX),HW=G([RW,uf],HX),KW=G([Kt,Sx,zW,BW,$W,UW,qW,Qe,oH,H4,HW,uf,CW],(e,t,n,r,i,l,u,c,d,h,m,v,g)=>{var{chartData:x,dataStartIndex:S,dataEndIndex:w}=d;if(!(v==null||u==null||t==null||c!=="horizontal"&&c!=="vertical"||n==null||r==null||i==null||l==null||h==null)){var{data:O}=v,_;if(O!=null&&O.length>0?_=O:_=x==null?void 0:x.slice(S,w+1),_!=null)return gJ({layout:c,barSettings:v,pos:u,parentViewBox:t,bandSize:h,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:l,stackedData:m,displayedData:_,offset:e,cells:g,dataStartIndex:S})}}),FW=["index"];function Mb(){return Mb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mb.apply(null,arguments)}function YW(e,t){if(e==null)return{};var n,r,i=GW(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function GW(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var K4=j.createContext(void 0),VW=e=>{var t=j.useContext(K4);if(t!=null)return t.stackId;if(e!=null)return tU(e)},QW=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),XW=e=>{var t=j.useContext(K4);if(t!=null){var{stackId:n}=t;return"url(#".concat(QW(n,e),")")}},F4=e=>{var{index:t}=e,n=YW(e,FW),r=XW(t);return j.createElement(Zn,Mb({className:"recharts-bar-stack-layer",clipPath:r},n))},ZW=["onMouseEnter","onMouseLeave","onClick"],WW=["value","background","tooltipPosition"],JW=["id"],eJ=["onMouseEnter","onClick","onMouseLeave"];function Gi(){return Gi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gi.apply(null,arguments)}function hP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function gn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hP(Object(n),!0).forEach(function(r){tJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tJ(e,t,n){return(t=nJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nJ(e){var t=rJ(e,"string");return typeof t=="symbol"?t:t+""}function rJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function om(e,t){if(e==null)return{};var n,r,i=aJ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function aJ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var iJ=e=>{var{dataKey:t,name:n,fill:r,legendType:i,hide:l}=e;return[{inactive:l,dataKey:t,type:i,color:r,value:Pm(n,t),payload:e}]},sJ=j.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:l,hide:u,unit:c,tooltipType:d,id:h}=e,m={dataDefinedOnItem:void 0,getPosition:rl,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:Pm(l,t),hide:u,type:d,color:i,unit:c,graphicalItemId:h}};return j.createElement(S4,{tooltipEntrySettings:m})});function lJ(e){var t=ge(Js),{data:n,dataKey:r,background:i,allOtherBarProps:l}=e,{onMouseEnter:u,onMouseLeave:c,onClick:d}=l,h=om(l,ZW),m=g4(u,r,l.id),v=b4(c),g=x4(d,r,l.id);if(!i||n==null)return null;var x=Kc(i);return j.createElement(Sr,{zIndex:FX(i,Ht.barBackground)},n.map((S,w)=>{var{value:O,background:_,tooltipPosition:A}=S,T=om(S,WW);if(!_)return null;var N=m(S,w),C=v(S,w),M=g(S,w),R=gn(gn(gn(gn(gn({option:i,isActive:String(w)===t},T),{},{fill:"#eee"},_),x),bm(h,S,w)),{},{onMouseEnter:N,onMouseLeave:C,onClick:M,dataKey:r,index:w,className:"recharts-bar-background-rectangle"});return j.createElement(L1,Gi({key:"background-bar-".concat(w)},R))}))}function oJ(e){var{showLabels:t,children:n,rects:r}=e,i=r==null?void 0:r.map(l=>{var u={x:l.x,y:l.y,width:l.width,lowerWidth:l.width,upperWidth:l.width,height:l.height};return gn(gn({},u),{},{value:l.value,payload:l.payload,parentViewBox:l.parentViewBox,viewBox:u,fill:l.fill})});return j.createElement(c4,{value:t?i:void 0},n)}function uJ(e){var{shape:t,activeBar:n,baseProps:r,entry:i,index:l,dataKey:u}=e,c=ge(Js),d=ge(UD),h=n&&String(i.originalDataIndex)===c&&(d==null||u===d),[m,v]=j.useState(!1),[g,x]=j.useState(!1);j.useEffect(()=>{var T;return h?(v(!0),T=requestAnimationFrame(()=>{x(!0)})):x(!1),()=>{cancelAnimationFrame(T)}},[h]);var S=j.useCallback(()=>{h||v(!1)},[h]),w=h&&g,O=h||m,_;h?n===!0?_=t:_=n:_=t;var A=j.createElement(L1,Gi({},r,{name:String(r.name)},i,{isActive:w,option:_,index:l,dataKey:u,onTransitionEnd:S}));return O?j.createElement(Sr,{zIndex:Ht.activeBar},j.createElement(F4,{index:i.originalDataIndex},A)):A}function cJ(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:l}=e;return j.createElement(L1,Gi({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:l}))}function fJ(e){var t,{data:n,props:r}=e,i=(t=Pr(r))!==null&&t!==void 0?t:{},{id:l}=i,u=om(i,JW),{shape:c,dataKey:d,activeBar:h}=r,{onMouseEnter:m,onClick:v,onMouseLeave:g}=r,x=om(r,eJ),S=g4(m,d,l),w=b4(g),O=x4(v,d,l);return n?j.createElement(j.Fragment,null,n.map((_,A)=>j.createElement(F4,Gi({index:_.originalDataIndex,key:"rectangle-".concat(_==null?void 0:_.x,"-").concat(_==null?void 0:_.y,"-").concat(_==null?void 0:_.value,"-").concat(A),className:"recharts-bar-rectangle"},bm(x,_,A),{onMouseEnter:S(_,A),onMouseLeave:w(_,A),onClick:O(_,A)}),h?j.createElement(uJ,{shape:c,activeBar:h,baseProps:u,entry:_,index:A,dataKey:d}):j.createElement(cJ,{shape:c,baseProps:u,entry:_,index:A,dataKey:d})))):null}function dJ(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:l,animationBegin:u,animationDuration:c,animationEasing:d,onAnimationEnd:h,onAnimationStart:m}=t,v=n.current,g=$m(t,"recharts-bar-"),[x,S]=j.useState(!1),w=!x,O=j.useCallback(()=>{typeof h=="function"&&h(),S(!1)},[h]),_=j.useCallback(()=>{typeof m=="function"&&m(),S(!0)},[m]);return j.createElement(oJ,{showLabels:w,rects:r},j.createElement(Bm,{animationId:g,begin:u,duration:c,isActive:l,easing:d,onAnimationEnd:O,onAnimationStart:_,key:g},A=>{var T=A===1?r:r==null?void 0:r.map((N,C)=>{var M=v&&v[C];if(M)return gn(gn({},N),{},{x:bt(M.x,N.x,A),y:bt(M.y,N.y,A),width:bt(M.width,N.width,A),height:bt(M.height,N.height,A)});if(i==="horizontal"){var R=bt(0,N.height,A),z=bt(N.stackedBarStart,N.y,A);return gn(gn({},N),{},{y:z,height:R})}var B=bt(0,N.width,A),D=bt(N.stackedBarStart,N.x,A);return gn(gn({},N),{},{width:B,x:D})});return A>0&&(n.current=T??null),T==null?null:j.createElement(Zn,null,j.createElement(fJ,{props:t,data:T}))}),j.createElement(d4,{label:t.label}),t.children)}function hJ(e){var t=j.useRef(null);return j.createElement(dJ,{previousRectanglesRef:t,props:e})}var Y4=0,mJ=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:jt(e,t)}};class vJ extends j.PureComponent{render(){var{hide:t,data:n,dataKey:r,className:i,xAxisId:l,yAxisId:u,needClip:c,background:d,id:h}=this.props;if(t||n==null)return null;var m=Ve("recharts-bar",i),v=h;return j.createElement(Zn,{className:m,id:h},c&&j.createElement("defs",null,j.createElement(k4,{clipPathId:v,xAxisId:l,yAxisId:u})),j.createElement(Zn,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(v,")"):void 0},j.createElement(lJ,{data:n,dataKey:r,background:d,allOtherBarProps:this.props}),j.createElement(hJ,this.props)))}}var pJ={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:Y4,xAxisId:0,yAxisId:0,zIndex:Ht.bar};function yJ(e){var{xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:l,activeBar:u,animationBegin:c,animationDuration:d,animationEasing:h,isAnimationActive:m}=e,{needClip:v}=k1(t,n),g=al(),x=mn(),S=RQ(e.children,T1),w=ge(A=>KW(A,e.id,x,S));if(g!=="vertical"&&g!=="horizontal")return null;var O,_=w==null?void 0:w[0];return _==null||_.height==null||_.width==null?O=0:O=g==="vertical"?_.height/2:_.width/2,j.createElement(D4,{xAxisId:t,yAxisId:n,data:w,dataPointFormatter:mJ,errorBarOffset:O},j.createElement(vJ,Gi({},e,{layout:g,needClip:v,data:w,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:l,activeBar:u,animationBegin:c,animationDuration:d,animationEasing:h,isAnimationActive:m})))}function gJ(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r,hasCustomShape:i},pos:l,bandSize:u,xAxis:c,yAxis:d,xAxisTicks:h,yAxisTicks:m,stackedData:v,displayedData:g,offset:x,cells:S,parentViewBox:w,dataStartIndex:O}=e,_=t==="horizontal"?d:c,A=v?_.scale.domain():null,T=nU({numericAxis:_}),N=_.scale.map(T);return g.map((C,M)=>{var R,z,B,D,H,q;if(v){var ae=v[M+O];if(ae==null)return null;R=X$(ae,A)}else R=jt(C,n),Array.isArray(R)||(R=[T,R]);var te=AW(r,Y4)(R[1],M);if(t==="horizontal"){var re,U=d.scale.map(R[0]),V=d.scale.map(R[1]);if(U==null||V==null)return null;z=eA({axis:c,ticks:h,bandSize:u,offset:l.offset,entry:C,index:M}),B=(re=V??U)!==null&&re!==void 0?re:void 0,D=l.size;var ie=U-V;if(H=Jr(ie)?0:ie,q={x:z,y:x.top,width:D,height:x.height},Math.abs(te)>0&&Math.abs(H)<Math.abs(te)){var oe=kn(H||te)*(Math.abs(te)-Math.abs(H));B-=oe,H+=oe}}else{var ce=c.scale.map(R[0]),I=c.scale.map(R[1]);if(ce==null||I==null)return null;if(z=ce,B=eA({axis:d,ticks:m,bandSize:u,offset:l.offset,entry:C,index:M}),D=I-ce,H=l.size,q={x:x.left,y:B,width:x.width,height:H},Math.abs(te)>0&&Math.abs(D)<Math.abs(te)){var Z=kn(D||te)*(Math.abs(te)-Math.abs(D));D+=Z}}if(z==null||B==null||D==null||H==null||!i&&(D===0||H===0))return null;var se=gn(gn({},C),{},{stackedBarStart:N,x:z,y:B,width:D,height:H,value:v?R:R[1],payload:C,background:q,tooltipPosition:{x:z+D/2,y:B+H/2},parentViewBox:w,originalDataIndex:M},S&&S[M]&&S[M].props);return se}).filter(Boolean)}function bJ(e){var t=an(e,pJ),n=VW(t.stackId),r=mn();return j.createElement(j4,{id:t.id,type:"bar"},i=>j.createElement(j.Fragment,null,j.createElement(w4,{legendPayload:iJ(t)}),j.createElement(sJ,{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}),j.createElement(_4,{type:"bar",id:i,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null}),j.createElement(Sr,{zIndex:t.zIndex},j.createElement(yJ,Gi({},t,{id:i})))))}var z1=j.memo(bJ,Uo);z1.displayName="Bar";var xJ=["domain","range"],SJ=["domain","range"];function mP(e,t){if(e==null)return{};var n,r,i=wJ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function wJ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function vP(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 G4(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=mP(e,xJ),{domain:l,range:u}=t,c=mP(t,SJ);return!vP(n,l)||!vP(r,u)?!1:Uo(i,c)}var jJ=["type"],OJ=["dangerouslySetInnerHTML","ticks","scale"],_J=["id","scale"];function Rb(){return Rb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rb.apply(null,arguments)}function pP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pP(Object(n),!0).forEach(function(r){EJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function EJ(e,t,n){return(t=AJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AJ(e){var t=NJ(e,"string");return typeof t=="symbol"?t:t+""}function NJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Db(e,t){if(e==null)return{};var n,r,i=TJ(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function TJ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function PJ(e){var t=ut(),n=j.useRef(null),r=h2(),{type:i}=e,l=Db(e,jJ),u=Hm(r,"xAxis",i),c=j.useMemo(()=>{if(u!=null)return yP(yP({},l),{},{type:u})},[l,u]);return j.useLayoutEffect(()=>{c!=null&&(n.current===null?t(SX(c)):n.current!==c&&t(wX({prev:n.current,next:c})),n.current=c)},[c,t]),j.useLayoutEffect(()=>()=>{n.current&&(t(jX(n.current)),n.current=null)},[t]),null}var CJ=e=>{var{xAxisId:t,className:n}=e,r=ge(Sx),i=mn(),l="xAxis",u=ge(_=>bD(_,l,t,i)),c=ge(_=>pD(_,t)),d=ge(_=>WF(_,t)),h=ge(_=>zR(_,t));if(c==null||d==null||h==null)return null;var{dangerouslySetInnerHTML:m,ticks:v,scale:g}=e,x=Db(e,OJ),{id:S,scale:w}=h,O=Db(h,_J);return j.createElement(D1,Rb({},x,O,{x:d.x,y:d.y,width:c.width,height:c.height,className:Ve("recharts-".concat(l," ").concat(l),n),viewBox:r,ticks:u,axisType:l,axisId:t}))},MJ={allowDataOverflow:Rt.allowDataOverflow,allowDecimals:Rt.allowDecimals,allowDuplicatedCategory:Rt.allowDuplicatedCategory,angle:Rt.angle,axisLine:ka.axisLine,height:Rt.height,hide:!1,includeHidden:Rt.includeHidden,interval:Rt.interval,label:!1,minTickGap:Rt.minTickGap,mirror:Rt.mirror,orientation:Rt.orientation,padding:Rt.padding,reversed:Rt.reversed,scale:Rt.scale,tick:Rt.tick,tickCount:Rt.tickCount,tickLine:ka.tickLine,tickSize:ka.tickSize,type:Rt.type,niceTicks:Rt.niceTicks,xAxisId:0},RJ=e=>{var t=an(e,MJ);return j.createElement(j.Fragment,null,j.createElement(PJ,{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}),j.createElement(CJ,t))},sv=j.memo(RJ,G4);sv.displayName="XAxis";var DJ=["type"],kJ=["dangerouslySetInnerHTML","ticks","scale"],IJ=["id","scale"];function kb(){return kb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kb.apply(null,arguments)}function gP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function bP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gP(Object(n),!0).forEach(function(r){LJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function LJ(e,t,n){return(t=zJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zJ(e){var t=BJ(e,"string");return typeof t=="symbol"?t:t+""}function BJ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ib(e,t){if(e==null)return{};var n,r,i=$J(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function $J(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function UJ(e){var t=ut(),n=j.useRef(null),r=h2(),{type:i}=e,l=Ib(e,DJ),u=Hm(r,"yAxis",i),c=j.useMemo(()=>{if(u!=null)return bP(bP({},l),{},{type:u})},[u,l]);return j.useLayoutEffect(()=>{c!=null&&(n.current===null?t(OX(c)):n.current!==c&&t(_X({prev:n.current,next:c})),n.current=c)},[c,t]),j.useLayoutEffect(()=>()=>{n.current&&(t(EX(n.current)),n.current=null)},[t]),null}function qJ(e){var{yAxisId:t,className:n,width:r,label:i}=e,l=j.useRef(null),u=j.useRef(null),c=ge(Sx),d=mn(),h=ut(),m="yAxis",v=ge(M=>yD(M,t)),g=ge(M=>eY(M,t)),x=ge(M=>bD(M,m,t,d)),S=ge(M=>BR(M,t));if(j.useLayoutEffect(()=>{if(!(r!=="auto"||!v||C1(i)||j.isValidElement(i)||S==null)){var M=l.current;if(M){var R=M.getCalculatedWidth();Math.round(v.width)!==Math.round(R)&&h(AX({id:t,width:R}))}}},[x,v,h,i,t,r,S]),v==null||g==null||S==null)return null;var{dangerouslySetInnerHTML:w,ticks:O,scale:_}=e,A=Ib(e,kJ),{id:T,scale:N}=S,C=Ib(S,IJ);return j.createElement(D1,kb({},A,C,{ref:l,labelRef:u,x:g.x,y:g.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:v.width,height:v.height,className:Ve("recharts-".concat(m," ").concat(m),n),viewBox:c,ticks:x,axisType:m,axisId:t}))}var HJ={allowDataOverflow:Dt.allowDataOverflow,allowDecimals:Dt.allowDecimals,allowDuplicatedCategory:Dt.allowDuplicatedCategory,angle:Dt.angle,axisLine:ka.axisLine,hide:!1,includeHidden:Dt.includeHidden,interval:Dt.interval,label:!1,minTickGap:Dt.minTickGap,mirror:Dt.mirror,orientation:Dt.orientation,padding:Dt.padding,reversed:Dt.reversed,scale:Dt.scale,tick:Dt.tick,tickCount:Dt.tickCount,tickLine:ka.tickLine,tickSize:ka.tickSize,type:Dt.type,niceTicks:Dt.niceTicks,width:Dt.width,yAxisId:0},KJ=e=>{var t=an(e,HJ);return j.createElement(j.Fragment,null,j.createElement(UJ,{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}),j.createElement(qJ,t))},lv=j.memo(KJ,G4);lv.displayName="YAxis";var FJ=(e,t)=>t,B1=G([FJ,Qe,eR,Yt,LD,Xa,jG,Kt],PG);function YJ(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function $1(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(YJ(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var l=e.currentTarget;n=l.offsetWidth>0?t.width/l.offsetWidth:1,r=l.offsetHeight>0?t.height/l.offsetHeight:1}var u=(c,d)=>({relativeX:Math.round((c-t.left)/n),relativeY:Math.round((d-t.top)/r)});return"touches"in e?Array.from(e.touches).map(c=>u(c.clientX,c.clientY)):u(e.clientX,e.clientY)}var V4=Wn("mouseClick"),Q4=Gc();Q4.startListening({actionCreator:V4,effect:(e,t)=>{var n=e.payload,r=B1(t.getState(),$1(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(pY({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var Lb=Wn("mouseMove"),X4=Gc(),no=null,ys=null,b0=null;X4.startListening({actionCreator:Lb,effect:(e,t)=>{var n=e.payload,r=t.getState(),{throttleDelay:i,throttledEvents:l}=r.eventSettings,u=l==="all"||(l==null?void 0:l.includes("mousemove"));no!==null&&(cancelAnimationFrame(no),no=null),ys!==null&&(typeof i!="number"||!u)&&(clearTimeout(ys),ys=null),b0=$1(n);var c=()=>{var d=t.getState(),h=lf(d,d.tooltip.settings.shared);if(!b0){no=null,ys=null;return}if(h==="axis"){var m=B1(d,b0);(m==null?void 0:m.activeIndex)!=null?t.dispatch(AD({activeIndex:m.activeIndex,activeDataKey:void 0,activeCoordinate:m.activeCoordinate})):t.dispatch(ED())}no=null,ys=null};if(!u){c();return}i==="raf"?no=requestAnimationFrame(c):typeof i=="number"&&ys===null&&(ys=setTimeout(c,i))}});function GJ(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 xP={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},Z4=hn({name:"rootProps",initialState:xP,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:xP.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}}}),VJ=Z4.reducer,{updateOptions:QJ}=Z4.actions,XJ=null,ZJ={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)},W4=hn({name:"polarOptions",initialState:XJ,reducers:ZJ}),{updatePolarOptions:qne}=W4.actions,WJ=W4.reducer,J4=Wn("keyDown"),e3=Wn("focus"),t3=Wn("blur"),ov=Gc(),ro=null,gs=null,Vd=null;ov.startListening({actionCreator:J4,effect:(e,t)=>{Vd=e.payload,ro!==null&&(cancelAnimationFrame(ro),ro=null);var n=t.getState(),{throttleDelay:r,throttledEvents:i}=n.eventSettings,l=i==="all"||i.includes("keydown");gs!==null&&(typeof r!="number"||!l)&&(clearTimeout(gs),gs=null);var u=()=>{try{var c=t.getState(),d=c.rootProps.accessibilityLayer!==!1;if(!d)return;var{keyboardInteraction:h}=c.tooltip,m=Vd;if(m!=="ArrowRight"&&m!=="ArrowLeft"&&m!=="Enter")return;var v=hc(h,Ws(c),Io(c),Lo(c)),g=v==null?-1:Number(v),x=!Number.isFinite(g)||g<0,S=Xa(c),w=Ws(c),O=lf(c,c.tooltip.settings.shared);if(m==="Enter"){if(x)return;var _=nm(c,O,"hover",String(h.index));t.dispatch(tm({active:!h.active,activeIndex:h.index,activeCoordinate:_}));return}var A=iY(c),T=A==="left-to-right"?1:-1,N=m==="ArrowRight"?1:-1,C;if(x){var M=Io(c),R=Lo(c),z=N*T,B=te=>({active:!1,index:String(te),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(C=-1,z>0){for(var D=0;D<w.length;D++)if(hc(B(D),w,M,R)!=null){C=D;break}}else for(var H=w.length-1;H>=0;H--)if(hc(B(H),w,M,R)!=null){C=H;break}if(C<0)return}else{C=g+N*T;var q=(S==null?void 0:S.length)||w.length;if(q===0||C>=q||C<0)return}var ae=nm(c,O,"hover",String(C));t.dispatch(tm({active:!0,activeIndex:C.toString(),activeCoordinate:ae}))}finally{ro=null,gs=null}};if(!l){u();return}r==="raf"?ro=requestAnimationFrame(u):typeof r=="number"&&gs===null&&(u(),Vd=null,gs=setTimeout(()=>{Vd?u():(gs=null,ro=null)},r))}});ov.startListening({actionCreator:e3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var l="0",u=lf(n,n.tooltip.settings.shared),c=nm(n,u,"hover",String(l));t.dispatch(tm({active:!0,activeIndex:l,activeCoordinate:c}))}}}});ov.startListening({actionCreator:t3,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;i.active&&t.dispatch(tm({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function n3(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(n,r)=>{if(r==="currentTarget")return t;var i=Reflect.get(n,r);return typeof i=="function"?i.bind(n):i}})}var dr=Wn("externalEvent"),r3=Gc(),Qd=new Map,ic=new Map,x0=new Map;r3.startListening({actionCreator:dr,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){var i=r.type,l=n3(r);x0.set(i,{handler:n,reactEvent:l});var u=Qd.get(i);u!==void 0&&(cancelAnimationFrame(u),Qd.delete(i));var c=t.getState(),{throttleDelay:d,throttledEvents:h}=c.eventSettings,m=h,v=m==="all"||(m==null?void 0:m.includes(i)),g=ic.get(i);g!==void 0&&(typeof d!="number"||!v)&&(clearTimeout(g),ic.delete(i));var x=()=>{var O=x0.get(i);try{if(!O)return;var{handler:_,reactEvent:A}=O,T=t.getState(),N={activeCoordinate:lG(T),activeDataKey:UD(T),activeIndex:Js(T),activeLabel:$D(T),activeTooltipIndex:Js(T),isTooltipActive:oG(T)};_&&_(N,A)}finally{Qd.delete(i),ic.delete(i),x0.delete(i)}};if(!v){x();return}if(d==="raf"){var S=requestAnimationFrame(x);Qd.set(i,S)}else if(typeof d=="number"){if(!ic.has(i)){x();var w=setTimeout(x,d);ic.set(i,w)}}else x()}}});var JJ=G([Qo],e=>e.tooltipItemPayloads),eee=G([JJ,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(l=>l.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),a3=Wn("touchMove"),i3=Gc(),bs=null,wi=null,SP=null,sc=null;i3.startListening({actionCreator:a3,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){sc=n3(n);var r=t.getState(),{throttleDelay:i,throttledEvents:l}=r.eventSettings,u=l==="all"||l.includes("touchmove");bs!==null&&(cancelAnimationFrame(bs),bs=null),wi!==null&&(typeof i!="number"||!u)&&(clearTimeout(wi),wi=null),SP=Array.from(n.touches).map(d=>$1({clientX:d.clientX,clientY:d.clientY,currentTarget:n.currentTarget}));var c=()=>{if(sc!=null){var d=t.getState(),h=lf(d,d.tooltip.settings.shared);if(h==="axis"){var m,v=(m=SP)===null||m===void 0?void 0:m[0];if(v==null){bs=null,wi=null;return}var g=B1(d,v);(g==null?void 0:g.activeIndex)!=null&&t.dispatch(AD({activeIndex:g.activeIndex,activeDataKey:void 0,activeCoordinate:g.activeCoordinate}))}else if(h==="item"){var x,S=sc.touches[0];if(document.elementFromPoint==null||S==null)return;var w=document.elementFromPoint(S.clientX,S.clientY);if(!w||!w.getAttribute)return;var O=w.getAttribute(uU),_=(x=w.getAttribute(cU))!==null&&x!==void 0?x:void 0,A=ll(d).find(C=>C.id===_);if(O==null||A==null||_==null)return;var{dataKey:T}=A,N=eee(d,O,_);t.dispatch(_D({activeDataKey:T,activeIndex:O,activeCoordinate:N,activeGraphicalItemId:_}))}bs=null,wi=null}};if(!u){c();return}i==="raf"?bs=requestAnimationFrame(c):typeof i=="number"&&wi===null&&(c(),sc=null,wi=setTimeout(()=>{sc?c():(wi=null,bs=null)},i))}}});var s3={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},l3=hn({name:"eventSettings",initialState:s3,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:tee}=l3.actions,nee=l3.reducer,ree=CM({brush:GX,cartesianAxis:NX,chartData:sV,errorBars:YZ,eventSettings:nee,graphicalItems:sX,layout:F$,legend:rq,options:tV,polarAxis:NQ,polarOptions:WJ,referenceElements:ZX,renderedTicks:mZ,rootProps:VJ,tooltip:yY,zIndex:HG}),aee=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return p$({reducer:ree,preloadedState:t,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([Q4.middleware,X4.middleware,ov.middleware,r3.middleware,i3.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(YM({type:"raf"}))},devTools:{serialize:{replacer:GJ},name:"recharts-".concat(n)}})};function iee(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=mn(),l=j.useRef(null);if(i)return n;l.current==null&&(l.current=aee(t,r));var u=mx;return j.createElement(bq,{context:u,store:l.current},n)}function see(e){var{layout:t,margin:n}=e,r=ut(),i=mn();return j.useEffect(()=>{i||(r(q$(t)),r(U$(n)))},[r,i,t,n]),null}var lee=j.memo(see,Uo);function oee(e){var t=ut();return j.useEffect(()=>{t(QJ(e))},[t,e]),null}var uee=e=>{var t=ut();return j.useEffect(()=>{t(tee(e))},[t,e]),null},cee=j.memo(uee,Uo);function wP(e){var{zIndex:t,isPanorama:n}=e,r=j.useRef(null),i=ut();return j.useLayoutEffect(()=>(r.current&&i(UG({zIndex:t,element:r.current,isPanorama:n})),()=>{i(qG({zIndex:t,isPanorama:n}))}),[i,t,n]),j.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(t)})}function jP(e){var{children:t,isPanorama:n}=e,r=ge(MG);if(!r||r.length===0)return t;var i=r.filter(u=>u<0),l=r.filter(u=>u>0);return j.createElement(j.Fragment,null,i.map(u=>j.createElement(wP,{key:u,zIndex:u,isPanorama:n})),t,l.map(u=>j.createElement(wP,{key:u,zIndex:u,isPanorama:n})))}var fee=["children"];function dee(e,t){if(e==null)return{};var n,r,i=hee(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function hee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function um(){return um=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},um.apply(null,arguments)}var mee={width:"100%",height:"100%",display:"block"},vee=j.forwardRef((e,t)=>{var n=_x(),r=Ex(),i=O2();if(!ta(n)||!ta(r))return null;var{children:l,otherAttributes:u,title:c,desc:d}=e,h,m;return u!=null&&(typeof u.tabIndex=="number"?h=u.tabIndex:h=i?0:void 0,typeof u.role=="string"?m=u.role:m=i?"application":void 0),j.createElement(ax,um({},u,{title:c,desc:d,role:m,tabIndex:h,width:n,height:r,style:mee,ref:t}),l)}),pee=e=>{var{children:t}=e,n=ge(Dm);if(!n)return null;var{width:r,height:i,y:l,x:u}=n;return j.createElement(ax,{width:r,height:i,x:u,y:l},t)},OP=j.forwardRef((e,t)=>{var{children:n}=e,r=dee(e,fee),i=mn();return i?j.createElement(pee,null,j.createElement(jP,{isPanorama:!0},n)):j.createElement(vee,um({ref:t},r),j.createElement(jP,{isPanorama:!1},n))});function yee(){var e=ut(),[t,n]=j.useState(null),r=ge(oU);return j.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),l=i.width/t.offsetWidth;$e(l)&&l!==r&&e(K$(l))}},[t,e,r]),n}function _P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function gee(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_P(Object(n),!0).forEach(function(r){bee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_P(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function bee(e,t,n){return(t=xee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xee(e){var t=See(e,"string");return typeof t=="symbol"?t:t+""}function See(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ki(){return Ki=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ki.apply(null,arguments)}var wee=()=>(vV(),null);function cm(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var jee=j.forwardRef((e,t)=>{var n,r,i=j.useRef(null),[l,u]=j.useState({containerWidth:cm((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:cm((r=e.style)===null||r===void 0?void 0:r.height)}),c=j.useCallback((h,m)=>{u(v=>{var g=Math.round(h),x=Math.round(m);return v.containerWidth===g&&v.containerHeight===x?v:{containerWidth:g,containerHeight:x}})},[]),d=j.useCallback(h=>{if(typeof t=="function"&&t(h),i.current!=null&&(i.current.disconnect(),i.current=null),h!=null&&typeof ResizeObserver<"u"){var{width:m,height:v}=h.getBoundingClientRect();c(m,v);var g=S=>{var w=S[0];if(w!=null){var{width:O,height:_}=w.contentRect;c(O,_)}},x=new ResizeObserver(g);x.observe(h),i.current=x}},[t,c]);return j.useEffect(()=>()=>{var h=i.current;h!=null&&h.disconnect()},[c]),j.createElement(j.Fragment,null,j.createElement(Qc,{width:l.containerWidth,height:l.containerHeight}),j.createElement("div",Ki({ref:d},e)))}),Oee=j.forwardRef((e,t)=>{var{width:n,height:r}=e,[i,l]=j.useState({containerWidth:cm(n),containerHeight:cm(r)}),u=j.useCallback((d,h)=>{l(m=>{var v=Math.round(d),g=Math.round(h);return m.containerWidth===v&&m.containerHeight===g?m:{containerWidth:v,containerHeight:g}})},[]),c=j.useCallback(d=>{if(typeof t=="function"&&t(d),d!=null){var{width:h,height:m}=d.getBoundingClientRect();u(h,m)}},[t,u]);return j.createElement(j.Fragment,null,j.createElement(Qc,{width:i.containerWidth,height:i.containerHeight}),j.createElement("div",Ki({ref:c},e)))}),_ee=j.forwardRef((e,t)=>{var{width:n,height:r}=e;return j.createElement(j.Fragment,null,j.createElement(Qc,{width:n,height:r}),j.createElement("div",Ki({ref:t},e)))}),Eee=j.forwardRef((e,t)=>{var{width:n,height:r}=e;return typeof n=="string"||typeof r=="string"?j.createElement(Oee,Ki({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?j.createElement(_ee,Ki({},e,{width:n,height:r,ref:t})):j.createElement(j.Fragment,null,j.createElement(Qc,{width:n,height:r}),j.createElement("div",Ki({ref:t},e)))});function Aee(e){return e?jee:Eee}var Nee=j.forwardRef((e,t)=>{var{children:n,className:r,height:i,onClick:l,onContextMenu:u,onDoubleClick:c,onMouseDown:d,onMouseEnter:h,onMouseLeave:m,onMouseMove:v,onMouseUp:g,onTouchEnd:x,onTouchMove:S,onTouchStart:w,style:O,width:_,responsive:A,dispatchTouchEvents:T=!0}=e,N=j.useRef(null),C=ut(),[M,R]=j.useState(null),[z,B]=j.useState(null),D=yee(),H=wx(),q=(H==null?void 0:H.width)>0?H.width:_,ae=(H==null?void 0:H.height)>0?H.height:i,te=j.useCallback(fe=>{D(fe),typeof t=="function"&&t(fe),R(fe),B(fe),fe!=null&&(N.current=fe)},[D,t,R,B]),re=j.useCallback(fe=>{C(V4(fe)),C(dr({handler:l,reactEvent:fe}))},[C,l]),U=j.useCallback(fe=>{C(Lb(fe)),C(dr({handler:h,reactEvent:fe}))},[C,h]),V=j.useCallback(fe=>{C(ED()),C(dr({handler:m,reactEvent:fe}))},[C,m]),ie=j.useCallback(fe=>{C(Lb(fe)),C(dr({handler:v,reactEvent:fe}))},[C,v]),oe=j.useCallback(()=>{C(e3())},[C]),ce=j.useCallback(()=>{C(t3())},[C]),I=j.useCallback(fe=>{C(J4(fe.key))},[C]),Z=j.useCallback(fe=>{C(dr({handler:u,reactEvent:fe}))},[C,u]),se=j.useCallback(fe=>{C(dr({handler:c,reactEvent:fe}))},[C,c]),X=j.useCallback(fe=>{C(dr({handler:d,reactEvent:fe}))},[C,d]),ve=j.useCallback(fe=>{C(dr({handler:g,reactEvent:fe}))},[C,g]),we=j.useCallback(fe=>{C(dr({handler:w,reactEvent:fe}))},[C,w]),je=j.useCallback(fe=>{T&&C(a3(fe)),C(dr({handler:S,reactEvent:fe}))},[C,T,S]),Me=j.useCallback(fe=>{C(dr({handler:x,reactEvent:fe}))},[C,x]),ue=Aee(A);return j.createElement(VD.Provider,{value:M},j.createElement(YC.Provider,{value:z},j.createElement(ue,{width:q??(O==null?void 0:O.width),height:ae??(O==null?void 0:O.height),className:Ve("recharts-wrapper",r),style:gee({position:"relative",cursor:"default",width:q,height:ae},O),onClick:re,onContextMenu:Z,onDoubleClick:se,onFocus:oe,onBlur:ce,onKeyDown:I,onMouseDown:X,onMouseEnter:U,onMouseLeave:V,onMouseMove:ie,onMouseUp:ve,onTouchEnd:Me,onTouchMove:je,onTouchStart:we,ref:te},j.createElement(wee,null),n)))}),Tee=["width","height","responsive","children","className","style","compact","title","desc"];function Pee(e,t){if(e==null)return{};var n,r,i=Cee(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Cee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Mee=j.forwardRef((e,t)=>{var{width:n,height:r,responsive:i,children:l,className:u,style:c,compact:d,title:h,desc:m}=e,v=Pee(e,Tee),g=Pr(v);return d?j.createElement(j.Fragment,null,j.createElement(Qc,{width:n,height:r}),j.createElement(OP,{otherAttributes:g,title:h,desc:m},l)):j.createElement(Nee,{className:u,style:c,width:n,height:r,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},j.createElement(OP,{otherAttributes:g,title:h,desc:m,ref:t},j.createElement(JX,null,l)))});function zb(){return zb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zb.apply(null,arguments)}function EP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ree(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?EP(Object(n),!0).forEach(function(r){Dee(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Dee(e,t,n){return(t=kee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kee(e){var t=Iee(e,"string");return typeof t=="symbol"?t:t+""}function Iee(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Lee={top:5,right:5,bottom:5,left:5},zee=Ree({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:Lee,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},s3),o3=j.forwardRef(function(t,n){var r,i=an(t.categoricalChartProps,zee),{chartName:l,defaultTooltipEventType:u,validateTooltipEventTypes:c,tooltipPayloadSearcher:d,categoricalChartProps:h}=t,m={chartName:l,defaultTooltipEventType:u,validateTooltipEventTypes:c,tooltipPayloadSearcher:d,eventEmitter:void 0};return j.createElement(iee,{preloadedState:{options:m},reduxStoreName:(r=h.id)!==null&&r!==void 0?r:l},j.createElement(YX,{chartData:h.data}),j.createElement(lee,{layout:i.layout,margin:i.margin}),j.createElement(cee,{throttleDelay:i.throttleDelay,throttledEvents:i.throttledEvents}),j.createElement(oee,{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}),j.createElement(Mee,zb({},i,{ref:n})))}),Bee=["axis"],$ee=j.forwardRef((e,t)=>j.createElement(o3,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Bee,tooltipPayloadSearcher:QD,categoricalChartProps:e,ref:t})),Uee=["axis","item"],u3=j.forwardRef((e,t)=>j.createElement(o3,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Uee,tooltipPayloadSearcher:QD,categoricalChartProps:e,ref:t}));const wt={green:"#34d399",red:"#f87171",gray:"#4b5563",cyan:"#22d3ee",gridLine:"#1f2937",labelText:"#9ca3af"},AP=["#22d3ee","#34d399","#facc15","#f87171","#a78bfa","#fb923c","#f472b6","#60a5fa"];function qee(e){return AP[e%AP.length]}function Hee({data:e,benchmarkId:t}){const[n,r]=j.useState(!0),[i,l]=j.useState(""),u=e.targets,c=ot(t?BC(t,i||void 0):F5(i||void 0)),d=i?c.data:void 0,h=j.useMemo(()=>Vee(e.runs??[]),[e.runs]);return p.jsxs("div",{className:"rounded-lg border border-gray-800",children:[p.jsxs("button",{type:"button",onClick:()=>r(m=>!m),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-gray-900/30",children:[p.jsx("span",{className:"text-sm font-medium text-gray-300",children:"Analytics"}),p.jsx("span",{className:"text-xs text-gray-500",children:n?"▸ Show":"▾ Hide"})]}),!n&&p.jsxs("div",{className:"space-y-6 border-t border-gray-800 px-4 py-4",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("label",{htmlFor:"baseline-select",className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Baseline target"}),p.jsxs("select",{id:"baseline-select",value:i,onChange:m=>l(m.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:[p.jsx("option",{value:"",children:"Select a baseline…"}),u.map(m=>p.jsx("option",{value:m,children:m},m))]}),i&&c.isLoading&&p.jsx("span",{className:"text-xs text-gray-500",children:"Loading…"})]}),i&&d&&p.jsx(Kee,{data:d,baseline:i}),e.runs&&e.runs.length>0&&u.length>1&&p.jsx(Fee,{runs:e.runs,targets:u}),i&&d&&p.jsx(Yee,{data:d,baseline:i}),p.jsx(Gee,{data:e}),h.length>1&&u.length>0&&p.jsx(Qee,{data:h,targets:u}),!i&&p.jsx("p",{className:"text-xs text-gray-500",children:"Select a baseline target above to see gain and delta charts."})]})]})}function U1({active:e,payload:t,label:n}){return!e||!(t!=null&&t.length)?null:p.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-900 px-3 py-2 text-xs shadow-xl",children:[n&&p.jsx("div",{className:"mb-1 font-medium text-gray-300",children:n}),t.map((r,i)=>p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:r.color}}),p.jsxs("span",{className:"text-gray-400",children:[r.name,":"]}),p.jsx("span",{className:"tabular-nums text-gray-200",children:typeof r.value=="number"?r.value.toFixed(3):r.value})]},`${r.name}-${i}`))]})}function zo({title:e,children:t}){return p.jsxs("div",{className:"space-y-3",children:[p.jsx("h3",{className:"text-sm font-medium text-gray-400",children:e}),t]})}function Kee({data:e,baseline:t}){const n=j.useMemo(()=>{const i=[];for(const l of e.cells)l.target!==t&&l.delta!==void 0&&i.push({experiment:l.experiment,target:l.target,g:l.normalized_gain??null,delta:l.delta});return i.sort((l,u)=>Math.abs(u.g??0)-Math.abs(l.g??0)),i},[e.cells,t]);if(n.length===0)return p.jsx(zo,{title:"Normalized Gain (g)",children:p.jsx("p",{className:"text-xs text-gray-500",children:"No gain data available. Ensure multiple targets exist."})});const r=n.map(i=>({name:`${i.target} · ${i.experiment}`,g:i.g??0,isNull:i.g===null}));return p.jsx(zo,{title:"Normalized Gain (g)",children:p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:p.jsx(jx,{width:"100%",height:Math.max(200,r.length*32),children:p.jsxs(u3,{data:r,layout:"vertical",margin:{left:120,right:20,top:5,bottom:5},children:[p.jsx(iv,{strokeDasharray:"3 3",stroke:wt.gridLine,horizontal:!1}),p.jsx(sv,{type:"number",tick:{fill:wt.labelText,fontSize:11},axisLine:{stroke:wt.gridLine}}),p.jsx(lv,{type:"category",dataKey:"name",tick:{fill:wt.labelText,fontSize:11},width:120,axisLine:{stroke:wt.gridLine}}),p.jsx(N1,{content:p.jsx(U1,{})}),p.jsx(z1,{dataKey:"g",name:"Normalized Gain",children:r.map(i=>p.jsx(T1,{fill:i.isNull?wt.gray:i.g>0?wt.green:i.g<0?wt.red:wt.gray},i.name))})]})})})})}function Fee({runs:e,targets:t}){const{tags:n,grid:r}=j.useMemo(()=>{const i=new Map;for(const c of e)for(const d of c.tags??[]){let h=i.get(d);h||(h=new Map,i.set(d,h));let m=h.get(c.target);m||(m={passed:0,total:0},h.set(c.target,m)),m.passed+=c.passed_count,m.total+=c.eval_count}const l=[...i.keys()].sort(),u=l.map(c=>{const d={tag:c},h=i.get(c);if(!h)return d;for(const m of t){const v=h.get(m);d[m]=v&&v.total>0?v.passed/v.total:-1}return d});return{tags:l,grid:u}},[e,t]);return n.length===0?null:p.jsx(zo,{title:"Pass Rate by Tag × Target",children:p.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Tag"}),t.map(i=>p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:i},i))]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:r.map(i=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:i.tag}),t.map(l=>{const u=i[l];if(u<0)return p.jsx("td",{className:"px-4 py-3 text-center text-gray-600",children:"—"},l);const c=Math.round(u*100),d=u>=.8?"bg-emerald-400/20 text-emerald-400":u>=.5?"bg-yellow-400/20 text-yellow-400":"bg-red-400/20 text-red-400";return p.jsx("td",{className:"px-4 py-3",children:p.jsxs("span",{className:`inline-block rounded px-2 py-0.5 text-xs tabular-nums font-medium ${d}`,children:[c,"%"]})},l)})]},i.tag))})]})})})}function Yee({data:e,baseline:t}){const n=j.useMemo(()=>e.cells.filter(r=>r.target!==t&&r.delta!==void 0&&r.delta<0).sort((r,i)=>(r.delta??0)-(i.delta??0)),[e.cells,t]);return n.length===0?null:p.jsx(zo,{title:"Regressions vs. Baseline",children:p.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Avg Score"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Delta"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"g"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(r=>{var i;return p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:r.experiment}),p.jsx("td",{className:"px-4 py-3 text-gray-300",children:r.target}),p.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[Math.round(r.avg_score*100),"%"]}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:(i=r.delta)==null?void 0:i.toFixed(3)}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:r.normalized_gain!==void 0&&r.normalized_gain!==null?r.normalized_gain.toFixed(3):"—"})]},`${r.experiment}::${r.target}`)})})]})})})}function Gee({data:e}){const t=j.useMemo(()=>{const n=[];for(const i of e.cells)for(const l of i.tests)n.push(l.score);if(n.length===0)return[];const r=Array.from({length:10},(i,l)=>({range:`${l*10}–${(l+1)*10}%`,count:0}));for(const i of n){const l=Math.min(Math.floor(i*10),9);r[l].count++}return r},[e.cells]);return t.length===0?null:p.jsx(zo,{title:"Score Distribution",children:p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:p.jsx(jx,{width:"100%",height:200,children:p.jsxs(u3,{data:t,margin:{left:10,right:10,top:5,bottom:5},children:[p.jsx(iv,{strokeDasharray:"3 3",stroke:wt.gridLine,vertical:!1}),p.jsx(sv,{dataKey:"range",tick:{fill:wt.labelText,fontSize:11},axisLine:{stroke:wt.gridLine}}),p.jsx(lv,{tick:{fill:wt.labelText,fontSize:11},axisLine:{stroke:wt.gridLine}}),p.jsx(N1,{content:p.jsx(U1,{})}),p.jsx(z1,{dataKey:"count",name:"Tests",fill:wt.cyan,radius:[2,2,0,0]})]})})})})}function Vee(e){if(e.length===0)return[];const t=new Map;for(const r of e){const i=r.started_at.slice(0,10);let l=t.get(i);l||(l=new Map,t.set(i,l));let u=l.get(r.target);u||(u={scoreSum:0,count:0},l.set(r.target,u)),u.scoreSum+=r.avg_score,u.count++}return[...t.keys()].sort().map(r=>{const i={date:r},l=t.get(r);if(!l)return i;for(const[u,c]of l)i[u]=Math.round(c.scoreSum/c.count*1e3)/1e3;return i})}function Qee({data:e,targets:t}){return p.jsx(zo,{title:"Score Trend Over Time",children:p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/30 p-3",children:p.jsx(jx,{width:"100%",height:250,children:p.jsxs($ee,{data:e,margin:{left:10,right:20,top:5,bottom:5},children:[p.jsx(iv,{strokeDasharray:"3 3",stroke:wt.gridLine}),p.jsx(sv,{dataKey:"date",tick:{fill:wt.labelText,fontSize:11},axisLine:{stroke:wt.gridLine}}),p.jsx(lv,{domain:[0,1],tick:{fill:wt.labelText,fontSize:11},axisLine:{stroke:wt.gridLine}}),p.jsx(N1,{content:p.jsx(U1,{})}),p.jsx(w2,{wrapperStyle:{fontSize:12,color:wt.labelText}}),t.map((n,r)=>p.jsx(q4,{type:"monotone",dataKey:n,stroke:qee(r),strokeWidth:2,dot:{r:3},connectNulls:!0},n))]})})})})}function qa({rate:e}){const t=Math.round(e*100);return p.jsxs("div",{className:"relative h-5 w-20 overflow-hidden rounded-full bg-gray-800",children:[p.jsx("div",{className:"absolute inset-y-0 left-0 bg-gradient-to-r from-blue-400 to-blue-600",style:{width:`${t}%`}}),p.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-semibold tabular-nums text-white",children:[t,"%"]})]})}function c3({data:e,isLoading:t,isError:n,error:r,benchmarkId:i,readOnly:l}){var A,T;const[u,c]=j.useState("aggregated"),[d,h]=j.useState([]),{allTags:m,tagCounts:v}=j.useMemo(()=>{const N=new Map;for(const C of(e==null?void 0:e.runs)??[])for(const M of C.tags??[])N.set(M,(N.get(M)??0)+1);return{allTags:[...N.keys()].sort(),tagCounts:N}},[e==null?void 0:e.runs]),g=j.useMemo(()=>{if(!e||d.length===0)return e;const N=new Set(d),C=(e.runs??[]).filter(D=>(D.tags??[]).some(H=>N.has(H))),M=new Map,R=new Set,z=new Set;for(const D of C){R.add(D.experiment),z.add(D.target);const H=`${D.experiment}::${D.target}`,q=M.get(H)??{experiment:D.experiment,target:D.target,eval_count:0,passed_count:0,score_sum:0,tests:[]};q.eval_count+=D.eval_count,q.passed_count+=D.passed_count,q.score_sum+=D.avg_score*D.eval_count;for(const ae of D.tests)q.tests.push(ae);M.set(H,q)}const B=[...M.values()].map(D=>{const H=new Map;for(const q of D.tests)H.set(q.test_id,q);return{experiment:D.experiment,target:D.target,eval_count:D.eval_count,passed_count:D.passed_count,pass_rate:D.eval_count>0?D.passed_count/D.eval_count:0,avg_score:D.eval_count>0?D.score_sum/D.eval_count:0,tests:[...H.values()].slice(-100)}});return{...e,experiments:[...R].sort(),targets:[...z].sort(),cells:B,runs:C}},[e,d]),x=N=>{h(C=>C.includes(N)?C.filter(M=>M!==N):[...C,N])},S=()=>h([]),w=((A=g==null?void 0:g.runs)==null?void 0:A.length)??0,O=e&&e.cells.length>0,_=d.length>0&&g&&(((T=g.runs)==null?void 0:T.length)??0)===0;return p.jsxs("div",{className:"space-y-4",children:[p.jsx(Zee,{mode:u,onModeChange:c,runsCount:w}),t&&p.jsx(dte,{}),!t&&n&&r&&p.jsx(cte,{message:`Failed to load comparison data: ${r.message}`}),!t&&!n&&!O&&p.jsx(fte,{}),!t&&!n&&O&&p.jsxs(p.Fragment,{children:[m.length>0&&p.jsx(Xee,{allTags:m,tagCounts:v,selected:d,onToggle:x,onClear:S}),_?p.jsx(uv,{headline:`No runs match ${d.map(N=>`\`${N}\``).join(" + ")}`,body:"Clear the filter or pick a different tag combination.",action:{label:"Clear filter",onClick:S}}):g&&p.jsxs(p.Fragment,{children:[u==="aggregated"&&p.jsx(Jee,{data:g,benchmarkId:i}),u==="per-run"&&p.jsx(ate,{data:g,benchmarkId:i,readOnly:l??!1})]})]})]})}function Xee({allTags:e,tagCounts:t,selected:n,onToggle:r,onClear:i}){const l=new Set(n),u=n.length>0;return p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900/40 px-4 py-3",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Filter by tag"}),e.map(c=>{const d=l.has(c),h=t.get(c)??0;return p.jsxs("button",{type:"button",onClick:()=>r(c),"aria-pressed":d,className:`inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 text-xs font-medium transition-colors ${d?"border-cyan-900/60 bg-cyan-950/30 text-cyan-300 hover:border-cyan-800/80":"border-gray-700 text-gray-400 hover:border-gray-600 hover:text-gray-200"}`,children:[p.jsx("span",{children:c}),p.jsx("span",{className:`rounded px-1 text-[0.65rem] tabular-nums ${d?"bg-cyan-900/50 text-cyan-200":"bg-gray-800 text-gray-500"}`,children:h})]},c)}),u&&p.jsx("button",{type:"button",onClick:i,className:"ml-1 text-xs text-gray-500 underline-offset-2 transition-colors hover:text-gray-300 hover:underline",children:"Clear"})]}),p.jsxs("p",{className:"mt-2 text-xs text-gray-500",children:["Showing runs with ",p.jsx("span",{className:"text-gray-400",children:"any"})," selected tag."]})]})}function Zee({mode:e,onModeChange:t,runsCount:n}){return p.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-xl font-semibold text-white",children:"Analyze runs"}),p.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Study one experiment against another, or pit individual runs head-to-head."})]}),p.jsx(Wee,{mode:e,onChange:t,runsCount:n})]})}function Wee({mode:e,onChange:t,runsCount:n}){const r=n===0;return p.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:[p.jsx(NP,{active:e==="aggregated",onClick:()=>t("aggregated"),children:"Aggregated"}),p.jsxs(NP,{active:e==="per-run",onClick:()=>t("per-run"),disabled:r,title:r?"No runs available":void 0,children:["Per run",n>0&&p.jsx("span",{className:"ml-1.5 rounded bg-gray-800 px-1.5 py-0.5 text-xs tabular-nums text-gray-400",children:n})]})]})}function NP({active:e,onClick:t,disabled:n,title:r,children:i}){return p.jsx("button",{type:"button",role:"tab","aria-selected":e,onClick:t,disabled:n,title:r,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 Jee({data:e,benchmarkId:t}){const{experiments:n,targets:r,cells:i}=e,l=j.useMemo(()=>{const u=new Map;for(const c of i)u.set(`${c.experiment}::${c.target}`,c);return u},[i]);return n.length<=1&&r.length<=1?p.jsx(uv,{headline:"Not enough variation to compare",body:`The aggregated matrix requires at least 2 experiments or 2 targets. Currently ${n.length} experiment(s) and ${r.length} target(s).`}):p.jsxs("div",{className:"space-y-3",children:[p.jsx(ute,{}),p.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:p.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Target ↓ / Experiment →"})}),n.map(u=>p.jsx("th",{className:"px-4 py-3 font-medium text-gray-300",children:u},u))]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:r.map(u=>p.jsx(ete,{target:u,experiments:n,cellMap:l},u))})]})}),p.jsx(Hee,{data:e,benchmarkId:t})]})}function ete({target:e,experiments:t,cellMap:n}){return p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:e}),t.map(r=>{const i=n.get(`${r}::${e}`);return p.jsx("td",{className:"px-4 py-3",children:i?p.jsx(tte,{cell:i}):p.jsx(nte,{})},r)})]})}function tte({cell:e}){const[t,n]=j.useState(!1),r=Math.round(e.avg_score*100);return p.jsxs("div",{className:"space-y-2",children:[p.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:()=>n(i=>!i),"aria-expanded":t,children:[p.jsx(qa,{rate:e.pass_rate}),p.jsxs("div",{className:"flex items-center gap-2 text-xs tabular-nums text-gray-500",children:[p.jsxs("span",{children:[p.jsx("span",{className:"text-emerald-400",children:e.passed_count}),p.jsx("span",{className:"text-gray-600",children:" / "}),p.jsx("span",{children:e.eval_count})]}),p.jsx("span",{className:"text-gray-700",children:"·"}),p.jsxs("span",{children:["avg ",r,"%"]})]})]}),t&&p.jsx(rte,{tests:e.tests})]})}function nte(){return p.jsx("div",{className:"text-center text-gray-600",children:"—"})}function rte({tests:e}){return p.jsxs("div",{className:"rounded-md border border-gray-800 bg-gray-950/60 px-3 py-2",children:[p.jsx("div",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Test cases"}),p.jsx("ul",{className:"space-y-1",children:e.map(t=>p.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[p.jsx("span",{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full ${t.passed?"bg-emerald-400":"bg-red-400"}`}),p.jsx("span",{className:"flex-1 truncate text-gray-300",title:t.test_id,children:t.test_id}),p.jsxs("span",{className:`tabular-nums ${t.passed?"text-emerald-400":"text-red-400"}`,children:[Math.round(t.score*100),"%"]})]},t.test_id))})]})}function ate({data:e,benchmarkId:t,readOnly:n}){const r=e.runs??[],[i,l]=j.useState(new Set),[u,c]=j.useState(!1),[d,h]=j.useState(null),m=x=>{l(S=>{const w=new Set(S);return w.has(x)?w.delete(x):w.add(x),w})},v=()=>l(new Set),g=j.useMemo(()=>r.filter(x=>i.has(x.run_id)),[r,i]);return r.length===0?p.jsx(uv,{headline:"No runs yet",body:"Run an evaluation to populate the per-run view."}):u&&g.length>=2?p.jsx(lte,{runs:g,onBack:()=>c(!1)}):p.jsxs("div",{className:"space-y-3",children:[p.jsx("div",{className:"flex items-center justify-between text-sm text-gray-400",children:p.jsxs("span",{children:[p.jsx("span",{className:"font-medium text-gray-300",children:r.length})," run",r.length===1?"":"s"," — select two or more to compare side-by-side"]})}),p.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"w-10 px-3 py-3","aria-label":"Select"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Timestamp"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Tags"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Tests"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass rate"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Avg"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:r.map(x=>p.jsx(ite,{run:x,checked:i.has(x.run_id),onToggle:()=>m(x.run_id),editing:d===x.run_id,onStartEdit:()=>h(x.run_id),onEndEdit:()=>h(null),benchmarkId:t,readOnly:n},x.run_id))})]})}),i.size>0&&p.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:[p.jsxs("div",{className:"text-sm text-gray-300",children:[p.jsx("span",{className:"font-semibold tabular-nums text-cyan-400",children:i.size})," ","selected"]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{type:"button",onClick:v,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200",children:"Clear"}),p.jsxs("button",{type:"button",disabled:i.size<2,onClick:()=>c(!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 ",i.size,p.jsx("span",{"aria-hidden":!0,children:"→"})]})]})]})]})}function ite({run:e,checked:t,onToggle:n,editing:r,onStartEdit:i,onEndEdit:l,benchmarkId:u,readOnly:c}){const d=Math.round(e.avg_score*100),h=!c&&e.source!=="remote",m=j.useRef(null),v=e.tags??[],g=v[0]??e.run_id,x=hte(e.run_id),S=j.useRef(r);return j.useEffect(()=>{var w;S.current&&!r&&((w=m.current)==null||w.focus()),S.current=r},[r]),p.jsxs(p.Fragment,{children:[p.jsxs("tr",{className:`transition-colors ${t?"bg-cyan-950/20 hover:bg-cyan-950/30":"hover:bg-gray-900/30"}`,children:[p.jsx("td",{className:"px-3 py-3 align-middle",children:p.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:n,"aria-label":`Select run ${g}`})}),p.jsxs("td",{className:"px-4 py-3 align-middle",title:e.run_id,children:[p.jsx("div",{className:"font-medium text-gray-200 tabular-nums",children:f3(e.started_at)}),x&&p.jsx("div",{className:"text-xs text-gray-500",children:x})]}),p.jsx("td",{className:"px-4 py-3 align-middle",children:h?p.jsx("button",{ref:m,type:"button",onClick:w=>{w.stopPropagation(),i()},className:v.length>0?"inline-flex flex-wrap items-center gap-1 rounded-md px-1 py-0.5 transition-colors hover:bg-gray-800/60":"rounded-md border border-dashed border-gray-700 px-2 py-0.5 text-xs text-gray-500 transition-colors hover:border-cyan-800 hover:text-cyan-400","aria-label":v.length>0?"Edit tags":"Add tags",children:v.length>0?v.map(w=>p.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/30 px-2 py-0.5 text-xs font-medium text-cyan-300",children:w},w)):p.jsx(p.Fragment,{children:"+ tags"})}):v.length>0?p.jsx("div",{className:"inline-flex flex-wrap items-center gap-1",children:v.map(w=>p.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/30 px-2 py-0.5 text-xs font-medium text-cyan-300",children:w},w))}):p.jsx("span",{className:"text-gray-600",children:"—"})}),p.jsx("td",{className:"px-4 py-3 align-middle text-gray-300",children:e.experiment}),p.jsx("td",{className:"px-4 py-3 align-middle text-gray-300",children:e.target}),p.jsx("td",{className:"px-4 py-3 align-middle text-right tabular-nums text-gray-400",children:e.eval_count}),p.jsx("td",{className:"px-4 py-3 align-middle",children:p.jsx(qa,{rate:e.pass_rate})}),p.jsxs("td",{className:"px-4 py-3 align-middle text-right tabular-nums text-gray-400",children:[d,"%"]})]}),r&&p.jsx("tr",{className:"bg-gray-950/80",children:p.jsx("td",{colSpan:8,className:"px-4 py-3",children:p.jsx(ste,{runId:e.run_id,currentTags:v,benchmarkId:u,onClose:l})})})]})}function ste({runId:e,currentTags:t,benchmarkId:n,onClose:r}){const[i,l]=j.useState(t),[u,c]=j.useState(""),[d,h]=j.useState(null),m=Ha(),v=j.useRef(null);j.useEffect(()=>{var A;(A=v.current)==null||A.focus()},[]);const g=I0({mutationFn:()=>vB(e,i,n),onSuccess:()=>{m.invalidateQueries({queryKey:["compare"]}),m.invalidateQueries({queryKey:["runs"]}),n&&(m.invalidateQueries({queryKey:["benchmarks",n,"compare"]}),m.invalidateQueries({queryKey:["benchmarks",n,"runs"]})),r()},onError:A=>h(A.message)}),x=I0({mutationFn:()=>pB(e,n),onSuccess:()=>{m.invalidateQueries({queryKey:["compare"]}),m.invalidateQueries({queryKey:["runs"]}),n&&(m.invalidateQueries({queryKey:["benchmarks",n,"compare"]}),m.invalidateQueries({queryKey:["benchmarks",n,"runs"]})),r()},onError:A=>h(A.message)}),S=g.isPending||x.isPending,w=i.length!==t.length||i.some((A,T)=>A!==t[T]),O=()=>{const A=u.trim();if(A!==""){if(i.includes(A)){c("");return}l([...i,A]),c(""),h(null)}},_=A=>{l(i.filter(T=>T!==A))};return p.jsxs("div",{className:"space-y-2 rounded-md border border-gray-800 bg-gray-900/60 p-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-gray-400",children:"Tag run"}),p.jsx("span",{className:"text-xs text-gray-500",children:"Multi-valued. Enter or comma adds; Backspace removes the last chip."})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-md border border-gray-700 bg-gray-950 px-2 py-1.5 focus-within:border-cyan-500 focus-within:ring-1 focus-within:ring-cyan-500",children:[i.map(A=>p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-cyan-900/60 bg-cyan-950/30 px-2 py-0.5 text-xs font-medium text-cyan-300",children:[A,p.jsx("button",{type:"button",onClick:()=>_(A),disabled:S,className:"text-cyan-500 transition-colors hover:text-cyan-200 disabled:opacity-50","aria-label":`Remove tag ${A}`,children:"×"})]},A)),p.jsx("input",{ref:v,type:"text",className:"flex-1 min-w-[140px] bg-transparent text-sm text-gray-100 placeholder:text-gray-600 focus:outline-none disabled:opacity-50",placeholder:i.length===0?"e.g. baseline, v2-prompt, slow":"Add tag…",value:u,onChange:A=>{h(null),c(A.target.value)},maxLength:60,disabled:S,onKeyDown:A=>{A.key==="Enter"||A.key===","?(A.preventDefault(),O()):A.key==="Backspace"&&u===""&&i.length>0?(A.preventDefault(),l(i.slice(0,-1))):A.key==="Escape"&&r()},onBlur:O})]}),p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[p.jsx("button",{type:"button",onClick:r,disabled:S,className:"rounded-md px-3 py-1.5 text-sm text-gray-400 transition-colors hover:text-gray-200 disabled:opacity-50",children:"Cancel"}),t.length>0&&p.jsx("button",{type:"button",onClick:()=>{S||x.mutate()},disabled:S,className:"rounded-md border border-red-900/60 px-3 py-1.5 text-sm text-red-400 transition-colors hover:border-red-800 hover:bg-red-950/30 hover:text-red-300 disabled:opacity-50",children:"Clear all"}),p.jsx("button",{type:"button",disabled:!w||S,onClick:()=>{S||!w||g.mutate()},className:"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:g.isPending?"Saving…":"Save"})]}),d&&p.jsx("div",{className:"rounded-md border border-red-900/60 bg-red-950/30 px-3 py-1.5 text-xs text-red-400",children:d})]})}function lte({runs:e,onBack:t}){const n=j.useMemo(()=>{const i=new Set,l=[];for(const u of e)for(const c of u.tests)i.has(c.test_id)||(i.add(c.test_id),l.push(c.test_id));return l},[e]),r=j.useMemo(()=>e.map(i=>{const l=new Map;for(const u of i.tests)l.set(u.test_id,u);return l}),[e]);return p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.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:[p.jsx("span",{"aria-hidden":!0,children:"←"})," Back to runs"]}),p.jsxs("span",{className:"text-sm text-gray-500",children:[e.length," runs · ",n.length," tests"]})]}),p.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsxs("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:[p.jsxs("tr",{children:[p.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=>p.jsx("th",{className:"px-4 py-3 align-bottom",children:p.jsx(ote,{run:i})},i.run_id))]}),p.jsxs("tr",{className:"border-t border-gray-800/50 bg-gray-900/30",children:[p.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=>p.jsx("th",{className:"px-4 py-2",children:p.jsx(qa,{rate:i.pass_rate})},i.run_id))]})]}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(i=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.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}),r.map((l,u)=>{const c=l.get(i),d=e[u].run_id;return c?p.jsx("td",{className:"px-4 py-3",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full ${c.passed?"bg-emerald-400":"bg-red-400"}`}),p.jsxs("span",{className:`tabular-nums ${c.passed?"text-emerald-400":"text-red-400"}`,children:[Math.round(c.score*100),"%"]})]})},d):p.jsx("td",{className:"px-4 py-3 text-center text-gray-600",children:"—"},d)})]},i))})]})})]})}function ote({run:e}){const t=e.tags??[];return p.jsxs("div",{className:"min-w-[140px] space-y-1",children:[p.jsx("div",{className:"text-sm font-medium text-gray-200 tabular-nums",title:e.run_id,children:f3(e.started_at)}),t.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(n=>p.jsx("span",{className:"rounded-md border border-cyan-900/60 bg-cyan-950/30 px-1.5 py-0.5 text-[0.7rem] font-medium text-cyan-300",children:n},n))}),p.jsxs("div",{className:"text-xs text-gray-500",children:[e.experiment," · ",e.target]})]})}function ute(){return p.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500",role:"note",children:[p.jsx(Xd,{className:"bg-emerald-400",label:"80%+"}),p.jsx(Xd,{className:"bg-yellow-400",label:"50–80%"}),p.jsx(Xd,{className:"bg-red-400",label:"< 50%"}),p.jsx(Xd,{className:"bg-gray-700",label:"no data"})]})}function Xd({className:e,label:t}){return p.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[p.jsx("span",{className:`h-2 w-2 rounded-full ${e}`,"aria-hidden":!0}),p.jsx("span",{children:t})]})}function cte({message:e}){return p.jsx("div",{className:"rounded-lg border border-red-900/60 bg-red-950/30 p-4 text-sm text-red-400",children:e})}function fte(){return p.jsx(uv,{headline:"No comparison data yet",body:"Run evaluations with different experiment and target combinations to populate this view."})}function uv({headline:e,body:t,action:n}){return p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[p.jsx("p",{className:"text-lg text-gray-300",children:e}),p.jsx("p",{className:"mt-2 text-sm text-gray-500",children:t}),n&&p.jsx("button",{type:"button",onClick:n.onClick,className:"mt-4 inline-flex items-center rounded-md bg-cyan-500 px-3 py-1.5 text-sm font-medium text-gray-950 transition-colors hover:bg-cyan-400",children:n.label})]})}function dte(){return p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("div",{className:"animate-pulse",children:[p.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>p.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[p.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},e))]})})}function f3(e){try{const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),l=String(t.getHours()).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0");return`${n}-${r}-${i} ${l}:${u}`}catch{return e}}function hte(e){const t=e.split("::");return t.length<2?null:t.slice(0,-1).join(" · ")}function mte(){const{data:e,isLoading:t}=ex();if(t)return p.jsx(vte,{});const n=(e==null?void 0:e.experiments)??[];return n.length===0?p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[p.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"}),p.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Experiments will appear here once evaluations are run with experiment labels."})]}):p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Targets"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Last Run"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(r=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3",children:p.jsx(Ie,{to:"/experiments/$experimentName",params:{experimentName:r.name},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:r.name})}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.run_count}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.target_count}),p.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[p.jsx("span",{className:"text-emerald-400",children:r.passed_count}),p.jsx("span",{className:"text-gray-600",children:" / "}),r.eval_count]}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(qa,{rate:r.pass_rate})}),p.jsx("td",{className:"px-4 py-3 text-gray-400",title:TP(r.last_run).full,children:TP(r.last_run).date})]},r.name))})]})})}function TP(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 n=t.toLocaleString(),r=Date.now()-t.getTime(),i=Math.floor(r/6e4),l=Math.floor(r/36e5);let u;return i<1?u="just now":i<60?u=`${i} min ago`:l<24?u=`${l} hour${l===1?"":"s"} ago`:u=t.toLocaleDateString(),{date:u,full:n}}catch{return{date:"N/A",full:"N/A"}}}function vte(){return p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("div",{className:"animate-pulse",children:[p.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>p.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[p.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},e))]})})}function pte(e){if(!e)return"No runs";const t=new Date(e);if(Number.isNaN(t.getTime()))return"N/A";const n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return"Just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function yte({project:e}){const t=Math.round(e.pass_rate*100);return p.jsxs(Ie,{to:"/projects/$benchmarkId",params:{benchmarkId:e.id},className:"group block rounded-lg border border-gray-800 bg-gray-900/50 p-5 transition-colors hover:border-cyan-800 hover:bg-gray-900",children:[p.jsx("div",{className:"flex items-start justify-between",children:p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("h3",{className:"truncate text-lg font-semibold text-white group-hover:text-cyan-400",children:e.name}),p.jsx("p",{className:"mt-1 truncate text-xs text-gray-500",children:e.path})]})}),p.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-3",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-gray-500",children:"Runs"}),p.jsx("p",{className:"text-lg font-semibold text-white",children:e.run_count})]}),p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-gray-500",children:"Pass Rate"}),p.jsx("p",{className:`text-lg font-semibold ${e.run_count===0?"text-gray-500":t>=80?"text-emerald-400":t>=50?"text-yellow-400":"text-red-400"}`,children:e.run_count>0?`${t}%`:"--"})]}),p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-gray-500",children:"Last Run"}),p.jsx("p",{className:"text-sm text-gray-300",children:pte(e.last_run)})]})]})]})}function cl({open:e,onClose:t,benchmarkId:n,prefill:r}){const i=Ha(),l=qc(),[u,c]=j.useState((r==null?void 0:r.suiteFilter)??""),[d,h]=j.useState(""),[m,v]=j.useState((r==null?void 0:r.testIds)??[]),[g,x]=j.useState((r==null?void 0:r.target)??""),[S,w]=j.useState(""),[O,_]=j.useState(""),[A,T]=j.useState(!1),[N,C]=j.useState(!1),[M,R]=j.useState(null),[z,B]=j.useState(null),[D,H]=j.useState(!1),[q,ae]=j.useState(null),{data:te}=bB(n),{data:re}=SB(n),{data:U}=UC(M),V=j.useMemo(()=>(te==null?void 0:te.eval_files)??[],[te]),ie=j.useMemo(()=>(re==null?void 0:re.targets)??[],[re]);j.useEffect(()=>{e&&(c((r==null?void 0:r.suiteFilter)??""),v((r==null?void 0:r.testIds)??[]),x((r==null?void 0:r.target)??""),h(""),w(""),_(""),T(!1),C(!1),R(null),B(null),H(!1),ae(null))},[e,r]),j.useEffect(()=>{((U==null?void 0:U.status)==="finished"||(U==null?void 0:U.status)==="failed")&&(i.invalidateQueries({queryKey:["runs"]}),i.invalidateQueries({queryKey:["projects"]}))},[U==null?void 0:U.status,i]);const oe=j.useCallback(()=>{const X={};return u.trim()&&(X.suite_filter=u.trim()),m.length>0&&(X.test_ids=m),g&&(X.target=g),S&&(X.threshold=Number.parseFloat(S)),O&&(X.workers=Number.parseInt(O,10)),A&&(X.dry_run=!0),X},[u,m,g,S,O,A]);j.useEffect(()=>{const X=oe();if(!X.suite_filter&&(!X.test_ids||X.test_ids.length===0)){ae(null);return}_B(X,n).then(ve=>ae(ve.command)).catch(()=>ae(null))},[oe,n]);function ce(){const X=d.trim();X&&!m.includes(X)&&v([...m,X]),h("")}function I(X){v(m.filter(ve=>ve!==X))}async function Z(){B(null),H(!0);try{const X=oe(),ve=await wB(X,n);R(ve.id)}catch(X){B(X.message)}finally{H(!1)}}if(!e)return null;if(M&&U){let X=function(){t(),l({to:"/",search:{tab:"runs"}})};return p.jsx(PP,{onClose:t,title:"Eval Run",children:p.jsx(gte,{status:U,onClose:t,onRunInBackground:X,runId:M})})}const se=!!(u.trim()||m.length>0);return p.jsx(PP,{onClose:t,title:"Run Eval",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"suite-filter",className:"mb-1 block text-sm font-medium text-gray-300",children:"Suite Filter"}),p.jsx("input",{id:"suite-filter",type:"text",value:u,onChange:X=>c(X.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"}),V.length>0&&!u&&p.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[V.slice(0,5).map(X=>p.jsx("button",{type:"button",onClick:()=>c(ve=>ve?`${ve}, ${X.relative_path}`:X.relative_path),className:"rounded bg-gray-800 px-2 py-0.5 text-xs text-gray-400 hover:bg-gray-700 hover:text-gray-200",children:X.relative_path},X.relative_path)),V.length>5&&p.jsxs("span",{className:"px-1 text-xs text-gray-500",children:["+",V.length-5," more"]})]})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"test-id-input",className:"mb-1 block text-sm font-medium text-gray-300",children:"Test ID Filter"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{id:"test-id-input",type:"text",value:d,onChange:X=>h(X.target.value),onKeyDown:X=>{X.key==="Enter"&&(X.preventDefault(),ce())},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"}),p.jsx("button",{type:"button",onClick:ce,disabled:!d.trim(),className:"rounded-md bg-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-600 disabled:opacity-50",children:"Add"})]}),m.length>0&&p.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:m.map(X=>p.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:[X,p.jsx("button",{type:"button",onClick:()=>I(X),className:"text-cyan-400 hover:text-white",children:"×"})]},X))})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"target-override",className:"mb-1 block text-sm font-medium text-gray-300",children:"Target Override"}),p.jsxs("select",{id:"target-override",value:g,onChange:X=>x(X.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:[p.jsx("option",{value:"",children:"Use eval's configured target"}),ie.map(X=>p.jsx("option",{value:X,children:X},X))]})]}),p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>C(!N),className:"text-sm text-gray-400 hover:text-gray-200",children:[N?"▾":"▸"," Advanced Options"]}),N&&p.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-3",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"threshold-input",className:"mb-1 block text-xs text-gray-400",children:"Threshold (0–1)"}),p.jsx("input",{id:"threshold-input",type:"number",value:S,onChange:X=>w(X.target.value),min:"0",max:"1",step:"0.1",placeholder:"0.8",className:"w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"workers-input",className:"mb-1 block text-xs text-gray-400",children:"Workers"}),p.jsx("input",{id:"workers-input",type:"number",value:O,onChange:X=>_(X.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"})]}),p.jsx("div",{className:"col-span-2",children:p.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-400",children:[p.jsx("input",{type:"checkbox",checked:A,onChange:X=>T(X.target.checked),className:"rounded border-gray-600 bg-gray-800"}),"Dry run (mock provider responses)"]})})]})]}),q&&p.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:[p.jsx("div",{className:"mb-1 text-xs text-gray-500",children:"CLI Preview"}),p.jsx("code",{className:"block break-all text-xs text-cyan-300",children:q})]}),z&&p.jsx("div",{className:"rounded-md border border-red-900/50 bg-red-950/20 p-2 text-sm text-red-400",children:z}),p.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[p.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"}),p.jsx("button",{type:"button",onClick:Z,disabled:!se||D,className:"rounded-md bg-cyan-600 px-4 py-2 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:D?"Launching…":"Run Now"})]})]})})}function PP({children:e,onClose:t,title:n}){return p.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/60 pt-[10vh]",children:p.jsxs("div",{className:"w-full max-w-lg rounded-lg border border-gray-700 bg-gray-900 shadow-xl",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-gray-800 px-5 py-3",children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:n}),p.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-white",children:"✕"})]}),p.jsx("div",{className:"px-5 py-4",children:e})]})})}function gte({status:e,onClose:t,onRunInBackground:n,runId:r}){const i=e.status==="finished"||e.status==="failed",l={starting:"text-yellow-400",running:"text-cyan-400",finished:"text-emerald-400",failed:"text-red-400"};return p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("span",{className:`text-sm font-medium ${l[e.status]??"text-gray-400"}`,children:[e.status==="running"&&"●"," ",e.status.charAt(0).toUpperCase()+e.status.slice(1)]}),!i&&p.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent"})]}),p.jsx("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-3",children:p.jsx("code",{className:"block break-all text-xs text-cyan-300",children:e.command})}),e.stdout&&p.jsx("div",{className:"max-h-48 overflow-y-auto rounded-md bg-gray-950 p-3",children:p.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-300",children:e.stdout.slice(-3e3)})}),e.stderr&&p.jsx("div",{className:"max-h-24 overflow-y-auto rounded-md bg-red-950/20 p-3",children:p.jsx("pre",{className:"whitespace-pre-wrap text-xs text-red-300",children:e.stderr.slice(-2e3)})}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-xs text-gray-500",children:i?p.jsxs(p.Fragment,{children:["Exit code: ",e.exit_code,e.finished_at&&` · ${new Date(e.finished_at).toLocaleTimeString()}`]}):r&&p.jsx("button",{type:"button",onClick:n,className:"text-xs text-gray-400 hover:text-cyan-400",children:"Run in background"})}),i&&p.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 bte(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 n=t.toLocaleString(),r=Date.now()-t.getTime(),i=Math.floor(r/6e4),l=Math.floor(r/36e5);let u;return i<1?u="just now":i<60?u=`${i} min ago`:l<24?u=`${l} hour${l===1?"":"s"} ago`:u=t.toLocaleDateString(),{date:u,full:n}}catch{return{date:"N/A",full:"N/A"}}}function xte(e){const t=[e.target,e.experiment].filter(n=>n&&n!=="default"&&n!=="-");return t.length>0?t.join(" · "):e.target?e.target:e.display_name??e.filename}function q1({runs:e,benchmarkId:t,emptyMessage:n}){const{data:r}=rn(),i=(r==null?void 0:r.threshold)??vh;return e.length===0?p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:n??p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-lg text-gray-400",children:"No evaluation runs found."}),p.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Run an evaluation first:"," ",p.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"agentv eval <eval-file>"})]})]})}):p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"w-8 px-4 py-3"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Run"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Passed"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Failed"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Total"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"When"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:e.map(l=>{const u=bte(l.timestamp),c=l.pass_rate>=i,d=xte(l),h=Math.round(l.pass_rate*l.test_count),m=l.test_count-h;return p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 text-center",children:p.jsx("span",{className:`text-base font-bold ${c?"text-emerald-400":"text-red-400"}`,children:c?"✓":"✗"})}),p.jsx("td",{className:"px-4 py-3",children:t?p.jsx(Ie,{to:"/projects/$benchmarkId/runs/$runId",params:{benchmarkId:t,runId:l.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:d}):p.jsx(Ie,{to:"/runs/$runId",params:{runId:l.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:d})}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-emerald-300",children:h}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-red-400",children:m>0?m:p.jsx("span",{className:"text-gray-600",children:"0"})}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:l.test_count}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(qa,{rate:l.pass_rate})}),p.jsx("td",{className:"px-4 py-3 text-gray-400",title:u.full,children:u.date})]},l.filename)})})]})})}function Ste(e){if(!e)return"Never synced";const t=new Date(e);return Number.isNaN(t.getTime())?"Never synced":`Last synced ${t.toLocaleString()}`}function d3({filter:e,onFilterChange:t,remoteStatus:n,syncInFlight:r,onSync:i}){const l=(n==null?void 0:n.configured)===!0,u=l&&(n==null?void 0:n.available)!==!0;return p.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-4",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[p.jsx("div",{className:"flex flex-wrap items-center gap-2",children:["all","local","remote"].map(c=>{const d=c==="remote"&&!l;return p.jsx("button",{type:"button",onClick:()=>t(c),title:d?"Remote results are not configured":void 0,className:`rounded-full px-3 py-1 text-sm font-medium transition-colors ${e===c?"bg-cyan-500/20 text-cyan-300":d?"bg-gray-800 text-gray-600":"bg-gray-800 text-gray-400 hover:text-gray-200"}`,children:c==="all"?"All Sources":c==="local"?"Local Only":"Remote Only"},c)})}),l&&i?p.jsx("button",{type:"button",onClick:i,disabled:r,className:"rounded-md border border-cyan-800 bg-cyan-950/40 px-3 py-1.5 text-sm font-medium text-cyan-300 transition-colors hover:bg-cyan-900/50 disabled:cursor-not-allowed disabled:opacity-60",children:r?"Syncing…":"Sync Remote Results"}):null]}),l?p.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-gray-400",children:[p.jsx("span",{children:Ste(n==null?void 0:n.last_synced_at)}),n!=null&&n.repo?p.jsxs("span",{children:["Repo: ",n.repo]}):null,u?p.jsx("span",{className:"text-yellow-400",children:"Remote cache unavailable"}):null]}):e==="all"?p.jsxs("p",{className:"text-sm text-gray-500",children:["Remote results are not configured. Add"," ",p.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:"results.export"})," to"," ",p.jsx("code",{className:"rounded bg-gray-800 px-1 text-gray-400",children:".agentv/config.yaml"})," to enable."]}):null,n!=null&&n.last_error?p.jsx("div",{className:"rounded-md border border-yellow-900/50 bg-yellow-950/20 px-3 py-2 text-sm text-yellow-300",children:n.last_error}):null]})}function wte(){const{data:e,isLoading:t}=tB();if(t)return p.jsx(jte,{});const n=(e==null?void 0:e.targets)??[];return n.length===0?p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[p.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"}),p.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Targets will appear here once evaluations are run with target labels."})]}):p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Experiments"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(r=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:r.name}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.run_count}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:r.experiment_count}),p.jsx("td",{className:"px-4 py-3",children:p.jsx(qa,{rate:r.pass_rate})}),p.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[p.jsx("span",{className:"text-emerald-400",children:r.passed_count}),p.jsx("span",{className:"text-gray-600",children:"/"}),p.jsx("span",{children:r.eval_count})]})]},r.name))})]})})}function jte(){return p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("div",{className:"animate-pulse",children:[p.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(e=>p.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[p.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),p.jsx("div",{className:"h-4 w-20 rounded bg-gray-800"})]},e))]})})}const CP=[{id:"runs",label:"🏃 Recent Runs"},{id:"experiments",label:"🧪 Experiments"},{id:"analytics",label:"📊 Analytics"},{id:"targets",label:"🤖 Targets"}],Ote=Rr("/")({component:_te});function _te(){const{data:e,isLoading:t}=tx(),{data:n,isLoading:r}=rn(),i=((e==null?void 0:e.projects.length)??0)>0,l=n==null?void 0:n.multi_project_dashboard;return t||r?p.jsx(h3,{}):l===!0||l===void 0&&i?p.jsx(Ete,{}):p.jsx(Ate,{})}function Ete(){const{data:e}=tx(),{data:t}=rn(),n=Ha(),[r,i]=j.useState(""),[l,u]=j.useState(""),[c,d]=j.useState(null),[h,m]=j.useState(!1),[v,g]=j.useState(!1),x=(e==null?void 0:e.projects)??[],S=(t==null?void 0:t.read_only)===!0;async function w(_){if(_.preventDefault(),!!r.trim()){d(null);try{await lB(r.trim()),i(""),m(!1),n.invalidateQueries({queryKey:["benchmarks"]})}catch(A){d(A.message)}}}async function O(_){if(_.preventDefault(),!!l.trim()){d(null);try{const A=await oB(l.trim());u(""),A.length===0&&d("No projects with .agentv/ found in that directory."),n.invalidateQueries({queryKey:["benchmarks"]})}catch(A){d(A.message)}}}return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Benchmarks"}),p.jsx("div",{className:"flex gap-2",children:!S&&p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button",onClick:()=>g(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"}),p.jsx("button",{type:"button",onClick:()=>m(!h),className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:h?"Cancel":"Add Benchmark"})]})})]}),c&&p.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-3 text-sm text-red-400",children:c}),!S&&h&&p.jsxs("div",{className:"space-y-3 rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[p.jsxs("form",{onSubmit:w,className:"flex gap-2",children:[p.jsx("input",{type:"text",value:r,onChange:_=>i(_.target.value),placeholder:"Benchmark path (e.g., /home/user/projects/my-evals)",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),p.jsx("button",{type:"submit",className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:"Add"})]}),p.jsxs("form",{onSubmit:O,className:"flex gap-2",children:[p.jsx("input",{type:"text",value:l,onChange:_=>u(_.target.value),placeholder:"Discover benchmarks in directory...",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),p.jsx("button",{type:"submit",className:"rounded-md bg-gray-700 px-3 py-1.5 text-sm font-medium text-white hover:bg-gray-600",children:"Discover"})]})]}),p.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:x.map(_=>p.jsx(yte,{project:_},_.id))}),!S&&p.jsx(cl,{open:v,onClose:()=>g(!1)})]})}function Ate(){const n=RC().location.search.tab,r=qc(),i=Ha(),{data:l,isLoading:u,error:c}=Jb(),{data:d}=LC(),{data:h}=rn(),[m,v]=j.useState(!1),[g,x]=j.useState("all"),[S,w]=j.useState(!1),O=(h==null?void 0:h.read_only)===!0,_=CP.some(N=>N.id===n)?n:"experiments",A=g==="all"?(l==null?void 0:l.runs)??[]:((l==null?void 0:l.runs)??[]).filter(N=>N.source===g);async function T(){w(!0);try{await $C(),await Promise.all([i.invalidateQueries({queryKey:["runs"]}),i.invalidateQueries({queryKey:["experiments"]}),i.invalidateQueries({queryKey:["compare"]}),i.invalidateQueries({queryKey:["targets"]}),i.invalidateQueries({queryKey:["remote-status",""]})])}finally{w(!1)}}return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Evaluation Runs"}),(h==null?void 0:h.project_name)&&p.jsx("p",{className:"mt-0.5 text-sm text-gray-500",children:h.project_name})]}),!O&&p.jsx("button",{type:"button",onClick:()=>v(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"})]}),p.jsx("div",{className:"border-b border-gray-800",children:p.jsx("div",{className:"flex gap-1",children:CP.map(N=>p.jsx("button",{type:"button",onClick:()=>r({to:"/",search:{tab:N.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${_===N.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:N.label},N.id))})}),_==="runs"&&p.jsx(Tte,{runs:A,isLoading:u,error:c,sourceFilter:g,onSourceFilterChange:x,remoteStatus:d,syncInFlight:S,onSyncRemote:T}),_==="experiments"&&p.jsx(mte,{}),_==="analytics"&&p.jsx(Nte,{readOnly:O}),_==="targets"&&p.jsx(wte,{}),!O&&p.jsx(cl,{open:m,onClose:()=>v(!1)})]})}function Nte({readOnly:e}){const{data:t,isLoading:n,isError:r,error:i}=eB();return p.jsx(c3,{data:t,isLoading:n,isError:r,error:i,readOnly:e})}function Tte({runs:e,isLoading:t,error:n,sourceFilter:r,onSourceFilterChange:i,remoteStatus:l,syncInFlight:u,onSyncRemote:c}){return t?p.jsx(h3,{}):n?p.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",n.message]}):p.jsxs("div",{className:"space-y-4",children:[p.jsx(Pte,{}),p.jsx(d3,{filter:r,onFilterChange:i,remoteStatus:l,syncInFlight:u,onSync:c}),p.jsx(q1,{runs:e,emptyMessage:r==="remote"?l!=null&&l.configured?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-lg text-gray-400",children:"No remote runs found."}),p.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Sync remote results or run an eval with"," ",p.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"auto_push: true"})," ","in your config."]})]}):p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-lg text-gray-400",children:"Remote results are not configured."}),p.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Add"," ",p.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"results.export"})," ","to"," ",p.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:".agentv/config.yaml"})," ","to enable remote result syncing."]})]}):void 0})]})}function Pte(){const{data:e}=qC(),t=((e==null?void 0:e.runs)??[]).filter(n=>n.status==="starting"||n.status==="running");return t.length===0?null:p.jsxs("div",{className:"rounded-lg border border-cyan-900/40 bg-cyan-950/10",children:[p.jsx("div",{className:"border-b border-cyan-900/30 px-4 py-2.5",children:p.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-cyan-400",children:"Active"})}),p.jsx("ul",{className:"divide-y divide-gray-800/50",children:t.map(n=>p.jsxs("li",{className:"flex items-center justify-between px-4 py-3",children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[p.jsx("span",{className:"inline-block h-2 w-2 flex-shrink-0 animate-pulse rounded-full bg-cyan-400"}),p.jsx("span",{className:"truncate font-mono text-sm text-gray-300",children:n.id}),p.jsx("span",{className:"flex-shrink-0 text-xs text-gray-500",children:new Date(n.started_at).toLocaleTimeString()})]}),p.jsx(Ie,{to:"/jobs/$runId",params:{runId:n.id},className:"ml-4 flex-shrink-0 text-xs text-cyan-400 hover:text-cyan-300",children:"View Log →"})]},n.id))})]})}function h3(){return p.jsx("div",{className:"space-y-2",children:["s1","s2","s3","s4","s5"].map(e=>p.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},e))})}function fm({total:e,passed:t,failed:n,passRate:r,totalCost:i}){const l=Math.round(r*100),u=l>=80?"text-cyan-400":l>=60?"text-amber-400":"text-red-400";return p.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:[p.jsx(lc,{label:"Pass Rate",value:`${l}%`,accent:u,large:!0}),p.jsx("div",{className:"h-6 w-px bg-gray-700"}),p.jsx(lc,{label:"Passed",value:String(t),accent:"text-emerald-400"}),p.jsx(lc,{label:"Failed",value:String(n),accent:"text-red-400"}),p.jsx(lc,{label:"Total",value:String(e)}),i!==void 0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"h-6 w-px bg-gray-700"}),p.jsx(lc,{label:"Cost",value:`$${i.toFixed(4)}`,accent:"text-amber-400"})]})]})}function lc({label:e,value:t,accent:n,large:r}){return p.jsxs("div",{className:"flex flex-col",children:[p.jsx("span",{className:"text-xs text-gray-500",children:e}),p.jsx("span",{className:`tabular-nums font-semibold ${r?"text-2xl":"text-lg"} ${n??"text-white"}`,children:t})]})}function Cte(e,t){const n=new Map;for(const r of e){const i=r.category??"Uncategorized",l=r.suite??"Uncategorized";n.has(i)||n.set(i,new Map);const u=n.get(i),c=u.get(l)??{passed:0,failed:0,total:0,scoreSum:0};c.total+=1,c.scoreSum+=r.score,La(r.score,t)?c.passed+=1:c.failed+=1,u.set(l,c)}return Array.from(n.entries()).map(([r,i])=>{const l=Array.from(i.entries()).map(([m,v])=>({name:m,...v,avgScore:v.total>0?v.scoreSum/v.total:0})).sort((m,v)=>m.name.localeCompare(v.name)),u=l.reduce((m,v)=>m+v.total,0),c=l.reduce((m,v)=>m+v.passed,0),d=l.reduce((m,v)=>m+v.failed,0),h=l.reduce((m,v)=>m+v.avgScore*v.total,0);return{name:r,suites:l,total:u,passed:c,failed:d,avgScore:u>0?h/u:0}}).sort((r,i)=>r.name.localeCompare(i.name))}function m3({results:e,runId:t,benchmarkId:n}){const{data:r}=rn(),i=(r==null?void 0:r.threshold)??(r==null?void 0:r.pass_threshold)??.8,l=e.length,u=e.filter(v=>La(v.score,i)).length,c=l-u,d=l>0?u/l:0,h=e.reduce((v,g)=>v+(g.costUsd??0),0),m=Cte(e,i);return l===0?p.jsxs("div",{className:"space-y-6",children:[p.jsx(fm,{total:0,passed:0,failed:0,passRate:0}),p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[p.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations found"}),p.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This run has no results yet."})]})]}):p.jsxs("div",{className:"space-y-6",children:[p.jsx(fm,{total:l,passed:u,failed:c,passRate:d,totalCost:h>0?h:void 0}),p.jsxs("div",{children:[p.jsx("h3",{className:"mb-3 text-sm font-medium text-gray-400",children:"Category Breakdown"}),p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Category"}),p.jsx("th",{className:"px-4 py-2.5 font-medium text-gray-400",children:"Pass Rate"}),p.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Passed"}),p.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Failed"}),p.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-gray-400",children:"Total"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:m.map(v=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-2.5 font-medium text-gray-200",children:v.name}),p.jsx("td",{className:"px-4 py-2.5",children:p.jsx(qa,{rate:v.total>0?v.passed/v.total:0})}),p.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-emerald-400",children:v.passed}),p.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-red-400",children:v.failed>0?v.failed:p.jsx("span",{className:"text-gray-600",children:"0"})}),p.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-gray-400",children:v.total})]},v.name))})]})})]}),p.jsxs("div",{children:[p.jsx("h3",{className:"mb-3 text-sm font-medium text-gray-400",children:"All Evals"}),p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"w-8 px-4 py-3"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),p.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:e.map((v,g)=>{const x=v.executionStatus==="execution_error",S=La(v.score,i);return p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3 text-center",children:x?p.jsx("span",{className:"text-base font-bold text-red-400",children:"!"}):p.jsx("span",{className:`text-base font-bold ${S?"text-emerald-400":"text-red-400"}`,children:S?"✓":"✗"})}),p.jsx("td",{className:"px-4 py-3",children:n?p.jsx(Ie,{to:"/projects/$benchmarkId/evals/$runId/$evalId",params:{benchmarkId:n,runId:t,evalId:v.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:v.testId}):p.jsx(Ie,{to:"/evals/$runId/$evalId",params:{runId:t,evalId:v.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:v.testId})}),p.jsx("td",{className:"px-4 py-3 text-gray-400",children:v.target??"-"}),p.jsx("td",{className:"px-4 py-3",children:x?p.jsx("span",{className:"inline-flex rounded-full bg-red-900/50 px-2 py-0.5 text-xs font-medium text-red-400",children:"ERR"}):p.jsx(qa,{rate:v.score})}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:v.durationMs!=null?`${(v.durationMs/1e3).toFixed(1)}s`:"-"}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:v.costUsd!=null?`$${v.costUsd.toFixed(4)}`:"-"})]},`${v.testId}-${g}`)})})]})})]})]})}const v3=Rr("/runs/$runId")({component:Mte});function Mte(){var w;const{runId:e}=v3.useParams(),{data:t,isLoading:n,error:r}=Hc(e),{data:i}=rn(),[l,u]=j.useState(!1),c=(i==null?void 0:i.read_only)===!0;if(n)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(O=>p.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},O))})]});if(r)return p.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",r.message]});const d=(w=t==null?void 0:t.results)==null?void 0:w[0],h=d==null?void 0:d.target,m=d==null?void 0:d.experiment,v=d==null?void 0:d.timestamp,g=h?{target:h}:void 0,x=(()=>{const O=[m,h].filter(_=>_&&_!=="default");return O.length>0?O.join(" · "):e})(),S=[h,m&&m!=="default"?m:null,v?new Date(v).toLocaleString():null,t==null?void 0:t.source].filter(Boolean).join(" · ");return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:x}),p.jsx("p",{className:"mt-1 text-sm text-gray-500",children:S})]}),!c&&p.jsx("button",{type:"button",onClick:()=>u(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Re-run with Filters"})]}),p.jsx(m3,{results:(t==null?void 0:t.results)??[],runId:e}),!c&&p.jsx(cl,{open:l,onClose:()=>u(!1),prefill:g})]})}const MP=[{id:"runs",label:"Recent Runs"},{id:"experiments",label:"Experiments"},{id:"analytics",label:"Analytics"},{id:"targets",label:"Targets"}],p3=Rr("/projects/$benchmarkId")({component:Rte});function Rte(){const{benchmarkId:e}=p3.useParams(),r=RC().location.search.tab,i=qc(),[l,u]=j.useState(!1),{data:c}=rn(),d=(c==null?void 0:c.read_only)===!0,h=MP.some(m=>m.id===r)?r:"experiments";return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:e}),!d&&p.jsx("button",{type:"button",onClick:()=>u(!0),className:"rounded-md bg-emerald-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-emerald-500",children:"▶ Run Eval"})]}),p.jsx("div",{className:"border-b border-gray-800",children:p.jsx("div",{className:"flex gap-1",children:MP.map(m=>p.jsx("button",{type:"button",onClick:()=>i({to:"/projects/$benchmarkId",params:{benchmarkId:e},search:{tab:m.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${h===m.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:m.label},m.id))})}),h==="runs"&&p.jsx(Dte,{benchmarkId:e}),h==="experiments"&&p.jsx(kte,{benchmarkId:e}),h==="analytics"&&p.jsx(Ite,{benchmarkId:e,readOnly:d}),h==="targets"&&p.jsx(Lte,{benchmarkId:e}),!d&&p.jsx(cl,{open:l,onClose:()=>u(!1),benchmarkId:e})]})}function Dte({benchmarkId:e}){const t=Ha(),{data:n,isLoading:r,error:i}=zC(e),{data:l}=LC(e),[u,c]=j.useState("all"),[d,h]=j.useState(!1),m=u==="all"?(n==null?void 0:n.runs)??[]:((n==null?void 0:n.runs)??[]).filter(g=>g.source===u);async function v(){h(!0);try{await $C(e),await Promise.all([t.invalidateQueries({queryKey:["benchmarks",e,"runs"]}),t.invalidateQueries({queryKey:["benchmarks",e,"experiments"]}),t.invalidateQueries({queryKey:["benchmarks",e,"compare"]}),t.invalidateQueries({queryKey:["benchmarks",e,"targets"]}),t.invalidateQueries({queryKey:["remote-status",e]})])}finally{h(!1)}}return r?p.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(g=>p.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},g))}):i?p.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",i.message]}):p.jsxs("div",{className:"space-y-4",children:[p.jsx(d3,{filter:u,onFilterChange:c,remoteStatus:l,syncInFlight:d,onSync:v}),p.jsx(q1,{runs:m,benchmarkId:e})]})}function kte({benchmarkId:e}){const{data:t,isLoading:n}=ot(hB(e)),r=(t==null?void 0:t.experiments)??[];return n?p.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(i=>p.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},i))}):r.length===0?p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:p.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"})}):p.jsx("div",{className:"space-y-2",children:r.map(i=>p.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[p.jsxs("div",{children:[p.jsx("p",{className:"font-medium text-white",children:i.name}),p.jsxs("p",{className:"text-sm text-gray-400",children:[i.run_count," run",i.run_count!==1?"s":""]})]}),p.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(i.pass_rate*100),"%"]})]},i.name))})}function Ite({benchmarkId:e,readOnly:t}){const{data:n,isLoading:r,isError:i,error:l}=ot(BC(e));return p.jsx(c3,{data:n,isLoading:r,isError:i,error:l,benchmarkId:e,readOnly:t})}function Lte({benchmarkId:e}){const{data:t,isLoading:n}=ot(mB(e)),r=(t==null?void 0:t.targets)??[];return n?p.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(i=>p.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},i))}):r.length===0?p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:p.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"})}):p.jsx("div",{className:"space-y-2",children:r.map(i=>p.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[p.jsxs("div",{children:[p.jsx("p",{className:"font-medium text-white",children:i.name}),p.jsxs("p",{className:"text-sm text-gray-400",children:[i.run_count," run",i.run_count!==1?"s":""," · ",i.experiment_count," ","experiment",i.experiment_count!==1?"s":""]})]}),p.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(i.pass_rate*100),"%"]})]},i.name))})}const y3=Rr("/jobs/$runId")({component:zte});function zte(){const{runId:e}=y3.useParams(),{data:t,isLoading:n,error:r}=UC(e);if(n)return p.jsxs("div",{className:"space-y-4",children:[p.jsx(S0,{}),p.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"h-64 animate-pulse rounded-lg bg-gray-900"})]});if(r||!t)return p.jsxs("div",{className:"space-y-4",children:[p.jsx(S0,{}),p.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-4 text-sm text-red-400",children:r?`Failed to load run: ${r.message}`:"Run not found."})]});const i=t.status==="finished"||t.status==="failed",u={starting:"text-yellow-400",running:"text-cyan-400",finished:"text-emerald-400",failed:"text-red-400"}[t.status]??"text-gray-400";return p.jsxs("div",{className:"space-y-4",children:[p.jsx(S0,{}),p.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-4",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("h1",{className:"truncate font-mono text-base font-semibold text-white",children:e}),p.jsxs("p",{className:"mt-0.5 text-xs text-gray-500",children:["Started ",new Date(t.started_at).toLocaleString(),t.finished_at&&p.jsxs(p.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"]})]})]}),p.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2",children:[p.jsx("span",{className:`text-sm font-medium ${u}`,children:t.status.charAt(0).toUpperCase()+t.status.slice(1)}),!i&&p.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-cyan-400 border-t-transparent"})]})]}),p.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 px-4 py-3",children:[p.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Command"}),p.jsx("code",{className:"break-all text-xs text-cyan-300",children:t.command})]}),t.stdout?p.jsxs("div",{children:[p.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Output"}),p.jsx("div",{className:"max-h-[60vh] overflow-y-auto rounded-lg border border-gray-700 bg-gray-950 p-4",children:p.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-gray-200",children:t.stdout})})]}):!i&&p.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[p.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&&p.jsxs("div",{children:[p.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-red-500",children:"Stderr"}),p.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border border-red-900/40 bg-red-950/20 p-4",children:p.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs text-red-300",children:t.stderr})})]}),i&&p.jsxs("p",{className:"text-xs text-gray-500",children:["Exit code:"," ",p.jsx("span",{className:t.exit_code===0?"text-emerald-400":"text-red-400",children:t.exit_code})]})]})}function S0(){return p.jsx(Ie,{to:"/",search:{tab:"runs"},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to Runs"})}const g3=Rr("/experiments/$experimentName")({component:Bte});function Bte(){var v;const{experimentName:e}=g3.useParams(),{data:t,isLoading:n}=ex(),{data:r,isLoading:i}=Jb();if(n||i)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"grid grid-cols-4 gap-4",children:["s1","s2","s3","s4"].map(g=>p.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},g))})]});const u=(v=t==null?void 0:t.experiments)==null?void 0:v.find(g=>g.name===e),c=(r==null?void 0:r.runs)??[],d=(u==null?void 0:u.pass_rate)??0,h=(u==null?void 0:u.run_count)??0,m=(u==null?void 0:u.target_count)??0;return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:e}),p.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[h," run",h!==1?"s":""," · ",m," target",m!==1?"s":"",(u==null?void 0:u.last_run)&&p.jsxs("span",{className:"ml-2",children:["· Last run: ",RP(u.last_run)]})]})]}),u&&p.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-4",children:[p.jsx(Zd,{label:"Runs",value:String(h)}),p.jsx(Zd,{label:"Targets",value:String(m)}),p.jsx(Zd,{label:"Pass Rate",value:`${Math.round(d*100)}%`,accent:"text-cyan-400"}),p.jsx(Zd,{label:"Last Run",value:RP(u.last_run)})]}),p.jsxs("div",{children:[p.jsx("h2",{className:"mb-4 text-lg font-medium text-gray-200",children:"All Runs"}),p.jsx(q1,{runs:c})]})]})}function Zd({label:e,value:t,accent:n}){return p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[p.jsx("p",{className:"text-sm text-gray-400",children:e}),p.jsx("p",{className:`mt-1 text-2xl font-semibold tabular-nums ${n??"text-white"}`,children:t})]})}function RP(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"}}async function $te(e,t){const n=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviews:[{test_id:e,comment:t}]})});if(!n.ok)throw new Error(`Failed to save feedback: ${n.status}`);return n.json()}function Ute({testId:e}){var m;const{data:t}=J5(),n=Ha(),r=(m=t==null?void 0:t.reviews)==null?void 0:m.find(v=>v.test_id===e),[i,l]=j.useState((r==null?void 0:r.comment)??""),[u,c]=j.useState(!1);j.useEffect(()=>{l((r==null?void 0:r.comment)??""),c(!1)},[r==null?void 0:r.comment]);const d=I0({mutationFn:()=>$te(e,i),onSuccess:()=>{n.invalidateQueries({queryKey:["feedback"]}),c(!0),setTimeout(()=>c(!1),2e3)}}),h=j.useCallback(()=>{d.mutate()},[d]);return p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[p.jsx("h4",{className:"mb-2 text-sm font-medium text-gray-400",children:"Feedback"}),p.jsx("textarea",{value:i,onChange:v=>{l(v.target.value),c(!1)},placeholder:"Add feedback for this test...",className:"w-full rounded-md border border-gray-700 bg-gray-800 p-3 text-sm text-gray-200 placeholder-gray-500 focus:border-cyan-400 focus:outline-none",rows:3}),p.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[p.jsx("button",{type:"button",onClick:h,disabled:d.isPending,className:"rounded-md bg-cyan-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:d.isPending?"Saving...":"Save Feedback"}),u&&p.jsx("span",{className:"text-sm text-emerald-400",children:"Saved"}),d.isError&&p.jsx("span",{className:"text-sm text-red-400",children:"Error saving feedback"})]})]})}function qte(e){var n;switch((n=e.split(".").pop())==null?void 0:n.toLowerCase()){case"ts":case"tsx":return"📘";case"json":return"📋";case"log":case"txt":return"📜";case"md":return"📝";default:return"📄"}}function b3(e){const t=[];for(const n of e)n.type==="dir"&&(t.push(n.path),n.children&&t.push(...b3(n.children)));return t}function x3({node:e,selectedPath:t,onSelect:n,openFolders:r,toggleFolder:i,depth:l=0}){const u=e.type==="dir",c=r.has(e.path),d=t===e.path;return p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>{u?i(e.path):n(e.path)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors ${d?"bg-cyan-400/20 text-cyan-400":"text-gray-300 hover:bg-gray-800/50 hover:text-gray-200"}`,style:{paddingLeft:`${l*16+8}px`},children:[p.jsx("span",{className:"flex-shrink-0 text-xs",children:u?c?"📂":"📁":qte(e.name)}),p.jsx("span",{className:"truncate",children:e.name})]}),u&&c&&e.children&&p.jsx("div",{children:e.children.map(h=>p.jsx(x3,{node:h,selectedPath:t,onSelect:n,openFolders:r,toggleFolder:i,depth:l+1},h.path))})]})}function Hte({files:e,selectedPath:t,onSelect:n}){const[r,i]=j.useState(()=>new Set(b3(e))),l=u=>{i(c=>{const d=new Set(c);return d.has(u)?d.delete(u):d.add(u),d})};return p.jsxs("div",{className:"w-64 overflow-y-auto rounded-lg border border-gray-800 bg-gray-900 py-2",children:[e.length===0&&p.jsx("p",{className:"px-4 py-2 text-sm text-gray-500",children:"No files."}),e.map(u=>p.jsx(x3,{node:u,selectedPath:t,onSelect:n,openFolders:r,toggleFolder:l},u.path))]})}const Kte="modulepreload",Fte=function(e){return"/"+e},DP={},Yte=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let u=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=u(n.map(h=>{if(h=Fte(h),h in DP)return;DP[h]=!0;const m=h.endsWith(".css"),v=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${v}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":Kte,m||(g.as="script"),g.crossOrigin="",g.href=h,d&&g.setAttribute("nonce",d),document.head.appendChild(g),m)return new Promise((x,S)=>{g.addEventListener("load",x),g.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(u){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=u,window.dispatchEvent(c),!c.defaultPrevented)throw u}return i.then(u=>{for(const c of u||[])c.status==="rejected"&&l(c.reason);return t().catch(l)})},Gte=j.lazy(()=>Yte(()=>import("./index-KfPHd-QM.js"),[]));function Vte({value:e,language:t="json",height:n="400px"}){return p.jsx(j.Suspense,{fallback:p.jsx("div",{className:"flex items-center justify-center rounded-lg bg-gray-900 p-8 text-gray-500",children:"Loading editor..."}),children:p.jsx(Gte,{height:n,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 Bb({score:e,className:t=""}){const n=Math.round(Math.max(0,Math.min(1,e))*100);return p.jsxs("div",{className:`flex items-center gap-3 ${t}`,children:[p.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-gray-800",children:p.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-cyan-400 to-blue-500 transition-all duration-300",style:{width:`${n}%`}})}),p.jsxs("span",{className:"w-12 text-right text-sm font-medium tabular-nums text-gray-300",children:[n,"%"]})]})}function S3(e){for(const t of e){if(t.type==="file")return t.path;if(t.children){const n=S3(t.children);if(n)return n}}return null}function w3({eval:e,runId:t,benchmarkId:n}){const[r,i]=j.useState("checks"),{data:l}=rn(),u=(l==null?void 0:l.read_only)===!0,c=[{id:"checks",label:"Checks"},{id:"files",label:"Files"},...u?[]:[{id:"feedback",label:"Feedback"}]];return p.jsxs("div",{className:"flex min-h-full flex-col",children:[p.jsx("div",{className:"flex items-start justify-between border-b border-gray-800 px-4 py-3",children:p.jsxs("div",{children:[p.jsx("h3",{className:"text-lg font-medium",children:e.testId}),p.jsxs("p",{className:"mt-0.5 text-sm text-gray-400",children:[e.target&&p.jsxs("span",{children:["Target: ",e.target]}),e.durationMs!=null&&p.jsxs("span",{className:"ml-4",children:[(e.durationMs/1e3).toFixed(1),"s"]}),e.costUsd!=null&&p.jsxs("span",{className:"ml-4",children:["$",e.costUsd.toFixed(4)]})]})]})}),p.jsx("div",{className:"border-b border-gray-800",children:p.jsx("div",{className:"flex gap-1 px-4",children:c.map(d=>p.jsx("button",{type:"button",onClick:()=>i(d.id),className:`px-4 py-2 text-sm font-medium transition-colors ${r===d.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:d.label},d.id))})}),p.jsxs("div",{className:"min-h-0 flex-1",children:[r==="checks"&&p.jsx("div",{className:"overflow-auto p-4",children:p.jsx(Qte,{result:e})}),r==="files"&&p.jsx("div",{className:"h-full p-4",children:p.jsx(Xte,{result:e,runId:t,benchmarkId:n})}),!u&&r==="feedback"&&p.jsx("div",{className:"p-4",children:p.jsx(Ute,{testId:e.testId})})]})]})}function kP({assertion:e}){return p.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:[p.jsx("span",{className:`mt-0.5 text-lg ${e.passed?"text-emerald-400":"text-red-400"}`,children:e.passed?"✓":"✗"}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("p",{className:"text-sm text-gray-200",children:[e.text,e.durationMs!=null&&p.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",(e.durationMs/1e3).toFixed(1),"s)"]})]}),e.evidence&&p.jsx("p",{className:"mt-1 text-xs text-gray-400",children:e.evidence})]})]})}function Qte({result:e}){const{data:t}=rn(),n=(t==null?void 0:t.threshold)??(t==null?void 0:t.pass_threshold)??.8,r=!La(e.score,n)||e.executionStatus==="error"||e.executionStatus==="failed",i=(e.scores??[]).filter(h=>Array.isArray(h.assertions)&&h.assertions.length>0),l=i.length>0,u=e.assertions??[],c=[];e.error&&c.push(e.error),(e.executionStatus==="error"||e.executionStatus==="failed")&&c.push(`Execution status: ${e.executionStatus}`);const d=l?i.flatMap(h=>h.assertions):u;for(const h of d.filter(m=>!m.passed)){const m=h.evidence?`${h.text}: ${h.evidence}`:h.text;c.push(m)}if(e.scores){for(const h of e.scores)if(!La(h.score,n)&&h.details){const m=typeof h.details=="string"?h.details:JSON.stringify(h.details,null,2);c.push(`[${h.name??h.type??"evaluator"}] ${m}`)}}return p.jsxs("div",{className:"space-y-6",children:[p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("span",{className:"text-sm font-medium text-gray-400",children:"Overall score"}),p.jsx("div",{className:"flex-1",children:p.jsx(Bb,{score:e.score})})]})}),e.scores&&e.scores.length>0&&p.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[p.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-400",children:"Grader Scores"}),p.jsx("div",{className:"space-y-3",children:e.scores.map((h,m)=>p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("span",{className:"w-40 truncate text-sm text-gray-300",children:h.name??h.type??`Score ${m+1}`}),p.jsx("div",{className:"flex-1",children:p.jsx(Bb,{score:h.score})})]},`${h.name??h.type??m}`))})]}),l?p.jsx("div",{className:"space-y-6",children:i.map((h,m)=>{const v=h.name??h.type??`Grader ${m+1}`;return p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-300",children:v}),h.assertions.map((g,x)=>p.jsx(kP,{assertion:g},`${g.text}-${x}`))]},`${h.name??h.type??m}`)})}):u.length>0?p.jsx("div",{className:"space-y-2",children:u.map((h,m)=>p.jsx(kP,{assertion:h},`${h.text}-${m}`))}):p.jsx("p",{className:"text-sm text-gray-500",children:"No assertion steps recorded."}),r&&c.length>0&&p.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[p.jsx("h4",{className:"mb-2 text-sm font-medium text-red-400",children:"Failure Reason"}),p.jsx("div",{className:"space-y-2",children:c.map(h=>p.jsx("p",{className:"text-sm text-gray-300",children:h},h))})]})]})}function Xte({result:e,runId:t,benchmarkId:n}){const r=e.testId,{data:i}=n?ot(fB(n,t,r)):nB(t,r),l=(i==null?void 0:i.files)??[],[u,c]=j.useState(null),d=u??(l.length>0?S3(l):null),{data:h,isLoading:m}=n?ot(dB(n,t,r,d??"")):rB(t,r,d??"");if(l.length===0)return p.jsx("p",{className:"text-sm text-gray-500",children:"No artifact files available."});const v=d?m?"Loading...":(h==null?void 0:h.content)??"":"",g=d?(h==null?void 0:h.language)??"plaintext":"plaintext";return p.jsxs("div",{className:"flex h-full min-h-[400px] gap-4",children:[p.jsx(Hte,{files:l,selectedPath:d,onSelect:c}),p.jsx("div",{className:"flex-1",children:p.jsx(Vte,{value:v,language:g,height:"100%"})})]})}const j3=Rr("/evals/$runId/$evalId")({component:Zte});function Zte(){const{runId:e,evalId:t}=j3.useParams(),{data:n,isLoading:r,error:i}=Hc(e),{data:l}=rn(),[u,c]=j.useState(!1),d=(l==null?void 0:l.read_only)===!0;if(r)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(i)return p.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",i.message]});const h=n==null?void 0:n.results.find(m=>m.testId===t);return h?p.jsxs("div",{className:"flex h-full flex-col gap-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",e," / Eval: ",t]}),p.jsx("h1",{className:"text-2xl font-semibold text-white",children:t})]}),!d&&p.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:"▶ Run this Test"})]}),p.jsx(w3,{eval:h,runId:e}),!d&&p.jsx(cl,{open:u,onClose:()=>c(!1),prefill:{testIds:[t],target:h.target}})]}):p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:p.jsxs("p",{className:"text-gray-400",children:["Eval ",p.jsx("code",{className:"text-cyan-400",children:t})," not found in run"," ",p.jsx("code",{className:"text-cyan-400",children:e}),"."]})})}const O3=Rr("/runs/$runId_/suite/$suite")({component:Wte});function Wte(){const{runId:e,suite:t}=O3.useParams(),{data:n,isLoading:r,error:i}=Hc(e),{data:l}=rn(),u=(l==null?void 0:l.threshold)??(l==null?void 0:l.pass_threshold)??.8;if(r)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(x=>p.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},x))})]});if(i)return p.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=((n==null?void 0:n.results)??[]).filter(x=>(x.suite??"Uncategorized")===t),d=c.length,h=c.filter(x=>La(x.score,u)).length,m=d-h,v=d>0?h/d:0,g=c.reduce((x,S)=>x+(S.costUsd??0),0);return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:t}),p.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Suite in run: ",e]})]}),p.jsx(fm,{total:d,passed:h,failed:m,passRate:v,totalCost:g>0?g:void 0}),d===0?p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:p.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations in this suite"})}):p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:p.jsxs("table",{className:"w-full text-left text-sm",children:[p.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),p.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),p.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),p.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),p.jsx("tbody",{className:"divide-y divide-gray-800/50",children:c.map((x,S)=>p.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[p.jsx("td",{className:"px-4 py-3",children:p.jsx(Ie,{to:"/evals/$runId/$evalId",params:{runId:e,evalId:x.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:x.testId})}),p.jsx("td",{className:"px-4 py-3 text-gray-400",children:x.target??"-"}),p.jsx("td",{className:"px-4 py-3",children:x.executionStatus==="execution_error"?p.jsx("span",{className:"inline-flex rounded-full px-2 py-0.5 text-xs font-medium bg-red-900/50 text-red-400",children:"ERR"}):p.jsx(qa,{rate:x.score})}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:x.durationMs!=null?`${(x.durationMs/1e3).toFixed(1)}s`:"-"}),p.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:x.costUsd!=null?`$${x.costUsd.toFixed(4)}`:"-"})]},`${x.testId}-${S}`))})]})})]})}const _3=Rr("/runs/$runId_/category/$category")({component:Jte});function Jte(){const{runId:e,category:t}=_3.useParams(),{data:n,isLoading:r,error:i}=IC(e,t);if(r)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(m=>p.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},m))})]});if(i)return p.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 l=(n==null?void 0:n.suites)??[],u=l.reduce((m,v)=>m+v.total,0),c=l.reduce((m,v)=>m+v.passed,0),d=u-c,h=u>0?c/u:0;return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:t}),p.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Category in run: ",e]})]}),p.jsx(fm,{total:u,passed:c,failed:d,passRate:h}),l.length===0?p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:p.jsx("p",{className:"text-lg text-gray-400",children:"No suites in this category"})}):p.jsxs("div",{className:"space-y-3",children:[p.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Suites"}),p.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:l.map(m=>p.jsxs(Ie,{to:"/runs/$runId/suite/$suite",params:{runId:e,suite:m.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:m.name}),p.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[m.passed,"/",m.total]})]}),p.jsx("div",{className:"mt-2",children:p.jsx(Bb,{score:m.avg_score})}),p.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[p.jsxs("span",{className:"text-emerald-400",children:[m.passed," passed"]}),m.failed>0&&p.jsxs("span",{className:"text-red-400",children:[m.failed," failed"]})]})]},m.name))})]})]})}const E3=Rr("/projects/$benchmarkId_/runs/$runId")({component:ene});function ene(){var O;const{benchmarkId:e,runId:t}=E3.useParams(),{data:n,isLoading:r,error:i}=nx(e,t),{data:l}=rn(),[u,c]=j.useState(!1),d=(l==null?void 0:l.read_only)===!0;if(r)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(_=>p.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},_))})]});if(i)return p.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 h=(O=n==null?void 0:n.results)==null?void 0:O[0],m=h==null?void 0:h.target,v=h==null?void 0:h.experiment,g=h==null?void 0:h.timestamp,x=m?{target:m}:void 0,S=(()=>{const _=[v,m].filter(A=>A&&A!=="default");return _.length>0?_.join(" · "):t})(),w=[m,v&&v!=="default"?v:null,g?new Date(g).toLocaleString():null,n==null?void 0:n.source].filter(Boolean).join(" · ");return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-white",children:S}),p.jsx("p",{className:"mt-1 text-sm text-gray-500",children:w})]}),!d&&p.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:"▶ Re-run with Filters"})]}),p.jsx(m3,{results:(n==null?void 0:n.results)??[],runId:t,benchmarkId:e}),!d&&p.jsx(cl,{open:u,onClose:()=>c(!1),benchmarkId:e,prefill:x})]})}const A3=Rr("/projects/$benchmarkId_/evals/$runId/$evalId")({component:tne});function tne(){const{benchmarkId:e,runId:t,evalId:n}=A3.useParams(),{data:r,isLoading:i,error:l}=nx(e,t),{data:u}=rn(),[c,d]=j.useState(!1),h=(u==null?void 0:u.read_only)===!0;if(i)return p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),p.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(l)return p.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 m=r==null?void 0:r.results.find(v=>v.testId===n);return m?p.jsxs("div",{className:"flex h-full flex-col gap-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",t," / Eval: ",n]}),p.jsx("h1",{className:"text-2xl font-semibold text-white",children:n})]}),!h&&p.jsx("button",{type:"button",onClick:()=>d(!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"})]}),p.jsx(w3,{eval:m,runId:t,benchmarkId:e}),!h&&p.jsx(cl,{open:c,onClose:()=>d(!1),benchmarkId:e,prefill:{testIds:[n],target:m.target}})]}):p.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:p.jsxs("p",{className:"text-gray-400",children:["Eval ",p.jsx("code",{className:"text-cyan-400",children:n})," not found in run"," ",p.jsx("code",{className:"text-cyan-400",children:t}),"."]})})}const nne=kB.update({id:"/settings",path:"/settings",getParentRoute:()=>br}),rne=Ote.update({id:"/",path:"/",getParentRoute:()=>br}),ane=v3.update({id:"/runs/$runId",path:"/runs/$runId",getParentRoute:()=>br}),ine=p3.update({id:"/projects/$benchmarkId",path:"/projects/$benchmarkId",getParentRoute:()=>br}),sne=y3.update({id:"/jobs/$runId",path:"/jobs/$runId",getParentRoute:()=>br}),lne=g3.update({id:"/experiments/$experimentName",path:"/experiments/$experimentName",getParentRoute:()=>br}),one=j3.update({id:"/evals/$runId/$evalId",path:"/evals/$runId/$evalId",getParentRoute:()=>br}),une=O3.update({id:"/runs/$runId_/suite/$suite",path:"/runs/$runId/suite/$suite",getParentRoute:()=>br}),cne=_3.update({id:"/runs/$runId_/category/$category",path:"/runs/$runId/category/$category",getParentRoute:()=>br}),fne=E3.update({id:"/projects/$benchmarkId_/runs/$runId",path:"/projects/$benchmarkId/runs/$runId",getParentRoute:()=>br}),dne=A3.update({id:"/projects/$benchmarkId_/evals/$runId/$evalId",path:"/projects/$benchmarkId/evals/$runId/$evalId",getParentRoute:()=>br}),hne={IndexRoute:rne,SettingsRoute:nne,ExperimentsExperimentNameRoute:lne,JobsRunIdRoute:sne,ProjectsBenchmarkIdRoute:ine,RunsRunIdRoute:ane,EvalsRunIdEvalIdRoute:one,ProjectsBenchmarkIdRunsRunIdRoute:fne,RunsRunIdCategoryCategoryRoute:cne,RunsRunIdSuiteSuiteRoute:une,ProjectsBenchmarkIdEvalsRunIdEvalIdRoute:dne},mne=br._addFileChildren(hne)._addFileTypes(),vne=new CL({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!0}}}),pne=R5({routeTree:mne}),N3=document.getElementById("root");if(!N3)throw new Error("Root element not found");sL.createRoot(N3).render(p.jsx(j.StrictMode,{children:p.jsx(ML,{client:vne,children:p.jsx(I5,{router:pne})})}));export{_o as W,j as r};