agent-nuvira 1.15.7 → 1.15.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-nuvira",
3
- "version": "1.15.7",
3
+ "version": "1.15.8",
4
4
  "description": "Agent-Nuvira: Multi-agent AI coding CLI — plan, write, review, test, and publish code with local models (Ollama) or cloud APIs (Groq, NVIDIA NIM, Google Gemini, OpenRouter)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -131,5 +131,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
131
131
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UG(e,t){if(e){if(typeof e=="string")return Ox(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ox(e,t)}}function Ox(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function WG(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],u=!0,s=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(u=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);u=!0);}catch(f){s=!0,i=f}finally{try{if(!u&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(s)throw i}}return l}}function HG(e){if(Array.isArray(e))return e}function gh(){return gh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gh.apply(this,arguments)}var VG=function(t,n){var r;return E.isValidElement(t)?r=E.cloneElement(t,n):J(t)?r=t(n):r=E.createElement("line",gh({},n,{className:"recharts-reference-line-line"})),r},GG=function(t,n,r,i,a,o,l,u,s){var f=a.x,c=a.y,d=a.width,p=a.height;if(r){var x=s.y,b=t.y.apply(x,{position:o});if(hn(s,"discard")&&!t.y.isInRange(b))return null;var m=[{x:f+d,y:b},{x:f,y:b}];return u==="left"?m.reverse():m}if(n){var y=s.x,v=t.x.apply(y,{position:o});if(hn(s,"discard")&&!t.x.isInRange(v))return null;var g=[{x:v,y:c+p},{x:v,y:c}];return l==="top"?g.reverse():g}if(i){var O=s.segment,h=O.map(function(S){return t.apply(S,{position:o})});return hn(s,"discard")&&vV(h,function(S){return!t.isInRange(S)})?null:h}return null};function KG(e){var t=e.x,n=e.y,r=e.segment,i=e.xAxisId,a=e.yAxisId,o=e.shape,l=e.className,u=e.alwaysShow,s=AG(),f=yP(i),c=mP(a),d=TG();if(!s||!d)return null;En(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=Ey({x:f.scale,y:c.scale}),x=Fe(t),b=Fe(n),m=r&&r.length===2,y=GG(p,x,b,m,d,e.position,f.orientation,c.orientation,e);if(!y)return null;var v=zG(y,2),g=v[0],O=g.x,h=g.y,S=v[1],_=S.x,P=S.y,j=hn(e,"hidden")?"url(#".concat(s,")"):void 0,T=Sx(Sx({clipPath:j},ae(e,!0)),{},{x1:O,y1:h,x2:_,y2:P});return E.createElement(Ve,{className:oe("recharts-reference-line",l)},VG(o,T),rt.renderCallByParent(e,iG({x1:O,y1:h,x2:_,y2:P})))}var My=function(e){function t(){return kG(this,t),IG(this,t,arguments)}return RG(t,e),MG(t,[{key:"render",value:function(){return E.createElement(KG,this.props)}}])}(E.Component);Ny(My,"displayName","ReferenceLine");Ny(My,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function bh(){return bh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bh.apply(this,arguments)}function ua(e){"@babel/helpers - typeof";return ua=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ua(e)}function _x(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 Px(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_x(Object(n),!0).forEach(function(r){Jc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_x(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function qG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function XG(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,wP(r.key),r)}}function YG(e,t,n){return t&&XG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function QG(e,t,n){return t=Us(t),ZG(e,xP()?Reflect.construct(t,n||[],Us(e).constructor):t.apply(e,n))}function ZG(e,t){if(t&&(ua(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return JG(e)}function JG(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xP=function(){return!!e})()}function Us(e){return Us=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Us(e)}function eK(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xh(e,t)}function xh(e,t){return xh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},xh(e,t)}function Jc(e,t,n){return t=wP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wP(e){var t=tK(e,"string");return ua(t)=="symbol"?t:t+""}function tK(e,t){if(ua(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ua(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var nK=function(t){var n=t.x,r=t.y,i=t.xAxis,a=t.yAxis,o=Ey({x:i.scale,y:a.scale}),l=o.apply({x:n,y:r},{bandAware:!0});return hn(t,"discard")&&!o.isInRange(l)?null:l},ef=function(e){function t(){return qG(this,t),QG(this,t,arguments)}return eK(t,e),YG(t,[{key:"render",value:function(){var r=this.props,i=r.x,a=r.y,o=r.r,l=r.alwaysShow,u=r.clipPathId,s=Fe(i),f=Fe(a);if(En(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!s||!f)return null;var c=nK(this.props);if(!c)return null;var d=c.x,p=c.y,x=this.props,b=x.shape,m=x.className,y=hn(this.props,"hidden")?"url(#".concat(u,")"):void 0,v=Px(Px({clipPath:y},ae(this.props,!0)),{},{cx:d,cy:p});return E.createElement(Ve,{className:oe("recharts-reference-dot",m)},t.renderDot(b,v),rt.renderCallByParent(this.props,{x:d-o,y:p-o,width:2*o,height:2*o}))}}])}(E.Component);Jc(ef,"displayName","ReferenceDot");Jc(ef,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});Jc(ef,"renderDot",function(e,t){var n;return E.isValidElement(e)?n=E.cloneElement(e,t):J(e)?n=e(t):n=E.createElement(Z_,bh({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),n});function wh(){return wh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wh.apply(this,arguments)}function sa(e){"@babel/helpers - typeof";return sa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sa(e)}function jx(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 Ax(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jx(Object(n),!0).forEach(function(r){tf(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jx(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rK(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iK(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,OP(r.key),r)}}function aK(e,t,n){return t&&iK(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function oK(e,t,n){return t=Ws(t),lK(e,SP()?Reflect.construct(t,n||[],Ws(e).constructor):t.apply(e,n))}function lK(e,t){if(t&&(sa(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uK(e)}function uK(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function SP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(SP=function(){return!!e})()}function Ws(e){return Ws=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ws(e)}function sK(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Sh(e,t)}function Sh(e,t){return Sh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Sh(e,t)}function tf(e,t,n){return t=OP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function OP(e){var t=cK(e,"string");return sa(t)=="symbol"?t:t+""}function cK(e,t){if(sa(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var fK=function(t,n,r,i,a){var o=a.x1,l=a.x2,u=a.y1,s=a.y2,f=a.xAxis,c=a.yAxis;if(!f||!c)return null;var d=Ey({x:f.scale,y:c.scale}),p={x:t?d.x.apply(o,{position:"start"}):d.x.rangeMin,y:r?d.y.apply(u,{position:"start"}):d.y.rangeMin},x={x:n?d.x.apply(l,{position:"end"}):d.x.rangeMax,y:i?d.y.apply(s,{position:"end"}):d.y.rangeMax};return hn(a,"discard")&&(!d.isInRange(p)||!d.isInRange(x))?null:sP(p,x)},nf=function(e){function t(){return rK(this,t),oK(this,t,arguments)}return sK(t,e),aK(t,[{key:"render",value:function(){var r=this.props,i=r.x1,a=r.x2,o=r.y1,l=r.y2,u=r.className,s=r.alwaysShow,f=r.clipPathId;En(s===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var c=Fe(i),d=Fe(a),p=Fe(o),x=Fe(l),b=this.props.shape;if(!c&&!d&&!p&&!x&&!b)return null;var m=fK(c,d,p,x,this.props);if(!m&&!b)return null;var y=hn(this.props,"hidden")?"url(#".concat(f,")"):void 0;return E.createElement(Ve,{className:oe("recharts-reference-area",u)},t.renderRect(b,Ax(Ax({clipPath:y},ae(this.props,!0)),m)),rt.renderCallByParent(this.props,m))}}])}(E.Component);tf(nf,"displayName","ReferenceArea");tf(nf,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});tf(nf,"renderRect",function(e,t){var n;return E.isValidElement(e)?n=E.cloneElement(e,t):J(e)?n=e(t):n=E.createElement(Ay,wh({},t,{className:"recharts-reference-area-rect"})),n});function _P(e,t,n){if(t<1)return[];if(t===1&&n===void 0)return e;for(var r=[],i=0;i<e.length;i+=t)r.push(e[i]);return r}function dK(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return oG(r,n)}function pK(e,t,n){var r=n==="width",i=e.x,a=e.y,o=e.width,l=e.height;return t===1?{start:r?i:a,end:r?i+o:a+l}:{start:r?i+o:a+l,end:r?i:a}}function Hs(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function hK(e,t){return _P(e,t+1)}function vK(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,l=t.end,u=0,s=1,f=o,c=function(){var x=r==null?void 0:r[u];if(x===void 0)return{v:_P(r,s)};var b=u,m,y=function(){return m===void 0&&(m=n(x,b)),m},v=x.coordinate,g=u===0||Hs(e,v,y,f,l);g||(u=0,f=o,s+=1),g&&(f=v+e*(y()/2+i),u+=s)},d;s<=a.length;)if(d=c(),d)return d.v;return[]}function yl(e){"@babel/helpers - typeof";return yl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yl(e)}function Ex(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 tt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ex(Object(n),!0).forEach(function(r){yK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ex(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yK(e,t,n){return t=mK(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mK(e){var t=gK(e,"string");return yl(t)=="symbol"?t:t+""}function gK(e,t){if(yl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bK(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,l=t.start,u=t.end,s=function(d){var p=a[d],x,b=function(){return x===void 0&&(x=n(p,d)),x};if(d===o-1){var m=e*(p.coordinate+e*b()/2-u);a[d]=p=tt(tt({},p),{},{tickCoord:m>0?p.coordinate-m*e:p.coordinate})}else a[d]=p=tt(tt({},p),{},{tickCoord:p.coordinate});var y=Hs(e,p.tickCoord,b,l,u);y&&(u=p.tickCoord-e*(b()/2+i),a[d]=tt(tt({},p),{},{isShow:!0}))},f=o-1;f>=0;f--)s(f);return a}function xK(e,t,n,r,i,a){var o=(r||[]).slice(),l=o.length,u=t.start,s=t.end;if(a){var f=r[l-1],c=n(f,l-1),d=e*(f.coordinate+e*c/2-s);o[l-1]=f=tt(tt({},f),{},{tickCoord:d>0?f.coordinate-d*e:f.coordinate});var p=Hs(e,f.tickCoord,function(){return c},u,s);p&&(s=f.tickCoord-e*(c/2+i),o[l-1]=tt(tt({},f),{},{isShow:!0}))}for(var x=a?l-1:l,b=function(v){var g=o[v],O,h=function(){return O===void 0&&(O=n(g,v)),O};if(v===0){var S=e*(g.coordinate-e*h()/2-u);o[v]=g=tt(tt({},g),{},{tickCoord:S<0?g.coordinate-S*e:g.coordinate})}else o[v]=g=tt(tt({},g),{},{tickCoord:g.coordinate});var _=Hs(e,g.tickCoord,h,u,s);_&&(u=g.tickCoord+e*(h()/2+i),o[v]=tt(tt({},g),{},{isShow:!0}))},m=0;m<x;m++)b(m);return o}function Iy(e,t,n){var r=e.tick,i=e.ticks,a=e.viewBox,o=e.minTickGap,l=e.orientation,u=e.interval,s=e.tickFormatter,f=e.unit,c=e.angle;if(!i||!i.length||!r)return[];if(H(u)||Al.isSsr)return hK(i,typeof u=="number"&&H(u)?u:0);var d=[],p=l==="top"||l==="bottom"?"width":"height",x=f&&p==="width"?ho(f,{fontSize:t,letterSpacing:n}):{width:0,height:0},b=function(g,O){var h=J(s)?s(g.value,O):g.value;return p==="width"?dK(ho(h,{fontSize:t,letterSpacing:n}),x,c):ho(h,{fontSize:t,letterSpacing:n})[p]},m=i.length>=2?Zt(i[1].coordinate-i[0].coordinate):1,y=pK(a,m,p);return u==="equidistantPreserveStart"?vK(m,y,b,i,o):(u==="preserveStart"||u==="preserveStartEnd"?d=xK(m,y,b,i,o,u==="preserveStartEnd"):d=bK(m,y,b,i,o),d.filter(function(v){return v.isShow}))}var wK=["viewBox"],SK=["viewBox"],OK=["ticks"];function ca(e){"@babel/helpers - typeof";return ca=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ca(e)}function Ai(){return Ai=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ai.apply(this,arguments)}function $x(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 Le(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$x(Object(n),!0).forEach(function(r){Dy(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$x(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function id(e,t){if(e==null)return{};var n=_K(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _K(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function PK(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tx(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,jP(r.key),r)}}function jK(e,t,n){return t&&Tx(e.prototype,t),n&&Tx(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function AK(e,t,n){return t=Vs(t),EK(e,PP()?Reflect.construct(t,n||[],Vs(e).constructor):t.apply(e,n))}function EK(e,t){if(t&&(ca(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $K(e)}function $K(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function PP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PP=function(){return!!e})()}function Vs(e){return Vs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Vs(e)}function TK(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Oh(e,t)}function Oh(e,t){return Oh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Oh(e,t)}function Dy(e,t,n){return t=jP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jP(e){var t=CK(e,"string");return ca(t)=="symbol"?t:t+""}function CK(e,t){if(ca(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ca(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ka=function(e){function t(n){var r;return PK(this,t),r=AK(this,t,[n]),r.state={fontSize:"",letterSpacing:""},r}return TK(t,e),jK(t,[{key:"shouldComponentUpdate",value:function(r,i){var a=r.viewBox,o=id(r,wK),l=this.props,u=l.viewBox,s=id(l,SK);return!Ii(a,u)||!Ii(o,s)||!Ii(i,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var i=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];i&&this.setState({fontSize:window.getComputedStyle(i).fontSize,letterSpacing:window.getComputedStyle(i).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var i=this.props,a=i.x,o=i.y,l=i.width,u=i.height,s=i.orientation,f=i.tickSize,c=i.mirror,d=i.tickMargin,p,x,b,m,y,v,g=c?-1:1,O=r.tickSize||f,h=H(r.tickCoord)?r.tickCoord:r.coordinate;switch(s){case"top":p=x=r.coordinate,m=o+ +!c*u,b=m-g*O,v=b-g*d,y=h;break;case"left":b=m=r.coordinate,x=a+ +!c*l,p=x-g*O,y=p-g*d,v=h;break;case"right":b=m=r.coordinate,x=a+ +c*l,p=x+g*O,y=p+g*d,v=h;break;default:p=x=r.coordinate,m=o+ +c*u,b=m+g*O,v=b+g*d,y=h;break}return{line:{x1:p,y1:b,x2:x,y2:m},tick:{x:y,y:v}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,i=r.orientation,a=r.mirror,o;switch(i){case"left":o=a?"start":"end";break;case"right":o=a?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,i=r.orientation,a=r.mirror,o="end";switch(i){case"left":case"right":o="middle";break;case"top":o=a?"start":"end";break;default:o=a?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.x,a=r.y,o=r.width,l=r.height,u=r.orientation,s=r.mirror,f=r.axisLine,c=Le(Le(Le({},ae(this.props,!1)),ae(f,!1)),{},{fill:"none"});if(u==="top"||u==="bottom"){var d=+(u==="top"&&!s||u==="bottom"&&s);c=Le(Le({},c),{},{x1:i,y1:a+d*l,x2:i+o,y2:a+d*l})}else{var p=+(u==="left"&&!s||u==="right"&&s);c=Le(Le({},c),{},{x1:i+p*o,y1:a,x2:i+p*o,y2:a+l})}return E.createElement("line",Ai({},c,{className:oe("recharts-cartesian-axis-line",Bt(f,"className"))}))}},{key:"renderTicks",value:function(r,i,a){var o=this,l=this.props,u=l.tickLine,s=l.stroke,f=l.tick,c=l.tickFormatter,d=l.unit,p=Iy(Le(Le({},this.props),{},{ticks:r}),i,a),x=this.getTickTextAnchor(),b=this.getTickVerticalAnchor(),m=ae(this.props,!1),y=ae(f,!1),v=Le(Le({},m),{},{fill:"none"},ae(u,!1)),g=p.map(function(O,h){var S=o.getTickLineCoord(O),_=S.line,P=S.tick,j=Le(Le(Le(Le({textAnchor:x,verticalAnchor:b},m),{},{stroke:"none",fill:s},y),P),{},{index:h,payload:O,visibleTicksCount:p.length,tickFormatter:c});return E.createElement(Ve,Ai({className:"recharts-cartesian-axis-tick",key:"tick-".concat(O.value,"-").concat(O.coordinate,"-").concat(O.tickCoord)},Qu(o.props,O,h)),u&&E.createElement("line",Ai({},v,_,{className:oe("recharts-cartesian-axis-tick-line",Bt(u,"className"))})),f&&t.renderTickItem(f,j,"".concat(J(c)?c(O.value,h):O.value).concat(d||"")))});return E.createElement("g",{className:"recharts-cartesian-axis-ticks"},g)}},{key:"render",value:function(){var r=this,i=this.props,a=i.axisLine,o=i.width,l=i.height,u=i.ticksGenerator,s=i.className,f=i.hide;if(f)return null;var c=this.props,d=c.ticks,p=id(c,OK),x=d;return J(u)&&(x=d&&d.length>0?u(this.props):u(p)),o<=0||l<=0||!x||!x.length?null:E.createElement(Ve,{className:oe("recharts-cartesian-axis",s),ref:function(m){r.layerReference=m}},a&&this.renderAxisLine(),this.renderTicks(x,this.state.fontSize,this.state.letterSpacing),rt.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,a){var o,l=oe(i.className,"recharts-cartesian-axis-tick-value");return E.isValidElement(r)?o=E.cloneElement(r,Le(Le({},i),{},{className:l})):J(r)?o=r(Le(Le({},i),{},{className:l})):o=E.createElement(fs,Ai({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])}(A.Component);Dy(ka,"displayName","CartesianAxis");Dy(ka,"defaultProps",{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"});var kK=["x1","y1","x2","y2","key"],NK=["offset"];function ei(e){"@babel/helpers - typeof";return ei=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ei(e)}function Cx(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 it(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cx(Object(n),!0).forEach(function(r){MK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cx(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function MK(e,t,n){return t=IK(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function IK(e){var t=DK(e,"string");return ei(t)=="symbol"?t:t+""}function DK(e,t){if(ei(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ei(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Br(){return Br=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Br.apply(this,arguments)}function kx(e,t){if(e==null)return{};var n=LK(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function LK(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var RK=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,i=t.x,a=t.y,o=t.width,l=t.height,u=t.ry;return E.createElement("rect",{x:i,y:a,ry:u,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function AP(e,t){var n;if(E.isValidElement(e))n=E.cloneElement(e,t);else if(J(e))n=e(t);else{var r=t.x1,i=t.y1,a=t.x2,o=t.y2,l=t.key,u=kx(t,kK),s=ae(u,!1);s.offset;var f=kx(s,NK);n=E.createElement("line",Br({},f,{x1:r,y1:i,x2:a,y2:o,fill:"none",key:l}))}return n}function BK(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0?!0:r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(l,u){var s=it(it({},e),{},{x1:t,y1:l,x2:t+n,y2:l,key:"line-".concat(u),index:u});return AP(i,s)});return E.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function zK(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0?!0:r,a=e.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(l,u){var s=it(it({},e),{},{x1:l,y1:t,x2:l,y2:t+n,key:"line-".concat(u),index:u});return AP(i,s)});return E.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function FK(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,l=e.horizontalPoints,u=e.horizontal,s=u===void 0?!0:u;if(!s||!t||!t.length)return null;var f=l.map(function(d){return Math.round(d+i-i)}).sort(function(d,p){return d-p});i!==f[0]&&f.unshift(0);var c=f.map(function(d,p){var x=!f[p+1],b=x?i+o-d:f[p+1]-d;if(b<=0)return null;var m=p%t.length;return E.createElement("rect",{key:"react-".concat(p),y:d,x:r,height:b,width:a,stroke:"none",fill:t[m],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return E.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},c)}function UK(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,l=e.width,u=e.height,s=e.verticalPoints;if(!n||!r||!r.length)return null;var f=s.map(function(d){return Math.round(d+a-a)}).sort(function(d,p){return d-p});a!==f[0]&&f.unshift(0);var c=f.map(function(d,p){var x=!f[p+1],b=x?a+l-d:f[p+1]-d;if(b<=0)return null;var m=p%r.length;return E.createElement("rect",{key:"react-".concat(p),x:d,y:o,width:b,height:u,stroke:"none",fill:r[m],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return E.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},c)}var WK=function(t,n){var r=t.xAxis,i=t.width,a=t.height,o=t.offset;return D_(Iy(it(it(it({},ka.defaultProps),r),{},{ticks:Pn(r,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,n)},HK=function(t,n){var r=t.yAxis,i=t.width,a=t.height,o=t.offset;return D_(Iy(it(it(it({},ka.defaultProps),r),{},{ticks:Pn(r,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,n)},di={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Bi(e){var t,n,r,i,a,o,l=Cy(),u=ky(),s=CG(),f=it(it({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:di.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:di.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:di.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:di.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:di.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:di.verticalFill,x:H(e.x)?e.x:s.left,y:H(e.y)?e.y:s.top,width:H(e.width)?e.width:s.width,height:H(e.height)?e.height:s.height}),c=f.x,d=f.y,p=f.width,x=f.height,b=f.syncWithTicks,m=f.horizontalValues,y=f.verticalValues,v=EG(),g=$G();if(!H(p)||p<=0||!H(x)||x<=0||!H(c)||c!==+c||!H(d)||d!==+d)return null;var O=f.verticalCoordinatesGenerator||WK,h=f.horizontalCoordinatesGenerator||HK,S=f.horizontalPoints,_=f.verticalPoints;if((!S||!S.length)&&J(h)){var P=m&&m.length,j=h({yAxis:g?it(it({},g),{},{ticks:P?m:g.ticks}):void 0,width:l,height:u,offset:s},P?!0:b);En(Array.isArray(j),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(ei(j),"]")),Array.isArray(j)&&(S=j)}if((!_||!_.length)&&J(O)){var T=y&&y.length,k=O({xAxis:v?it(it({},v),{},{ticks:T?y:v.ticks}):void 0,width:l,height:u,offset:s},T?!0:b);En(Array.isArray(k),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(ei(k),"]")),Array.isArray(k)&&(_=k)}return E.createElement("g",{className:"recharts-cartesian-grid"},E.createElement(RK,{fill:f.fill,fillOpacity:f.fillOpacity,x:f.x,y:f.y,width:f.width,height:f.height,ry:f.ry}),E.createElement(BK,Br({},f,{offset:s,horizontalPoints:S,xAxis:v,yAxis:g})),E.createElement(zK,Br({},f,{offset:s,verticalPoints:_,xAxis:v,yAxis:g})),E.createElement(FK,Br({},f,{horizontalPoints:S})),E.createElement(UK,Br({},f,{verticalPoints:_})))}Bi.displayName="CartesianGrid";function fa(e){"@babel/helpers - typeof";return fa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fa(e)}function VK(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function GK(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,TP(r.key),r)}}function KK(e,t,n){return t&&GK(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qK(e,t,n){return t=Gs(t),XK(e,EP()?Reflect.construct(t,n||[],Gs(e).constructor):t.apply(e,n))}function XK(e,t){if(t&&(fa(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YK(e)}function YK(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function EP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(EP=function(){return!!e})()}function Gs(e){return Gs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Gs(e)}function QK(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_h(e,t)}function _h(e,t){return _h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},_h(e,t)}function $P(e,t,n){return t=TP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function TP(e){var t=ZK(e,"string");return fa(t)=="symbol"?t:t+""}function ZK(e,t){if(fa(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Ph(){return Ph=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ph.apply(this,arguments)}function JK(e){var t=e.xAxisId,n=Cy(),r=ky(),i=yP(t);return i==null?null:A.createElement(ka,Ph({},i,{className:oe("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(o){return Pn(o,!0)}}))}var fr=function(e){function t(){return VK(this,t),qK(this,t,arguments)}return QK(t,e),KK(t,[{key:"render",value:function(){return A.createElement(JK,this.props)}}])}(A.Component);$P(fr,"displayName","XAxis");$P(fr,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function da(e){"@babel/helpers - typeof";return da=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},da(e)}function eq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tq(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,NP(r.key),r)}}function nq(e,t,n){return t&&tq(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rq(e,t,n){return t=Ks(t),iq(e,CP()?Reflect.construct(t,n||[],Ks(e).constructor):t.apply(e,n))}function iq(e,t){if(t&&(da(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aq(e)}function aq(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function CP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(CP=function(){return!!e})()}function Ks(e){return Ks=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ks(e)}function oq(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jh(e,t)}function jh(e,t){return jh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},jh(e,t)}function kP(e,t,n){return t=NP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function NP(e){var t=lq(e,"string");return da(t)=="symbol"?t:t+""}function lq(e,t){if(da(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(da(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Ah(){return Ah=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ah.apply(this,arguments)}var uq=function(t){var n=t.yAxisId,r=Cy(),i=ky(),a=mP(n);return a==null?null:A.createElement(ka,Ah({},a,{className:oe("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:i},ticksGenerator:function(l){return Pn(l,!0)}}))},dr=function(e){function t(){return eq(this,t),rq(this,t,arguments)}return oq(t,e),nq(t,[{key:"render",value:function(){return A.createElement(uq,this.props)}}])}(A.Component);kP(dr,"displayName","YAxis");kP(dr,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function Nx(e){return dq(e)||fq(e)||cq(e)||sq()}function sq(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
132
132
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cq(e,t){if(e){if(typeof e=="string")return Eh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Eh(e,t)}}function fq(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function dq(e){if(Array.isArray(e))return Eh(e)}function Eh(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var $h=function(t,n,r,i,a){var o=tn(t,My),l=tn(t,ef),u=[].concat(Nx(o),Nx(l)),s=tn(t,nf),f="".concat(i,"Id"),c=i[0],d=n;if(u.length&&(d=u.reduce(function(b,m){if(m.props[f]===r&&hn(m.props,"extendDomain")&&H(m.props[c])){var y=m.props[c];return[Math.min(b[0],y),Math.max(b[1],y)]}return b},d)),s.length){var p="".concat(c,"1"),x="".concat(c,"2");d=s.reduce(function(b,m){if(m.props[f]===r&&hn(m.props,"extendDomain")&&H(m.props[p])&&H(m.props[x])){var y=m.props[p],v=m.props[x];return[Math.min(b[0],y,v),Math.max(b[1],y,v)]}return b},d)}return a&&a.length&&(d=a.reduce(function(b,m){return H(m)?[Math.min(b[0],m),Math.max(b[1],m)]:b},d)),d},MP={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(u,s,f){this.fn=u,this.context=s,this.once=f||!1}function a(u,s,f,c,d){if(typeof f!="function")throw new TypeError("The listener must be a function");var p=new i(f,c||u,d),x=n?n+s:s;return u._events[x]?u._events[x].fn?u._events[x]=[u._events[x],p]:u._events[x].push(p):(u._events[x]=p,u._eventsCount++),u}function o(u,s){--u._eventsCount===0?u._events=new r:delete u._events[s]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var s=[],f,c;if(this._eventsCount===0)return s;for(c in f=this._events)t.call(f,c)&&s.push(n?c.slice(1):c);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(f)):s},l.prototype.listeners=function(s){var f=n?n+s:s,c=this._events[f];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,p=c.length,x=new Array(p);d<p;d++)x[d]=c[d].fn;return x},l.prototype.listenerCount=function(s){var f=n?n+s:s,c=this._events[f];return c?c.fn?1:c.length:0},l.prototype.emit=function(s,f,c,d,p,x){var b=n?n+s:s;if(!this._events[b])return!1;var m=this._events[b],y=arguments.length,v,g;if(m.fn){switch(m.once&&this.removeListener(s,m.fn,void 0,!0),y){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,f),!0;case 3:return m.fn.call(m.context,f,c),!0;case 4:return m.fn.call(m.context,f,c,d),!0;case 5:return m.fn.call(m.context,f,c,d,p),!0;case 6:return m.fn.call(m.context,f,c,d,p,x),!0}for(g=1,v=new Array(y-1);g<y;g++)v[g-1]=arguments[g];m.fn.apply(m.context,v)}else{var O=m.length,h;for(g=0;g<O;g++)switch(m[g].once&&this.removeListener(s,m[g].fn,void 0,!0),y){case 1:m[g].fn.call(m[g].context);break;case 2:m[g].fn.call(m[g].context,f);break;case 3:m[g].fn.call(m[g].context,f,c);break;case 4:m[g].fn.call(m[g].context,f,c,d);break;default:if(!v)for(h=1,v=new Array(y-1);h<y;h++)v[h-1]=arguments[h];m[g].fn.apply(m[g].context,v)}}return!0},l.prototype.on=function(s,f,c){return a(this,s,f,c,!1)},l.prototype.once=function(s,f,c){return a(this,s,f,c,!0)},l.prototype.removeListener=function(s,f,c,d){var p=n?n+s:s;if(!this._events[p])return this;if(!f)return o(this,p),this;var x=this._events[p];if(x.fn)x.fn===f&&(!d||x.once)&&(!c||x.context===c)&&o(this,p);else{for(var b=0,m=[],y=x.length;b<y;b++)(x[b].fn!==f||d&&!x[b].once||c&&x[b].context!==c)&&m.push(x[b]);m.length?this._events[p]=m.length===1?m[0]:m:o(this,p)}return this},l.prototype.removeAllListeners=function(s){var f;return s?(f=n?n+s:s,this._events[f]&&o(this,f)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l})(MP);var pq=MP.exports;const hq=pe(pq);var ad=new hq,od="recharts.syncMouseEvents";function ml(e){"@babel/helpers - typeof";return ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ml(e)}function vq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yq(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,IP(r.key),r)}}function mq(e,t,n){return t&&yq(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ld(e,t,n){return t=IP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function IP(e){var t=gq(e,"string");return ml(t)=="symbol"?t:t+""}function gq(e,t){if(ml(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ml(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var bq=function(){function e(){vq(this,e),ld(this,"activeIndex",0),ld(this,"coordinateList",[]),ld(this,"layout","horizontal")}return mq(e,[{key:"setDetails",value:function(n){var r,i=n.coordinateList,a=i===void 0?null:i,o=n.container,l=o===void 0?null:o,u=n.layout,s=u===void 0?null:u,f=n.offset,c=f===void 0?null:f,d=n.mouseHandlerCallback,p=d===void 0?null:d;this.coordinateList=(r=a??this.coordinateList)!==null&&r!==void 0?r:[],this.container=l??this.container,this.layout=s??this.layout,this.offset=c??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),a=i.x,o=i.y,l=i.height,u=this.coordinateList[this.activeIndex].coordinate,s=((n=window)===null||n===void 0?void 0:n.scrollX)||0,f=((r=window)===null||r===void 0?void 0:r.scrollY)||0,c=a+u+s,d=o+this.offset.top+l/2+f;this.mouseHandlerCallback({pageX:c,pageY:d})}}}])}();function xq(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e==null?void 0:e[0],i=e==null?void 0:e[1];if(r&&i&&H(r)&&H(i))return!0}return!1}function wq(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function DP(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle,o=Ye(t,n,r,i),l=Ye(t,n,r,a);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function Sq(e,t,n){var r,i,a,o;if(e==="horizontal")r=t.x,a=r,i=n.top,o=n.top+n.height;else if(e==="vertical")i=t.y,o=i,r=n.left,a=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,u=t.cy,s=t.innerRadius,f=t.outerRadius,c=t.angle,d=Ye(l,u,s,c),p=Ye(l,u,f,c);r=d.x,i=d.y,a=p.x,o=p.y}else return DP(t);return[{x:r,y:i},{x:a,y:o}]}function gl(e){"@babel/helpers - typeof";return gl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gl(e)}function Mx(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 su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Mx(Object(n),!0).forEach(function(r){Oq(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mx(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Oq(e,t,n){return t=_q(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _q(e){var t=Pq(e,"string");return gl(t)=="symbol"?t:t+""}function Pq(e,t){if(gl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jq(e){var t,n,r=e.element,i=e.tooltipEventType,a=e.isActive,o=e.activeCoordinate,l=e.activePayload,u=e.offset,s=e.activeTooltipIndex,f=e.tooltipAxisBandSize,c=e.layout,d=e.chartName,p=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!p||!a||!o||d!=="ScatterChart"&&i!=="axis")return null;var x,b=Mb;if(d==="ScatterChart")x=o,b=BH;else if(d==="BarChart")x=wq(c,o,u,f),b=Ay;else if(c==="radial"){var m=DP(o),y=m.cx,v=m.cy,g=m.radius,O=m.startAngle,h=m.endAngle;x={cx:y,cy:v,startAngle:O,endAngle:h,innerRadius:g,outerRadius:g},b=F_}else x={points:Sq(c,o,u)},b=Mb;var S=su(su(su(su({stroke:"#ccc",pointerEvents:"none"},u),x),ae(p,!1)),{},{payload:l,payloadIndex:s,className:oe("recharts-tooltip-cursor",p.className)});return A.isValidElement(p)?A.cloneElement(p,S):A.createElement(b,S)}var Aq=["item"],Eq=["children","className","width","height","style","compact","title","desc"];function pa(e){"@babel/helpers - typeof";return pa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pa(e)}function Ei(){return Ei=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ei.apply(this,arguments)}function Ix(e,t){return Cq(e)||Tq(e,t)||RP(e,t)||$q()}function $q(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
133
133
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tq(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],u=!0,s=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(u=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);u=!0);}catch(f){s=!0,i=f}finally{try{if(!u&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(s)throw i}}return l}}function Cq(e){if(Array.isArray(e))return e}function Dx(e,t){if(e==null)return{};var n=kq(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kq(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Nq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mq(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,BP(r.key),r)}}function Iq(e,t,n){return t&&Mq(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dq(e,t,n){return t=qs(t),Lq(e,LP()?Reflect.construct(t,n||[],qs(e).constructor):t.apply(e,n))}function Lq(e,t){if(t&&(pa(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Rq(e)}function Rq(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function LP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(LP=function(){return!!e})()}function qs(e){return qs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},qs(e)}function Bq(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Th(e,t)}function Th(e,t){return Th=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Th(e,t)}function ha(e){return Uq(e)||Fq(e)||RP(e)||zq()}function zq(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
134
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RP(e,t){if(e){if(typeof e=="string")return Ch(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ch(e,t)}}function Fq(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Uq(e){if(Array.isArray(e))return Ch(e)}function Ch(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Lx(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 N(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Lx(Object(n),!0).forEach(function(r){Y(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lx(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Y(e,t,n){return t=BP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BP(e){var t=Wq(e,"string");return pa(t)=="symbol"?t:t+""}function Wq(e,t){if(pa(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(pa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Hq={xAxis:["bottom","top"],yAxis:["left","right"]},Vq={width:"100%",height:"100%"},zP={x:0,y:0};function cu(e){return e}var Gq=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},Kq=function(t,n,r,i){var a=n.find(function(f){return f&&f.index===r});if(a){if(t==="horizontal")return{x:a.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:a.coordinate};if(t==="centric"){var o=a.coordinate,l=i.radius;return N(N(N({},i),Ye(i.cx,i.cy,l,o)),{},{angle:o,radius:l})}var u=a.coordinate,s=i.angle;return N(N(N({},i),Ye(i.cx,i.cy,u,s)),{},{angle:s,radius:u})}return zP},rf=function(t,n){var r=n.graphicalItems,i=n.dataStartIndex,a=n.dataEndIndex,o=(r??[]).reduce(function(l,u){var s=u.props.data;return s&&s.length?[].concat(ha(l),ha(s)):l},[]);return o.length>0?o:t&&t.length&&H(i)&&H(a)?t.slice(i,a+1):[]};function FP(e){return e==="number"?[0,"auto"]:void 0}var kh=function(t,n,r,i){var a=t.graphicalItems,o=t.tooltipAxis,l=rf(n,t);return r<0||!a||!a.length||r>=l.length?null:a.reduce(function(u,s){var f,c=(f=s.props.data)!==null&&f!==void 0?f:n;c&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(c=c.slice(t.dataStartIndex,t.dataEndIndex+1));var d;if(o.dataKey&&!o.allowDuplicatedCategory){var p=c===void 0?l:c;d=fp(p,o.dataKey,i)}else d=c&&c[r]||l[r];return d?[].concat(ha(u),[R_(s,d)]):u},[])},Rx=function(t,n,r,i){var a=i||{x:t.chartX,y:t.chartY},o=Gq(a,r),l=t.orderedTooltipTicks,u=t.tooltipAxis,s=t.tooltipTicks,f=mU(o,l,s,u);if(f>=0&&s){var c=s[f]&&s[f].value,d=kh(t,n,f,c),p=Kq(r,l,f,a);return{activeTooltipIndex:f,activeLabel:c,activePayload:d,activeCoordinate:p}}return null},qq=function(t,n){var r=n.axes,i=n.graphicalItems,a=n.axisType,o=n.axisIdKey,l=n.stackGroups,u=n.dataStartIndex,s=n.dataEndIndex,f=t.layout,c=t.children,d=t.stackOffset,p=I_(f,a);return r.reduce(function(x,b){var m,y=b.type.defaultProps!==void 0?N(N({},b.type.defaultProps),b.props):b.props,v=y.type,g=y.dataKey,O=y.allowDataOverflow,h=y.allowDuplicatedCategory,S=y.scale,_=y.ticks,P=y.includeHidden,j=y[o];if(x[j])return x;var T=rf(t.data,{graphicalItems:i.filter(function(W){var X,te=o in W.props?W.props[o]:(X=W.type.defaultProps)===null||X===void 0?void 0:X[o];return te===j}),dataStartIndex:u,dataEndIndex:s}),k=T.length,$,D,I;xq(y.domain,O,v)&&($=Zp(y.domain,null,O),p&&(v==="number"||S!=="auto")&&(I=yo(T,g,"category")));var M=FP(v);if(!$||$.length===0){var R,z=(R=y.domain)!==null&&R!==void 0?R:M;if(g){if($=yo(T,g,v),v==="category"&&p){var C=ak($);h&&C?(D=$,$=Ds(0,k)):h||($=wb(z,$,b).reduce(function(W,X){return W.indexOf(X)>=0?W:[].concat(ha(W),[X])},[]))}else if(v==="category")h?$=$.filter(function(W){return W!==""&&!le(W)}):$=wb(z,$,b).reduce(function(W,X){return W.indexOf(X)>=0||X===""||le(X)?W:[].concat(ha(W),[X])},[]);else if(v==="number"){var L=SU(T,i.filter(function(W){var X,te,xe=o in W.props?W.props[o]:(X=W.type.defaultProps)===null||X===void 0?void 0:X[o],Te="hide"in W.props?W.props.hide:(te=W.type.defaultProps)===null||te===void 0?void 0:te.hide;return xe===j&&(P||!Te)}),g,a,f);L&&($=L)}p&&(v==="number"||S!=="auto")&&(I=yo(T,g,"category"))}else p?$=Ds(0,k):l&&l[j]&&l[j].hasStack&&v==="number"?$=d==="expand"?[0,1]:L_(l[j].stackGroups,u,s):$=M_(T,i.filter(function(W){var X=o in W.props?W.props[o]:W.type.defaultProps[o],te="hide"in W.props?W.props.hide:W.type.defaultProps.hide;return X===j&&(P||!te)}),v,f,!0);if(v==="number")$=$h(c,$,j,a,_),z&&($=Zp(z,$,O));else if(v==="category"&&z){var B=z,V=$.every(function(W){return B.indexOf(W)>=0});V&&($=B)}}return N(N({},x),{},Y({},j,N(N({},y),{},{axisType:a,domain:$,categoricalDomain:I,duplicateDomain:D,originalDomain:(m=y.domain)!==null&&m!==void 0?m:M,isCategorical:p,layout:f})))},{})},Xq=function(t,n){var r=n.graphicalItems,i=n.Axis,a=n.axisType,o=n.axisIdKey,l=n.stackGroups,u=n.dataStartIndex,s=n.dataEndIndex,f=t.layout,c=t.children,d=rf(t.data,{graphicalItems:r,dataStartIndex:u,dataEndIndex:s}),p=d.length,x=I_(f,a),b=-1;return r.reduce(function(m,y){var v=y.type.defaultProps!==void 0?N(N({},y.type.defaultProps),y.props):y.props,g=v[o],O=FP("number");if(!m[g]){b++;var h;return x?h=Ds(0,p):l&&l[g]&&l[g].hasStack?(h=L_(l[g].stackGroups,u,s),h=$h(c,h,g,a)):(h=Zp(O,M_(d,r.filter(function(S){var _,P,j=o in S.props?S.props[o]:(_=S.type.defaultProps)===null||_===void 0?void 0:_[o],T="hide"in S.props?S.props.hide:(P=S.type.defaultProps)===null||P===void 0?void 0:P.hide;return j===g&&!T}),"number",f),i.defaultProps.allowDataOverflow),h=$h(c,h,g,a)),N(N({},m),{},Y({},g,N(N({axisType:a},i.defaultProps),{},{hide:!0,orientation:Bt(Hq,"".concat(a,".").concat(b%2),null),domain:h,originalDomain:O,isCategorical:x,layout:f})))}return m},{})},Yq=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,a=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,u=n.dataStartIndex,s=n.dataEndIndex,f=t.children,c="".concat(i,"Id"),d=tn(f,a),p={};return d&&d.length?p=qq(t,{axes:d,graphicalItems:o,axisType:i,axisIdKey:c,stackGroups:l,dataStartIndex:u,dataEndIndex:s}):o&&o.length&&(p=Xq(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:c,stackGroups:l,dataStartIndex:u,dataEndIndex:s})),p},Qq=function(t){var n=Yn(t),r=Pn(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Jv(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:js(n,r)}},Bx=function(t){var n=t.children,r=t.defaultShowTooltip,i=Ot(n,aa),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},Zq=function(t){return!t||!t.length?!1:t.some(function(n){var r=An(n&&n.type);return r&&r.indexOf("Bar")>=0})},zx=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Jq=function(t,n){var r=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,l=t.yAxisMap,u=l===void 0?{}:l,s=r.width,f=r.height,c=r.children,d=r.margin||{},p=Ot(c,aa),x=Ot(c,Di),b=Object.keys(u).reduce(function(h,S){var _=u[S],P=_.orientation;return!_.mirror&&!_.hide?N(N({},h),{},Y({},P,h[P]+_.width)):h},{left:d.left||0,right:d.right||0}),m=Object.keys(o).reduce(function(h,S){var _=o[S],P=_.orientation;return!_.mirror&&!_.hide?N(N({},h),{},Y({},P,Bt(h,"".concat(P))+_.height)):h},{top:d.top||0,bottom:d.bottom||0}),y=N(N({},m),b),v=y.bottom;p&&(y.bottom+=p.props.height||aa.defaultProps.height),x&&n&&(y=xU(y,i,r,n));var g=s-y.left-y.right,O=f-y.top-y.bottom;return N(N({brushBottom:v},y),{},{width:Math.max(g,0),height:Math.max(O,0)})},eX=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},tX=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,u=t.axisComponents,s=t.legendContent,f=t.formatAxisMap,c=t.defaultProps,d=function(y,v){var g=v.graphicalItems,O=v.stackGroups,h=v.offset,S=v.updateId,_=v.dataStartIndex,P=v.dataEndIndex,j=y.barSize,T=y.layout,k=y.barGap,$=y.barCategoryGap,D=y.maxBarSize,I=zx(T),M=I.numericAxisName,R=I.cateAxisName,z=Zq(g),C=[];return g.forEach(function(L,B){var V=rf(y.data,{graphicalItems:[L],dataStartIndex:_,dataEndIndex:P}),W=L.type.defaultProps!==void 0?N(N({},L.type.defaultProps),L.props):L.props,X=W.dataKey,te=W.maxBarSize,xe=W["".concat(M,"Id")],Te=W["".concat(R,"Id")],Tt={},ft=u.reduce(function(Pr,jr){var af=v["".concat(jr.axisType,"Map")],Ly=W["".concat(jr.axisType,"Id")];af&&af[Ly]||jr.axisType==="zAxis"||Jr();var Ry=af[Ly];return N(N({},Pr),{},Y(Y({},jr.axisType,Ry),"".concat(jr.axisType,"Ticks"),Pn(Ry)))},Tt),G=ft[R],Q=ft["".concat(R,"Ticks")],Z=O&&O[xe]&&O[xe].hasStack&&MU(L,O[xe].stackGroups),F=An(L.type).indexOf("Bar")>=0,Ae=js(G,Q),ne=[],Ie=z&&gU({barSize:j,stackGroups:O,totalSize:eX(ft,R)});if(F){var De,dt,Un=le(te)?D:te,li=(De=(dt=js(G,Q,!0))!==null&&dt!==void 0?dt:Un)!==null&&De!==void 0?De:0;ne=bU({barGap:k,barCategoryGap:$,bandSize:li!==Ae?li:Ae,sizeList:Ie[Te],maxBarSize:Un}),li!==Ae&&(ne=ne.map(function(Pr){return N(N({},Pr),{},{position:N(N({},Pr.position),{},{offset:Pr.position.offset-li/2})})}))}var kl=L&&L.type&&L.type.getComposedData;kl&&C.push({props:N(N({},kl(N(N({},ft),{},{displayedData:V,props:y,dataKey:X,item:L,bandSize:Ae,barPosition:ne,offset:h,stackedData:Z,layout:T,dataStartIndex:_,dataEndIndex:P}))),{},Y(Y(Y({key:L.key||"item-".concat(B)},M,ft[M]),R,ft[R]),"animationId",S)),childIndex:mk(L,y.children),item:L})}),C},p=function(y,v){var g=y.props,O=y.dataStartIndex,h=y.dataEndIndex,S=y.updateId;if(!vg({props:g}))return null;var _=g.children,P=g.layout,j=g.stackOffset,T=g.data,k=g.reverseStackOrder,$=zx(P),D=$.numericAxisName,I=$.cateAxisName,M=tn(_,r),R=CU(T,M,"".concat(D,"Id"),"".concat(I,"Id"),j,k),z=u.reduce(function(W,X){var te="".concat(X.axisType,"Map");return N(N({},W),{},Y({},te,Yq(g,N(N({},X),{},{graphicalItems:M,stackGroups:X.axisType===D&&R,dataStartIndex:O,dataEndIndex:h}))))},{}),C=Jq(N(N({},z),{},{props:g,graphicalItems:M}),v==null?void 0:v.legendBBox);Object.keys(z).forEach(function(W){z[W]=f(g,z[W],C,W.replace("Map",""),n)});var L=z["".concat(I,"Map")],B=Qq(L),V=d(g,N(N({},z),{},{dataStartIndex:O,dataEndIndex:h,updateId:S,graphicalItems:M,stackGroups:R,offset:C}));return N(N({formattedGraphicalItems:V,graphicalItems:M,offset:C,stackGroups:R},B),z)},x=function(m){function y(v){var g,O,h;return Nq(this,y),h=Dq(this,y,[v]),Y(h,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Y(h,"accessibilityManager",new bq),Y(h,"handleLegendBBoxUpdate",function(S){if(S){var _=h.state,P=_.dataStartIndex,j=_.dataEndIndex,T=_.updateId;h.setState(N({legendBBox:S},p({props:h.props,dataStartIndex:P,dataEndIndex:j,updateId:T},N(N({},h.state),{},{legendBBox:S}))))}}),Y(h,"handleReceiveSyncEvent",function(S,_,P){if(h.props.syncId===S){if(P===h.eventEmitterSymbol&&typeof h.props.syncMethod!="function")return;h.applySyncEvent(_)}}),Y(h,"handleBrushChange",function(S){var _=S.startIndex,P=S.endIndex;if(_!==h.state.dataStartIndex||P!==h.state.dataEndIndex){var j=h.state.updateId;h.setState(function(){return N({dataStartIndex:_,dataEndIndex:P},p({props:h.props,dataStartIndex:_,dataEndIndex:P,updateId:j},h.state))}),h.triggerSyncEvent({dataStartIndex:_,dataEndIndex:P})}}),Y(h,"handleMouseEnter",function(S){var _=h.getMouseInfo(S);if(_){var P=N(N({},_),{},{isTooltipActive:!0});h.setState(P),h.triggerSyncEvent(P);var j=h.props.onMouseEnter;J(j)&&j(P,S)}}),Y(h,"triggeredAfterMouseMove",function(S){var _=h.getMouseInfo(S),P=_?N(N({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};h.setState(P),h.triggerSyncEvent(P);var j=h.props.onMouseMove;J(j)&&j(P,S)}),Y(h,"handleItemMouseEnter",function(S){h.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),Y(h,"handleItemMouseLeave",function(){h.setState(function(){return{isTooltipActive:!1}})}),Y(h,"handleMouseMove",function(S){S.persist(),h.throttleTriggeredAfterMouseMove(S)}),Y(h,"handleMouseLeave",function(S){h.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};h.setState(_),h.triggerSyncEvent(_);var P=h.props.onMouseLeave;J(P)&&P(_,S)}),Y(h,"handleOuterEvent",function(S){var _=yk(S),P=Bt(h.props,"".concat(_));if(_&&J(P)){var j,T;/.*touch.*/i.test(_)?T=h.getMouseInfo(S.changedTouches[0]):T=h.getMouseInfo(S),P((j=T)!==null&&j!==void 0?j:{},S)}}),Y(h,"handleClick",function(S){var _=h.getMouseInfo(S);if(_){var P=N(N({},_),{},{isTooltipActive:!0});h.setState(P),h.triggerSyncEvent(P);var j=h.props.onClick;J(j)&&j(P,S)}}),Y(h,"handleMouseDown",function(S){var _=h.props.onMouseDown;if(J(_)){var P=h.getMouseInfo(S);_(P,S)}}),Y(h,"handleMouseUp",function(S){var _=h.props.onMouseUp;if(J(_)){var P=h.getMouseInfo(S);_(P,S)}}),Y(h,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&h.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),Y(h,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&h.handleMouseDown(S.changedTouches[0])}),Y(h,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&h.handleMouseUp(S.changedTouches[0])}),Y(h,"handleDoubleClick",function(S){var _=h.props.onDoubleClick;if(J(_)){var P=h.getMouseInfo(S);_(P,S)}}),Y(h,"handleContextMenu",function(S){var _=h.props.onContextMenu;if(J(_)){var P=h.getMouseInfo(S);_(P,S)}}),Y(h,"triggerSyncEvent",function(S){h.props.syncId!==void 0&&ad.emit(od,h.props.syncId,S,h.eventEmitterSymbol)}),Y(h,"applySyncEvent",function(S){var _=h.props,P=_.layout,j=_.syncMethod,T=h.state.updateId,k=S.dataStartIndex,$=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)h.setState(N({dataStartIndex:k,dataEndIndex:$},p({props:h.props,dataStartIndex:k,dataEndIndex:$,updateId:T},h.state)));else if(S.activeTooltipIndex!==void 0){var D=S.chartX,I=S.chartY,M=S.activeTooltipIndex,R=h.state,z=R.offset,C=R.tooltipTicks;if(!z)return;if(typeof j=="function")M=j(C,S);else if(j==="value"){M=-1;for(var L=0;L<C.length;L++)if(C[L].value===S.activeLabel){M=L;break}}var B=N(N({},z),{},{x:z.left,y:z.top}),V=Math.min(D,B.x+B.width),W=Math.min(I,B.y+B.height),X=C[M]&&C[M].value,te=kh(h.state,h.props.data,M),xe=C[M]?{x:P==="horizontal"?C[M].coordinate:V,y:P==="horizontal"?W:C[M].coordinate}:zP;h.setState(N(N({},S),{},{activeLabel:X,activeCoordinate:xe,activePayload:te,activeTooltipIndex:M}))}else h.setState(S)}),Y(h,"renderCursor",function(S){var _,P=h.state,j=P.isTooltipActive,T=P.activeCoordinate,k=P.activePayload,$=P.offset,D=P.activeTooltipIndex,I=P.tooltipAxisBandSize,M=h.getTooltipEventType(),R=(_=S.props.active)!==null&&_!==void 0?_:j,z=h.props.layout,C=S.key||"_recharts-cursor";return E.createElement(jq,{key:C,activeCoordinate:T,activePayload:k,activeTooltipIndex:D,chartName:n,element:S,isActive:R,layout:z,offset:$,tooltipAxisBandSize:I,tooltipEventType:M})}),Y(h,"renderPolarAxis",function(S,_,P){var j=Bt(S,"type.axisType"),T=Bt(h.state,"".concat(j,"Map")),k=S.type.defaultProps,$=k!==void 0?N(N({},k),S.props):S.props,D=T&&T[$["".concat(j,"Id")]];return A.cloneElement(S,N(N({},D),{},{className:oe(j,D.className),key:S.key||"".concat(_,"-").concat(P),ticks:Pn(D,!0)}))}),Y(h,"renderPolarGrid",function(S){var _=S.props,P=_.radialLines,j=_.polarAngles,T=_.polarRadius,k=h.state,$=k.radiusAxisMap,D=k.angleAxisMap,I=Yn($),M=Yn(D),R=M.cx,z=M.cy,C=M.innerRadius,L=M.outerRadius;return A.cloneElement(S,{polarAngles:Array.isArray(j)?j:Pn(M,!0).map(function(B){return B.coordinate}),polarRadius:Array.isArray(T)?T:Pn(I,!0).map(function(B){return B.coordinate}),cx:R,cy:z,innerRadius:C,outerRadius:L,key:S.key||"polar-grid",radialLines:P})}),Y(h,"renderLegend",function(){var S=h.state.formattedGraphicalItems,_=h.props,P=_.children,j=_.width,T=_.height,k=h.props.margin||{},$=j-(k.left||0)-(k.right||0),D=k_({children:P,formattedGraphicalItems:S,legendWidth:$,legendContent:s});if(!D)return null;var I=D.item,M=Dx(D,Aq);return A.cloneElement(I,N(N({},M),{},{chartWidth:j,chartHeight:T,margin:k,onBBoxUpdate:h.handleLegendBBoxUpdate}))}),Y(h,"renderTooltip",function(){var S,_=h.props,P=_.children,j=_.accessibilityLayer,T=Ot(P,pt);if(!T)return null;var k=h.state,$=k.isTooltipActive,D=k.activeCoordinate,I=k.activePayload,M=k.activeLabel,R=k.offset,z=(S=T.props.active)!==null&&S!==void 0?S:$;return A.cloneElement(T,{viewBox:N(N({},R),{},{x:R.left,y:R.top}),active:z,label:M,payload:z?I:[],coordinate:D,accessibilityLayer:j})}),Y(h,"renderBrush",function(S){var _=h.props,P=_.margin,j=_.data,T=h.state,k=T.offset,$=T.dataStartIndex,D=T.dataEndIndex,I=T.updateId;return A.cloneElement(S,{key:S.key||"_recharts-brush",onChange:au(h.handleBrushChange,S.props.onChange),data:j,x:H(S.props.x)?S.props.x:k.left,y:H(S.props.y)?S.props.y:k.top+k.height+k.brushBottom-(P.bottom||0),width:H(S.props.width)?S.props.width:k.width,startIndex:$,endIndex:D,updateId:"brush-".concat(I)})}),Y(h,"renderReferenceElement",function(S,_,P){if(!S)return null;var j=h,T=j.clipPathId,k=h.state,$=k.xAxisMap,D=k.yAxisMap,I=k.offset,M=S.type.defaultProps||{},R=S.props,z=R.xAxisId,C=z===void 0?M.xAxisId:z,L=R.yAxisId,B=L===void 0?M.yAxisId:L;return A.cloneElement(S,{key:S.key||"".concat(_,"-").concat(P),xAxis:$[C],yAxis:D[B],viewBox:{x:I.left,y:I.top,width:I.width,height:I.height},clipPathId:T})}),Y(h,"renderActivePoints",function(S){var _=S.item,P=S.activePoint,j=S.basePoint,T=S.childIndex,k=S.isRange,$=[],D=_.props.key,I=_.item.type.defaultProps!==void 0?N(N({},_.item.type.defaultProps),_.item.props):_.item.props,M=I.activeDot,R=I.dataKey,z=N(N({index:T,dataKey:R,cx:P.x,cy:P.y,r:4,fill:jy(_.item),strokeWidth:2,stroke:"#fff",payload:P.payload,value:P.value},ae(M,!1)),Yu(M));return $.push(y.renderActiveDot(M,z,"".concat(D,"-activePoint-").concat(T))),j?$.push(y.renderActiveDot(M,N(N({},z),{},{cx:j.x,cy:j.y}),"".concat(D,"-basePoint-").concat(T))):k&&$.push(null),$}),Y(h,"renderGraphicChild",function(S,_,P){var j=h.filterFormatItem(S,_,P);if(!j)return null;var T=h.getTooltipEventType(),k=h.state,$=k.isTooltipActive,D=k.tooltipAxis,I=k.activeTooltipIndex,M=k.activeLabel,R=h.props.children,z=Ot(R,pt),C=j.props,L=C.points,B=C.isRange,V=C.baseLine,W=j.item.type.defaultProps!==void 0?N(N({},j.item.type.defaultProps),j.item.props):j.item.props,X=W.activeDot,te=W.hide,xe=W.activeBar,Te=W.activeShape,Tt=!!(!te&&$&&z&&(X||xe||Te)),ft={};T!=="axis"&&z&&z.props.trigger==="click"?ft={onClick:au(h.handleItemMouseEnter,S.props.onClick)}:T!=="axis"&&(ft={onMouseLeave:au(h.handleItemMouseLeave,S.props.onMouseLeave),onMouseEnter:au(h.handleItemMouseEnter,S.props.onMouseEnter)});var G=A.cloneElement(S,N(N({},j.props),ft));function Q(jr){return typeof D.dataKey=="function"?D.dataKey(jr.payload):null}if(Tt)if(I>=0){var Z,F;if(D.dataKey&&!D.allowDuplicatedCategory){var Ae=typeof D.dataKey=="function"?Q:"payload.".concat(D.dataKey.toString());Z=fp(L,Ae,M),F=B&&V&&fp(V,Ae,M)}else Z=L==null?void 0:L[I],F=B&&V&&V[I];if(Te||xe){var ne=S.props.activeIndex!==void 0?S.props.activeIndex:I;return[A.cloneElement(S,N(N(N({},j.props),ft),{},{activeIndex:ne})),null,null]}if(!le(Z))return[G].concat(ha(h.renderActivePoints({item:j,activePoint:Z,basePoint:F,childIndex:I,isRange:B})))}else{var Ie,De=(Ie=h.getItemByXY(h.state.activeCoordinate))!==null&&Ie!==void 0?Ie:{graphicalItem:G},dt=De.graphicalItem,Un=dt.item,li=Un===void 0?S:Un,kl=dt.childIndex,Pr=N(N(N({},j.props),ft),{},{activeIndex:kl});return[A.cloneElement(li,Pr),null,null]}return B?[G,null,null]:[G,null]}),Y(h,"renderCustomized",function(S,_,P){return A.cloneElement(S,N(N({key:"recharts-customized-".concat(P)},h.props),h.state))}),Y(h,"renderMap",{CartesianGrid:{handler:cu,once:!0},ReferenceArea:{handler:h.renderReferenceElement},ReferenceLine:{handler:cu},ReferenceDot:{handler:h.renderReferenceElement},XAxis:{handler:cu},YAxis:{handler:cu},Brush:{handler:h.renderBrush,once:!0},Bar:{handler:h.renderGraphicChild},Line:{handler:h.renderGraphicChild},Area:{handler:h.renderGraphicChild},Radar:{handler:h.renderGraphicChild},RadialBar:{handler:h.renderGraphicChild},Scatter:{handler:h.renderGraphicChild},Pie:{handler:h.renderGraphicChild},Funnel:{handler:h.renderGraphicChild},Tooltip:{handler:h.renderCursor,once:!0},PolarGrid:{handler:h.renderPolarGrid,once:!0},PolarAngleAxis:{handler:h.renderPolarAxis},PolarRadiusAxis:{handler:h.renderPolarAxis},Customized:{handler:h.renderCustomized}}),h.clipPathId="".concat((g=v.id)!==null&&g!==void 0?g:Tc("recharts"),"-clip"),h.throttleTriggeredAfterMouseMove=NO(h.triggeredAfterMouseMove,(O=v.throttleDelay)!==null&&O!==void 0?O:1e3/60),h.state={},h}return Bq(y,m),Iq(y,[{key:"componentDidMount",value:function(){var g,O;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(g=this.props.margin.left)!==null&&g!==void 0?g:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var g=this.props,O=g.children,h=g.data,S=g.height,_=g.layout,P=Ot(O,pt);if(P){var j=P.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var T=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,k=kh(this.state,h,j,T),$=this.state.tooltipTicks[j].coordinate,D=(this.state.offset.top+S)/2,I=_==="horizontal",M=I?{x:$,y:D}:{y:$,x:D},R=this.state.formattedGraphicalItems.find(function(C){var L=C.item;return L.type.name==="Scatter"});R&&(M=N(N({},M),R.props.points[j].tooltipPosition),k=R.props.points[j].tooltipPayload);var z={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:T,activePayload:k,activeCoordinate:M};this.setState(z),this.renderCursor(P),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(g,O){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==O.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==g.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==g.margin){var h,S;this.accessibilityManager.setDetails({offset:{left:(h=this.props.margin.left)!==null&&h!==void 0?h:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(g){pp([Ot(g.children,pt)],[Ot(this.props.children,pt)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var g=Ot(this.props.children,pt);if(g&&typeof g.props.shared=="boolean"){var O=g.props.shared?"axis":"item";return l.indexOf(O)>=0?O:a}return a}},{key:"getMouseInfo",value:function(g){if(!this.container)return null;var O=this.container,h=O.getBoundingClientRect(),S=W4(h),_={chartX:Math.round(g.pageX-S.left),chartY:Math.round(g.pageY-S.top)},P=h.width/O.offsetWidth||1,j=this.inRange(_.chartX,_.chartY,P);if(!j)return null;var T=this.state,k=T.xAxisMap,$=T.yAxisMap,D=this.getTooltipEventType(),I=Rx(this.state,this.props.data,this.props.layout,j);if(D!=="axis"&&k&&$){var M=Yn(k).scale,R=Yn($).scale,z=M&&M.invert?M.invert(_.chartX):null,C=R&&R.invert?R.invert(_.chartY):null;return N(N({},_),{},{xValue:z,yValue:C},I)}return I?N(N({},_),I):null}},{key:"inRange",value:function(g,O){var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,_=g/h,P=O/h;if(S==="horizontal"||S==="vertical"){var j=this.state.offset,T=_>=j.left&&_<=j.left+j.width&&P>=j.top&&P<=j.top+j.height;return T?{x:_,y:P}:null}var k=this.state,$=k.angleAxisMap,D=k.radiusAxisMap;if($&&D){var I=Yn($);return _b({x:_,y:P},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var g=this.props.children,O=this.getTooltipEventType(),h=Ot(g,pt),S={};h&&O==="axis"&&(h.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var _=Yu(this.props,this.handleOuterEvent);return N(N({},_),S)}},{key:"addListener",value:function(){ad.on(od,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){ad.removeListener(od,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(g,O,h){for(var S=this.state.formattedGraphicalItems,_=0,P=S.length;_<P;_++){var j=S[_];if(j.item===g||j.props.key===g.key||O===An(j.item.type)&&h===j.childIndex)return j}return null}},{key:"renderClipPath",value:function(){var g=this.clipPathId,O=this.state.offset,h=O.left,S=O.top,_=O.height,P=O.width;return E.createElement("defs",null,E.createElement("clipPath",{id:g},E.createElement("rect",{x:h,y:S,height:_,width:P})))}},{key:"getXScales",value:function(){var g=this.state.xAxisMap;return g?Object.entries(g).reduce(function(O,h){var S=Ix(h,2),_=S[0],P=S[1];return N(N({},O),{},Y({},_,P.scale))},{}):null}},{key:"getYScales",value:function(){var g=this.state.yAxisMap;return g?Object.entries(g).reduce(function(O,h){var S=Ix(h,2),_=S[0],P=S[1];return N(N({},O),{},Y({},_,P.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(g){var O;return(O=this.state.xAxisMap)===null||O===void 0||(O=O[g])===null||O===void 0?void 0:O.scale}},{key:"getYScaleByAxisId",value:function(g){var O;return(O=this.state.yAxisMap)===null||O===void 0||(O=O[g])===null||O===void 0?void 0:O.scale}},{key:"getItemByXY",value:function(g){var O=this.state,h=O.formattedGraphicalItems,S=O.activeItem;if(h&&h.length)for(var _=0,P=h.length;_<P;_++){var j=h[_],T=j.props,k=j.item,$=k.type.defaultProps!==void 0?N(N({},k.type.defaultProps),k.props):k.props,D=An(k.type);if(D==="Bar"){var I=(T.data||[]).find(function(C){return $H(g,C)});if(I)return{graphicalItem:j,payload:I}}else if(D==="RadialBar"){var M=(T.data||[]).find(function(C){return _b(g,C)});if(M)return{graphicalItem:j,payload:M}}else if(Yc(j,S)||Qc(j,S)||dl(j,S)){var R=k7({graphicalItem:j,activeTooltipItem:S,itemData:$.data}),z=$.activeIndex===void 0?R:$.activeIndex;return{graphicalItem:N(N({},j),{},{childIndex:z}),payload:dl(j,S)?$.data[R]:j.props.data[R]}}}return null}},{key:"render",value:function(){var g=this;if(!vg(this))return null;var O=this.props,h=O.children,S=O.className,_=O.width,P=O.height,j=O.style,T=O.compact,k=O.title,$=O.desc,D=Dx(O,Eq),I=ae(D,!1);if(T)return E.createElement(xx,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},E.createElement(vp,Ei({},I,{width:_,height:P,title:k,desc:$}),this.renderClipPath(),mg(h,this.renderMap)));if(this.props.accessibilityLayer){var M,R;I.tabIndex=(M=this.props.tabIndex)!==null&&M!==void 0?M:0,I.role=(R=this.props.role)!==null&&R!==void 0?R:"application",I.onKeyDown=function(C){g.accessibilityManager.keyboardEvent(C)},I.onFocus=function(){g.accessibilityManager.focus()}}var z=this.parseEventsOfWrapper();return E.createElement(xx,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},E.createElement("div",Ei({className:oe("recharts-wrapper",S),style:N({position:"relative",cursor:"default",width:_,height:P},j)},z,{ref:function(L){g.container=L}}),E.createElement(vp,Ei({},I,{width:_,height:P,title:k,desc:$,style:Vq}),this.renderClipPath(),mg(h,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(A.Component);Y(x,"displayName",n),Y(x,"defaultProps",N({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},c)),Y(x,"getDerivedStateFromProps",function(m,y){var v=m.dataKey,g=m.data,O=m.children,h=m.width,S=m.height,_=m.layout,P=m.stackOffset,j=m.margin,T=y.dataStartIndex,k=y.dataEndIndex;if(y.updateId===void 0){var $=Bx(m);return N(N(N({},$),{},{updateId:0},p(N(N({props:m},$),{},{updateId:0}),y)),{},{prevDataKey:v,prevData:g,prevWidth:h,prevHeight:S,prevLayout:_,prevStackOffset:P,prevMargin:j,prevChildren:O})}if(v!==y.prevDataKey||g!==y.prevData||h!==y.prevWidth||S!==y.prevHeight||_!==y.prevLayout||P!==y.prevStackOffset||!Ii(j,y.prevMargin)){var D=Bx(m),I={chartX:y.chartX,chartY:y.chartY,isTooltipActive:y.isTooltipActive},M=N(N({},Rx(y,g,_)),{},{updateId:y.updateId+1}),R=N(N(N({},D),I),M);return N(N(N({},R),p(N({props:m},R),y)),{},{prevDataKey:v,prevData:g,prevWidth:h,prevHeight:S,prevLayout:_,prevStackOffset:P,prevMargin:j,prevChildren:O})}if(!pp(O,y.prevChildren)){var z,C,L,B,V=Ot(O,aa),W=V&&(z=(C=V.props)===null||C===void 0?void 0:C.startIndex)!==null&&z!==void 0?z:T,X=V&&(L=(B=V.props)===null||B===void 0?void 0:B.endIndex)!==null&&L!==void 0?L:k,te=W!==T||X!==k,xe=!le(g),Te=xe&&!te?y.updateId:y.updateId+1;return N(N({updateId:Te},p(N(N({props:m},y),{},{updateId:Te,dataStartIndex:W,dataEndIndex:X}),y)),{},{prevChildren:O,dataStartIndex:W,dataEndIndex:X})}return null}),Y(x,"renderActiveDot",function(m,y,v){var g;return A.isValidElement(m)?g=A.cloneElement(m,y):J(m)?g=m(y):g=E.createElement(Z_,y),E.createElement(Ve,{className:"recharts-active-dot",key:v},g)});var b=A.forwardRef(function(y,v){return E.createElement(x,Ei({},y,{ref:v}))});return b.displayName=x.displayName,b},go=tX({chartName:"BarChart",GraphicalChild:nn,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:fr},{axisType:"yAxis",AxisComp:dr}],formatAxisMap:rG});function Fx(e){return e==null||e<1e-5?"$0.00":e<.01?"$"+e.toFixed(6):"$"+e.toFixed(4)}function Qa(e){return e==null?"0":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toLocaleString()}const nX={local:"#3fb950",groq:"#58a6ff",gemini:"#bc8cff",nim:"#39d2c0",openrouter:"#d29922"};function rX({data:e}){if(!e)return w.jsxs("div",{className:"loading-state",children:[w.jsx("div",{className:"loading-spinner"}),w.jsx("p",{children:"Connecting to dashboard..."})]});const{cost:t,history:n,benchmarks:r,memory:i,health:a}=e,o=[{icon:"💰",value:Fx(t.totalCost),label:"Total Cost"},{icon:"📞",value:Qa(t.totalRequests),label:"API Requests"},{icon:"🧠",value:Qa(i.total),label:"Trajectories"},{icon:"📝",value:Qa(n.total),label:"Chat Sessions"},{icon:"🏆",value:Qa(r.totalRuns),label:"Benchmark Runs"},{icon:"📦",value:Qa(a.vectors),label:"Vector Entries"}],l=Object.entries(t.byProvider||{}).map(([s,f])=>({name:s,value:f})).sort((s,f)=>f.value-s.value),u=Object.entries(i.byFingerprint||{}).map(([s,f])=>({name:s.length>15?s.slice(0,13)+"..":s,value:f})).sort((s,f)=>f.value-s.value).slice(0,8);return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"📊 System Overview"}),w.jsx("div",{className:"stats-grid",children:o.map(s=>w.jsxs("div",{className:"stat-card",children:[w.jsx("div",{className:"stat-icon",children:s.icon}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",children:s.value}),w.jsx("div",{className:"stat-label",children:s.label})]})]},s.label))}),w.jsx("h3",{className:"section-subtitle",children:"💰 Cost by Provider"}),w.jsx("div",{className:"chart-container",children:l.length>0?w.jsx(po,{width:"100%",height:260,children:w.jsxs(go,{data:l,margin:{top:20,right:20,left:10,bottom:40},children:[w.jsx(Bi,{strokeDasharray:"3 3",stroke:"#21262d"}),w.jsx(fr,{dataKey:"name",tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(dr,{tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"},tickFormatter:s=>"$"+s.toFixed(4)}),w.jsx(pt,{contentStyle:{background:"#161b22",border:"1px solid #30363d",borderRadius:8},labelStyle:{color:"#e6edf3"},formatter:s=>[Fx(s),"Cost"]}),w.jsx(nn,{dataKey:"value",radius:[4,4,0,0],children:l.map(s=>w.jsx(Rc,{fill:nX[s.name]||"#58a6ff",fillOpacity:.8},s.name))})]})}):w.jsx("div",{className:"empty-state",children:"No cost data yet."})}),w.jsx("h3",{className:"section-subtitle",children:"📊 Trajectories by Project Type"}),w.jsx("div",{className:"chart-container",children:u.length>0?w.jsx(po,{width:"100%",height:260,children:w.jsxs(go,{data:u,margin:{top:20,right:20,left:10,bottom:40},children:[w.jsx(Bi,{strokeDasharray:"3 3",stroke:"#21262d"}),w.jsx(fr,{dataKey:"name",tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(dr,{tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(pt,{contentStyle:{background:"#161b22",border:"1px solid #30363d",borderRadius:8},labelStyle:{color:"#e6edf3"}}),w.jsx(nn,{dataKey:"value",fill:"#bc8cff",radius:[4,4,0,0],fillOpacity:.8})]})}):w.jsx("div",{className:"empty-state",children:"No trajectory data yet."})})]})}const Ux={planner:"📋","context-gatherer":"📂",writer:"✏️",reviewer:"👁️",tester:"🧪",debugger:"🐛",runner:"▶️",git:"🔀",package:"📦","github-release":"🏷️",security:"🔒",orchestrator:"🎯"},ud={planner:"#58a6ff","context-gatherer":"#39d2c0",writer:"#d29922",reviewer:"#bc8cff",tester:"#3fb950",debugger:"#f85149",runner:"#58a6ff",git:"#f0883e",package:"#db6d28","github-release":"#3fb950",security:"#f85149",orchestrator:"#f0883e"},iX={pending:{bg:"#1a1f2e",stroke:"#30363d",text:"#6e7681"},running:{bg:"rgba(88, 166, 255, 0.12)",stroke:"#58a6ff",text:"#58a6ff"},completed:{bg:"rgba(63, 185, 80, 0.12)",stroke:"#3fb950",text:"#3fb950"},failed:{bg:"rgba(248, 81, 73, 0.12)",stroke:"#f85149",text:"#f85149"}},Wx={pending:"⏳ Pending",running:"▶️ Running",completed:"✅ Done",failed:"❌ Failed"},sd={planner:"Planner","context-gatherer":"Context",writer:"Writer",reviewer:"Reviewer",tester:"Tester",debugger:"Debugger",runner:"Runner",git:"Git",package:"Package","github-release":"Release",security:"Security",orchestrator:"Orchestrator"};function aX(e,t,n=160,r=68,i=40,a=24,o=40){if(e.length===0)return{layoutNodes:[],svgW:400,svgH:200};const l=new Map,u=new Set;function s(m){if(l.has(m))return l.get(m);if(u.has(m))return 0;u.add(m);const y=t.filter(O=>O.to===m);if(y.length===0)return l.set(m,0),0;const g=Math.max(...y.map(O=>s(O.from)))+1;return l.set(m,g),g}for(const m of e)s(m.id);const f=new Map;for(const m of e){const y=l.get(m.id)??0;f.has(y)||f.set(y,[]),f.get(y).push(m)}const c=Math.max(...f.keys()),d=Math.max(...Array.from(f.values()).map(m=>m.length)),p=(c+1)*(n+i)+o*2-i,x=Math.max(d,1)*(r+a)+o*2-a,b=[];for(const m of e){const y=l.get(m.id)??0,v=f.get(y),g=v.indexOf(m),O=v.length,h=O*(r+a)-a,S=x/2-h/2;b.push({...m,x:o+y*(n+i),y:S+g*(r+a),w:n,h:r,step:y,totalInStep:O,indexInStep:g})}return{layoutNodes:b,svgW:p,svgH:x}}function Hx(e,t){if(!e)return"--";const n=(t||Date.now())-e;return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${Math.floor(n/6e4)}m ${Math.floor(n%6e4/1e3)}s`}function Vx(e){return e?new Date(e).toLocaleTimeString("en-US",{minute:"2-digit",second:"2-digit"}):""}function oX({memoryTotal:e}){return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"🔀 Agent Execution DAG"}),w.jsx("p",{className:"section-description",children:"Live visualization of the agent execution pipeline. When an agent task runs, you'll see each step appear here in real time as it moves through planning → context gathering → writing → review → testing."}),w.jsxs("div",{className:"dag-empty",children:[w.jsx("div",{className:"dag-empty-icon",children:"🔀"}),w.jsx("h3",{children:"No Active Pipeline"}),w.jsx("p",{children:"Run an agent task to see the execution pipeline appear here in real time."}),e!==void 0&&e>0&&w.jsxs("p",{className:"dag-empty-hint",children:[w.jsx("code",{children:e})," past executions are stored in memory."]})]})]})}function lX({data:e}){var O;const t=e==null?void 0:e.dag,n=(O=e==null?void 0:e.memory)==null?void 0:O.total,[r,i]=A.useState(null),[a,o]=A.useState(null);A.useEffect(()=>pi.onDAGEvent(S=>{i(S)}),[]);const l=t||r;if(!l||l.nodes.length===0&&!l.active)return w.jsx(oX,{memoryTotal:n});const{nodes:u,edges:s,pipeline:f,active:c}=l,{layoutNodes:d,svgW:p,svgH:x}=aX(u,s),b=u.filter(h=>h.status==="running").length,m=u.filter(h=>h.status==="completed").length,y=u.filter(h=>h.status==="failed").length,v=u.filter(h=>h.status==="pending").length,g=u.length;return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"🔀 Agent Execution DAG"}),w.jsxs("div",{className:`dag-status-bar ${c?"active":""}`,children:[w.jsxs("div",{className:"dag-pipeline-name",children:[c&&w.jsx("span",{className:"dag-live-dot"}),f||"Execution Pipeline"]}),w.jsxs("div",{className:"dag-pipeline-meta",children:[c&&w.jsx("span",{className:"dag-live-badge",children:"LIVE"}),w.jsxs("span",{className:"dag-step-count",children:[g," steps"]}),b>0&&w.jsxs("span",{className:"dag-running-badge",children:["▶ ",b," running"]}),v>0&&w.jsxs("span",{className:"dag-pending-badge",children:["⏳ ",v," pending"]}),w.jsxs("span",{className:"dag-completed-badge",children:["✅ ",m," done"]}),y>0&&w.jsxs("span",{className:"dag-failed-badge",children:["❌ ",y," failed"]})]})]}),w.jsx("div",{className:"dag-container",children:w.jsxs("svg",{width:p,height:x,viewBox:`0 0 ${p} ${x}`,children:[w.jsxs("defs",{children:[s.map(h=>w.jsx("marker",{id:`arrow-${h.from}-${h.to}`,markerWidth:"8",markerHeight:"6",refX:"8",refY:"3",orient:"auto",children:w.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:"#58a6ff"})},`arrow-${h.from}-${h.to}`)),w.jsxs("filter",{id:"glow",children:[w.jsx("feGaussianBlur",{stdDeviation:"3",result:"coloredBlur"}),w.jsxs("feMerge",{children:[w.jsx("feMergeNode",{in:"coloredBlur"}),w.jsx("feMergeNode",{in:"SourceGraphic"})]})]})]}),s.map(h=>{const S=d.find(M=>M.id===h.from),_=d.find(M=>M.id===h.to);if(!S||!_)return null;const P=S.x+S.w,j=S.y+S.h/2,T=_.x,k=_.y+_.h/2,$=(P+T)/2,D=_.status,I=D==="failed"?"#f85149":D==="running"?"#58a6ff":D==="completed"?"#3fb950":"#30363d";return w.jsx("g",{children:w.jsx("path",{d:`M ${P} ${j} C ${$} ${j}, ${$} ${k}, ${T} ${k}`,fill:"none",stroke:I,strokeWidth:D==="pending"?1.5:2.5,strokeOpacity:D==="pending"?.3:.8,markerEnd:`url(#arrow-${h.from}-${h.to})`,className:"dag-edge"})},`edge-${h.from}-${h.to}`)}),d.map(h=>{const S=iX[h.status];ud[h.agentType];const _=Ux[h.agentType]||"⚙️",P=sd[h.agentType]||h.agentType,j=a===h.id,T=h.status==="running";return w.jsxs("g",{onClick:()=>o(j?null:h.id),style:{cursor:"pointer"},className:"dag-node-group",children:[j&&w.jsx("rect",{x:h.x-4,y:h.y-4,width:h.w+8,height:h.h+8,rx:10,ry:10,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.5}),w.jsx("rect",{x:h.x,y:h.y,width:h.w,height:h.h,rx:8,ry:8,fill:S.bg,stroke:S.stroke,strokeWidth:T?2.5:1.5,strokeOpacity:.9,className:T?"dag-node-running":"",filter:T?"url(#glow)":void 0}),w.jsxs("text",{x:h.x+10,y:h.y+22,fill:"#e6edf3",fontSize:10,fontWeight:600,children:[_," ",P]}),w.jsx("text",{x:h.x+h.w-10,y:h.y+22,textAnchor:"end",fill:S.text,fontSize:9,fontWeight:500,children:Wx[h.status]}),w.jsx("text",{x:h.x+10,y:h.y+40,fill:"#8b949e",fontSize:9,children:h.description.length>28?h.description.slice(0,26)+"..":h.description}),w.jsx("text",{x:h.x+10,y:h.y+56,fill:"#6e7681",fontSize:8,children:Hx(h.startedAt,h.completedAt)}),w.jsx("text",{x:h.x+h.w-10,y:h.y+56,textAnchor:"end",fill:"#6e7681",fontSize:8,children:Vx(h.startedAt||h.completedAt)}),(h.status==="failed"||j)&&h.summary&&w.jsx("foreignObject",{x:Math.max(10,h.x-80),y:h.y+h.h+6,width:h.w+160,height:36,children:w.jsx("div",{className:"dag-node-summary",style:{color:h.status==="failed"?"#f85149":"#8b949e",fontSize:"10px",lineHeight:1.4,background:"rgba(13,17,23,0.9)",padding:"4px 8px",borderRadius:"4px",border:`1px solid ${h.status==="failed"?"rgba(248,81,73,0.3)":"rgba(48,54,61,0.5)"}`,maxHeight:"32px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.summary})})]},`node-${h.id}`)})]})}),w.jsx("h3",{className:"section-subtitle",children:"Step Details"}),w.jsx("div",{className:"dag-table-wrapper",children:w.jsxs("table",{className:"dag-table",children:[w.jsx("thead",{children:w.jsxs("tr",{children:[w.jsx("th",{children:"Step"}),w.jsx("th",{children:"Agent"}),w.jsx("th",{children:"Status"}),w.jsx("th",{children:"Duration"}),w.jsx("th",{children:"Time"}),w.jsx("th",{children:"Summary"})]})}),w.jsx("tbody",{children:d.map(h=>w.jsxs("tr",{className:`dag-row dag-row-${h.status}`,children:[w.jsx("td",{className:"dag-cell-step",children:h.step}),w.jsxs("td",{className:"dag-cell-agent",children:[w.jsx("span",{className:"dag-agent-dot",style:{background:ud[h.agentType]||"#58a6ff"}}),sd[h.agentType]||h.agentType]}),w.jsx("td",{className:`dag-cell-status dag-status-${h.status}`,children:Wx[h.status]}),w.jsx("td",{className:"dag-cell-duration",children:Hx(h.startedAt,h.completedAt)}),w.jsx("td",{className:"dag-cell-time",children:Vx(h.startedAt||h.completedAt)}),w.jsx("td",{className:"dag-cell-summary",children:h.summary||h.description||"--"})]},h.id))})]})}),w.jsx("h3",{className:"section-subtitle",children:"Agent Types"}),w.jsxs("div",{className:"dag-legend",children:[Object.entries(Ux).map(([h,S])=>w.jsxs("div",{className:"legend-item",children:[w.jsx("span",{className:"legend-dot",style:{background:ud[h]||"#58a6ff"}}),w.jsx("span",{className:"legend-icon",children:S}),w.jsx("span",{className:"legend-label",children:sd[h]||h})]},h)),w.jsxs("div",{className:"legend-item",children:[w.jsx("span",{className:"legend-dot",style:{background:"transparent",border:"2px dashed #58a6ff"}}),w.jsx("span",{className:"legend-icon",children:"⚡"}),w.jsx("span",{className:"legend-label",children:"Live node"})]})]})]})}function uX(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function sX({data:e}){if(!e)return w.jsx("div",{className:"loading-state",children:w.jsx("p",{children:"Loading history..."})});const{history:t}=e,n=t.recent||[];return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"📝 Conversation History"}),w.jsx("div",{className:"history-stats",children:w.jsxs("span",{className:"history-count",children:["Total: ",w.jsx("strong",{children:t.total})," sessions"]})}),w.jsx("div",{className:"history-list",children:n.length===0?w.jsx("div",{className:"empty-state",children:"No conversations recorded yet."}):n.map(r=>w.jsxs("div",{className:"history-item",children:[w.jsx("div",{className:"history-summary",children:r.summary||"Untitled"}),w.jsxs("div",{className:"history-meta",children:[w.jsxs("span",{children:["📅 ",uX(r.startedAt)]}),w.jsxs("span",{children:["🤖 ",r.provider||"--"]}),w.jsxs("span",{children:["💬 ",r.messageCount||0," msgs"]}),r.tags&&r.tags.length>0&&w.jsxs("span",{children:["🏷️ ",r.tags.map(i=>w.jsx("span",{className:"history-tag",children:i},i))]})]})]},r.id))})]})}function fu(e){return e==null||e<1e-5?"$0.00":e<.01?"$"+e.toFixed(6):"$"+e.toFixed(4)}function cd(e){return e==null?"0":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toLocaleString()}function cX(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function fX({data:e}){if(!e)return w.jsx("div",{className:"loading-state",children:w.jsx("p",{children:"Loading cost data..."})});const{cost:t}=e,n=Object.entries(t.byProvider||{}).sort(([,a],[,o])=>o-a),r=Object.entries(t.byModel||{}).sort(([,a],[,o])=>o-a).slice(0,10),i=n.reduce((a,[,o])=>a+o,0);return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"💰 Cost Tracking"}),w.jsxs("div",{className:"cost-summary",children:[w.jsxs("div",{className:"cost-total",children:[w.jsx("span",{className:"cost-label",children:"Total Spent"}),w.jsx("span",{className:"cost-amount",children:fu(t.totalCost)})]}),w.jsxs("div",{className:"cost-total",children:[w.jsx("span",{className:"cost-label",children:"Total Tokens"}),w.jsx("span",{className:"cost-amount",children:cd(t.totalTokens)})]}),w.jsxs("div",{className:"cost-total",children:[w.jsx("span",{className:"cost-label",children:"Total Requests"}),w.jsx("span",{className:"cost-amount",children:cd(t.totalRequests)})]})]}),w.jsx("h3",{className:"section-subtitle",children:"By Provider"}),w.jsx("div",{className:"cost-list",children:n.length===0?w.jsx("div",{className:"empty-state",children:"No costs recorded yet."}):n.map(([a,o])=>{const l=i>0?(o/i*100).toFixed(1):"0";return w.jsxs("div",{className:"cost-row",children:[w.jsx("span",{className:"cost-row-name",children:a}),w.jsx("div",{className:"cost-row-bar",children:w.jsx("div",{className:"cost-row-fill",style:{width:`${l}%`}})}),w.jsx("span",{className:"cost-row-value",children:fu(o)})]},a)})}),w.jsx("h3",{className:"section-subtitle",children:"By Model"}),w.jsx("div",{className:"cost-list",children:r.length===0?w.jsx("div",{className:"empty-state",children:"No model costs recorded yet."}):r.map(([a,o])=>{const l=i>0?(o/i*100).toFixed(1):"0",u=a.length>30?a.slice(0,28)+"..":a;return w.jsxs("div",{className:"cost-row",children:[w.jsx("span",{className:"cost-row-name",children:u}),w.jsx("div",{className:"cost-row-bar",children:w.jsx("div",{className:"cost-row-fill",style:{width:`${l}%`}})}),w.jsx("span",{className:"cost-row-value",children:fu(o)})]},a)})}),w.jsx("h3",{className:"section-subtitle",children:"Recent Requests"}),w.jsx("div",{className:"request-list",children:!t.recent||t.recent.length===0?w.jsx("div",{className:"empty-state",children:"No requests recorded yet."}):t.recent.slice(0,30).map((a,o)=>w.jsxs("div",{className:"request-row",children:[w.jsx("span",{className:"request-time",children:cX(a.timestamp)}),w.jsx("span",{className:"request-provider",children:a.provider||"--"}),w.jsx("span",{className:"request-model",children:a.model||"--"}),w.jsx("span",{className:"request-cost",children:fu(a.costUsd)}),w.jsxs("span",{className:"request-tokens",children:[cd(a.totalTokens)," tok"]})]},o))})]})}function dX(e){return e==null?"$0.00":"$"+e.toFixed(6)}function pX(e){return e==null?"0%":(e*100).toFixed(1)+"%"}function hX({data:e}){if(!e)return w.jsx("div",{className:"loading-state",children:w.jsx("p",{children:"Loading benchmark data..."})});const{benchmarks:t}=e,n=t.latest,r=t.runs||[],i=r.map(a=>({name:a.model.length>12?a.model.slice(0,10)+"..":a.model,passRate:a.summary.totalTasks>0?Math.round(a.summary.tasksPassed/a.summary.totalTasks*100):0,quality:Math.round(a.summary.avgQualityScore*100),latency:a.summary.medianLatencyMs,cost:a.summary.totalCostUsd,fullModel:a.model,provider:a.provider})).reverse();return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"📈 Benchmark Results"}),w.jsx("div",{className:"benchmark-latest",children:n?w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"benchmark-header",children:[w.jsx("strong",{children:"Latest Run:"})," ",n.provider,"/",n.model]}),w.jsxs("div",{className:"benchmark-stats",children:[w.jsxs("div",{className:"benchmark-stat pass",children:[w.jsxs("div",{className:"benchmark-stat-value",children:[n.summary.tasksPassed,"/",n.summary.totalTasks]}),w.jsx("div",{className:"benchmark-stat-label",children:"Passed"})]}),w.jsxs("div",{className:"benchmark-stat quality",children:[w.jsx("div",{className:"benchmark-stat-value",children:pX(n.summary.avgQualityScore)}),w.jsx("div",{className:"benchmark-stat-label",children:"Quality"})]}),w.jsxs("div",{className:"benchmark-stat latency",children:[w.jsxs("div",{className:"benchmark-stat-value",children:[n.summary.medianLatencyMs,"ms"]}),w.jsx("div",{className:"benchmark-stat-label",children:"Latency"})]}),w.jsxs("div",{className:"benchmark-stat fail",children:[w.jsx("div",{className:"benchmark-stat-value",children:dX(n.summary.totalCostUsd)}),w.jsx("div",{className:"benchmark-stat-label",children:"Cost"})]})]})]}):w.jsxs("div",{className:"empty-state",children:["No benchmark runs yet. Run ",w.jsx("code",{children:"buff benchmark"})," to start."]})}),i.length>1&&w.jsxs(w.Fragment,{children:[w.jsx("h3",{className:"section-subtitle",children:"Pass Rate by Model"}),w.jsx("div",{className:"chart-container",children:w.jsx(po,{width:"100%",height:260,children:w.jsxs(go,{data:i,margin:{top:20,right:20,left:10,bottom:40},children:[w.jsx(Bi,{strokeDasharray:"3 3",stroke:"#21262d"}),w.jsx(fr,{dataKey:"name",tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(dr,{domain:[0,100],tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"},tickFormatter:a=>a+"%"}),w.jsx(pt,{contentStyle:{background:"#161b22",border:"1px solid #30363d",borderRadius:8},labelStyle:{color:"#e6edf3"},formatter:a=>[a+"%","Pass Rate"]}),w.jsx(nn,{dataKey:"passRate",radius:[4,4,0,0],children:i.map((a,o)=>w.jsx(Rc,{fill:a.passRate>=80?"#3fb950":a.passRate>=50?"#d29922":"#f85149",fillOpacity:.8},o))})]})})}),w.jsx("h3",{className:"section-subtitle",children:"Latency by Model"}),w.jsx("div",{className:"chart-container",children:w.jsx(po,{width:"100%",height:260,children:w.jsxs(go,{data:i,margin:{top:20,right:20,left:10,bottom:40},children:[w.jsx(Bi,{strokeDasharray:"3 3",stroke:"#21262d"}),w.jsx(fr,{dataKey:"name",tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(dr,{tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"},tickFormatter:a=>a+"ms"}),w.jsx(pt,{contentStyle:{background:"#161b22",border:"1px solid #30363d",borderRadius:8},labelStyle:{color:"#e6edf3"},formatter:a=>[a+"ms","Latency"]}),w.jsx(nn,{dataKey:"latency",fill:"#d29922",radius:[4,4,0,0],fillOpacity:.8})]})})}),w.jsx("h3",{className:"section-subtitle",children:"Cost by Model"}),w.jsx("div",{className:"chart-container",children:w.jsx(po,{width:"100%",height:260,children:w.jsxs(go,{data:i,margin:{top:20,right:20,left:10,bottom:40},children:[w.jsx(Bi,{strokeDasharray:"3 3",stroke:"#21262d"}),w.jsx(fr,{dataKey:"name",tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(dr,{tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"},tickFormatter:a=>"$"+a.toFixed(6)}),w.jsx(pt,{contentStyle:{background:"#161b22",border:"1px solid #30363d",borderRadius:8},labelStyle:{color:"#e6edf3"},formatter:a=>["$"+a.toFixed(6),"Cost"]}),w.jsx(nn,{dataKey:"cost",fill:"#bc8cff",radius:[4,4,0,0],fillOpacity:.8})]})})})]}),w.jsx("h3",{className:"section-subtitle",children:"Run History"}),w.jsx("div",{className:"benchmark-list",children:r.length===0?w.jsxs("div",{className:"empty-state",children:["No benchmark runs yet. Run ",w.jsx("code",{children:"buff benchmark"})," to start."]}):r.map(a=>{const o=a.summary.totalTasks>0?Math.round(a.summary.tasksPassed/a.summary.totalTasks*100):0,l=o>=80?"high":o>=50?"medium":"low";return w.jsxs("div",{className:"benchmark-item",children:[w.jsx("span",{className:"benchmark-date",children:new Date(a.startedAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}),w.jsxs("span",{className:"benchmark-model",children:[a.provider,"/",a.model]}),w.jsxs("span",{className:`benchmark-score ${l}`,children:[o,"%"]})]},a.id)})})]})}function fd(e){return e==null?"0":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toLocaleString()}function vX(e){return e==null?"0%":(e*100).toFixed(1)+"%"}function yX({data:e}){if(!e)return w.jsx("div",{className:"loading-state",children:w.jsx("p",{children:"Loading memory data..."})});const{memory:t,health:n}=e,r=Object.entries(t.byFingerprint||{}).sort(([,i],[,a])=>a-i);return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"💾 Memory Store"}),w.jsxs("div",{className:"stats-grid mini",children:[w.jsxs("div",{className:"stat-card",children:[w.jsx("div",{className:"stat-value",children:fd(t.total)}),w.jsx("div",{className:"stat-label",children:"Trajectories"})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("div",{className:"stat-value",children:vX(t.avgScore)}),w.jsx("div",{className:"stat-label",children:"Avg Score"})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("div",{className:"stat-value",children:fd(n==null?void 0:n.patterns)}),w.jsx("div",{className:"stat-label",children:"Coding Patterns"})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("div",{className:"stat-value",children:fd(n==null?void 0:n.feedback)}),w.jsx("div",{className:"stat-label",children:"Feedback Ratings"})]})]}),r.length>0&&w.jsxs(w.Fragment,{children:[w.jsx("h3",{className:"section-subtitle",children:"By Project Type"}),w.jsx("div",{className:"memory-list",children:r.map(([i,a])=>w.jsxs("div",{className:"memory-item",children:[w.jsx("span",{className:"memory-project",children:i}),w.jsxs("span",{className:"memory-count",children:[a," trajectory(ies)"]})]},i))})]})]})}function dd(e){return e==null?"0":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toLocaleString()}function mX({data:e}){if(!e)return w.jsx("div",{className:"loading-state",children:w.jsx("p",{children:"Loading system data..."})});const{health:t,serverTime:n}=e;return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"⚙️ System Health"}),w.jsxs("div",{className:"health-grid",children:[w.jsxs("div",{className:"health-card",children:[w.jsx("span",{className:"health-icon",children:"💾"}),w.jsxs("div",{className:"health-body",children:[w.jsx("div",{className:"health-title",children:"Memory Directory"}),w.jsx("div",{className:"health-path",children:t.memoryDir||"~/.buff/memory/"})]})]}),w.jsxs("div",{className:"health-card",children:[w.jsx("span",{className:"health-icon",children:"📝"}),w.jsxs("div",{className:"health-body",children:[w.jsx("div",{className:"health-title",children:"Coding Patterns"}),w.jsx("div",{className:"health-value",children:dd(t.patterns)})]})]}),w.jsxs("div",{className:"health-card",children:[w.jsx("span",{className:"health-icon",children:"👍"}),w.jsxs("div",{className:"health-body",children:[w.jsx("div",{className:"health-title",children:"User Feedback"}),w.jsxs("div",{className:"health-value",children:[dd(t.feedback)," ratings"]})]})]}),w.jsxs("div",{className:"health-card",children:[w.jsx("span",{className:"health-icon",children:"🧠"}),w.jsxs("div",{className:"health-body",children:[w.jsx("div",{className:"health-title",children:"Vector Index"}),w.jsxs("div",{className:"health-value",children:[dd(t.vectors)," entries"]})]})]})]}),w.jsx("h3",{className:"section-subtitle",children:"Server Info"}),w.jsxs("div",{className:"server-info",children:[w.jsxs("div",{className:"info-row",children:[w.jsx("span",{className:"info-label",children:"Status"}),w.jsx("span",{className:"info-value",children:"● Connected"})]}),w.jsxs("div",{className:"info-row",children:[w.jsx("span",{className:"info-label",children:"Last Updated"}),w.jsx("span",{className:"info-value",children:n?new Date(n).toLocaleString():"--"})]}),w.jsxs("div",{className:"info-row",children:[w.jsx("span",{className:"info-label",children:"Data Directory"}),w.jsx("span",{className:"info-value",children:t.memoryDir||"~/.buff/memory/"})]})]})]})}const gX=new Set(["local","lmstudio","vllm"]),Xs={available:{bg:"#0a2e1a",text:"#3fb950",dot:"#3fb950",cardBorder:"#3fb950",cardBg:"#0d2818"},limited:{bg:"#2d1f00",text:"#d29922",dot:"#d29922",cardBorder:"#d29922",cardBg:"#1f1700"},unavailable:{bg:"#2d0f0f",text:"#f85149",dot:"#f85149",cardBorder:"#f85149",cardBg:"#1f0a0a"}};function bX(e){return e==="available"?"Available":e==="limited"?"Limited":"Unavailable"}function xX(e){return e==="available"?"Ready":e==="limited"?"Limited":"Down"}function wX(e){return{local:"💻",groq:"🟢",nim:"🔶",gemini:"🔷",openrouter:"🟣",openai:"🤖",anthropic:"🔮",mistral:"🌀",cohere:"🧠",together:"🟢",deepinfra:"🌐",fireworks:"🎆",perplexity:"❓",azure:"🔵",anyscale:"🔷",lmstudio:"🎨",vllm:"⚡"}[e]||"🔌"}function SX(e){return{local:"Ollama",groq:"Groq",nim:"NVIDIA NIM",gemini:"Gemini",openrouter:"OpenRouter",openai:"OpenAI",anthropic:"Anthropic",mistral:"Mistral",cohere:"Cohere",together:"Together AI",deepinfra:"DeepInfra",fireworks:"Fireworks AI",perplexity:"Perplexity",azure:"Azure OpenAI",anyscale:"Anyscale",lmstudio:"LM Studio",vllm:"vLLM / TGI"}[e]||e}function Gx({status:e,label:t}){const n=Xs[e];return w.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,background:n.bg,color:n.text,padding:"3px 10px",borderRadius:12,fontSize:12,fontWeight:500,border:`1px solid ${n.text}22`},children:[w.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:n.dot}}),t]})}function OX({onRefresh:e,loading:t}){return w.jsxs("div",{className:"stats-grid mini",style:{marginBottom:16},children:[w.jsx("button",{onClick:e,disabled:t,className:"stat-card",style:{cursor:t?"not-allowed":"pointer",opacity:t?.6:1,border:"1px solid #30363d",justifyContent:"center",fontSize:13},children:t?"⏳ Testing...":"🔄 Refresh Status"}),w.jsx("div",{className:"stat-card",style:{border:"1px solid #30363d"},children:w.jsx("div",{style:{fontSize:13,color:"#8b949e",textAlign:"center",width:"100%"},children:"Tests all configured providers and their API keys in real time"})})]})}function _X({data:e}){const t=e.totalModels;if(t===0)return null;const n=e.available||0,r=e.limited||0,i=e.unavailable||0;return w.jsxs("div",{style:{marginBottom:16},children:[w.jsxs("div",{style:{background:"#0d1117",borderRadius:8,overflow:"hidden",height:10,display:"flex",border:"1px solid #21262d"},children:[n>0&&w.jsx("div",{style:{width:`${n/t*100}%`,background:"#3fb950",transition:"width 0.5s"},title:`${n} available`}),r>0&&w.jsx("div",{style:{width:`${r/t*100}%`,background:"#d29922",transition:"width 0.5s"},title:`${r} limited`}),i>0&&w.jsx("div",{style:{width:`${i/t*100}%`,background:"#f85149",transition:"width 0.5s"},title:`${i} unavailable`})]}),w.jsxs("div",{style:{display:"flex",gap:16,marginTop:6,fontSize:12,color:"#8b949e"},children:[w.jsxs("span",{children:[w.jsx("span",{style:{color:"#3fb950"},children:"●"})," Ready"]}),w.jsxs("span",{children:[w.jsx("span",{style:{color:"#d29922"},children:"●"})," Limited"]}),w.jsxs("span",{children:[w.jsx("span",{style:{color:"#f85149"},children:"●"})," Unavailable"]})]})]})}function pd({provider:e}){const[t,n]=A.useState(!1),r=Xs[e.overallStatus].text,i={available:e.models.filter(a=>a.status==="available").length,limited:e.models.filter(a=>a.status==="limited").length,unavailable:e.models.filter(a=>a.status==="unavailable").length};return w.jsxs("div",{style:{background:"#161b22",borderRadius:12,border:`1px solid ${r}44`,borderLeft:`4px solid ${r}`,marginBottom:12,overflow:"hidden"},children:[w.jsxs("div",{onClick:()=>n(!t),style:{padding:"14px 18px",cursor:"pointer",display:"flex",alignItems:"center",gap:14,userSelect:"none"},children:[w.jsx("span",{style:{fontSize:24},children:e.icon}),w.jsxs("div",{style:{flex:1},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:2},children:[w.jsx("span",{style:{fontSize:16,fontWeight:600,color:"#e6edf3"},children:e.providerLabel}),w.jsx(Gx,{status:e.overallStatus,label:bX(e.overallStatus)})]}),w.jsxs("div",{style:{fontSize:13,color:"#8b949e"},children:[e.models.length," model",e.models.length!==1?"s":"",i.available>0&&w.jsxs("span",{style:{color:"#3fb950"},children:[" · ",i.available," ready"]}),i.limited>0&&w.jsxs("span",{style:{color:"#d29922"},children:[" · ",i.limited," limited"]}),i.unavailable>0&&w.jsxs("span",{style:{color:"#f85149"},children:[" · ",i.unavailable," unavailable"]})]})]}),w.jsxs("div",{style:{fontSize:12,color:"#8b949e",textAlign:"right"},children:[w.jsx("div",{style:{marginBottom:2,color:e.apiConfigured?"#3fb950":"#f85149"},children:e.apiConfigured?"✅ Key set":"❌ No key"}),w.jsx("div",{style:{color:e.apiAccessible?"#3fb950":"#f85149"},children:e.apiAccessible?"✅ Connected":"❌ Offline"})]}),w.jsx("span",{style:{color:"#8b949e",fontSize:18,transition:"transform 0.2s",transform:t?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),t&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{style:{padding:"10px 18px",background:"#0d1117",fontSize:13,color:"#8b949e",display:"flex",justifyContent:"space-between",flexWrap:"wrap",gap:8,borderTop:"1px solid #21262d"},children:[w.jsx("span",{children:e.notes}),e.freeTierInfo&&w.jsxs("span",{style:{color:"#d29922"},children:["🎁 ",e.freeTierInfo]})]}),w.jsx("div",{style:{overflowX:"auto",borderTop:"1px solid #21262d"},children:w.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[w.jsx("thead",{children:w.jsxs("tr",{style:{borderBottom:"1px solid #21262d",color:"#8b949e"},children:[w.jsx("th",{style:{padding:"8px 18px",textAlign:"left",fontWeight:500},children:"Model"}),w.jsx("th",{style:{padding:"8px 12px",textAlign:"left",fontWeight:500},children:"Status"}),w.jsx("th",{style:{padding:"8px 12px",textAlign:"left",fontWeight:500},children:"Quota"}),w.jsx("th",{style:{padding:"8px 18px",textAlign:"left",fontWeight:500},children:"Details"})]})}),w.jsx("tbody",{children:e.models.map((a,o)=>w.jsxs("tr",{style:{borderBottom:o<e.models.length-1?"1px solid #21262d":"none",background:a.status==="unavailable"?"#0d1117":"transparent"},children:[w.jsxs("td",{style:{padding:"8px 18px",color:"#e6edf3",fontFamily:"'SFMono-Regular', Consolas, monospace",fontSize:12},children:[w.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:Xs[a.status].dot,marginRight:8}}),a.name]}),w.jsx("td",{style:{padding:"8px 12px"},children:w.jsx(Gx,{status:a.status,label:xX(a.status)})}),w.jsx("td",{style:{padding:"8px 12px",color:"#8b949e",fontSize:12,fontFamily:"'SFMono-Regular', Consolas, monospace"},children:a.rateLimitRemaining!==void 0?a.rateLimitTotal?`${a.rateLimitRemaining}/${a.rateLimitTotal}`:`${a.rateLimitRemaining} left`:"—"}),w.jsx("td",{style:{padding:"8px 18px",color:"#8b949e",fontSize:12},children:a.statusReason})]},a.id))})]})})]})]})}function hd({icon:e,title:t,count:n}){return n===0?null:w.jsxs("h3",{style:{fontSize:15,fontWeight:600,color:"#e6edf3",margin:"24px 0 12px 0",display:"flex",alignItems:"center",gap:8},children:[w.jsx("span",{children:e})," ",t,w.jsx("span",{style:{fontSize:12,color:"#8b949e",fontWeight:400,background:"#161b22",padding:"1px 8px",borderRadius:8},children:n})]})}function PX({model:e,provider:t}){const n=Xs[e.status],r=e.rateLimitRemaining!==void 0?e.rateLimitTotal?`${e.rateLimitRemaining} / ${e.rateLimitTotal}`:`${e.rateLimitRemaining} left`:"Unlimited";return w.jsxs("div",{style:{background:n.cardBg,border:`1px solid ${n.cardBorder}44`,borderRadius:12,padding:16,display:"flex",flexDirection:"column",gap:8,transition:"all 0.2s ease",cursor:"default",position:"relative",overflow:"hidden"},onMouseEnter:i=>{i.currentTarget.style.borderColor=n.cardBorder,i.currentTarget.style.transform="translateY(-2px)",i.currentTarget.style.boxShadow=`0 4px 16px ${n.cardBorder}22`},onMouseLeave:i=>{i.currentTarget.style.borderColor=`${n.cardBorder}44`,i.currentTarget.style.transform="none",i.currentTarget.style.boxShadow="none"},children:[w.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:3,background:n.cardBorder,opacity:.6}}),w.jsx("div",{style:{fontSize:14,fontWeight:600,color:"#e6edf3",fontFamily:"'SFMono-Regular', Consolas, monospace",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",paddingTop:4},children:e.name.length>30?e.name.slice(0,28)+"…":e.name}),w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12,color:"#8b949e"},children:[w.jsx("span",{children:wX(t)}),w.jsx("span",{children:SX(t)})]}),w.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,background:n.bg,color:n.text,padding:"4px 10px",borderRadius:8,fontSize:12,fontWeight:600,alignSelf:"flex-start"},children:[w.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:n.dot}}),e.status==="available"?"Available":e.status==="limited"?"Limited":"Unavailable"]}),w.jsxs("div",{style:{fontSize:11,color:"#6e7681",marginTop:"auto"},children:[w.jsx("span",{style:{color:"#8b949e"},children:"Quota:"})," ",w.jsx("span",{style:{color:e.rateLimitRemaining!==void 0&&e.rateLimitRemaining<=10?"#d29922":"#8b949e",fontFamily:"'SFMono-Regular', Consolas, monospace"},children:r})]}),e.statusReason&&e.status!=="available"&&w.jsx("div",{style:{fontSize:10,color:"#6e7681",marginTop:2},children:e.statusReason.length>40?e.statusReason.slice(0,38)+"…":e.statusReason})]})}function jX({providers:e}){const t=[];for(const r of e)for(const i of r.models)t.push({model:i,provider:r.provider});if(t.length===0)return null;const n={available:0,limited:1,unavailable:2};return t.sort((r,i)=>n[r.model.status]-n[i.model.status]),w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",style:{marginTop:36},children:"📋 Model Health Overview"}),w.jsx("p",{className:"section-description",children:"All models across all providers, color-coded by health status. Green = ready, Amber = limited quota, Red = unavailable."}),w.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))",gap:14},children:t.map(({model:r,provider:i})=>w.jsx(PX,{model:r,provider:i},`${i}-${r.id}`))})]})}function AX(){return w.jsxs("div",{style:{background:"#0d1117",borderRadius:10,padding:14,marginBottom:20,border:"1px solid #21262d",fontSize:13,color:"#8b949e",display:"flex",flexWrap:"wrap",gap:20},children:[w.jsxs("div",{children:[w.jsx("div",{style:{fontWeight:600,color:"#e6edf3",marginBottom:6},children:"Color Coding"}),w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[w.jsxs("span",{children:[w.jsx("span",{style:{color:"#3fb950"},children:"●"})," ",w.jsx("strong",{style:{color:"#e6edf3"},children:"Green"})," — Working with rate limit available"]}),w.jsxs("span",{children:[w.jsx("span",{style:{color:"#d29922"},children:"●"})," ",w.jsx("strong",{style:{color:"#e6edf3"},children:"Amber"})," — Slow / low rate limit / needs action"]}),w.jsxs("span",{children:[w.jsx("span",{style:{color:"#f85149"},children:"●"})," ",w.jsx("strong",{style:{color:"#e6edf3"},children:"Red"})," — API key missing / payment needed / unreachable"]})]})]}),w.jsxs("div",{children:[w.jsx("div",{style:{fontWeight:600,color:"#e6edf3",marginBottom:6},children:"Provider Sections"}),w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[w.jsxs("span",{children:["✅ ",w.jsx("strong",{children:"Cloud"})," — Online providers with active API keys"]}),w.jsxs("span",{children:["🏠 ",w.jsx("strong",{children:"Local"})," — Locally running inference servers"]}),w.jsxs("span",{children:["⛔ ",w.jsx("strong",{children:"Unavailable"})," — Missing keys or unreachable endpoints"]})]})]})]})}function EX(){const[e,t]=A.useState(null),[n,r]=A.useState(!0),[i,a]=A.useState(null),o=A.useRef(!0);async function l(){r(!0),a(null);try{const s=await fetch("/api/models");if(!o.current)return;if(!s.ok)throw new Error(`HTTP ${s.status}`);const f=await s.json();o.current&&t(f)}catch(s){o.current&&a(s instanceof Error?s.message:"Failed to fetch model status")}finally{o.current&&r(!1)}}A.useEffect(()=>{o.current=!0,l();const s=setInterval(l,6e4);return()=>{o.current=!1,clearInterval(s)}},[]);function u(s){const f=[],c=[],d=[],p={available:0,limited:1,unavailable:2};for(const x of s.providers)gX.has(x.provider)?c.push(x):x.overallStatus==="available"?f.push(x):d.push(x);return f.sort((x,b)=>p[x.overallStatus]-p[b.overallStatus]),c.sort((x,b)=>p[x.overallStatus]-p[b.overallStatus]),d.sort((x,b)=>p[x.overallStatus]-p[b.overallStatus]),{available:f,local:c,unavailable:d}}return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"🧠 Model Provider Status"}),w.jsx("p",{className:"section-description",children:"Real-time health check of all AI providers and their available models. Providers are grouped into sections: Available cloud → Local → Unavailable."}),w.jsx(OX,{onRefresh:l,loading:n}),w.jsx(AX,{}),n&&!e&&w.jsxs("div",{className:"loading-state",children:[w.jsx("div",{className:"loading-spinner"}),w.jsx("p",{children:"Testing all 17 provider connections..."})]}),i&&w.jsxs("div",{className:"empty-state",style:{color:"#f85149",border:"1px solid #f8514944",borderRadius:10,padding:16,marginBottom:16},children:["⚠️ ",i]}),e&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"stats-grid",style:{marginBottom:16},children:[w.jsxs("div",{className:"stat-card",children:[w.jsx("span",{className:"stat-icon",children:"🧠"}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",children:e.totalModels}),w.jsx("div",{className:"stat-label",children:"Total Models"})]})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("span",{className:"stat-icon",children:"✅"}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",style:{color:"#3fb950"},children:e.available}),w.jsx("div",{className:"stat-label",children:"Available"})]})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("span",{className:"stat-icon",children:"🟡"}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",style:{color:"#d29922"},children:e.limited}),w.jsx("div",{className:"stat-label",children:"Limited"})]})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("span",{className:"stat-icon",children:"🔴"}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",style:{color:"#f85149"},children:e.unavailable}),w.jsx("div",{className:"stat-label",children:"Unavailable"})]})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("span",{className:"stat-icon",children:"🔌"}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",children:e.providers.length}),w.jsx("div",{className:"stat-label",children:"Providers"})]})]})]}),w.jsx(_X,{data:e}),(()=>{const{available:s,local:f,unavailable:c}=u(e);return w.jsxs(w.Fragment,{children:[w.jsx(hd,{icon:"✅",title:"Available Cloud Providers",count:s.length}),s.map(d=>w.jsx(pd,{provider:d},d.provider)),w.jsx(hd,{icon:"🏠",title:"Local Providers",count:f.length}),f.map(d=>w.jsx(pd,{provider:d},d.provider)),w.jsx(hd,{icon:"⛔",title:"Unavailable Providers",count:c.length}),c.map(d=>w.jsx(pd,{provider:d},d.provider))]})})(),w.jsx(jX,{providers:e.providers}),w.jsxs("div",{style:{textAlign:"center",fontSize:12,color:"#484f58",marginTop:16},children:["Last checked: ",new Date(e.lastChecked).toLocaleTimeString()," · ","Auto-refreshes every 60s"]})]})]})}function $X(){const[e,t]=A.useState(null),[n,r]=A.useState(!1),[i,a]=A.useState("--"),o=A.useCallback(u=>{t(u),a(new Date().toLocaleTimeString())},[]),l=A.useCallback(u=>{r(u)},[]);return A.useEffect(()=>{pi.fetchAll().then(f=>{f&&o(f)});const u=pi.subscribe(o),s=pi.onConnectionChange(l);return pi.connect(),()=>{u(),s(),pi.disconnect()}},[o,l]),w.jsx(j$,{connected:n,lastUpdated:i,children:w.jsxs(u$,{children:[w.jsx(ln,{path:"/",element:w.jsx(rX,{data:e})}),w.jsx(ln,{path:"/dag",element:w.jsx(lX,{data:e})}),w.jsx(ln,{path:"/history",element:w.jsx(sX,{data:e})}),w.jsx(ln,{path:"/costs",element:w.jsx(fX,{data:e})}),w.jsx(ln,{path:"/benchmarks",element:w.jsx(hX,{data:e})}),w.jsx(ln,{path:"/memory",element:w.jsx(yX,{data:e})}),w.jsx(ln,{path:"/models",element:w.jsx(EX,{})}),w.jsx(ln,{path:"/system",element:w.jsx(mX,{data:e})}),w.jsx(ln,{path:"*",element:w.jsx(o$,{to:"/",replace:!0})})]})})}aS(document.getElementById("root")).render(w.jsx(A.StrictMode,{children:w.jsx(y$,{children:w.jsx($X,{})})}));
135
- //# sourceMappingURL=index-B765Xf_a.js.map
134
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RP(e,t){if(e){if(typeof e=="string")return Ch(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ch(e,t)}}function Fq(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Uq(e){if(Array.isArray(e))return Ch(e)}function Ch(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Lx(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 N(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Lx(Object(n),!0).forEach(function(r){Y(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lx(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Y(e,t,n){return t=BP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BP(e){var t=Wq(e,"string");return pa(t)=="symbol"?t:t+""}function Wq(e,t){if(pa(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(pa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Hq={xAxis:["bottom","top"],yAxis:["left","right"]},Vq={width:"100%",height:"100%"},zP={x:0,y:0};function cu(e){return e}var Gq=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},Kq=function(t,n,r,i){var a=n.find(function(f){return f&&f.index===r});if(a){if(t==="horizontal")return{x:a.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:a.coordinate};if(t==="centric"){var o=a.coordinate,l=i.radius;return N(N(N({},i),Ye(i.cx,i.cy,l,o)),{},{angle:o,radius:l})}var u=a.coordinate,s=i.angle;return N(N(N({},i),Ye(i.cx,i.cy,u,s)),{},{angle:s,radius:u})}return zP},rf=function(t,n){var r=n.graphicalItems,i=n.dataStartIndex,a=n.dataEndIndex,o=(r??[]).reduce(function(l,u){var s=u.props.data;return s&&s.length?[].concat(ha(l),ha(s)):l},[]);return o.length>0?o:t&&t.length&&H(i)&&H(a)?t.slice(i,a+1):[]};function FP(e){return e==="number"?[0,"auto"]:void 0}var kh=function(t,n,r,i){var a=t.graphicalItems,o=t.tooltipAxis,l=rf(n,t);return r<0||!a||!a.length||r>=l.length?null:a.reduce(function(u,s){var f,c=(f=s.props.data)!==null&&f!==void 0?f:n;c&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(c=c.slice(t.dataStartIndex,t.dataEndIndex+1));var d;if(o.dataKey&&!o.allowDuplicatedCategory){var p=c===void 0?l:c;d=fp(p,o.dataKey,i)}else d=c&&c[r]||l[r];return d?[].concat(ha(u),[R_(s,d)]):u},[])},Rx=function(t,n,r,i){var a=i||{x:t.chartX,y:t.chartY},o=Gq(a,r),l=t.orderedTooltipTicks,u=t.tooltipAxis,s=t.tooltipTicks,f=mU(o,l,s,u);if(f>=0&&s){var c=s[f]&&s[f].value,d=kh(t,n,f,c),p=Kq(r,l,f,a);return{activeTooltipIndex:f,activeLabel:c,activePayload:d,activeCoordinate:p}}return null},qq=function(t,n){var r=n.axes,i=n.graphicalItems,a=n.axisType,o=n.axisIdKey,l=n.stackGroups,u=n.dataStartIndex,s=n.dataEndIndex,f=t.layout,c=t.children,d=t.stackOffset,p=I_(f,a);return r.reduce(function(x,b){var m,y=b.type.defaultProps!==void 0?N(N({},b.type.defaultProps),b.props):b.props,v=y.type,g=y.dataKey,O=y.allowDataOverflow,h=y.allowDuplicatedCategory,S=y.scale,_=y.ticks,P=y.includeHidden,j=y[o];if(x[j])return x;var T=rf(t.data,{graphicalItems:i.filter(function(W){var X,te=o in W.props?W.props[o]:(X=W.type.defaultProps)===null||X===void 0?void 0:X[o];return te===j}),dataStartIndex:u,dataEndIndex:s}),k=T.length,$,D,I;xq(y.domain,O,v)&&($=Zp(y.domain,null,O),p&&(v==="number"||S!=="auto")&&(I=yo(T,g,"category")));var M=FP(v);if(!$||$.length===0){var R,z=(R=y.domain)!==null&&R!==void 0?R:M;if(g){if($=yo(T,g,v),v==="category"&&p){var C=ak($);h&&C?(D=$,$=Ds(0,k)):h||($=wb(z,$,b).reduce(function(W,X){return W.indexOf(X)>=0?W:[].concat(ha(W),[X])},[]))}else if(v==="category")h?$=$.filter(function(W){return W!==""&&!le(W)}):$=wb(z,$,b).reduce(function(W,X){return W.indexOf(X)>=0||X===""||le(X)?W:[].concat(ha(W),[X])},[]);else if(v==="number"){var L=SU(T,i.filter(function(W){var X,te,xe=o in W.props?W.props[o]:(X=W.type.defaultProps)===null||X===void 0?void 0:X[o],Te="hide"in W.props?W.props.hide:(te=W.type.defaultProps)===null||te===void 0?void 0:te.hide;return xe===j&&(P||!Te)}),g,a,f);L&&($=L)}p&&(v==="number"||S!=="auto")&&(I=yo(T,g,"category"))}else p?$=Ds(0,k):l&&l[j]&&l[j].hasStack&&v==="number"?$=d==="expand"?[0,1]:L_(l[j].stackGroups,u,s):$=M_(T,i.filter(function(W){var X=o in W.props?W.props[o]:W.type.defaultProps[o],te="hide"in W.props?W.props.hide:W.type.defaultProps.hide;return X===j&&(P||!te)}),v,f,!0);if(v==="number")$=$h(c,$,j,a,_),z&&($=Zp(z,$,O));else if(v==="category"&&z){var B=z,V=$.every(function(W){return B.indexOf(W)>=0});V&&($=B)}}return N(N({},x),{},Y({},j,N(N({},y),{},{axisType:a,domain:$,categoricalDomain:I,duplicateDomain:D,originalDomain:(m=y.domain)!==null&&m!==void 0?m:M,isCategorical:p,layout:f})))},{})},Xq=function(t,n){var r=n.graphicalItems,i=n.Axis,a=n.axisType,o=n.axisIdKey,l=n.stackGroups,u=n.dataStartIndex,s=n.dataEndIndex,f=t.layout,c=t.children,d=rf(t.data,{graphicalItems:r,dataStartIndex:u,dataEndIndex:s}),p=d.length,x=I_(f,a),b=-1;return r.reduce(function(m,y){var v=y.type.defaultProps!==void 0?N(N({},y.type.defaultProps),y.props):y.props,g=v[o],O=FP("number");if(!m[g]){b++;var h;return x?h=Ds(0,p):l&&l[g]&&l[g].hasStack?(h=L_(l[g].stackGroups,u,s),h=$h(c,h,g,a)):(h=Zp(O,M_(d,r.filter(function(S){var _,P,j=o in S.props?S.props[o]:(_=S.type.defaultProps)===null||_===void 0?void 0:_[o],T="hide"in S.props?S.props.hide:(P=S.type.defaultProps)===null||P===void 0?void 0:P.hide;return j===g&&!T}),"number",f),i.defaultProps.allowDataOverflow),h=$h(c,h,g,a)),N(N({},m),{},Y({},g,N(N({axisType:a},i.defaultProps),{},{hide:!0,orientation:Bt(Hq,"".concat(a,".").concat(b%2),null),domain:h,originalDomain:O,isCategorical:x,layout:f})))}return m},{})},Yq=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,a=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,u=n.dataStartIndex,s=n.dataEndIndex,f=t.children,c="".concat(i,"Id"),d=tn(f,a),p={};return d&&d.length?p=qq(t,{axes:d,graphicalItems:o,axisType:i,axisIdKey:c,stackGroups:l,dataStartIndex:u,dataEndIndex:s}):o&&o.length&&(p=Xq(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:c,stackGroups:l,dataStartIndex:u,dataEndIndex:s})),p},Qq=function(t){var n=Yn(t),r=Pn(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Jv(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:js(n,r)}},Bx=function(t){var n=t.children,r=t.defaultShowTooltip,i=Ot(n,aa),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},Zq=function(t){return!t||!t.length?!1:t.some(function(n){var r=An(n&&n.type);return r&&r.indexOf("Bar")>=0})},zx=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Jq=function(t,n){var r=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,l=t.yAxisMap,u=l===void 0?{}:l,s=r.width,f=r.height,c=r.children,d=r.margin||{},p=Ot(c,aa),x=Ot(c,Di),b=Object.keys(u).reduce(function(h,S){var _=u[S],P=_.orientation;return!_.mirror&&!_.hide?N(N({},h),{},Y({},P,h[P]+_.width)):h},{left:d.left||0,right:d.right||0}),m=Object.keys(o).reduce(function(h,S){var _=o[S],P=_.orientation;return!_.mirror&&!_.hide?N(N({},h),{},Y({},P,Bt(h,"".concat(P))+_.height)):h},{top:d.top||0,bottom:d.bottom||0}),y=N(N({},m),b),v=y.bottom;p&&(y.bottom+=p.props.height||aa.defaultProps.height),x&&n&&(y=xU(y,i,r,n));var g=s-y.left-y.right,O=f-y.top-y.bottom;return N(N({brushBottom:v},y),{},{width:Math.max(g,0),height:Math.max(O,0)})},eX=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},tX=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,u=t.axisComponents,s=t.legendContent,f=t.formatAxisMap,c=t.defaultProps,d=function(y,v){var g=v.graphicalItems,O=v.stackGroups,h=v.offset,S=v.updateId,_=v.dataStartIndex,P=v.dataEndIndex,j=y.barSize,T=y.layout,k=y.barGap,$=y.barCategoryGap,D=y.maxBarSize,I=zx(T),M=I.numericAxisName,R=I.cateAxisName,z=Zq(g),C=[];return g.forEach(function(L,B){var V=rf(y.data,{graphicalItems:[L],dataStartIndex:_,dataEndIndex:P}),W=L.type.defaultProps!==void 0?N(N({},L.type.defaultProps),L.props):L.props,X=W.dataKey,te=W.maxBarSize,xe=W["".concat(M,"Id")],Te=W["".concat(R,"Id")],Tt={},ft=u.reduce(function(Pr,jr){var af=v["".concat(jr.axisType,"Map")],Ly=W["".concat(jr.axisType,"Id")];af&&af[Ly]||jr.axisType==="zAxis"||Jr();var Ry=af[Ly];return N(N({},Pr),{},Y(Y({},jr.axisType,Ry),"".concat(jr.axisType,"Ticks"),Pn(Ry)))},Tt),G=ft[R],Q=ft["".concat(R,"Ticks")],Z=O&&O[xe]&&O[xe].hasStack&&MU(L,O[xe].stackGroups),F=An(L.type).indexOf("Bar")>=0,Ae=js(G,Q),ne=[],Ie=z&&gU({barSize:j,stackGroups:O,totalSize:eX(ft,R)});if(F){var De,dt,Un=le(te)?D:te,li=(De=(dt=js(G,Q,!0))!==null&&dt!==void 0?dt:Un)!==null&&De!==void 0?De:0;ne=bU({barGap:k,barCategoryGap:$,bandSize:li!==Ae?li:Ae,sizeList:Ie[Te],maxBarSize:Un}),li!==Ae&&(ne=ne.map(function(Pr){return N(N({},Pr),{},{position:N(N({},Pr.position),{},{offset:Pr.position.offset-li/2})})}))}var kl=L&&L.type&&L.type.getComposedData;kl&&C.push({props:N(N({},kl(N(N({},ft),{},{displayedData:V,props:y,dataKey:X,item:L,bandSize:Ae,barPosition:ne,offset:h,stackedData:Z,layout:T,dataStartIndex:_,dataEndIndex:P}))),{},Y(Y(Y({key:L.key||"item-".concat(B)},M,ft[M]),R,ft[R]),"animationId",S)),childIndex:mk(L,y.children),item:L})}),C},p=function(y,v){var g=y.props,O=y.dataStartIndex,h=y.dataEndIndex,S=y.updateId;if(!vg({props:g}))return null;var _=g.children,P=g.layout,j=g.stackOffset,T=g.data,k=g.reverseStackOrder,$=zx(P),D=$.numericAxisName,I=$.cateAxisName,M=tn(_,r),R=CU(T,M,"".concat(D,"Id"),"".concat(I,"Id"),j,k),z=u.reduce(function(W,X){var te="".concat(X.axisType,"Map");return N(N({},W),{},Y({},te,Yq(g,N(N({},X),{},{graphicalItems:M,stackGroups:X.axisType===D&&R,dataStartIndex:O,dataEndIndex:h}))))},{}),C=Jq(N(N({},z),{},{props:g,graphicalItems:M}),v==null?void 0:v.legendBBox);Object.keys(z).forEach(function(W){z[W]=f(g,z[W],C,W.replace("Map",""),n)});var L=z["".concat(I,"Map")],B=Qq(L),V=d(g,N(N({},z),{},{dataStartIndex:O,dataEndIndex:h,updateId:S,graphicalItems:M,stackGroups:R,offset:C}));return N(N({formattedGraphicalItems:V,graphicalItems:M,offset:C,stackGroups:R},B),z)},x=function(m){function y(v){var g,O,h;return Nq(this,y),h=Dq(this,y,[v]),Y(h,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Y(h,"accessibilityManager",new bq),Y(h,"handleLegendBBoxUpdate",function(S){if(S){var _=h.state,P=_.dataStartIndex,j=_.dataEndIndex,T=_.updateId;h.setState(N({legendBBox:S},p({props:h.props,dataStartIndex:P,dataEndIndex:j,updateId:T},N(N({},h.state),{},{legendBBox:S}))))}}),Y(h,"handleReceiveSyncEvent",function(S,_,P){if(h.props.syncId===S){if(P===h.eventEmitterSymbol&&typeof h.props.syncMethod!="function")return;h.applySyncEvent(_)}}),Y(h,"handleBrushChange",function(S){var _=S.startIndex,P=S.endIndex;if(_!==h.state.dataStartIndex||P!==h.state.dataEndIndex){var j=h.state.updateId;h.setState(function(){return N({dataStartIndex:_,dataEndIndex:P},p({props:h.props,dataStartIndex:_,dataEndIndex:P,updateId:j},h.state))}),h.triggerSyncEvent({dataStartIndex:_,dataEndIndex:P})}}),Y(h,"handleMouseEnter",function(S){var _=h.getMouseInfo(S);if(_){var P=N(N({},_),{},{isTooltipActive:!0});h.setState(P),h.triggerSyncEvent(P);var j=h.props.onMouseEnter;J(j)&&j(P,S)}}),Y(h,"triggeredAfterMouseMove",function(S){var _=h.getMouseInfo(S),P=_?N(N({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};h.setState(P),h.triggerSyncEvent(P);var j=h.props.onMouseMove;J(j)&&j(P,S)}),Y(h,"handleItemMouseEnter",function(S){h.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),Y(h,"handleItemMouseLeave",function(){h.setState(function(){return{isTooltipActive:!1}})}),Y(h,"handleMouseMove",function(S){S.persist(),h.throttleTriggeredAfterMouseMove(S)}),Y(h,"handleMouseLeave",function(S){h.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};h.setState(_),h.triggerSyncEvent(_);var P=h.props.onMouseLeave;J(P)&&P(_,S)}),Y(h,"handleOuterEvent",function(S){var _=yk(S),P=Bt(h.props,"".concat(_));if(_&&J(P)){var j,T;/.*touch.*/i.test(_)?T=h.getMouseInfo(S.changedTouches[0]):T=h.getMouseInfo(S),P((j=T)!==null&&j!==void 0?j:{},S)}}),Y(h,"handleClick",function(S){var _=h.getMouseInfo(S);if(_){var P=N(N({},_),{},{isTooltipActive:!0});h.setState(P),h.triggerSyncEvent(P);var j=h.props.onClick;J(j)&&j(P,S)}}),Y(h,"handleMouseDown",function(S){var _=h.props.onMouseDown;if(J(_)){var P=h.getMouseInfo(S);_(P,S)}}),Y(h,"handleMouseUp",function(S){var _=h.props.onMouseUp;if(J(_)){var P=h.getMouseInfo(S);_(P,S)}}),Y(h,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&h.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),Y(h,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&h.handleMouseDown(S.changedTouches[0])}),Y(h,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&h.handleMouseUp(S.changedTouches[0])}),Y(h,"handleDoubleClick",function(S){var _=h.props.onDoubleClick;if(J(_)){var P=h.getMouseInfo(S);_(P,S)}}),Y(h,"handleContextMenu",function(S){var _=h.props.onContextMenu;if(J(_)){var P=h.getMouseInfo(S);_(P,S)}}),Y(h,"triggerSyncEvent",function(S){h.props.syncId!==void 0&&ad.emit(od,h.props.syncId,S,h.eventEmitterSymbol)}),Y(h,"applySyncEvent",function(S){var _=h.props,P=_.layout,j=_.syncMethod,T=h.state.updateId,k=S.dataStartIndex,$=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)h.setState(N({dataStartIndex:k,dataEndIndex:$},p({props:h.props,dataStartIndex:k,dataEndIndex:$,updateId:T},h.state)));else if(S.activeTooltipIndex!==void 0){var D=S.chartX,I=S.chartY,M=S.activeTooltipIndex,R=h.state,z=R.offset,C=R.tooltipTicks;if(!z)return;if(typeof j=="function")M=j(C,S);else if(j==="value"){M=-1;for(var L=0;L<C.length;L++)if(C[L].value===S.activeLabel){M=L;break}}var B=N(N({},z),{},{x:z.left,y:z.top}),V=Math.min(D,B.x+B.width),W=Math.min(I,B.y+B.height),X=C[M]&&C[M].value,te=kh(h.state,h.props.data,M),xe=C[M]?{x:P==="horizontal"?C[M].coordinate:V,y:P==="horizontal"?W:C[M].coordinate}:zP;h.setState(N(N({},S),{},{activeLabel:X,activeCoordinate:xe,activePayload:te,activeTooltipIndex:M}))}else h.setState(S)}),Y(h,"renderCursor",function(S){var _,P=h.state,j=P.isTooltipActive,T=P.activeCoordinate,k=P.activePayload,$=P.offset,D=P.activeTooltipIndex,I=P.tooltipAxisBandSize,M=h.getTooltipEventType(),R=(_=S.props.active)!==null&&_!==void 0?_:j,z=h.props.layout,C=S.key||"_recharts-cursor";return E.createElement(jq,{key:C,activeCoordinate:T,activePayload:k,activeTooltipIndex:D,chartName:n,element:S,isActive:R,layout:z,offset:$,tooltipAxisBandSize:I,tooltipEventType:M})}),Y(h,"renderPolarAxis",function(S,_,P){var j=Bt(S,"type.axisType"),T=Bt(h.state,"".concat(j,"Map")),k=S.type.defaultProps,$=k!==void 0?N(N({},k),S.props):S.props,D=T&&T[$["".concat(j,"Id")]];return A.cloneElement(S,N(N({},D),{},{className:oe(j,D.className),key:S.key||"".concat(_,"-").concat(P),ticks:Pn(D,!0)}))}),Y(h,"renderPolarGrid",function(S){var _=S.props,P=_.radialLines,j=_.polarAngles,T=_.polarRadius,k=h.state,$=k.radiusAxisMap,D=k.angleAxisMap,I=Yn($),M=Yn(D),R=M.cx,z=M.cy,C=M.innerRadius,L=M.outerRadius;return A.cloneElement(S,{polarAngles:Array.isArray(j)?j:Pn(M,!0).map(function(B){return B.coordinate}),polarRadius:Array.isArray(T)?T:Pn(I,!0).map(function(B){return B.coordinate}),cx:R,cy:z,innerRadius:C,outerRadius:L,key:S.key||"polar-grid",radialLines:P})}),Y(h,"renderLegend",function(){var S=h.state.formattedGraphicalItems,_=h.props,P=_.children,j=_.width,T=_.height,k=h.props.margin||{},$=j-(k.left||0)-(k.right||0),D=k_({children:P,formattedGraphicalItems:S,legendWidth:$,legendContent:s});if(!D)return null;var I=D.item,M=Dx(D,Aq);return A.cloneElement(I,N(N({},M),{},{chartWidth:j,chartHeight:T,margin:k,onBBoxUpdate:h.handleLegendBBoxUpdate}))}),Y(h,"renderTooltip",function(){var S,_=h.props,P=_.children,j=_.accessibilityLayer,T=Ot(P,pt);if(!T)return null;var k=h.state,$=k.isTooltipActive,D=k.activeCoordinate,I=k.activePayload,M=k.activeLabel,R=k.offset,z=(S=T.props.active)!==null&&S!==void 0?S:$;return A.cloneElement(T,{viewBox:N(N({},R),{},{x:R.left,y:R.top}),active:z,label:M,payload:z?I:[],coordinate:D,accessibilityLayer:j})}),Y(h,"renderBrush",function(S){var _=h.props,P=_.margin,j=_.data,T=h.state,k=T.offset,$=T.dataStartIndex,D=T.dataEndIndex,I=T.updateId;return A.cloneElement(S,{key:S.key||"_recharts-brush",onChange:au(h.handleBrushChange,S.props.onChange),data:j,x:H(S.props.x)?S.props.x:k.left,y:H(S.props.y)?S.props.y:k.top+k.height+k.brushBottom-(P.bottom||0),width:H(S.props.width)?S.props.width:k.width,startIndex:$,endIndex:D,updateId:"brush-".concat(I)})}),Y(h,"renderReferenceElement",function(S,_,P){if(!S)return null;var j=h,T=j.clipPathId,k=h.state,$=k.xAxisMap,D=k.yAxisMap,I=k.offset,M=S.type.defaultProps||{},R=S.props,z=R.xAxisId,C=z===void 0?M.xAxisId:z,L=R.yAxisId,B=L===void 0?M.yAxisId:L;return A.cloneElement(S,{key:S.key||"".concat(_,"-").concat(P),xAxis:$[C],yAxis:D[B],viewBox:{x:I.left,y:I.top,width:I.width,height:I.height},clipPathId:T})}),Y(h,"renderActivePoints",function(S){var _=S.item,P=S.activePoint,j=S.basePoint,T=S.childIndex,k=S.isRange,$=[],D=_.props.key,I=_.item.type.defaultProps!==void 0?N(N({},_.item.type.defaultProps),_.item.props):_.item.props,M=I.activeDot,R=I.dataKey,z=N(N({index:T,dataKey:R,cx:P.x,cy:P.y,r:4,fill:jy(_.item),strokeWidth:2,stroke:"#fff",payload:P.payload,value:P.value},ae(M,!1)),Yu(M));return $.push(y.renderActiveDot(M,z,"".concat(D,"-activePoint-").concat(T))),j?$.push(y.renderActiveDot(M,N(N({},z),{},{cx:j.x,cy:j.y}),"".concat(D,"-basePoint-").concat(T))):k&&$.push(null),$}),Y(h,"renderGraphicChild",function(S,_,P){var j=h.filterFormatItem(S,_,P);if(!j)return null;var T=h.getTooltipEventType(),k=h.state,$=k.isTooltipActive,D=k.tooltipAxis,I=k.activeTooltipIndex,M=k.activeLabel,R=h.props.children,z=Ot(R,pt),C=j.props,L=C.points,B=C.isRange,V=C.baseLine,W=j.item.type.defaultProps!==void 0?N(N({},j.item.type.defaultProps),j.item.props):j.item.props,X=W.activeDot,te=W.hide,xe=W.activeBar,Te=W.activeShape,Tt=!!(!te&&$&&z&&(X||xe||Te)),ft={};T!=="axis"&&z&&z.props.trigger==="click"?ft={onClick:au(h.handleItemMouseEnter,S.props.onClick)}:T!=="axis"&&(ft={onMouseLeave:au(h.handleItemMouseLeave,S.props.onMouseLeave),onMouseEnter:au(h.handleItemMouseEnter,S.props.onMouseEnter)});var G=A.cloneElement(S,N(N({},j.props),ft));function Q(jr){return typeof D.dataKey=="function"?D.dataKey(jr.payload):null}if(Tt)if(I>=0){var Z,F;if(D.dataKey&&!D.allowDuplicatedCategory){var Ae=typeof D.dataKey=="function"?Q:"payload.".concat(D.dataKey.toString());Z=fp(L,Ae,M),F=B&&V&&fp(V,Ae,M)}else Z=L==null?void 0:L[I],F=B&&V&&V[I];if(Te||xe){var ne=S.props.activeIndex!==void 0?S.props.activeIndex:I;return[A.cloneElement(S,N(N(N({},j.props),ft),{},{activeIndex:ne})),null,null]}if(!le(Z))return[G].concat(ha(h.renderActivePoints({item:j,activePoint:Z,basePoint:F,childIndex:I,isRange:B})))}else{var Ie,De=(Ie=h.getItemByXY(h.state.activeCoordinate))!==null&&Ie!==void 0?Ie:{graphicalItem:G},dt=De.graphicalItem,Un=dt.item,li=Un===void 0?S:Un,kl=dt.childIndex,Pr=N(N(N({},j.props),ft),{},{activeIndex:kl});return[A.cloneElement(li,Pr),null,null]}return B?[G,null,null]:[G,null]}),Y(h,"renderCustomized",function(S,_,P){return A.cloneElement(S,N(N({key:"recharts-customized-".concat(P)},h.props),h.state))}),Y(h,"renderMap",{CartesianGrid:{handler:cu,once:!0},ReferenceArea:{handler:h.renderReferenceElement},ReferenceLine:{handler:cu},ReferenceDot:{handler:h.renderReferenceElement},XAxis:{handler:cu},YAxis:{handler:cu},Brush:{handler:h.renderBrush,once:!0},Bar:{handler:h.renderGraphicChild},Line:{handler:h.renderGraphicChild},Area:{handler:h.renderGraphicChild},Radar:{handler:h.renderGraphicChild},RadialBar:{handler:h.renderGraphicChild},Scatter:{handler:h.renderGraphicChild},Pie:{handler:h.renderGraphicChild},Funnel:{handler:h.renderGraphicChild},Tooltip:{handler:h.renderCursor,once:!0},PolarGrid:{handler:h.renderPolarGrid,once:!0},PolarAngleAxis:{handler:h.renderPolarAxis},PolarRadiusAxis:{handler:h.renderPolarAxis},Customized:{handler:h.renderCustomized}}),h.clipPathId="".concat((g=v.id)!==null&&g!==void 0?g:Tc("recharts"),"-clip"),h.throttleTriggeredAfterMouseMove=NO(h.triggeredAfterMouseMove,(O=v.throttleDelay)!==null&&O!==void 0?O:1e3/60),h.state={},h}return Bq(y,m),Iq(y,[{key:"componentDidMount",value:function(){var g,O;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(g=this.props.margin.left)!==null&&g!==void 0?g:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var g=this.props,O=g.children,h=g.data,S=g.height,_=g.layout,P=Ot(O,pt);if(P){var j=P.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var T=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,k=kh(this.state,h,j,T),$=this.state.tooltipTicks[j].coordinate,D=(this.state.offset.top+S)/2,I=_==="horizontal",M=I?{x:$,y:D}:{y:$,x:D},R=this.state.formattedGraphicalItems.find(function(C){var L=C.item;return L.type.name==="Scatter"});R&&(M=N(N({},M),R.props.points[j].tooltipPosition),k=R.props.points[j].tooltipPayload);var z={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:T,activePayload:k,activeCoordinate:M};this.setState(z),this.renderCursor(P),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(g,O){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==O.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==g.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==g.margin){var h,S;this.accessibilityManager.setDetails({offset:{left:(h=this.props.margin.left)!==null&&h!==void 0?h:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(g){pp([Ot(g.children,pt)],[Ot(this.props.children,pt)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var g=Ot(this.props.children,pt);if(g&&typeof g.props.shared=="boolean"){var O=g.props.shared?"axis":"item";return l.indexOf(O)>=0?O:a}return a}},{key:"getMouseInfo",value:function(g){if(!this.container)return null;var O=this.container,h=O.getBoundingClientRect(),S=W4(h),_={chartX:Math.round(g.pageX-S.left),chartY:Math.round(g.pageY-S.top)},P=h.width/O.offsetWidth||1,j=this.inRange(_.chartX,_.chartY,P);if(!j)return null;var T=this.state,k=T.xAxisMap,$=T.yAxisMap,D=this.getTooltipEventType(),I=Rx(this.state,this.props.data,this.props.layout,j);if(D!=="axis"&&k&&$){var M=Yn(k).scale,R=Yn($).scale,z=M&&M.invert?M.invert(_.chartX):null,C=R&&R.invert?R.invert(_.chartY):null;return N(N({},_),{},{xValue:z,yValue:C},I)}return I?N(N({},_),I):null}},{key:"inRange",value:function(g,O){var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,_=g/h,P=O/h;if(S==="horizontal"||S==="vertical"){var j=this.state.offset,T=_>=j.left&&_<=j.left+j.width&&P>=j.top&&P<=j.top+j.height;return T?{x:_,y:P}:null}var k=this.state,$=k.angleAxisMap,D=k.radiusAxisMap;if($&&D){var I=Yn($);return _b({x:_,y:P},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var g=this.props.children,O=this.getTooltipEventType(),h=Ot(g,pt),S={};h&&O==="axis"&&(h.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var _=Yu(this.props,this.handleOuterEvent);return N(N({},_),S)}},{key:"addListener",value:function(){ad.on(od,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){ad.removeListener(od,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(g,O,h){for(var S=this.state.formattedGraphicalItems,_=0,P=S.length;_<P;_++){var j=S[_];if(j.item===g||j.props.key===g.key||O===An(j.item.type)&&h===j.childIndex)return j}return null}},{key:"renderClipPath",value:function(){var g=this.clipPathId,O=this.state.offset,h=O.left,S=O.top,_=O.height,P=O.width;return E.createElement("defs",null,E.createElement("clipPath",{id:g},E.createElement("rect",{x:h,y:S,height:_,width:P})))}},{key:"getXScales",value:function(){var g=this.state.xAxisMap;return g?Object.entries(g).reduce(function(O,h){var S=Ix(h,2),_=S[0],P=S[1];return N(N({},O),{},Y({},_,P.scale))},{}):null}},{key:"getYScales",value:function(){var g=this.state.yAxisMap;return g?Object.entries(g).reduce(function(O,h){var S=Ix(h,2),_=S[0],P=S[1];return N(N({},O),{},Y({},_,P.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(g){var O;return(O=this.state.xAxisMap)===null||O===void 0||(O=O[g])===null||O===void 0?void 0:O.scale}},{key:"getYScaleByAxisId",value:function(g){var O;return(O=this.state.yAxisMap)===null||O===void 0||(O=O[g])===null||O===void 0?void 0:O.scale}},{key:"getItemByXY",value:function(g){var O=this.state,h=O.formattedGraphicalItems,S=O.activeItem;if(h&&h.length)for(var _=0,P=h.length;_<P;_++){var j=h[_],T=j.props,k=j.item,$=k.type.defaultProps!==void 0?N(N({},k.type.defaultProps),k.props):k.props,D=An(k.type);if(D==="Bar"){var I=(T.data||[]).find(function(C){return $H(g,C)});if(I)return{graphicalItem:j,payload:I}}else if(D==="RadialBar"){var M=(T.data||[]).find(function(C){return _b(g,C)});if(M)return{graphicalItem:j,payload:M}}else if(Yc(j,S)||Qc(j,S)||dl(j,S)){var R=k7({graphicalItem:j,activeTooltipItem:S,itemData:$.data}),z=$.activeIndex===void 0?R:$.activeIndex;return{graphicalItem:N(N({},j),{},{childIndex:z}),payload:dl(j,S)?$.data[R]:j.props.data[R]}}}return null}},{key:"render",value:function(){var g=this;if(!vg(this))return null;var O=this.props,h=O.children,S=O.className,_=O.width,P=O.height,j=O.style,T=O.compact,k=O.title,$=O.desc,D=Dx(O,Eq),I=ae(D,!1);if(T)return E.createElement(xx,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},E.createElement(vp,Ei({},I,{width:_,height:P,title:k,desc:$}),this.renderClipPath(),mg(h,this.renderMap)));if(this.props.accessibilityLayer){var M,R;I.tabIndex=(M=this.props.tabIndex)!==null&&M!==void 0?M:0,I.role=(R=this.props.role)!==null&&R!==void 0?R:"application",I.onKeyDown=function(C){g.accessibilityManager.keyboardEvent(C)},I.onFocus=function(){g.accessibilityManager.focus()}}var z=this.parseEventsOfWrapper();return E.createElement(xx,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},E.createElement("div",Ei({className:oe("recharts-wrapper",S),style:N({position:"relative",cursor:"default",width:_,height:P},j)},z,{ref:function(L){g.container=L}}),E.createElement(vp,Ei({},I,{width:_,height:P,title:k,desc:$,style:Vq}),this.renderClipPath(),mg(h,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(A.Component);Y(x,"displayName",n),Y(x,"defaultProps",N({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},c)),Y(x,"getDerivedStateFromProps",function(m,y){var v=m.dataKey,g=m.data,O=m.children,h=m.width,S=m.height,_=m.layout,P=m.stackOffset,j=m.margin,T=y.dataStartIndex,k=y.dataEndIndex;if(y.updateId===void 0){var $=Bx(m);return N(N(N({},$),{},{updateId:0},p(N(N({props:m},$),{},{updateId:0}),y)),{},{prevDataKey:v,prevData:g,prevWidth:h,prevHeight:S,prevLayout:_,prevStackOffset:P,prevMargin:j,prevChildren:O})}if(v!==y.prevDataKey||g!==y.prevData||h!==y.prevWidth||S!==y.prevHeight||_!==y.prevLayout||P!==y.prevStackOffset||!Ii(j,y.prevMargin)){var D=Bx(m),I={chartX:y.chartX,chartY:y.chartY,isTooltipActive:y.isTooltipActive},M=N(N({},Rx(y,g,_)),{},{updateId:y.updateId+1}),R=N(N(N({},D),I),M);return N(N(N({},R),p(N({props:m},R),y)),{},{prevDataKey:v,prevData:g,prevWidth:h,prevHeight:S,prevLayout:_,prevStackOffset:P,prevMargin:j,prevChildren:O})}if(!pp(O,y.prevChildren)){var z,C,L,B,V=Ot(O,aa),W=V&&(z=(C=V.props)===null||C===void 0?void 0:C.startIndex)!==null&&z!==void 0?z:T,X=V&&(L=(B=V.props)===null||B===void 0?void 0:B.endIndex)!==null&&L!==void 0?L:k,te=W!==T||X!==k,xe=!le(g),Te=xe&&!te?y.updateId:y.updateId+1;return N(N({updateId:Te},p(N(N({props:m},y),{},{updateId:Te,dataStartIndex:W,dataEndIndex:X}),y)),{},{prevChildren:O,dataStartIndex:W,dataEndIndex:X})}return null}),Y(x,"renderActiveDot",function(m,y,v){var g;return A.isValidElement(m)?g=A.cloneElement(m,y):J(m)?g=m(y):g=E.createElement(Z_,y),E.createElement(Ve,{className:"recharts-active-dot",key:v},g)});var b=A.forwardRef(function(y,v){return E.createElement(x,Ei({},y,{ref:v}))});return b.displayName=x.displayName,b},go=tX({chartName:"BarChart",GraphicalChild:nn,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:fr},{axisType:"yAxis",AxisComp:dr}],formatAxisMap:rG});function Fx(e){return e==null||e<1e-5?"$0.00":e<.01?"$"+e.toFixed(6):"$"+e.toFixed(4)}function Qa(e){return e==null?"0":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toLocaleString()}const nX={local:"#3fb950",groq:"#58a6ff",gemini:"#bc8cff",nim:"#39d2c0",openrouter:"#d29922"};function rX({data:e}){if(!e)return w.jsxs("div",{className:"loading-state",children:[w.jsx("div",{className:"loading-spinner"}),w.jsx("p",{children:"Connecting to dashboard..."})]});const{cost:t,history:n,benchmarks:r,memory:i,health:a}=e,o=[{icon:"💰",value:Fx(t.totalCost),label:"Total Cost"},{icon:"📞",value:Qa(t.totalRequests),label:"API Requests"},{icon:"🧠",value:Qa(i.total),label:"Trajectories"},{icon:"📝",value:Qa(n.total),label:"Chat Sessions"},{icon:"🏆",value:Qa(r.totalRuns),label:"Benchmark Runs"},{icon:"📦",value:Qa(a.vectors),label:"Vector Entries"}],l=Object.entries(t.byProvider||{}).map(([s,f])=>({name:s,value:f})).sort((s,f)=>f.value-s.value),u=Object.entries(i.byFingerprint||{}).map(([s,f])=>({name:s.length>15?s.slice(0,13)+"..":s,value:f})).sort((s,f)=>f.value-s.value).slice(0,8);return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"📊 System Overview"}),w.jsx("div",{className:"stats-grid",children:o.map(s=>w.jsxs("div",{className:"stat-card",children:[w.jsx("div",{className:"stat-icon",children:s.icon}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",children:s.value}),w.jsx("div",{className:"stat-label",children:s.label})]})]},s.label))}),w.jsx("h3",{className:"section-subtitle",children:"💰 Cost by Provider"}),w.jsx("div",{className:"chart-container",children:l.length>0?w.jsx(po,{width:"100%",height:260,children:w.jsxs(go,{data:l,margin:{top:20,right:20,left:10,bottom:40},children:[w.jsx(Bi,{strokeDasharray:"3 3",stroke:"#21262d"}),w.jsx(fr,{dataKey:"name",tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(dr,{tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"},tickFormatter:s=>"$"+s.toFixed(4)}),w.jsx(pt,{contentStyle:{background:"#161b22",border:"1px solid #30363d",borderRadius:8},labelStyle:{color:"#e6edf3"},formatter:s=>[Fx(s),"Cost"]}),w.jsx(nn,{dataKey:"value",radius:[4,4,0,0],children:l.map(s=>w.jsx(Rc,{fill:nX[s.name]||"#58a6ff",fillOpacity:.8},s.name))})]})}):w.jsx("div",{className:"empty-state",children:"No cost data yet."})}),w.jsx("h3",{className:"section-subtitle",children:"📊 Trajectories by Project Type"}),w.jsx("div",{className:"chart-container",children:u.length>0?w.jsx(po,{width:"100%",height:260,children:w.jsxs(go,{data:u,margin:{top:20,right:20,left:10,bottom:40},children:[w.jsx(Bi,{strokeDasharray:"3 3",stroke:"#21262d"}),w.jsx(fr,{dataKey:"name",tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(dr,{tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(pt,{contentStyle:{background:"#161b22",border:"1px solid #30363d",borderRadius:8},labelStyle:{color:"#e6edf3"}}),w.jsx(nn,{dataKey:"value",fill:"#bc8cff",radius:[4,4,0,0],fillOpacity:.8})]})}):w.jsx("div",{className:"empty-state",children:"No trajectory data yet."})})]})}const Ux={planner:"📋","context-gatherer":"📂",writer:"✏️",reviewer:"👁️",tester:"🧪",debugger:"🐛",runner:"▶️",git:"🔀",package:"📦","github-release":"🏷️",security:"🔒",orchestrator:"🎯"},ud={planner:"#58a6ff","context-gatherer":"#39d2c0",writer:"#d29922",reviewer:"#bc8cff",tester:"#3fb950",debugger:"#f85149",runner:"#58a6ff",git:"#f0883e",package:"#db6d28","github-release":"#3fb950",security:"#f85149",orchestrator:"#f0883e"},iX={pending:{bg:"#1a1f2e",stroke:"#30363d",text:"#6e7681"},running:{bg:"rgba(88, 166, 255, 0.12)",stroke:"#58a6ff",text:"#58a6ff"},completed:{bg:"rgba(63, 185, 80, 0.12)",stroke:"#3fb950",text:"#3fb950"},failed:{bg:"rgba(248, 81, 73, 0.12)",stroke:"#f85149",text:"#f85149"}},Wx={pending:"⏳ Pending",running:"▶️ Running",completed:"✅ Done",failed:"❌ Failed"},sd={planner:"Planner","context-gatherer":"Context",writer:"Writer",reviewer:"Reviewer",tester:"Tester",debugger:"Debugger",runner:"Runner",git:"Git",package:"Package","github-release":"Release",security:"Security",orchestrator:"Orchestrator"};function aX(e,t,n=160,r=68,i=40,a=24,o=40){if(e.length===0)return{layoutNodes:[],svgW:400,svgH:200};const l=new Map,u=new Set;function s(m){if(l.has(m))return l.get(m);if(u.has(m))return 0;u.add(m);const y=t.filter(O=>O.to===m);if(y.length===0)return l.set(m,0),0;const g=Math.max(...y.map(O=>s(O.from)))+1;return l.set(m,g),g}for(const m of e)s(m.id);const f=new Map;for(const m of e){const y=l.get(m.id)??0;f.has(y)||f.set(y,[]),f.get(y).push(m)}const c=Math.max(...f.keys()),d=Math.max(...Array.from(f.values()).map(m=>m.length)),p=(c+1)*(n+i)+o*2-i,x=Math.max(d,1)*(r+a)+o*2-a,b=[];for(const m of e){const y=l.get(m.id)??0,v=f.get(y),g=v.indexOf(m),O=v.length,h=O*(r+a)-a,S=x/2-h/2;b.push({...m,x:o+y*(n+i),y:S+g*(r+a),w:n,h:r,step:y,totalInStep:O,indexInStep:g})}return{layoutNodes:b,svgW:p,svgH:x}}function Hx(e,t){if(!e)return"--";const n=(t||Date.now())-e;return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${Math.floor(n/6e4)}m ${Math.floor(n%6e4/1e3)}s`}function Vx(e){return e?new Date(e).toLocaleTimeString("en-US",{minute:"2-digit",second:"2-digit"}):""}function oX({memoryTotal:e}){return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"🔀 Agent Execution DAG"}),w.jsx("p",{className:"section-description",children:"Live visualization of the agent execution pipeline. When an agent task runs, you'll see each step appear here in real time as it moves through planning → context gathering → writing → review → testing."}),w.jsxs("div",{className:"dag-empty",children:[w.jsx("div",{className:"dag-empty-icon",children:"🔀"}),w.jsx("h3",{children:"No Active Pipeline"}),w.jsx("p",{children:"Run an agent task to see the execution pipeline appear here in real time."}),e!==void 0&&e>0&&w.jsxs("p",{className:"dag-empty-hint",children:[w.jsx("code",{children:e})," past executions are stored in memory."]})]})]})}function lX({data:e}){var O;const t=e==null?void 0:e.dag,n=(O=e==null?void 0:e.memory)==null?void 0:O.total,[r,i]=A.useState(null),[a,o]=A.useState(null);A.useEffect(()=>pi.onDAGEvent(S=>{i(S)}),[]);const l=t||r;if(!l||l.nodes.length===0&&!l.active)return w.jsx(oX,{memoryTotal:n});const{nodes:u,edges:s,pipeline:f,active:c}=l,{layoutNodes:d,svgW:p,svgH:x}=aX(u,s),b=u.filter(h=>h.status==="running").length,m=u.filter(h=>h.status==="completed").length,y=u.filter(h=>h.status==="failed").length,v=u.filter(h=>h.status==="pending").length,g=u.length;return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"🔀 Agent Execution DAG"}),w.jsxs("div",{className:`dag-status-bar ${c?"active":""}`,children:[w.jsxs("div",{className:"dag-pipeline-name",children:[c&&w.jsx("span",{className:"dag-live-dot"}),f||"Execution Pipeline"]}),w.jsxs("div",{className:"dag-pipeline-meta",children:[c&&w.jsx("span",{className:"dag-live-badge",children:"LIVE"}),w.jsxs("span",{className:"dag-step-count",children:[g," steps"]}),b>0&&w.jsxs("span",{className:"dag-running-badge",children:["▶ ",b," running"]}),v>0&&w.jsxs("span",{className:"dag-pending-badge",children:["⏳ ",v," pending"]}),w.jsxs("span",{className:"dag-completed-badge",children:["✅ ",m," done"]}),y>0&&w.jsxs("span",{className:"dag-failed-badge",children:["❌ ",y," failed"]})]})]}),w.jsx("div",{className:"dag-container",children:w.jsxs("svg",{width:p,height:x,viewBox:`0 0 ${p} ${x}`,children:[w.jsxs("defs",{children:[s.map(h=>w.jsx("marker",{id:`arrow-${h.from}-${h.to}`,markerWidth:"8",markerHeight:"6",refX:"8",refY:"3",orient:"auto",children:w.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:"#58a6ff"})},`arrow-${h.from}-${h.to}`)),w.jsxs("filter",{id:"glow",children:[w.jsx("feGaussianBlur",{stdDeviation:"3",result:"coloredBlur"}),w.jsxs("feMerge",{children:[w.jsx("feMergeNode",{in:"coloredBlur"}),w.jsx("feMergeNode",{in:"SourceGraphic"})]})]})]}),s.map(h=>{const S=d.find(M=>M.id===h.from),_=d.find(M=>M.id===h.to);if(!S||!_)return null;const P=S.x+S.w,j=S.y+S.h/2,T=_.x,k=_.y+_.h/2,$=(P+T)/2,D=_.status,I=D==="failed"?"#f85149":D==="running"?"#58a6ff":D==="completed"?"#3fb950":"#30363d";return w.jsx("g",{children:w.jsx("path",{d:`M ${P} ${j} C ${$} ${j}, ${$} ${k}, ${T} ${k}`,fill:"none",stroke:I,strokeWidth:D==="pending"?1.5:2.5,strokeOpacity:D==="pending"?.3:.8,markerEnd:`url(#arrow-${h.from}-${h.to})`,className:"dag-edge"})},`edge-${h.from}-${h.to}`)}),d.map(h=>{const S=iX[h.status];ud[h.agentType];const _=Ux[h.agentType]||"⚙️",P=sd[h.agentType]||h.agentType,j=a===h.id,T=h.status==="running";return w.jsxs("g",{onClick:()=>o(j?null:h.id),style:{cursor:"pointer"},className:"dag-node-group",children:[j&&w.jsx("rect",{x:h.x-4,y:h.y-4,width:h.w+8,height:h.h+8,rx:10,ry:10,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.5}),w.jsx("rect",{x:h.x,y:h.y,width:h.w,height:h.h,rx:8,ry:8,fill:S.bg,stroke:S.stroke,strokeWidth:T?2.5:1.5,strokeOpacity:.9,className:T?"dag-node-running":"",filter:T?"url(#glow)":void 0}),w.jsxs("text",{x:h.x+10,y:h.y+22,fill:"#e6edf3",fontSize:10,fontWeight:600,children:[_," ",P]}),w.jsx("text",{x:h.x+h.w-10,y:h.y+22,textAnchor:"end",fill:S.text,fontSize:9,fontWeight:500,children:Wx[h.status]}),w.jsx("text",{x:h.x+10,y:h.y+40,fill:"#8b949e",fontSize:9,children:h.description.length>28?h.description.slice(0,26)+"..":h.description}),w.jsx("text",{x:h.x+10,y:h.y+56,fill:"#6e7681",fontSize:8,children:Hx(h.startedAt,h.completedAt)}),w.jsx("text",{x:h.x+h.w-10,y:h.y+56,textAnchor:"end",fill:"#6e7681",fontSize:8,children:Vx(h.startedAt||h.completedAt)}),(h.status==="failed"||j)&&h.summary&&w.jsx("foreignObject",{x:Math.max(10,h.x-80),y:h.y+h.h+6,width:h.w+160,height:36,children:w.jsx("div",{className:"dag-node-summary",style:{color:h.status==="failed"?"#f85149":"#8b949e",fontSize:"10px",lineHeight:1.4,background:"rgba(13,17,23,0.9)",padding:"4px 8px",borderRadius:"4px",border:`1px solid ${h.status==="failed"?"rgba(248,81,73,0.3)":"rgba(48,54,61,0.5)"}`,maxHeight:"32px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.summary})})]},`node-${h.id}`)})]})}),w.jsx("h3",{className:"section-subtitle",children:"Step Details"}),w.jsx("div",{className:"dag-table-wrapper",children:w.jsxs("table",{className:"dag-table",children:[w.jsx("thead",{children:w.jsxs("tr",{children:[w.jsx("th",{children:"Step"}),w.jsx("th",{children:"Agent"}),w.jsx("th",{children:"Status"}),w.jsx("th",{children:"Duration"}),w.jsx("th",{children:"Time"}),w.jsx("th",{children:"Summary"})]})}),w.jsx("tbody",{children:d.map(h=>w.jsxs("tr",{className:`dag-row dag-row-${h.status}`,children:[w.jsx("td",{className:"dag-cell-step",children:h.step}),w.jsxs("td",{className:"dag-cell-agent",children:[w.jsx("span",{className:"dag-agent-dot",style:{background:ud[h.agentType]||"#58a6ff"}}),sd[h.agentType]||h.agentType]}),w.jsx("td",{className:`dag-cell-status dag-status-${h.status}`,children:Wx[h.status]}),w.jsx("td",{className:"dag-cell-duration",children:Hx(h.startedAt,h.completedAt)}),w.jsx("td",{className:"dag-cell-time",children:Vx(h.startedAt||h.completedAt)}),w.jsx("td",{className:"dag-cell-summary",children:h.summary||h.description||"--"})]},h.id))})]})}),w.jsx("h3",{className:"section-subtitle",children:"Agent Types"}),w.jsxs("div",{className:"dag-legend",children:[Object.entries(Ux).map(([h,S])=>w.jsxs("div",{className:"legend-item",children:[w.jsx("span",{className:"legend-dot",style:{background:ud[h]||"#58a6ff"}}),w.jsx("span",{className:"legend-icon",children:S}),w.jsx("span",{className:"legend-label",children:sd[h]||h})]},h)),w.jsxs("div",{className:"legend-item",children:[w.jsx("span",{className:"legend-dot",style:{background:"transparent",border:"2px dashed #58a6ff"}}),w.jsx("span",{className:"legend-icon",children:"⚡"}),w.jsx("span",{className:"legend-label",children:"Live node"})]})]})]})}function uX(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function sX({data:e}){if(!e)return w.jsx("div",{className:"loading-state",children:w.jsx("p",{children:"Loading history..."})});const{history:t}=e,n=t.recent||[];return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"📝 Conversation History"}),w.jsx("div",{className:"history-stats",children:w.jsxs("span",{className:"history-count",children:["Total: ",w.jsx("strong",{children:t.total})," sessions"]})}),w.jsx("div",{className:"history-list",children:n.length===0?w.jsx("div",{className:"empty-state",children:"No conversations recorded yet."}):n.map(r=>w.jsxs("div",{className:"history-item",children:[w.jsx("div",{className:"history-summary",children:r.summary||"Untitled"}),w.jsxs("div",{className:"history-meta",children:[w.jsxs("span",{children:["📅 ",uX(r.startedAt)]}),w.jsxs("span",{children:["🤖 ",r.provider||"--"]}),w.jsxs("span",{children:["💬 ",r.messageCount||0," msgs"]}),r.tags&&r.tags.length>0&&w.jsxs("span",{children:["🏷️ ",r.tags.map(i=>w.jsx("span",{className:"history-tag",children:i},i))]})]})]},r.id))})]})}function fu(e){return e==null||e<1e-5?"$0.00":e<.01?"$"+e.toFixed(6):"$"+e.toFixed(4)}function cd(e){return e==null?"0":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toLocaleString()}function cX(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function fX({data:e}){if(!e)return w.jsx("div",{className:"loading-state",children:w.jsx("p",{children:"Loading cost data..."})});const{cost:t}=e,n=Object.entries(t.byProvider||{}).sort(([,a],[,o])=>o-a),r=Object.entries(t.byModel||{}).sort(([,a],[,o])=>o-a).slice(0,10),i=n.reduce((a,[,o])=>a+o,0);return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"💰 Cost Tracking"}),w.jsxs("div",{className:"cost-summary",children:[w.jsxs("div",{className:"cost-total",children:[w.jsx("span",{className:"cost-label",children:"Total Spent"}),w.jsx("span",{className:"cost-amount",children:fu(t.totalCost)})]}),w.jsxs("div",{className:"cost-total",children:[w.jsx("span",{className:"cost-label",children:"Total Tokens"}),w.jsx("span",{className:"cost-amount",children:cd(t.totalTokens)})]}),w.jsxs("div",{className:"cost-total",children:[w.jsx("span",{className:"cost-label",children:"Total Requests"}),w.jsx("span",{className:"cost-amount",children:cd(t.totalRequests)})]})]}),w.jsx("h3",{className:"section-subtitle",children:"By Provider"}),w.jsx("div",{className:"cost-list",children:n.length===0?w.jsx("div",{className:"empty-state",children:"No costs recorded yet."}):n.map(([a,o])=>{const l=i>0?(o/i*100).toFixed(1):"0";return w.jsxs("div",{className:"cost-row",children:[w.jsx("span",{className:"cost-row-name",children:a}),w.jsx("div",{className:"cost-row-bar",children:w.jsx("div",{className:"cost-row-fill",style:{width:`${l}%`}})}),w.jsx("span",{className:"cost-row-value",children:fu(o)})]},a)})}),w.jsx("h3",{className:"section-subtitle",children:"By Model"}),w.jsx("div",{className:"cost-list",children:r.length===0?w.jsx("div",{className:"empty-state",children:"No model costs recorded yet."}):r.map(([a,o])=>{const l=i>0?(o/i*100).toFixed(1):"0",u=a.length>30?a.slice(0,28)+"..":a;return w.jsxs("div",{className:"cost-row",children:[w.jsx("span",{className:"cost-row-name",children:u}),w.jsx("div",{className:"cost-row-bar",children:w.jsx("div",{className:"cost-row-fill",style:{width:`${l}%`}})}),w.jsx("span",{className:"cost-row-value",children:fu(o)})]},a)})}),w.jsx("h3",{className:"section-subtitle",children:"Recent Requests"}),w.jsx("div",{className:"request-list",children:!t.recent||t.recent.length===0?w.jsx("div",{className:"empty-state",children:"No requests recorded yet."}):t.recent.slice(0,30).map((a,o)=>w.jsxs("div",{className:"request-row",children:[w.jsx("span",{className:"request-time",children:cX(a.timestamp)}),w.jsx("span",{className:"request-provider",children:a.provider||"--"}),w.jsx("span",{className:"request-model",children:a.model||"--"}),w.jsx("span",{className:"request-cost",children:fu(a.costUsd)}),w.jsxs("span",{className:"request-tokens",children:[cd(a.totalTokens)," tok"]})]},o))})]})}function dX(e){return e==null?"$0.00":"$"+e.toFixed(6)}function pX(e){return e==null?"0%":(e*100).toFixed(1)+"%"}function hX({data:e}){if(!e)return w.jsx("div",{className:"loading-state",children:w.jsx("p",{children:"Loading benchmark data..."})});const{benchmarks:t}=e,n=t.latest,r=t.runs||[],i=r.map(a=>({name:a.model.length>12?a.model.slice(0,10)+"..":a.model,passRate:a.summary.totalTasks>0?Math.round(a.summary.tasksPassed/a.summary.totalTasks*100):0,quality:Math.round(a.summary.avgQualityScore*100),latency:a.summary.medianLatencyMs,cost:a.summary.totalCostUsd,fullModel:a.model,provider:a.provider})).reverse();return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"📈 Benchmark Results"}),w.jsx("div",{className:"benchmark-latest",children:n?w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"benchmark-header",children:[w.jsx("strong",{children:"Latest Run:"})," ",n.provider,"/",n.model]}),w.jsxs("div",{className:"benchmark-stats",children:[w.jsxs("div",{className:"benchmark-stat pass",children:[w.jsxs("div",{className:"benchmark-stat-value",children:[n.summary.tasksPassed,"/",n.summary.totalTasks]}),w.jsx("div",{className:"benchmark-stat-label",children:"Passed"})]}),w.jsxs("div",{className:"benchmark-stat quality",children:[w.jsx("div",{className:"benchmark-stat-value",children:pX(n.summary.avgQualityScore)}),w.jsx("div",{className:"benchmark-stat-label",children:"Quality"})]}),w.jsxs("div",{className:"benchmark-stat latency",children:[w.jsxs("div",{className:"benchmark-stat-value",children:[n.summary.medianLatencyMs,"ms"]}),w.jsx("div",{className:"benchmark-stat-label",children:"Latency"})]}),w.jsxs("div",{className:"benchmark-stat fail",children:[w.jsx("div",{className:"benchmark-stat-value",children:dX(n.summary.totalCostUsd)}),w.jsx("div",{className:"benchmark-stat-label",children:"Cost"})]})]})]}):w.jsxs("div",{className:"empty-state",children:["No benchmark runs yet. Run ",w.jsx("code",{children:"buff benchmark"})," to start."]})}),i.length>1&&w.jsxs(w.Fragment,{children:[w.jsx("h3",{className:"section-subtitle",children:"Pass Rate by Model"}),w.jsx("div",{className:"chart-container",children:w.jsx(po,{width:"100%",height:260,children:w.jsxs(go,{data:i,margin:{top:20,right:20,left:10,bottom:40},children:[w.jsx(Bi,{strokeDasharray:"3 3",stroke:"#21262d"}),w.jsx(fr,{dataKey:"name",tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(dr,{domain:[0,100],tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"},tickFormatter:a=>a+"%"}),w.jsx(pt,{contentStyle:{background:"#161b22",border:"1px solid #30363d",borderRadius:8},labelStyle:{color:"#e6edf3"},formatter:a=>[a+"%","Pass Rate"]}),w.jsx(nn,{dataKey:"passRate",radius:[4,4,0,0],children:i.map((a,o)=>w.jsx(Rc,{fill:a.passRate>=80?"#3fb950":a.passRate>=50?"#d29922":"#f85149",fillOpacity:.8},o))})]})})}),w.jsx("h3",{className:"section-subtitle",children:"Latency by Model"}),w.jsx("div",{className:"chart-container",children:w.jsx(po,{width:"100%",height:260,children:w.jsxs(go,{data:i,margin:{top:20,right:20,left:10,bottom:40},children:[w.jsx(Bi,{strokeDasharray:"3 3",stroke:"#21262d"}),w.jsx(fr,{dataKey:"name",tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(dr,{tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"},tickFormatter:a=>a+"ms"}),w.jsx(pt,{contentStyle:{background:"#161b22",border:"1px solid #30363d",borderRadius:8},labelStyle:{color:"#e6edf3"},formatter:a=>[a+"ms","Latency"]}),w.jsx(nn,{dataKey:"latency",fill:"#d29922",radius:[4,4,0,0],fillOpacity:.8})]})})}),w.jsx("h3",{className:"section-subtitle",children:"Cost by Model"}),w.jsx("div",{className:"chart-container",children:w.jsx(po,{width:"100%",height:260,children:w.jsxs(go,{data:i,margin:{top:20,right:20,left:10,bottom:40},children:[w.jsx(Bi,{strokeDasharray:"3 3",stroke:"#21262d"}),w.jsx(fr,{dataKey:"name",tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"}}),w.jsx(dr,{tick:{fill:"#8b949e",fontSize:11},axisLine:{stroke:"#30363d"},tickFormatter:a=>"$"+a.toFixed(6)}),w.jsx(pt,{contentStyle:{background:"#161b22",border:"1px solid #30363d",borderRadius:8},labelStyle:{color:"#e6edf3"},formatter:a=>["$"+a.toFixed(6),"Cost"]}),w.jsx(nn,{dataKey:"cost",fill:"#bc8cff",radius:[4,4,0,0],fillOpacity:.8})]})})})]}),w.jsx("h3",{className:"section-subtitle",children:"Run History"}),w.jsx("div",{className:"benchmark-list",children:r.length===0?w.jsxs("div",{className:"empty-state",children:["No benchmark runs yet. Run ",w.jsx("code",{children:"buff benchmark"})," to start."]}):r.map(a=>{const o=a.summary.totalTasks>0?Math.round(a.summary.tasksPassed/a.summary.totalTasks*100):0,l=o>=80?"high":o>=50?"medium":"low";return w.jsxs("div",{className:"benchmark-item",children:[w.jsx("span",{className:"benchmark-date",children:new Date(a.startedAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}),w.jsxs("span",{className:"benchmark-model",children:[a.provider,"/",a.model]}),w.jsxs("span",{className:`benchmark-score ${l}`,children:[o,"%"]})]},a.id)})})]})}function fd(e){return e==null?"0":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toLocaleString()}function vX(e){return e==null?"0%":(e*100).toFixed(1)+"%"}function yX({data:e}){if(!e)return w.jsx("div",{className:"loading-state",children:w.jsx("p",{children:"Loading memory data..."})});const{memory:t,health:n}=e,r=Object.entries(t.byFingerprint||{}).sort(([,i],[,a])=>a-i);return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"💾 Memory Store"}),w.jsxs("div",{className:"stats-grid mini",children:[w.jsxs("div",{className:"stat-card",children:[w.jsx("div",{className:"stat-value",children:fd(t.total)}),w.jsx("div",{className:"stat-label",children:"Trajectories"})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("div",{className:"stat-value",children:vX(t.avgScore)}),w.jsx("div",{className:"stat-label",children:"Avg Score"})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("div",{className:"stat-value",children:fd(n==null?void 0:n.patterns)}),w.jsx("div",{className:"stat-label",children:"Coding Patterns"})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("div",{className:"stat-value",children:fd(n==null?void 0:n.feedback)}),w.jsx("div",{className:"stat-label",children:"Feedback Ratings"})]})]}),r.length>0&&w.jsxs(w.Fragment,{children:[w.jsx("h3",{className:"section-subtitle",children:"By Project Type"}),w.jsx("div",{className:"memory-list",children:r.map(([i,a])=>w.jsxs("div",{className:"memory-item",children:[w.jsx("span",{className:"memory-project",children:i}),w.jsxs("span",{className:"memory-count",children:[a," trajectory(ies)"]})]},i))})]})]})}function dd(e){return e==null?"0":e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toLocaleString()}function mX({data:e}){if(!e)return w.jsx("div",{className:"loading-state",children:w.jsx("p",{children:"Loading system data..."})});const{health:t,serverTime:n}=e;return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"⚙️ System Health"}),w.jsxs("div",{className:"health-grid",children:[w.jsxs("div",{className:"health-card",children:[w.jsx("span",{className:"health-icon",children:"💾"}),w.jsxs("div",{className:"health-body",children:[w.jsx("div",{className:"health-title",children:"Memory Directory"}),w.jsx("div",{className:"health-path",children:t.memoryDir||"~/.buff/memory/"})]})]}),w.jsxs("div",{className:"health-card",children:[w.jsx("span",{className:"health-icon",children:"📝"}),w.jsxs("div",{className:"health-body",children:[w.jsx("div",{className:"health-title",children:"Coding Patterns"}),w.jsx("div",{className:"health-value",children:dd(t.patterns)})]})]}),w.jsxs("div",{className:"health-card",children:[w.jsx("span",{className:"health-icon",children:"👍"}),w.jsxs("div",{className:"health-body",children:[w.jsx("div",{className:"health-title",children:"User Feedback"}),w.jsxs("div",{className:"health-value",children:[dd(t.feedback)," ratings"]})]})]}),w.jsxs("div",{className:"health-card",children:[w.jsx("span",{className:"health-icon",children:"🧠"}),w.jsxs("div",{className:"health-body",children:[w.jsx("div",{className:"health-title",children:"Vector Index"}),w.jsxs("div",{className:"health-value",children:[dd(t.vectors)," entries"]})]})]})]}),w.jsx("h3",{className:"section-subtitle",children:"Server Info"}),w.jsxs("div",{className:"server-info",children:[w.jsxs("div",{className:"info-row",children:[w.jsx("span",{className:"info-label",children:"Status"}),w.jsx("span",{className:"info-value",children:"● Connected"})]}),w.jsxs("div",{className:"info-row",children:[w.jsx("span",{className:"info-label",children:"Last Updated"}),w.jsx("span",{className:"info-value",children:n?new Date(n).toLocaleString():"--"})]}),w.jsxs("div",{className:"info-row",children:[w.jsx("span",{className:"info-label",children:"Data Directory"}),w.jsx("span",{className:"info-value",children:t.memoryDir||"~/.buff/memory/"})]})]})]})}const gX=new Set(["local","lmstudio","vllm"]),Xs={available:{bg:"#0a2e1a",text:"#3fb950",dot:"#3fb950",cardBorder:"#3fb950",cardBg:"#0d2818"},limited:{bg:"#2d1f00",text:"#d29922",dot:"#d29922",cardBorder:"#d29922",cardBg:"#1f1700"},unavailable:{bg:"#2d0f0f",text:"#f85149",dot:"#f85149",cardBorder:"#f85149",cardBg:"#1f0a0a"}};function bX(e){return e==="available"?"Available":e==="limited"?"Limited":"Unavailable"}function xX(e){return e==="available"?"Ready":e==="limited"?"Limited":"Down"}function wX(e){return{local:"💻",groq:"🟢",nim:"🔶",gemini:"🔷",openrouter:"🟣",openai:"🤖",anthropic:"🔮",mistral:"🌀",cohere:"🧠",together:"🟢",deepinfra:"🌐",fireworks:"🎆",perplexity:"❓",azure:"🔵",anyscale:"🔷",lmstudio:"🎨",vllm:"⚡"}[e]||"🔌"}function SX(e){return{local:"Ollama",groq:"Groq",nim:"NVIDIA NIM",gemini:"Gemini",openrouter:"OpenRouter",openai:"OpenAI",anthropic:"Anthropic",mistral:"Mistral",cohere:"Cohere",together:"Together AI",deepinfra:"DeepInfra",fireworks:"Fireworks AI",perplexity:"Perplexity",azure:"Azure OpenAI",anyscale:"Anyscale",lmstudio:"LM Studio",vllm:"vLLM / TGI"}[e]||e}function Gx({status:e,label:t}){const n=Xs[e];return w.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,background:n.bg,color:n.text,padding:"3px 10px",borderRadius:12,fontSize:12,fontWeight:500,border:`1px solid ${n.text}22`},children:[w.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:n.dot}}),t]})}function OX({onRefresh:e,loading:t}){return w.jsxs("div",{className:"stats-grid mini",style:{marginBottom:16},children:[w.jsx("button",{onClick:e,disabled:t,className:"stat-card",style:{cursor:t?"not-allowed":"pointer",opacity:t?.6:1,border:"1px solid #30363d",justifyContent:"center",fontSize:13},children:t?"⏳ Testing...":"🔄 Refresh Status"}),w.jsx("div",{className:"stat-card",style:{border:"1px solid #30363d"},children:w.jsx("div",{style:{fontSize:13,color:"#8b949e",textAlign:"center",width:"100%"},children:"Tests all configured providers and their API keys in real time"})})]})}function _X({data:e}){const t=e.totalModels;if(t===0)return null;const n=e.available||0,r=e.limited||0,i=e.unavailable||0;return w.jsxs("div",{style:{marginBottom:16},children:[w.jsxs("div",{style:{background:"#0d1117",borderRadius:8,overflow:"hidden",height:10,display:"flex",border:"1px solid #21262d"},children:[n>0&&w.jsx("div",{style:{width:`${n/t*100}%`,background:"#3fb950",transition:"width 0.5s"},title:`${n} available`}),r>0&&w.jsx("div",{style:{width:`${r/t*100}%`,background:"#d29922",transition:"width 0.5s"},title:`${r} limited`}),i>0&&w.jsx("div",{style:{width:`${i/t*100}%`,background:"#f85149",transition:"width 0.5s"},title:`${i} unavailable`})]}),w.jsxs("div",{style:{display:"flex",gap:16,marginTop:6,fontSize:12,color:"#8b949e"},children:[w.jsxs("span",{children:[w.jsx("span",{style:{color:"#3fb950"},children:"●"})," Ready"]}),w.jsxs("span",{children:[w.jsx("span",{style:{color:"#d29922"},children:"●"})," Limited"]}),w.jsxs("span",{children:[w.jsx("span",{style:{color:"#f85149"},children:"●"})," Unavailable"]})]})]})}function pd({provider:e}){const[t,n]=A.useState(!1),r=Xs[e.overallStatus].text,i={available:e.models.filter(a=>a.status==="available").length,limited:e.models.filter(a=>a.status==="limited").length,unavailable:e.models.filter(a=>a.status==="unavailable").length};return w.jsxs("div",{style:{background:"#161b22",borderRadius:12,border:`1px solid ${r}44`,borderLeft:`4px solid ${r}`,marginBottom:12,overflow:"hidden"},children:[w.jsxs("div",{onClick:()=>n(!t),style:{padding:"14px 18px",cursor:"pointer",display:"flex",alignItems:"center",gap:14,userSelect:"none"},children:[w.jsx("span",{style:{fontSize:24},children:e.icon}),w.jsxs("div",{style:{flex:1},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:2},children:[w.jsx("span",{style:{fontSize:16,fontWeight:600,color:"#e6edf3"},children:e.providerLabel}),w.jsx(Gx,{status:e.overallStatus,label:bX(e.overallStatus)})]}),w.jsxs("div",{style:{fontSize:13,color:"#8b949e"},children:[e.models.length," model",e.models.length!==1?"s":"",i.available>0&&w.jsxs("span",{style:{color:"#3fb950"},children:[" · ",i.available," ready"]}),i.limited>0&&w.jsxs("span",{style:{color:"#d29922"},children:[" · ",i.limited," limited"]}),i.unavailable>0&&w.jsxs("span",{style:{color:"#f85149"},children:[" · ",i.unavailable," unavailable"]})]})]}),w.jsxs("div",{style:{fontSize:12,color:"#8b949e",textAlign:"right"},children:[w.jsx("div",{style:{marginBottom:2,color:e.apiConfigured?"#3fb950":"#f85149"},children:e.apiConfigured?"✅ Key set":"❌ No key"}),w.jsx("div",{style:{color:e.apiAccessible?"#3fb950":"#f85149"},children:e.apiAccessible?"✅ Connected":"❌ Offline"})]}),w.jsx("span",{style:{color:"#8b949e",fontSize:18,transition:"transform 0.2s",transform:t?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),t&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{style:{padding:"10px 18px",background:"#0d1117",fontSize:13,color:"#8b949e",display:"flex",justifyContent:"space-between",flexWrap:"wrap",gap:8,borderTop:"1px solid #21262d"},children:[w.jsx("span",{children:e.notes}),e.freeTierInfo&&w.jsxs("span",{style:{color:"#d29922"},children:["🎁 ",e.freeTierInfo]})]}),w.jsx("div",{style:{overflowX:"auto",borderTop:"1px solid #21262d"},children:w.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[w.jsx("thead",{children:w.jsxs("tr",{style:{borderBottom:"1px solid #21262d",color:"#8b949e"},children:[w.jsx("th",{style:{padding:"8px 18px",textAlign:"left",fontWeight:500},children:"Model"}),w.jsx("th",{style:{padding:"8px 12px",textAlign:"left",fontWeight:500},children:"Status"}),w.jsx("th",{style:{padding:"8px 12px",textAlign:"left",fontWeight:500},children:"Quota"}),w.jsx("th",{style:{padding:"8px 18px",textAlign:"left",fontWeight:500},children:"Details"})]})}),w.jsx("tbody",{children:e.models.map((a,o)=>w.jsxs("tr",{style:{borderBottom:o<e.models.length-1?"1px solid #21262d":"none",background:a.status==="unavailable"?"#0d1117":"transparent"},children:[w.jsxs("td",{style:{padding:"8px 18px",color:"#e6edf3",fontFamily:"'SFMono-Regular', Consolas, monospace",fontSize:12},children:[w.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:Xs[a.status].dot,marginRight:8}}),a.name]}),w.jsx("td",{style:{padding:"8px 12px"},children:w.jsx(Gx,{status:a.status,label:xX(a.status)})}),w.jsx("td",{style:{padding:"8px 12px",color:"#8b949e",fontSize:12,fontFamily:"'SFMono-Regular', Consolas, monospace"},children:a.rateLimitRemaining!==void 0?a.rateLimitTotal?`${a.rateLimitRemaining}/${a.rateLimitTotal}`:`${a.rateLimitRemaining} left`:"—"}),w.jsx("td",{style:{padding:"8px 18px",color:"#8b949e",fontSize:12},children:a.statusReason})]},a.id))})]})})]})]})}function hd({icon:e,title:t,count:n}){return n===0?null:w.jsxs("h3",{style:{fontSize:15,fontWeight:600,color:"#e6edf3",margin:"24px 0 12px 0",display:"flex",alignItems:"center",gap:8},children:[w.jsx("span",{children:e})," ",t,w.jsx("span",{style:{fontSize:12,color:"#8b949e",fontWeight:400,background:"#161b22",padding:"1px 8px",borderRadius:8},children:n})]})}function PX({model:e,provider:t}){const n=Xs[e.status],r=e.rateLimitRemaining!==void 0?e.rateLimitTotal?`${e.rateLimitRemaining} / ${e.rateLimitTotal}`:`${e.rateLimitRemaining} left`:"—";return w.jsx("td",{style:{padding:10,verticalAlign:"top"},children:w.jsxs("div",{style:{background:n.cardBg,border:`1px solid ${n.cardBorder}44`,borderRadius:10,padding:14,display:"flex",flexDirection:"column",gap:8,height:"100%",transition:"all 0.2s ease",position:"relative",overflow:"hidden",cursor:"default"},onMouseEnter:i=>{i.currentTarget.style.borderColor=n.cardBorder,i.currentTarget.style.boxShadow=`0 2px 10px ${n.cardBorder}22`},onMouseLeave:i=>{i.currentTarget.style.borderColor=`${n.cardBorder}44`,i.currentTarget.style.boxShadow="none"},children:[w.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:3,background:n.cardBorder,opacity:.6}}),w.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#e6edf3",fontFamily:"'SFMono-Regular', Consolas, monospace",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",paddingTop:2},children:e.name.length>28?e.name.slice(0,25)+"…":e.name}),w.jsxs("div",{style:{fontSize:12,color:"#8b949e"},children:[wX(t)," ",SX(t)]}),w.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:5,background:n.bg,color:n.text,padding:"3px 8px",borderRadius:6,fontSize:11,fontWeight:600,alignSelf:"flex-start"},children:[w.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:n.dot}}),e.status==="available"?"Available":e.status==="limited"?"Limited":"Unavailable"]}),w.jsxs("div",{style:{fontSize:11,color:"#6e7681"},children:[w.jsx("span",{style:{color:"#8b949e"},children:"Tokens:"})," ",w.jsx("span",{style:{color:e.rateLimitRemaining!==void 0&&e.rateLimitRemaining<=10?"#d29922":"#8b949e",fontFamily:"'SFMono-Regular', Consolas, monospace",fontWeight:500},children:r})]}),e.status!=="available"&&e.statusReason&&w.jsx("div",{style:{fontSize:10,color:"#6e7681",lineHeight:1.3,marginTop:2},children:e.statusReason.length>45?e.statusReason.slice(0,42)+"…":e.statusReason})]})})}function jX({providers:e}){const t=[];for(const a of e)for(const o of a.models)t.push({model:o,provider:a.provider});if(t.length===0)return null;const n={available:0,limited:1,unavailable:2};t.sort((a,o)=>n[a.model.status]-n[o.model.status]);const r=4,i=[];for(let a=0;a<t.length;a+=r)i.push(t.slice(a,a+r));return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",style:{marginTop:36},children:"📋 Model Health Overview"}),w.jsx("p",{className:"section-description",children:"All models across all providers, color-coded by health status. Each cell shows: Model · Provider · Health · Token Remaining."}),w.jsx("div",{style:{overflowX:"auto"},children:w.jsx("table",{style:{width:"100%",borderCollapse:"separate",borderSpacing:10,tableLayout:"fixed"},children:w.jsx("tbody",{children:i.map((a,o)=>w.jsxs("tr",{children:[a.map(({model:l,provider:u})=>w.jsx(PX,{model:l,provider:u},`${u}-${l.id}`)),a.length<r&&Array.from({length:r-a.length}).map((l,u)=>w.jsx("td",{style:{padding:10}},`empty-${u}`))]},o))})})})]})}function AX(){return w.jsxs("div",{style:{background:"#0d1117",borderRadius:10,padding:14,marginBottom:20,border:"1px solid #21262d",fontSize:13,color:"#8b949e",display:"flex",flexWrap:"wrap",gap:20},children:[w.jsxs("div",{children:[w.jsx("div",{style:{fontWeight:600,color:"#e6edf3",marginBottom:6},children:"Color Coding"}),w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[w.jsxs("span",{children:[w.jsx("span",{style:{color:"#3fb950"},children:"●"})," ",w.jsx("strong",{style:{color:"#e6edf3"},children:"Green"})," — Working with rate limit available"]}),w.jsxs("span",{children:[w.jsx("span",{style:{color:"#d29922"},children:"●"})," ",w.jsx("strong",{style:{color:"#e6edf3"},children:"Amber"})," — Slow / low rate limit / needs action"]}),w.jsxs("span",{children:[w.jsx("span",{style:{color:"#f85149"},children:"●"})," ",w.jsx("strong",{style:{color:"#e6edf3"},children:"Red"})," — API key missing / payment needed / unreachable"]})]})]}),w.jsxs("div",{children:[w.jsx("div",{style:{fontWeight:600,color:"#e6edf3",marginBottom:6},children:"Provider Sections"}),w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[w.jsxs("span",{children:["✅ ",w.jsx("strong",{children:"Cloud"})," — Online providers with active API keys"]}),w.jsxs("span",{children:["🏠 ",w.jsx("strong",{children:"Local"})," — Locally running inference servers"]}),w.jsxs("span",{children:["⛔ ",w.jsx("strong",{children:"Unavailable"})," — Missing keys or unreachable endpoints"]})]})]})]})}function EX(){const[e,t]=A.useState(null),[n,r]=A.useState(!0),[i,a]=A.useState(null),o=A.useRef(!0);async function l(){r(!0),a(null);try{const s=await fetch("/api/models");if(!o.current)return;if(!s.ok)throw new Error(`HTTP ${s.status}`);const f=await s.json();o.current&&t(f)}catch(s){o.current&&a(s instanceof Error?s.message:"Failed to fetch model status")}finally{o.current&&r(!1)}}A.useEffect(()=>{o.current=!0,l();const s=setInterval(l,6e4);return()=>{o.current=!1,clearInterval(s)}},[]);function u(s){const f=[],c=[],d=[],p={available:0,limited:1,unavailable:2};for(const x of s.providers)gX.has(x.provider)?c.push(x):x.overallStatus==="available"?f.push(x):d.push(x);return f.sort((x,b)=>p[x.overallStatus]-p[b.overallStatus]),c.sort((x,b)=>p[x.overallStatus]-p[b.overallStatus]),d.sort((x,b)=>p[x.overallStatus]-p[b.overallStatus]),{available:f,local:c,unavailable:d}}return w.jsxs(w.Fragment,{children:[w.jsx("h2",{className:"section-title",children:"🧠 Model Provider Status"}),w.jsx("p",{className:"section-description",children:"Real-time health check of all AI providers and their available models. Providers are grouped into sections: Available cloud → Local → Unavailable."}),w.jsx(OX,{onRefresh:l,loading:n}),w.jsx(AX,{}),n&&!e&&w.jsxs("div",{className:"loading-state",children:[w.jsx("div",{className:"loading-spinner"}),w.jsx("p",{children:"Testing all 17 provider connections..."})]}),i&&w.jsxs("div",{className:"empty-state",style:{color:"#f85149",border:"1px solid #f8514944",borderRadius:10,padding:16,marginBottom:16},children:["⚠️ ",i]}),e&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"stats-grid",style:{marginBottom:16},children:[w.jsxs("div",{className:"stat-card",children:[w.jsx("span",{className:"stat-icon",children:"🧠"}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",children:e.totalModels}),w.jsx("div",{className:"stat-label",children:"Total Models"})]})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("span",{className:"stat-icon",children:"✅"}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",style:{color:"#3fb950"},children:e.available}),w.jsx("div",{className:"stat-label",children:"Available"})]})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("span",{className:"stat-icon",children:"🟡"}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",style:{color:"#d29922"},children:e.limited}),w.jsx("div",{className:"stat-label",children:"Limited"})]})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("span",{className:"stat-icon",children:"🔴"}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",style:{color:"#f85149"},children:e.unavailable}),w.jsx("div",{className:"stat-label",children:"Unavailable"})]})]}),w.jsxs("div",{className:"stat-card",children:[w.jsx("span",{className:"stat-icon",children:"🔌"}),w.jsxs("div",{className:"stat-body",children:[w.jsx("div",{className:"stat-value",children:e.providers.length}),w.jsx("div",{className:"stat-label",children:"Providers"})]})]})]}),w.jsx(_X,{data:e}),(()=>{const{available:s,local:f,unavailable:c}=u(e);return w.jsxs(w.Fragment,{children:[w.jsx(hd,{icon:"✅",title:"Available Cloud Providers",count:s.length}),s.map(d=>w.jsx(pd,{provider:d},d.provider)),w.jsx(hd,{icon:"🏠",title:"Local Providers",count:f.length}),f.map(d=>w.jsx(pd,{provider:d},d.provider)),w.jsx(hd,{icon:"⛔",title:"Unavailable Providers",count:c.length}),c.map(d=>w.jsx(pd,{provider:d},d.provider))]})})(),w.jsx(jX,{providers:e.providers}),w.jsxs("div",{style:{textAlign:"center",fontSize:12,color:"#484f58",marginTop:16},children:["Last checked: ",new Date(e.lastChecked).toLocaleTimeString()," · ","Auto-refreshes every 60s"]})]})]})}function $X(){const[e,t]=A.useState(null),[n,r]=A.useState(!1),[i,a]=A.useState("--"),o=A.useCallback(u=>{t(u),a(new Date().toLocaleTimeString())},[]),l=A.useCallback(u=>{r(u)},[]);return A.useEffect(()=>{pi.fetchAll().then(f=>{f&&o(f)});const u=pi.subscribe(o),s=pi.onConnectionChange(l);return pi.connect(),()=>{u(),s(),pi.disconnect()}},[o,l]),w.jsx(j$,{connected:n,lastUpdated:i,children:w.jsxs(u$,{children:[w.jsx(ln,{path:"/",element:w.jsx(rX,{data:e})}),w.jsx(ln,{path:"/dag",element:w.jsx(lX,{data:e})}),w.jsx(ln,{path:"/history",element:w.jsx(sX,{data:e})}),w.jsx(ln,{path:"/costs",element:w.jsx(fX,{data:e})}),w.jsx(ln,{path:"/benchmarks",element:w.jsx(hX,{data:e})}),w.jsx(ln,{path:"/memory",element:w.jsx(yX,{data:e})}),w.jsx(ln,{path:"/models",element:w.jsx(EX,{})}),w.jsx(ln,{path:"/system",element:w.jsx(mX,{data:e})}),w.jsx(ln,{path:"*",element:w.jsx(o$,{to:"/",replace:!0})})]})})}aS(document.getElementById("root")).render(w.jsx(A.StrictMode,{children:w.jsx(y$,{children:w.jsx($X,{})})}));
135
+ //# sourceMappingURL=index-DMvjleGh.js.map