tokenrace 0.1.13 → 0.1.14

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.
@@ -184,4 +184,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
184
184
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q7(e,t){if(e){if(typeof e=="string")return wb(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 wb(e,t)}}function z7(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function B7(e){if(Array.isArray(e))return wb(e)}function wb(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 L7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j2(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,qN(r.key),r)}}function k7(e,t,n){return t&&j2(e.prototype,t),n&&j2(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function U7(e,t,n){return t=gf(t),I7(e,$N()?Reflect.construct(t,n||[],gf(e).constructor):t.apply(e,n))}function I7(e,t){if(t&&(To(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return H7(e)}function H7(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($N=function(){return!!e})()}function gf(e){return gf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},gf(e)}function G7(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&&Tb(e,t)}function Tb(e,t){return Tb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Tb(e,t)}function In(e,t,n){return t=qN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qN(e){var t=Y7(e,"string");return To(t)=="symbol"?t:t+""}function Y7(e,t){if(To(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(To(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Il=(function(e){function t(){var n;L7(this,t);for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return n=U7(this,t,[].concat(o)),In(n,"state",{isAnimationFinished:!0,totalLength:0}),In(n,"generateSimpleStrokeDasharray",function(c,f){return"".concat(f,"px ").concat(c-f,"px")}),In(n,"getStrokeDasharray",function(c,f,d){var h=d.reduce(function(w,E){return w+E});if(!h)return n.generateSimpleStrokeDasharray(f,c);for(var v=Math.floor(c/h),y=c%h,g=f-c,x=[],_=0,S=0;_<d.length;S+=d[_],++_)if(S+d[_]>y){x=[].concat(Ji(d.slice(0,_)),[y-S]);break}var b=x.length%2===0?[0,g]:[g];return[].concat(Ji(t.repeat(d,v)),Ji(x),b).map(function(w){return"".concat(w,"px")}).join(", ")}),In(n,"id",$o("recharts-line-")),In(n,"pathRef",function(c){n.mainCurve=c}),In(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),In(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return G7(t,e),k7(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,o){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.points,f=l.xAxis,d=l.yAxis,h=l.layout,v=l.children,y=Nn(v,kl);if(!y)return null;var g=function(S,b){return{x:S.x,y:S.y,value:S.value,errorVal:Yt(S.payload,b)}},x={clipPath:r?"url(#clipPath-".concat(o,")"):null};return L.createElement(Je,x,y.map(function(_){return L.cloneElement(_,{key:"bar-".concat(_.props.dataKey),data:c,xAxis:f,yAxis:d,layout:h,dataPointFormatter:g})}))}},{key:"renderDots",value:function(r,o,l){var c=this.props.isAnimationActive;if(c&&!this.state.isAnimationFinished)return null;var f=this.props,d=f.dot,h=f.points,v=f.dataKey,y=Ee(this.props,!1),g=Ee(d,!0),x=h.map(function(S,b){var w=fn(fn(fn({key:"dot-".concat(b),r:3},y),g),{},{index:b,cx:S.x,cy:S.y,value:S.value,dataKey:v,payload:S.payload,points:h});return t.renderDotItem(d,w)}),_={clipPath:r?"url(#clipPath-".concat(o?"":"dots-").concat(l,")"):null};return L.createElement(Je,Wu({className:"recharts-line-dots",key:"dots"},_),x)}},{key:"renderCurveStatically",value:function(r,o,l,c){var f=this.props,d=f.type,h=f.layout,v=f.connectNulls;f.ref;var y=T2(f,D7),g=fn(fn(fn({},Ee(y,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:o?"url(#clipPath-".concat(l,")"):null,points:r},c),{},{type:d,layout:h,connectNulls:v});return L.createElement(oo,Wu({},g,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,o){var l=this,c=this.props,f=c.points,d=c.strokeDasharray,h=c.isAnimationActive,v=c.animationBegin,y=c.animationDuration,g=c.animationEasing,x=c.animationId,_=c.animateNewValues,S=c.width,b=c.height,w=this.state,E=w.prevPoints,j=w.totalLength;return L.createElement(ar,{begin:v,duration:y,isActive:h,easing:g,from:{t:0},to:{t:1},key:"line-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var A=N.t;if(E){var T=E.length/f.length,C=f.map(function(B,V){var Q=Math.floor(V*T);if(E[Q]){var F=E[Q],R=$t(F.x,B.x),G=$t(F.y,B.y);return fn(fn({},B),{},{x:R(A),y:G(A)})}if(_){var ee=$t(S*2,B.x),oe=$t(b/2,B.y);return fn(fn({},B),{},{x:ee(A),y:oe(A)})}return fn(fn({},B),{},{x:B.x,y:B.y})});return l.renderCurveStatically(C,r,o)}var $=$t(0,j),z=$(A),Z;if(d){var U="".concat(d).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});Z=l.getStrokeDasharray(z,j,U)}else Z=l.generateSimpleStrokeDasharray(j,z);return l.renderCurveStatically(f,r,o,{strokeDasharray:Z})})}},{key:"renderCurve",value:function(r,o){var l=this.props,c=l.points,f=l.isAnimationActive,d=this.state,h=d.prevPoints,v=d.totalLength;return f&&c&&c.length&&(!h&&v>0||!yo(h,c))?this.renderCurveWithAnimation(r,o):this.renderCurveStatically(c,r,o)}},{key:"render",value:function(){var r,o=this.props,l=o.hide,c=o.dot,f=o.points,d=o.className,h=o.xAxis,v=o.yAxis,y=o.top,g=o.left,x=o.width,_=o.height,S=o.isAnimationActive,b=o.id;if(l||!f||!f.length)return null;var w=this.state.isAnimationFinished,E=f.length===1,j=$e("recharts-line",d),N=h&&h.allowDataOverflow,A=v&&v.allowDataOverflow,T=N||A,C=je(b)?this.id:b,$=(r=Ee(c,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},z=$.r,Z=z===void 0?3:z,U=$.strokeWidth,B=U===void 0?2:U,V=Q2(c)?c:{},Q=V.clipDot,F=Q===void 0?!0:Q,R=Z*2+B;return L.createElement(Je,{className:j},N||A?L.createElement("defs",null,L.createElement("clipPath",{id:"clipPath-".concat(C)},L.createElement("rect",{x:N?g:g-x/2,y:A?y:y-_/2,width:N?x:x*2,height:A?_:_*2})),!F&&L.createElement("clipPath",{id:"clipPath-dots-".concat(C)},L.createElement("rect",{x:g-R/2,y:y-R/2,width:x+R,height:_+R}))):null,!E&&this.renderCurve(T,C),this.renderErrorBar(T,C),(E||c)&&this.renderDots(T,F,C),(!S||w)&&Dr.renderCallByParent(this.props,f))}}],[{key:"getDerivedStateFromProps",value:function(r,o){return r.animationId!==o.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:o.curPoints}:r.points!==o.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,o){for(var l=r.length%2!==0?[].concat(Ji(r),[0]):r,c=[],f=0;f<o;++f)c=[].concat(Ji(c),Ji(l));return c}},{key:"renderDotItem",value:function(r,o){var l;if(L.isValidElement(r))l=L.cloneElement(r,o);else if(Ae(r))l=r(o);else{var c=o.key,f=T2(o,P7),d=$e("recharts-line-dot",typeof r!="boolean"?r.className:"");l=L.createElement(Yf,Wu({key:c},f,{className:d}))}return l}}])})(W.PureComponent);In(Il,"displayName","Line");In(Il,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!ui.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});In(Il,"getComposedData",function(e){var t=e.props,n=e.xAxis,r=e.yAxis,o=e.xAxisTicks,l=e.yAxisTicks,c=e.dataKey,f=e.bandSize,d=e.displayedData,h=e.offset,v=t.layout,y=d.map(function(g,x){var _=Yt(g,c);return v==="horizontal"?{x:Zs({axis:n,ticks:o,bandSize:f,entry:g,index:x}),y:je(_)?null:r.scale(_),value:_,payload:g}:{x:je(_)?null:n.scale(_),y:Zs({axis:r,ticks:l,bandSize:f,entry:g,index:x}),value:_,payload:g}});return fn({points:y,layout:v},h)});var X7=["layout","type","stroke","connectNulls","isRange","ref"],K7=["key"],zN;function Eo(e){"@babel/helpers - typeof";return Eo=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},Eo(e)}function BN(e,t){if(e==null)return{};var n=V7(e,t),r,o;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)r=l[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function V7(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 Qa(){return Qa=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},Qa.apply(this,arguments)}function M2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function pa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?M2(Object(n),!0).forEach(function(r){Jn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function F7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C2(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,kN(r.key),r)}}function Z7(e,t,n){return t&&C2(e.prototype,t),n&&C2(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Q7(e,t,n){return t=bf(t),W7(e,LN()?Reflect.construct(t,n||[],bf(e).constructor):t.apply(e,n))}function W7(e,t){if(t&&(Eo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return J7(e)}function J7(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function LN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(LN=function(){return!!e})()}function bf(e){return bf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bf(e)}function eG(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&&Eb(e,t)}function Eb(e,t){return Eb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Eb(e,t)}function Jn(e,t,n){return t=kN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kN(e){var t=tG(e,"string");return Eo(t)=="symbol"?t:t+""}function tG(e,t){if(Eo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Eo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Yn=(function(e){function t(){var n;F7(this,t);for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return n=Q7(this,t,[].concat(o)),Jn(n,"state",{isAnimationFinished:!0}),Jn(n,"id",$o("recharts-area-")),Jn(n,"handleAnimationEnd",function(){var c=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Ae(c)&&c()}),Jn(n,"handleAnimationStart",function(){var c=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Ae(c)&&c()}),n}return eG(t,e),Z7(t,[{key:"renderDots",value:function(r,o,l){var c=this.props.isAnimationActive,f=this.state.isAnimationFinished;if(c&&!f)return null;var d=this.props,h=d.dot,v=d.points,y=d.dataKey,g=Ee(this.props,!1),x=Ee(h,!0),_=v.map(function(b,w){var E=pa(pa(pa({key:"dot-".concat(w),r:3},g),x),{},{index:w,cx:b.x,cy:b.y,dataKey:y,value:b.value,payload:b.payload,points:v});return t.renderDotItem(h,E)}),S={clipPath:r?"url(#clipPath-".concat(o?"":"dots-").concat(l,")"):null};return L.createElement(Je,Qa({className:"recharts-area-dots"},S),_)}},{key:"renderHorizontalRect",value:function(r){var o=this.props,l=o.baseLine,c=o.points,f=o.strokeWidth,d=c[0].x,h=c[c.length-1].x,v=r*Math.abs(d-h),y=ma(c.map(function(g){return g.y||0}));return fe(l)&&typeof l=="number"?y=Math.max(l,y):l&&Array.isArray(l)&&l.length&&(y=Math.max(ma(l.map(function(g){return g.y||0})),y)),fe(y)?L.createElement("rect",{x:d<h?d:d-v,y:0,width:v,height:Math.floor(y+(f?parseInt("".concat(f),10):1))}):null}},{key:"renderVerticalRect",value:function(r){var o=this.props,l=o.baseLine,c=o.points,f=o.strokeWidth,d=c[0].y,h=c[c.length-1].y,v=r*Math.abs(d-h),y=ma(c.map(function(g){return g.x||0}));return fe(l)&&typeof l=="number"?y=Math.max(l,y):l&&Array.isArray(l)&&l.length&&(y=Math.max(ma(l.map(function(g){return g.x||0})),y)),fe(y)?L.createElement("rect",{x:0,y:d<h?d:d-v,width:y+(f?parseInt("".concat(f),10):1),height:Math.floor(v)}):null}},{key:"renderClipRect",value:function(r){var o=this.props.layout;return o==="vertical"?this.renderVerticalRect(r):this.renderHorizontalRect(r)}},{key:"renderAreaStatically",value:function(r,o,l,c){var f=this.props,d=f.layout,h=f.type,v=f.stroke,y=f.connectNulls,g=f.isRange;f.ref;var x=BN(f,X7);return L.createElement(Je,{clipPath:l?"url(#clipPath-".concat(c,")"):null},L.createElement(oo,Qa({},Ee(x,!0),{points:r,connectNulls:y,type:h,baseLine:o,layout:d,stroke:"none",className:"recharts-area-area"})),v!=="none"&&L.createElement(oo,Qa({},Ee(this.props,!1),{className:"recharts-area-curve",layout:d,type:h,connectNulls:y,fill:"none",points:r})),v!=="none"&&g&&L.createElement(oo,Qa({},Ee(this.props,!1),{className:"recharts-area-curve",layout:d,type:h,connectNulls:y,fill:"none",points:o})))}},{key:"renderAreaWithAnimation",value:function(r,o){var l=this,c=this.props,f=c.points,d=c.baseLine,h=c.isAnimationActive,v=c.animationBegin,y=c.animationDuration,g=c.animationEasing,x=c.animationId,_=this.state,S=_.prevPoints,b=_.prevBaseLine;return L.createElement(ar,{begin:v,duration:y,isActive:h,easing:g,from:{t:0},to:{t:1},key:"area-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(w){var E=w.t;if(S){var j=S.length/f.length,N=f.map(function($,z){var Z=Math.floor(z*j);if(S[Z]){var U=S[Z],B=$t(U.x,$.x),V=$t(U.y,$.y);return pa(pa({},$),{},{x:B(E),y:V(E)})}return $}),A;if(fe(d)&&typeof d=="number"){var T=$t(b,d);A=T(E)}else if(je(d)||Ro(d)){var C=$t(b,0);A=C(E)}else A=d.map(function($,z){var Z=Math.floor(z*j);if(b[Z]){var U=b[Z],B=$t(U.x,$.x),V=$t(U.y,$.y);return pa(pa({},$),{},{x:B(E),y:V(E)})}return $});return l.renderAreaStatically(N,A,r,o)}return L.createElement(Je,null,L.createElement("defs",null,L.createElement("clipPath",{id:"animationClipPath-".concat(o)},l.renderClipRect(E))),L.createElement(Je,{clipPath:"url(#animationClipPath-".concat(o,")")},l.renderAreaStatically(f,d,r,o)))})}},{key:"renderArea",value:function(r,o){var l=this.props,c=l.points,f=l.baseLine,d=l.isAnimationActive,h=this.state,v=h.prevPoints,y=h.prevBaseLine,g=h.totalLength;return d&&c&&c.length&&(!v&&g>0||!yo(v,c)||!yo(y,f))?this.renderAreaWithAnimation(r,o):this.renderAreaStatically(c,f,r,o)}},{key:"render",value:function(){var r,o=this.props,l=o.hide,c=o.dot,f=o.points,d=o.className,h=o.top,v=o.left,y=o.xAxis,g=o.yAxis,x=o.width,_=o.height,S=o.isAnimationActive,b=o.id;if(l||!f||!f.length)return null;var w=this.state.isAnimationFinished,E=f.length===1,j=$e("recharts-area",d),N=y&&y.allowDataOverflow,A=g&&g.allowDataOverflow,T=N||A,C=je(b)?this.id:b,$=(r=Ee(c,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},z=$.r,Z=z===void 0?3:z,U=$.strokeWidth,B=U===void 0?2:U,V=Q2(c)?c:{},Q=V.clipDot,F=Q===void 0?!0:Q,R=Z*2+B;return L.createElement(Je,{className:j},N||A?L.createElement("defs",null,L.createElement("clipPath",{id:"clipPath-".concat(C)},L.createElement("rect",{x:N?v:v-x/2,y:A?h:h-_/2,width:N?x:x*2,height:A?_:_*2})),!F&&L.createElement("clipPath",{id:"clipPath-dots-".concat(C)},L.createElement("rect",{x:v-R/2,y:h-R/2,width:x+R,height:_+R}))):null,E?null:this.renderArea(T,C),(c||E)&&this.renderDots(T,F,C),(!S||w)&&Dr.renderCallByParent(this.props,f))}}],[{key:"getDerivedStateFromProps",value:function(r,o){return r.animationId!==o.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:o.curPoints,prevBaseLine:o.curBaseLine}:r.points!==o.curPoints||r.baseLine!==o.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])})(W.PureComponent);zN=Yn;Jn(Yn,"displayName","Area");Jn(Yn,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ui.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Jn(Yn,"getBaseValue",function(e,t,n,r){var o=e.layout,l=e.baseValue,c=t.props.baseValue,f=c??l;if(fe(f)&&typeof f=="number")return f;var d=o==="horizontal"?r:n,h=d.scale.domain();if(d.type==="number"){var v=Math.max(h[0],h[1]),y=Math.min(h[0],h[1]);return f==="dataMin"?y:f==="dataMax"||v<0?v:Math.max(Math.min(h[0],h[1]),0)}return f==="dataMin"?h[0]:f==="dataMax"?h[1]:h[0]});Jn(Yn,"getComposedData",function(e){var t=e.props,n=e.item,r=e.xAxis,o=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,f=e.bandSize,d=e.dataKey,h=e.stackedData,v=e.dataStartIndex,y=e.displayedData,g=e.offset,x=t.layout,_=h&&h.length,S=zN.getBaseValue(t,n,r,o),b=x==="horizontal",w=!1,E=y.map(function(N,A){var T;_?T=h[v+A]:(T=Yt(N,d),Array.isArray(T)?w=!0:T=[S,T]);var C=T[1]==null||_&&Yt(N,d)==null;return b?{x:Zs({axis:r,ticks:l,bandSize:f,entry:N,index:A}),y:C?null:o.scale(T[1]),value:T,payload:N}:{x:C?null:r.scale(T[1]),y:Zs({axis:o,ticks:c,bandSize:f,entry:N,index:A}),value:T,payload:N}}),j;return _||w?j=E.map(function(N){var A=Array.isArray(N.value)?N.value[0]:null;return b?{x:N.x,y:A!=null&&N.y!=null?o.scale(A):null}:{x:A!=null?r.scale(A):null,y:N.y}}):j=b?o.scale(S):r.scale(S),pa({points:E,baseLine:j,layout:x,isRange:w},g)});Jn(Yn,"renderDotItem",function(e,t){var n;if(L.isValidElement(e))n=L.cloneElement(e,t);else if(Ae(e))n=e(t);else{var r=$e("recharts-area-dot",typeof e!="boolean"?e.className:""),o=t.key,l=BN(t,K7);n=L.createElement(Yf,Qa({},l,{key:o,className:r}))}return n});function jo(e){"@babel/helpers - typeof";return jo=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},jo(e)}function nG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rG(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,HN(r.key),r)}}function aG(e,t,n){return t&&rG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function iG(e,t,n){return t=xf(t),oG(e,UN()?Reflect.construct(t,n||[],xf(e).constructor):t.apply(e,n))}function oG(e,t){if(t&&(jo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uG(e)}function uG(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function UN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(UN=function(){return!!e})()}function xf(e){return xf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},xf(e)}function lG(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&&jb(e,t)}function jb(e,t){return jb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},jb(e,t)}function IN(e,t,n){return t=HN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HN(e){var t=cG(e,"string");return jo(t)=="symbol"?t:t+""}function cG(e,t){if(jo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(jo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Mb(){return Mb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mb.apply(this,arguments)}function sG(e){var t=e.xAxisId,n=B0(),r=L0(),o=_N(t);return o==null?null:W.createElement(ko,Mb({},o,{className:$e("recharts-".concat(o.axisType," ").concat(o.axisType),o.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(c){return jr(c,!0)}}))}var kr=(function(e){function t(){return nG(this,t),iG(this,t,arguments)}return lG(t,e),aG(t,[{key:"render",value:function(){return W.createElement(sG,this.props)}}])})(W.Component);IN(kr,"displayName","XAxis");IN(kr,"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 Mo(e){"@babel/helpers - typeof";return Mo=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},Mo(e)}function fG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dG(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,XN(r.key),r)}}function hG(e,t,n){return t&&dG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function pG(e,t,n){return t=Sf(t),vG(e,GN()?Reflect.construct(t,n||[],Sf(e).constructor):t.apply(e,n))}function vG(e,t){if(t&&(Mo(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yG(e)}function yG(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function GN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(GN=function(){return!!e})()}function Sf(e){return Sf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sf(e)}function mG(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&&Cb(e,t)}function Cb(e,t){return Cb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Cb(e,t)}function YN(e,t,n){return t=XN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XN(e){var t=gG(e,"string");return Mo(t)=="symbol"?t:t+""}function gG(e,t){if(Mo(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Mo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Nb(){return Nb=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},Nb.apply(this,arguments)}var bG=function(t){var n=t.yAxisId,r=B0(),o=L0(),l=AN(n);return l==null?null:W.createElement(ko,Nb({},l,{className:$e("recharts-".concat(l.axisType," ").concat(l.axisType),l.className),viewBox:{x:0,y:0,width:r,height:o},ticksGenerator:function(f){return jr(f,!0)}}))},Ur=(function(e){function t(){return fG(this,t),pG(this,t,arguments)}return mG(t,e),hG(t,[{key:"render",value:function(){return W.createElement(bG,this.props)}}])})(W.Component);YN(Ur,"displayName","YAxis");YN(Ur,"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 N2(e){return _G(e)||OG(e)||SG(e)||xG()}function xG(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
185
185
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SG(e,t){if(e){if(typeof e=="string")return Db(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 Db(e,t)}}function OG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _G(e){if(Array.isArray(e))return Db(e)}function Db(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 Pb=function(t,n,r,o,l){var c=Nn(t,Ff),f=Nn(t,Qf),d=[].concat(N2(c),N2(f)),h=Nn(t,Jf),v="".concat(o,"Id"),y=o[0],g=n;if(d.length&&(g=d.reduce(function(S,b){if(b.props[v]===r&&nr(b.props,"extendDomain")&&fe(b.props[y])){var w=b.props[y];return[Math.min(S[0],w),Math.max(S[1],w)]}return S},g)),h.length){var x="".concat(y,"1"),_="".concat(y,"2");g=h.reduce(function(S,b){if(b.props[v]===r&&nr(b.props,"extendDomain")&&fe(b.props[x])&&fe(b.props[_])){var w=b.props[x],E=b.props[_];return[Math.min(S[0],w,E),Math.max(S[1],w,E)]}return S},g)}return l&&l.length&&(g=l.reduce(function(S,b){return fe(b)?[Math.min(S[0],b),Math.max(S[1],b)]:S},g)),g},vg={exports:{}},D2;function AG(){return D2||(D2=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function o(d,h,v){this.fn=d,this.context=h,this.once=v||!1}function l(d,h,v,y,g){if(typeof v!="function")throw new TypeError("The listener must be a function");var x=new o(v,y||d,g),_=n?n+h:h;return d._events[_]?d._events[_].fn?d._events[_]=[d._events[_],x]:d._events[_].push(x):(d._events[_]=x,d._eventsCount++),d}function c(d,h){--d._eventsCount===0?d._events=new r:delete d._events[h]}function f(){this._events=new r,this._eventsCount=0}f.prototype.eventNames=function(){var h=[],v,y;if(this._eventsCount===0)return h;for(y in v=this._events)t.call(v,y)&&h.push(n?y.slice(1):y);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(v)):h},f.prototype.listeners=function(h){var v=n?n+h:h,y=this._events[v];if(!y)return[];if(y.fn)return[y.fn];for(var g=0,x=y.length,_=new Array(x);g<x;g++)_[g]=y[g].fn;return _},f.prototype.listenerCount=function(h){var v=n?n+h:h,y=this._events[v];return y?y.fn?1:y.length:0},f.prototype.emit=function(h,v,y,g,x,_){var S=n?n+h:h;if(!this._events[S])return!1;var b=this._events[S],w=arguments.length,E,j;if(b.fn){switch(b.once&&this.removeListener(h,b.fn,void 0,!0),w){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,v),!0;case 3:return b.fn.call(b.context,v,y),!0;case 4:return b.fn.call(b.context,v,y,g),!0;case 5:return b.fn.call(b.context,v,y,g,x),!0;case 6:return b.fn.call(b.context,v,y,g,x,_),!0}for(j=1,E=new Array(w-1);j<w;j++)E[j-1]=arguments[j];b.fn.apply(b.context,E)}else{var N=b.length,A;for(j=0;j<N;j++)switch(b[j].once&&this.removeListener(h,b[j].fn,void 0,!0),w){case 1:b[j].fn.call(b[j].context);break;case 2:b[j].fn.call(b[j].context,v);break;case 3:b[j].fn.call(b[j].context,v,y);break;case 4:b[j].fn.call(b[j].context,v,y,g);break;default:if(!E)for(A=1,E=new Array(w-1);A<w;A++)E[A-1]=arguments[A];b[j].fn.apply(b[j].context,E)}}return!0},f.prototype.on=function(h,v,y){return l(this,h,v,y,!1)},f.prototype.once=function(h,v,y){return l(this,h,v,y,!0)},f.prototype.removeListener=function(h,v,y,g){var x=n?n+h:h;if(!this._events[x])return this;if(!v)return c(this,x),this;var _=this._events[x];if(_.fn)_.fn===v&&(!g||_.once)&&(!y||_.context===y)&&c(this,x);else{for(var S=0,b=[],w=_.length;S<w;S++)(_[S].fn!==v||g&&!_[S].once||y&&_[S].context!==y)&&b.push(_[S]);b.length?this._events[x]=b.length===1?b[0]:b:c(this,x)}return this},f.prototype.removeAllListeners=function(h){var v;return h?(v=n?n+h:h,this._events[v]&&c(this,v)):(this._events=new r,this._eventsCount=0),this},f.prototype.off=f.prototype.removeListener,f.prototype.addListener=f.prototype.on,f.prefixed=n,f.EventEmitter=f,e.exports=f})(vg)),vg.exports}var wG=AG();const TG=Qe(wG);var yg=new TG,mg="recharts.syncMouseEvents";function Dl(e){"@babel/helpers - typeof";return Dl=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},Dl(e)}function EG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jG(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,KN(r.key),r)}}function MG(e,t,n){return t&&jG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function gg(e,t,n){return t=KN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KN(e){var t=CG(e,"string");return Dl(t)=="symbol"?t:t+""}function CG(e,t){if(Dl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Dl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var NG=(function(){function e(){EG(this,e),gg(this,"activeIndex",0),gg(this,"coordinateList",[]),gg(this,"layout","horizontal")}return MG(e,[{key:"setDetails",value:function(n){var r,o=n.coordinateList,l=o===void 0?null:o,c=n.container,f=c===void 0?null:c,d=n.layout,h=d===void 0?null:d,v=n.offset,y=v===void 0?null:v,g=n.mouseHandlerCallback,x=g===void 0?null:g;this.coordinateList=(r=l??this.coordinateList)!==null&&r!==void 0?r:[],this.container=f??this.container,this.layout=h??this.layout,this.offset=y??this.offset,this.mouseHandlerCallback=x??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 o=this.container.getBoundingClientRect(),l=o.x,c=o.y,f=o.height,d=this.coordinateList[this.activeIndex].coordinate,h=((n=window)===null||n===void 0?void 0:n.scrollX)||0,v=((r=window)===null||r===void 0?void 0:r.scrollY)||0,y=l+d+h,g=c+this.offset.top+f/2+v;this.mouseHandlerCallback({pageX:y,pageY:g})}}}])})();function DG(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e==null?void 0:e[0],o=e==null?void 0:e[1];if(r&&o&&fe(r)&&fe(o))return!0}return!1}function PG(e,t,n,r){var o=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-o:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-o,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function VN(e){var t=e.cx,n=e.cy,r=e.radius,o=e.startAngle,l=e.endAngle,c=qt(t,n,r,o),f=qt(t,n,r,l);return{points:[c,f],cx:t,cy:n,radius:r,startAngle:o,endAngle:l}}function RG(e,t,n){var r,o,l,c;if(e==="horizontal")r=t.x,l=r,o=n.top,c=n.top+n.height;else if(e==="vertical")o=t.y,c=o,r=n.left,l=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var f=t.cx,d=t.cy,h=t.innerRadius,v=t.outerRadius,y=t.angle,g=qt(f,d,h,y),x=qt(f,d,v,y);r=g.x,o=g.y,l=x.x,c=x.y}else return VN(t);return[{x:r,y:o},{x:l,y:c}]}function Pl(e){"@babel/helpers - typeof";return Pl=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},Pl(e)}function P2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function bs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?P2(Object(n),!0).forEach(function(r){$G(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $G(e,t,n){return t=qG(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qG(e){var t=zG(e,"string");return Pl(t)=="symbol"?t:t+""}function zG(e,t){if(Pl(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Pl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function BG(e){var t,n,r=e.element,o=e.tooltipEventType,l=e.isActive,c=e.activeCoordinate,f=e.activePayload,d=e.offset,h=e.activeTooltipIndex,v=e.tooltipAxisBandSize,y=e.layout,g=e.chartName,x=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!x||!l||!c||g!=="ScatterChart"&&o!=="axis")return null;var _,S=oo;if(g==="ScatterChart")_=c,S=TI;else if(g==="BarChart")_=PG(y,c,d,v),S=P0;else if(y==="radial"){var b=VN(c),w=b.cx,E=b.cy,j=b.radius,N=b.startAngle,A=b.endAngle;_={cx:w,cy:E,startAngle:N,endAngle:A,innerRadius:j,outerRadius:j},S=JC}else _={points:RG(y,c,d)},S=oo;var T=bs(bs(bs(bs({stroke:"#ccc",pointerEvents:"none"},d),_),Ee(x,!1)),{},{payload:f,payloadIndex:h,className:$e("recharts-tooltip-cursor",x.className)});return W.isValidElement(x)?W.cloneElement(x,T):W.createElement(S,T)}var LG=["item"],kG=["children","className","width","height","style","compact","title","desc"];function Co(e){"@babel/helpers - typeof";return Co=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},Co(e)}function no(){return no=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},no.apply(this,arguments)}function R2(e,t){return HG(e)||IG(e,t)||ZN(e,t)||UG()}function UG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
186
186
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IG(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,l,c,f=[],d=!0,h=!1;try{if(l=(n=n.call(e)).next,t!==0)for(;!(d=(r=l.call(n)).done)&&(f.push(r.value),f.length!==t);d=!0);}catch(v){h=!0,o=v}finally{try{if(!d&&n.return!=null&&(c=n.return(),Object(c)!==c))return}finally{if(h)throw o}}return f}}function HG(e){if(Array.isArray(e))return e}function $2(e,t){if(e==null)return{};var n=GG(e,t),r,o;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)r=l[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function GG(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 YG(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,QN(r.key),r)}}function KG(e,t,n){return t&&XG(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function VG(e,t,n){return t=Of(t),FG(e,FN()?Reflect.construct(t,n||[],Of(e).constructor):t.apply(e,n))}function FG(e,t){if(t&&(Co(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ZG(e)}function ZG(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function FN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(FN=function(){return!!e})()}function Of(e){return Of=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Of(e)}function QG(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&&Rb(e,t)}function Rb(e,t){return Rb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Rb(e,t)}function No(e){return eY(e)||JG(e)||ZN(e)||WG()}function WG(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
187
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZN(e,t){if(e){if(typeof e=="string")return $b(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 $b(e,t)}}function JG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function eY(e){if(Array.isArray(e))return $b(e)}function $b(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 q2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?q2(Object(n),!0).forEach(function(r){be(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function be(e,t,n){return t=QN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function QN(e){var t=tY(e,"string");return Co(t)=="symbol"?t:t+""}function tY(e,t){if(Co(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Co(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var nY={xAxis:["bottom","top"],yAxis:["left","right"]},rY={width:"100%",height:"100%"},WN={x:0,y:0};function xs(e){return e}var aY=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},iY=function(t,n,r,o){var l=n.find(function(v){return v&&v.index===r});if(l){if(t==="horizontal")return{x:l.coordinate,y:o.y};if(t==="vertical")return{x:o.x,y:l.coordinate};if(t==="centric"){var c=l.coordinate,f=o.radius;return ne(ne(ne({},o),qt(o.cx,o.cy,f,c)),{},{angle:c,radius:f})}var d=l.coordinate,h=o.angle;return ne(ne(ne({},o),qt(o.cx,o.cy,d,h)),{},{angle:h,radius:d})}return WN},ed=function(t,n){var r=n.graphicalItems,o=n.dataStartIndex,l=n.dataEndIndex,c=(r??[]).reduce(function(f,d){var h=d.props.data;return h&&h.length?[].concat(No(f),No(h)):f},[]);return c.length>0?c:t&&t.length&&fe(o)&&fe(l)?t.slice(o,l+1):[]};function JN(e){return e==="number"?[0,"auto"]:void 0}var qb=function(t,n,r,o){var l=t.graphicalItems,c=t.tooltipAxis,f=ed(n,t);return r<0||!l||!l.length||r>=f.length?null:l.reduce(function(d,h){var v,y=(v=h.props.data)!==null&&v!==void 0?v:n;y&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(y=y.slice(t.dataStartIndex,t.dataEndIndex+1));var g;if(c.dataKey&&!c.allowDuplicatedCategory){var x=y===void 0?f:y;g=Os(x,c.dataKey,o)}else g=y&&y[r]||f[r];return g?[].concat(No(d),[ZC(h,g)]):d},[])},z2=function(t,n,r,o){var l=o||{x:t.chartX,y:t.chartY},c=aY(l,r),f=t.orderedTooltipTicks,d=t.tooltipAxis,h=t.tooltipTicks,v=i5(c,f,h,d);if(v>=0&&h){var y=h[v]&&h[v].value,g=qb(t,n,v,y),x=iY(r,f,v,l);return{activeTooltipIndex:v,activeLabel:y,activePayload:g,activeCoordinate:x}}return null},oY=function(t,n){var r=n.axes,o=n.graphicalItems,l=n.axisType,c=n.axisIdKey,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,y=t.children,g=t.stackOffset,x=KC(v,l);return r.reduce(function(_,S){var b,w=S.type.defaultProps!==void 0?ne(ne({},S.type.defaultProps),S.props):S.props,E=w.type,j=w.dataKey,N=w.allowDataOverflow,A=w.allowDuplicatedCategory,T=w.scale,C=w.ticks,$=w.includeHidden,z=w[c];if(_[z])return _;var Z=ed(t.data,{graphicalItems:o.filter(function(I){var re,se=c in I.props?I.props[c]:(re=I.type.defaultProps)===null||re===void 0?void 0:re[c];return se===z}),dataStartIndex:d,dataEndIndex:h}),U=Z.length,B,V,Q;DG(w.domain,N,E)&&(B=Jg(w.domain,null,N),x&&(E==="number"||T!=="auto")&&(Q=Zu(Z,j,"category")));var F=JN(E);if(!B||B.length===0){var R,G=(R=w.domain)!==null&&R!==void 0?R:F;if(j){if(B=Zu(Z,j,E),E==="category"&&x){var ee=Q3(B);A&&ee?(V=B,B=lf(0,U)):A||(B=FE(G,B,S).reduce(function(I,re){return I.indexOf(re)>=0?I:[].concat(No(I),[re])},[]))}else if(E==="category")A?B=B.filter(function(I){return I!==""&&!je(I)}):B=FE(G,B,S).reduce(function(I,re){return I.indexOf(re)>=0||re===""||je(re)?I:[].concat(No(I),[re])},[]);else if(E==="number"){var oe=s5(Z,o.filter(function(I){var re,se,pe=c in I.props?I.props[c]:(re=I.type.defaultProps)===null||re===void 0?void 0:re[c],me="hide"in I.props?I.props.hide:(se=I.type.defaultProps)===null||se===void 0?void 0:se.hide;return pe===z&&($||!me)}),j,l,v);oe&&(B=oe)}x&&(E==="number"||T!=="auto")&&(Q=Zu(Z,j,"category"))}else x?B=lf(0,U):f&&f[z]&&f[z].hasStack&&E==="number"?B=g==="expand"?[0,1]:FC(f[z].stackGroups,d,h):B=XC(Z,o.filter(function(I){var re=c in I.props?I.props[c]:I.type.defaultProps[c],se="hide"in I.props?I.props.hide:I.type.defaultProps.hide;return re===z&&($||!se)}),E,v,!0);if(E==="number")B=Pb(y,B,z,l,C),G&&(B=Jg(G,B,N));else if(E==="category"&&G){var le=G,P=B.every(function(I){return le.indexOf(I)>=0});P&&(B=le)}}return ne(ne({},_),{},be({},z,ne(ne({},w),{},{axisType:l,domain:B,categoricalDomain:Q,duplicateDomain:V,originalDomain:(b=w.domain)!==null&&b!==void 0?b:F,isCategorical:x,layout:v})))},{})},uY=function(t,n){var r=n.graphicalItems,o=n.Axis,l=n.axisType,c=n.axisIdKey,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,y=t.children,g=ed(t.data,{graphicalItems:r,dataStartIndex:d,dataEndIndex:h}),x=g.length,_=KC(v,l),S=-1;return r.reduce(function(b,w){var E=w.type.defaultProps!==void 0?ne(ne({},w.type.defaultProps),w.props):w.props,j=E[c],N=JN("number");if(!b[j]){S++;var A;return _?A=lf(0,x):f&&f[j]&&f[j].hasStack?(A=FC(f[j].stackGroups,d,h),A=Pb(y,A,j,l)):(A=Jg(N,XC(g,r.filter(function(T){var C,$,z=c in T.props?T.props[c]:(C=T.type.defaultProps)===null||C===void 0?void 0:C[c],Z="hide"in T.props?T.props.hide:($=T.type.defaultProps)===null||$===void 0?void 0:$.hide;return z===j&&!Z}),"number",v),o.defaultProps.allowDataOverflow),A=Pb(y,A,j,l)),ne(ne({},b),{},be({},j,ne(ne({axisType:l},o.defaultProps),{},{hide:!0,orientation:Cn(nY,"".concat(l,".").concat(S%2),null),domain:A,originalDomain:N,isCategorical:_,layout:v})))}return b},{})},lY=function(t,n){var r=n.axisType,o=r===void 0?"xAxis":r,l=n.AxisComp,c=n.graphicalItems,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.children,y="".concat(o,"Id"),g=Nn(v,l),x={};return g&&g.length?x=oY(t,{axes:g,graphicalItems:c,axisType:o,axisIdKey:y,stackGroups:f,dataStartIndex:d,dataEndIndex:h}):c&&c.length&&(x=uY(t,{Axis:l,graphicalItems:c,axisType:o,axisIdKey:y,stackGroups:f,dataStartIndex:d,dataEndIndex:h})),x},cY=function(t){var n=ya(t),r=jr(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:o0(r,function(o){return o.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Qs(n,r)}},B2=function(t){var n=t.children,r=t.defaultShowTooltip,o=hn(n,xo),l=0,c=0;return t.data&&t.data.length!==0&&(c=t.data.length-1),o&&o.props&&(o.props.startIndex>=0&&(l=o.props.startIndex),o.props.endIndex>=0&&(c=o.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:l,dataEndIndex:c,activeTooltipIndex:-1,isTooltipActive:!!r}},sY=function(t){return!t||!t.length?!1:t.some(function(n){var r=Mr(n&&n.type);return r&&r.indexOf("Bar")>=0})},L2=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"}},fY=function(t,n){var r=t.props,o=t.graphicalItems,l=t.xAxisMap,c=l===void 0?{}:l,f=t.yAxisMap,d=f===void 0?{}:f,h=r.width,v=r.height,y=r.children,g=r.margin||{},x=hn(y,xo),_=hn(y,ba),S=Object.keys(d).reduce(function(A,T){var C=d[T],$=C.orientation;return!C.mirror&&!C.hide?ne(ne({},A),{},be({},$,A[$]+C.width)):A},{left:g.left||0,right:g.right||0}),b=Object.keys(c).reduce(function(A,T){var C=c[T],$=C.orientation;return!C.mirror&&!C.hide?ne(ne({},A),{},be({},$,Cn(A,"".concat($))+C.height)):A},{top:g.top||0,bottom:g.bottom||0}),w=ne(ne({},b),S),E=w.bottom;x&&(w.bottom+=x.props.height||xo.defaultProps.height),_&&n&&(w=l5(w,o,r,n));var j=h-w.left-w.right,N=v-w.top-w.bottom;return ne(ne({brushBottom:E},w),{},{width:Math.max(j,0),height:Math.max(N,0)})},dY=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},H0=function(t){var n=t.chartName,r=t.GraphicalChild,o=t.defaultTooltipEventType,l=o===void 0?"axis":o,c=t.validateTooltipEventTypes,f=c===void 0?["axis"]:c,d=t.axisComponents,h=t.legendContent,v=t.formatAxisMap,y=t.defaultProps,g=function(w,E){var j=E.graphicalItems,N=E.stackGroups,A=E.offset,T=E.updateId,C=E.dataStartIndex,$=E.dataEndIndex,z=w.barSize,Z=w.layout,U=w.barGap,B=w.barCategoryGap,V=w.maxBarSize,Q=L2(Z),F=Q.numericAxisName,R=Q.cateAxisName,G=sY(j),ee=[];return j.forEach(function(oe,le){var P=ed(w.data,{graphicalItems:[oe],dataStartIndex:C,dataEndIndex:$}),I=oe.type.defaultProps!==void 0?ne(ne({},oe.type.defaultProps),oe.props):oe.props,re=I.dataKey,se=I.maxBarSize,pe=I["".concat(F,"Id")],me=I["".concat(R,"Id")],Me={},ke=d.reduce(function($n,or){var Uo=E["".concat(or.axisType,"Map")],Bt=I["".concat(or.axisType,"Id")];Uo&&Uo[Bt]||or.axisType==="zAxis"||ai();var Hl=Uo[Bt];return ne(ne({},$n),{},be(be({},or.axisType,Hl),"".concat(or.axisType,"Ticks"),jr(Hl)))},Me),ce=ke[R],xe=ke["".concat(R,"Ticks")],Se=N&&N[pe]&&N[pe].hasStack&&O5(oe,N[pe].stackGroups),ue=Mr(oe.type).indexOf("Bar")>=0,et=Qs(ce,xe),we=[],ot=G&&o5({barSize:z,stackGroups:N,totalSize:dY(ke,R)});if(ue){var ut,zt,Rn=je(se)?V:se,Kn=(ut=(zt=Qs(ce,xe,!0))!==null&&zt!==void 0?zt:Rn)!==null&&ut!==void 0?ut:0;we=u5({barGap:U,barCategoryGap:B,bandSize:Kn!==et?Kn:et,sizeList:ot[me],maxBarSize:Rn}),Kn!==et&&(we=we.map(function($n){return ne(ne({},$n),{},{position:ne(ne({},$n.position),{},{offset:$n.position.offset-Kn/2})})}))}var Ir=oe&&oe.type&&oe.type.getComposedData;Ir&&ee.push({props:ne(ne({},Ir(ne(ne({},ke),{},{displayedData:P,props:w,dataKey:re,item:oe,bandSize:et,barPosition:we,offset:A,stackedData:Se,layout:Z,dataStartIndex:C,dataEndIndex:$}))),{},be(be(be({key:oe.key||"item-".concat(le)},F,ke[F]),R,ke[R]),"animationId",T)),childIndex:c$(oe,w.children),item:oe})}),ee},x=function(w,E){var j=w.props,N=w.dataStartIndex,A=w.dataEndIndex,T=w.updateId;if(!sA({props:j}))return null;var C=j.children,$=j.layout,z=j.stackOffset,Z=j.data,U=j.reverseStackOrder,B=L2($),V=B.numericAxisName,Q=B.cateAxisName,F=Nn(C,r),R=b5(Z,F,"".concat(V,"Id"),"".concat(Q,"Id"),z,U),G=d.reduce(function(I,re){var se="".concat(re.axisType,"Map");return ne(ne({},I),{},be({},se,lY(j,ne(ne({},re),{},{graphicalItems:F,stackGroups:re.axisType===V&&R,dataStartIndex:N,dataEndIndex:A}))))},{}),ee=fY(ne(ne({},G),{},{props:j,graphicalItems:F}),E==null?void 0:E.legendBBox);Object.keys(G).forEach(function(I){G[I]=v(j,G[I],ee,I.replace("Map",""),n)});var oe=G["".concat(Q,"Map")],le=cY(oe),P=g(j,ne(ne({},G),{},{dataStartIndex:N,dataEndIndex:A,updateId:T,graphicalItems:F,stackGroups:R,offset:ee}));return ne(ne({formattedGraphicalItems:P,graphicalItems:F,offset:ee,stackGroups:R},le),G)},_=(function(b){function w(E){var j,N,A;return YG(this,w),A=VG(this,w,[E]),be(A,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),be(A,"accessibilityManager",new NG),be(A,"handleLegendBBoxUpdate",function(T){if(T){var C=A.state,$=C.dataStartIndex,z=C.dataEndIndex,Z=C.updateId;A.setState(ne({legendBBox:T},x({props:A.props,dataStartIndex:$,dataEndIndex:z,updateId:Z},ne(ne({},A.state),{},{legendBBox:T}))))}}),be(A,"handleReceiveSyncEvent",function(T,C,$){if(A.props.syncId===T){if($===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(C)}}),be(A,"handleBrushChange",function(T){var C=T.startIndex,$=T.endIndex;if(C!==A.state.dataStartIndex||$!==A.state.dataEndIndex){var z=A.state.updateId;A.setState(function(){return ne({dataStartIndex:C,dataEndIndex:$},x({props:A.props,dataStartIndex:C,dataEndIndex:$,updateId:z},A.state))}),A.triggerSyncEvent({dataStartIndex:C,dataEndIndex:$})}}),be(A,"handleMouseEnter",function(T){var C=A.getMouseInfo(T);if(C){var $=ne(ne({},C),{},{isTooltipActive:!0});A.setState($),A.triggerSyncEvent($);var z=A.props.onMouseEnter;Ae(z)&&z($,T)}}),be(A,"triggeredAfterMouseMove",function(T){var C=A.getMouseInfo(T),$=C?ne(ne({},C),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState($),A.triggerSyncEvent($);var z=A.props.onMouseMove;Ae(z)&&z($,T)}),be(A,"handleItemMouseEnter",function(T){A.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),be(A,"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),be(A,"handleMouseMove",function(T){T.persist(),A.throttleTriggeredAfterMouseMove(T)}),be(A,"handleMouseLeave",function(T){A.throttleTriggeredAfterMouseMove.cancel();var C={isTooltipActive:!1};A.setState(C),A.triggerSyncEvent(C);var $=A.props.onMouseLeave;Ae($)&&$(C,T)}),be(A,"handleOuterEvent",function(T){var C=l$(T),$=Cn(A.props,"".concat(C));if(C&&Ae($)){var z,Z;/.*touch.*/i.test(C)?Z=A.getMouseInfo(T.changedTouches[0]):Z=A.getMouseInfo(T),$((z=Z)!==null&&z!==void 0?z:{},T)}}),be(A,"handleClick",function(T){var C=A.getMouseInfo(T);if(C){var $=ne(ne({},C),{},{isTooltipActive:!0});A.setState($),A.triggerSyncEvent($);var z=A.props.onClick;Ae(z)&&z($,T)}}),be(A,"handleMouseDown",function(T){var C=A.props.onMouseDown;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleMouseUp",function(T){var C=A.props.onMouseUp;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),be(A,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.handleMouseDown(T.changedTouches[0])}),be(A,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.handleMouseUp(T.changedTouches[0])}),be(A,"handleDoubleClick",function(T){var C=A.props.onDoubleClick;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleContextMenu",function(T){var C=A.props.onContextMenu;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"triggerSyncEvent",function(T){A.props.syncId!==void 0&&yg.emit(mg,A.props.syncId,T,A.eventEmitterSymbol)}),be(A,"applySyncEvent",function(T){var C=A.props,$=C.layout,z=C.syncMethod,Z=A.state.updateId,U=T.dataStartIndex,B=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)A.setState(ne({dataStartIndex:U,dataEndIndex:B},x({props:A.props,dataStartIndex:U,dataEndIndex:B,updateId:Z},A.state)));else if(T.activeTooltipIndex!==void 0){var V=T.chartX,Q=T.chartY,F=T.activeTooltipIndex,R=A.state,G=R.offset,ee=R.tooltipTicks;if(!G)return;if(typeof z=="function")F=z(ee,T);else if(z==="value"){F=-1;for(var oe=0;oe<ee.length;oe++)if(ee[oe].value===T.activeLabel){F=oe;break}}var le=ne(ne({},G),{},{x:G.left,y:G.top}),P=Math.min(V,le.x+le.width),I=Math.min(Q,le.y+le.height),re=ee[F]&&ee[F].value,se=qb(A.state,A.props.data,F),pe=ee[F]?{x:$==="horizontal"?ee[F].coordinate:P,y:$==="horizontal"?I:ee[F].coordinate}:WN;A.setState(ne(ne({},T),{},{activeLabel:re,activeCoordinate:pe,activePayload:se,activeTooltipIndex:F}))}else A.setState(T)}),be(A,"renderCursor",function(T){var C,$=A.state,z=$.isTooltipActive,Z=$.activeCoordinate,U=$.activePayload,B=$.offset,V=$.activeTooltipIndex,Q=$.tooltipAxisBandSize,F=A.getTooltipEventType(),R=(C=T.props.active)!==null&&C!==void 0?C:z,G=A.props.layout,ee=T.key||"_recharts-cursor";return L.createElement(BG,{key:ee,activeCoordinate:Z,activePayload:U,activeTooltipIndex:V,chartName:n,element:T,isActive:R,layout:G,offset:B,tooltipAxisBandSize:Q,tooltipEventType:F})}),be(A,"renderPolarAxis",function(T,C,$){var z=Cn(T,"type.axisType"),Z=Cn(A.state,"".concat(z,"Map")),U=T.type.defaultProps,B=U!==void 0?ne(ne({},U),T.props):T.props,V=Z&&Z[B["".concat(z,"Id")]];return W.cloneElement(T,ne(ne({},V),{},{className:$e(z,V.className),key:T.key||"".concat(C,"-").concat($),ticks:jr(V,!0)}))}),be(A,"renderPolarGrid",function(T){var C=T.props,$=C.radialLines,z=C.polarAngles,Z=C.polarRadius,U=A.state,B=U.radiusAxisMap,V=U.angleAxisMap,Q=ya(B),F=ya(V),R=F.cx,G=F.cy,ee=F.innerRadius,oe=F.outerRadius;return W.cloneElement(T,{polarAngles:Array.isArray(z)?z:jr(F,!0).map(function(le){return le.coordinate}),polarRadius:Array.isArray(Z)?Z:jr(Q,!0).map(function(le){return le.coordinate}),cx:R,cy:G,innerRadius:ee,outerRadius:oe,key:T.key||"polar-grid",radialLines:$})}),be(A,"renderLegend",function(){var T=A.state.formattedGraphicalItems,C=A.props,$=C.children,z=C.width,Z=C.height,U=A.props.margin||{},B=z-(U.left||0)-(U.right||0),V=GC({children:$,formattedGraphicalItems:T,legendWidth:B,legendContent:h});if(!V)return null;var Q=V.item,F=$2(V,LG);return W.cloneElement(Q,ne(ne({},F),{},{chartWidth:z,chartHeight:Z,margin:U,onBBoxUpdate:A.handleLegendBBoxUpdate}))}),be(A,"renderTooltip",function(){var T,C=A.props,$=C.children,z=C.accessibilityLayer,Z=hn($,pn);if(!Z)return null;var U=A.state,B=U.isTooltipActive,V=U.activeCoordinate,Q=U.activePayload,F=U.activeLabel,R=U.offset,G=(T=Z.props.active)!==null&&T!==void 0?T:B;return W.cloneElement(Z,{viewBox:ne(ne({},R),{},{x:R.left,y:R.top}),active:G,label:F,payload:G?Q:[],coordinate:V,accessibilityLayer:z})}),be(A,"renderBrush",function(T){var C=A.props,$=C.margin,z=C.data,Z=A.state,U=Z.offset,B=Z.dataStartIndex,V=Z.dataEndIndex,Q=Z.updateId;return W.cloneElement(T,{key:T.key||"_recharts-brush",onChange:vs(A.handleBrushChange,T.props.onChange),data:z,x:fe(T.props.x)?T.props.x:U.left,y:fe(T.props.y)?T.props.y:U.top+U.height+U.brushBottom-($.bottom||0),width:fe(T.props.width)?T.props.width:U.width,startIndex:B,endIndex:V,updateId:"brush-".concat(Q)})}),be(A,"renderReferenceElement",function(T,C,$){if(!T)return null;var z=A,Z=z.clipPathId,U=A.state,B=U.xAxisMap,V=U.yAxisMap,Q=U.offset,F=T.type.defaultProps||{},R=T.props,G=R.xAxisId,ee=G===void 0?F.xAxisId:G,oe=R.yAxisId,le=oe===void 0?F.yAxisId:oe;return W.cloneElement(T,{key:T.key||"".concat(C,"-").concat($),xAxis:B[ee],yAxis:V[le],viewBox:{x:Q.left,y:Q.top,width:Q.width,height:Q.height},clipPathId:Z})}),be(A,"renderActivePoints",function(T){var C=T.item,$=T.activePoint,z=T.basePoint,Z=T.childIndex,U=T.isRange,B=[],V=C.props.key,Q=C.item.type.defaultProps!==void 0?ne(ne({},C.item.type.defaultProps),C.item.props):C.item.props,F=Q.activeDot,R=Q.dataKey,G=ne(ne({index:Z,dataKey:R,cx:$.x,cy:$.y,r:4,fill:D0(C.item),strokeWidth:2,stroke:"#fff",payload:$.payload,value:$.value},Ee(F,!1)),_s(F));return B.push(w.renderActiveDot(F,G,"".concat(V,"-activePoint-").concat(Z))),z?B.push(w.renderActiveDot(F,ne(ne({},G),{},{cx:z.x,cy:z.y}),"".concat(V,"-basePoint-").concat(Z))):U&&B.push(null),B}),be(A,"renderGraphicChild",function(T,C,$){var z=A.filterFormatItem(T,C,$);if(!z)return null;var Z=A.getTooltipEventType(),U=A.state,B=U.isTooltipActive,V=U.tooltipAxis,Q=U.activeTooltipIndex,F=U.activeLabel,R=A.props.children,G=hn(R,pn),ee=z.props,oe=ee.points,le=ee.isRange,P=ee.baseLine,I=z.item.type.defaultProps!==void 0?ne(ne({},z.item.type.defaultProps),z.item.props):z.item.props,re=I.activeDot,se=I.hide,pe=I.activeBar,me=I.activeShape,Me=!!(!se&&B&&G&&(re||pe||me)),ke={};Z!=="axis"&&G&&G.props.trigger==="click"?ke={onClick:vs(A.handleItemMouseEnter,T.props.onClick)}:Z!=="axis"&&(ke={onMouseLeave:vs(A.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:vs(A.handleItemMouseEnter,T.props.onMouseEnter)});var ce=W.cloneElement(T,ne(ne({},z.props),ke));function xe(or){return typeof V.dataKey=="function"?V.dataKey(or.payload):null}if(Me)if(Q>=0){var Se,ue;if(V.dataKey&&!V.allowDuplicatedCategory){var et=typeof V.dataKey=="function"?xe:"payload.".concat(V.dataKey.toString());Se=Os(oe,et,F),ue=le&&P&&Os(P,et,F)}else Se=oe==null?void 0:oe[Q],ue=le&&P&&P[Q];if(me||pe){var we=T.props.activeIndex!==void 0?T.props.activeIndex:Q;return[W.cloneElement(T,ne(ne(ne({},z.props),ke),{},{activeIndex:we})),null,null]}if(!je(Se))return[ce].concat(No(A.renderActivePoints({item:z,activePoint:Se,basePoint:ue,childIndex:Q,isRange:le})))}else{var ot,ut=(ot=A.getItemByXY(A.state.activeCoordinate))!==null&&ot!==void 0?ot:{graphicalItem:ce},zt=ut.graphicalItem,Rn=zt.item,Kn=Rn===void 0?T:Rn,Ir=zt.childIndex,$n=ne(ne(ne({},z.props),ke),{},{activeIndex:Ir});return[W.cloneElement(Kn,$n),null,null]}return le?[ce,null,null]:[ce,null]}),be(A,"renderCustomized",function(T,C,$){return W.cloneElement(T,ne(ne({key:"recharts-customized-".concat($)},A.props),A.state))}),be(A,"renderMap",{CartesianGrid:{handler:xs,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:xs},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:xs},YAxis:{handler:xs},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((j=E.id)!==null&&j!==void 0?j:$o("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=GM(A.triggeredAfterMouseMove,(N=E.throttleDelay)!==null&&N!==void 0?N:1e3/60),A.state={},A}return QG(w,b),KG(w,[{key:"componentDidMount",value:function(){var j,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var j=this.props,N=j.children,A=j.data,T=j.height,C=j.layout,$=hn(N,pn);if($){var z=$.props.defaultIndex;if(!(typeof z!="number"||z<0||z>this.state.tooltipTicks.length-1)){var Z=this.state.tooltipTicks[z]&&this.state.tooltipTicks[z].value,U=qb(this.state,A,z,Z),B=this.state.tooltipTicks[z].coordinate,V=(this.state.offset.top+T)/2,Q=C==="horizontal",F=Q?{x:B,y:V}:{y:B,x:V},R=this.state.formattedGraphicalItems.find(function(ee){var oe=ee.item;return oe.type.name==="Scatter"});R&&(F=ne(ne({},F),R.props.points[z].tooltipPosition),U=R.props.points[z].tooltipPayload);var G={activeTooltipIndex:z,isTooltipActive:!0,activeLabel:Z,activePayload:U,activeCoordinate:F};this.setState(G),this.renderCursor($),this.accessibilityManager.setIndex(z)}}}},{key:"getSnapshotBeforeUpdate",value:function(j,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==j.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==j.margin){var A,T;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(j){Sg([hn(j.children,pn)],[hn(this.props.children,pn)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var j=hn(this.props.children,pn);if(j&&typeof j.props.shared=="boolean"){var N=j.props.shared?"axis":"item";return f.indexOf(N)>=0?N:l}return l}},{key:"getMouseInfo",value:function(j){if(!this.container)return null;var N=this.container,A=N.getBoundingClientRect(),T=F8(A),C={chartX:Math.round(j.pageX-T.left),chartY:Math.round(j.pageY-T.top)},$=A.width/N.offsetWidth||1,z=this.inRange(C.chartX,C.chartY,$);if(!z)return null;var Z=this.state,U=Z.xAxisMap,B=Z.yAxisMap,V=this.getTooltipEventType(),Q=z2(this.state,this.props.data,this.props.layout,z);if(V!=="axis"&&U&&B){var F=ya(U).scale,R=ya(B).scale,G=F&&F.invert?F.invert(C.chartX):null,ee=R&&R.invert?R.invert(C.chartY):null;return ne(ne({},C),{},{xValue:G,yValue:ee},Q)}return Q?ne(ne({},C),Q):null}},{key:"inRange",value:function(j,N){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,C=j/A,$=N/A;if(T==="horizontal"||T==="vertical"){var z=this.state.offset,Z=C>=z.left&&C<=z.left+z.width&&$>=z.top&&$<=z.top+z.height;return Z?{x:C,y:$}:null}var U=this.state,B=U.angleAxisMap,V=U.radiusAxisMap;if(B&&V){var Q=ya(B);return WE({x:C,y:$},Q)}return null}},{key:"parseEventsOfWrapper",value:function(){var j=this.props.children,N=this.getTooltipEventType(),A=hn(j,pn),T={};A&&N==="axis"&&(A.props.trigger==="click"?T={onClick:this.handleClick}:T={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 C=_s(this.props,this.handleOuterEvent);return ne(ne({},C),T)}},{key:"addListener",value:function(){yg.on(mg,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){yg.removeListener(mg,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(j,N,A){for(var T=this.state.formattedGraphicalItems,C=0,$=T.length;C<$;C++){var z=T[C];if(z.item===j||z.props.key===j.key||N===Mr(z.item.type)&&A===z.childIndex)return z}return null}},{key:"renderClipPath",value:function(){var j=this.clipPathId,N=this.state.offset,A=N.left,T=N.top,C=N.height,$=N.width;return L.createElement("defs",null,L.createElement("clipPath",{id:j},L.createElement("rect",{x:A,y:T,height:C,width:$})))}},{key:"getXScales",value:function(){var j=this.state.xAxisMap;return j?Object.entries(j).reduce(function(N,A){var T=R2(A,2),C=T[0],$=T[1];return ne(ne({},N),{},be({},C,$.scale))},{}):null}},{key:"getYScales",value:function(){var j=this.state.yAxisMap;return j?Object.entries(j).reduce(function(N,A){var T=R2(A,2),C=T[0],$=T[1];return ne(ne({},N),{},be({},C,$.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(j){var N;return(N=this.state.xAxisMap)===null||N===void 0||(N=N[j])===null||N===void 0?void 0:N.scale}},{key:"getYScaleByAxisId",value:function(j){var N;return(N=this.state.yAxisMap)===null||N===void 0||(N=N[j])===null||N===void 0?void 0:N.scale}},{key:"getItemByXY",value:function(j){var N=this.state,A=N.formattedGraphicalItems,T=N.activeItem;if(A&&A.length)for(var C=0,$=A.length;C<$;C++){var z=A[C],Z=z.props,U=z.item,B=U.type.defaultProps!==void 0?ne(ne({},U.type.defaultProps),U.props):U.props,V=Mr(U.type);if(V==="Bar"){var Q=(Z.data||[]).find(function(ee){return yI(j,ee)});if(Q)return{graphicalItem:z,payload:Q}}else if(V==="RadialBar"){var F=(Z.data||[]).find(function(ee){return WE(j,ee)});if(F)return{graphicalItem:z,payload:F}}else if(Xf(z,T)||Kf(z,T)||El(z,T)){var R=oH({graphicalItem:z,activeTooltipItem:T,itemData:B.data}),G=B.activeIndex===void 0?R:B.activeIndex;return{graphicalItem:ne(ne({},z),{},{childIndex:G}),payload:El(z,T)?B.data[R]:z.props.data[R]}}}return null}},{key:"render",value:function(){var j=this;if(!sA(this))return null;var N=this.props,A=N.children,T=N.className,C=N.width,$=N.height,z=N.style,Z=N.compact,U=N.title,B=N.desc,V=$2(N,kG),Q=Ee(V,!1);if(Z)return L.createElement(h2,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement(_g,no({},Q,{width:C,height:$,title:U,desc:B}),this.renderClipPath(),dA(A,this.renderMap)));if(this.props.accessibilityLayer){var F,R;Q.tabIndex=(F=this.props.tabIndex)!==null&&F!==void 0?F:0,Q.role=(R=this.props.role)!==null&&R!==void 0?R:"application",Q.onKeyDown=function(ee){j.accessibilityManager.keyboardEvent(ee)},Q.onFocus=function(){j.accessibilityManager.focus()}}var G=this.parseEventsOfWrapper();return L.createElement(h2,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement("div",no({className:$e("recharts-wrapper",T),style:ne({position:"relative",cursor:"default",width:C,height:$},z)},G,{ref:function(oe){j.container=oe}}),L.createElement(_g,no({},Q,{width:C,height:$,title:U,desc:B,style:rY}),this.renderClipPath(),dA(A,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(W.Component);be(_,"displayName",n),be(_,"defaultProps",ne({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},y)),be(_,"getDerivedStateFromProps",function(b,w){var E=b.dataKey,j=b.data,N=b.children,A=b.width,T=b.height,C=b.layout,$=b.stackOffset,z=b.margin,Z=w.dataStartIndex,U=w.dataEndIndex;if(w.updateId===void 0){var B=B2(b);return ne(ne(ne({},B),{},{updateId:0},x(ne(ne({props:b},B),{},{updateId:0}),w)),{},{prevDataKey:E,prevData:j,prevWidth:A,prevHeight:T,prevLayout:C,prevStackOffset:$,prevMargin:z,prevChildren:N})}if(E!==w.prevDataKey||j!==w.prevData||A!==w.prevWidth||T!==w.prevHeight||C!==w.prevLayout||$!==w.prevStackOffset||!ro(z,w.prevMargin)){var V=B2(b),Q={chartX:w.chartX,chartY:w.chartY,isTooltipActive:w.isTooltipActive},F=ne(ne({},z2(w,j,C)),{},{updateId:w.updateId+1}),R=ne(ne(ne({},V),Q),F);return ne(ne(ne({},R),x(ne({props:b},R),w)),{},{prevDataKey:E,prevData:j,prevWidth:A,prevHeight:T,prevLayout:C,prevStackOffset:$,prevMargin:z,prevChildren:N})}if(!Sg(N,w.prevChildren)){var G,ee,oe,le,P=hn(N,xo),I=P&&(G=(ee=P.props)===null||ee===void 0?void 0:ee.startIndex)!==null&&G!==void 0?G:Z,re=P&&(oe=(le=P.props)===null||le===void 0?void 0:le.endIndex)!==null&&oe!==void 0?oe:U,se=I!==Z||re!==U,pe=!je(j),me=pe&&!se?w.updateId:w.updateId+1;return ne(ne({updateId:me},x(ne(ne({props:b},w),{},{updateId:me,dataStartIndex:I,dataEndIndex:re}),w)),{},{prevChildren:N,dataStartIndex:I,dataEndIndex:re})}return null}),be(_,"renderActiveDot",function(b,w,E){var j;return W.isValidElement(b)?j=W.cloneElement(b,w):Ae(b)?j=b(w):j=L.createElement(Yf,w),L.createElement(Je,{className:"recharts-active-dot",key:E},j)});var S=W.forwardRef(function(w,E){return L.createElement(_,no({},w,{ref:E}))});return S.displayName=_.displayName,S},hY=H0({chartName:"LineChart",GraphicalChild:Il,axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:R0}),pY=H0({chartName:"BarChart",GraphicalChild:fi,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:R0}),eD=H0({chartName:"AreaChart",GraphicalChild:Yn,axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:R0});function vY(e){return new Date(e).toLocaleString("es",{hour:"2-digit",minute:"2-digit",day:"numeric",month:"short"})}function yY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.input",e,v),ht.timeseries("claude_code.tokens.output",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>({ts:v,label:vY(v),input:f.get(v)??0,output:d.get(v)??0}));return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de tokens"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Tokens por período"}),D.jsx($f,{width:"100%",height:220,children:D.jsxs(eD,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsxs("defs",{children:[D.jsxs("linearGradient",{id:"colorInput",x1:"0",y1:"0",x2:"0",y2:"1",children:[D.jsx("stop",{offset:"5%",stopColor:"#4da6ff",stopOpacity:.3}),D.jsx("stop",{offset:"95%",stopColor:"#4da6ff",stopOpacity:0})]}),D.jsxs("linearGradient",{id:"colorOutput",x1:"0",y1:"0",x2:"0",y2:"1",children:[D.jsx("stop",{offset:"5%",stopColor:"#00ff88",stopOpacity:.3}),D.jsx("stop",{offset:"95%",stopColor:"#00ff88",stopOpacity:0})]})]}),D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:v=>v>=1e3?`${(v/1e3).toFixed(0)}K`:String(v)}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},labelStyle:{color:"#888888",fontSize:12},itemStyle:{fontSize:12}}),D.jsx(ba,{wrapperStyle:{fontSize:12,color:"#888888"}}),D.jsx(Yn,{type:"monotone",dataKey:"input",name:"Input",stroke:"#4da6ff",fill:"url(#colorInput)",strokeWidth:2}),D.jsx(Yn,{type:"monotone",dataKey:"output",name:"Output",stroke:"#00ff88",fill:"url(#colorOutput)",strokeWidth:2})]})})]})}function mY(e){return new Date(e).toLocaleDateString("es",{day:"numeric",month:"short"})}function gY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]);W.useEffect(()=>{ht.timeseries("claude_code.cost",e,"1d").then(r).catch(()=>{})},[e,t]);const o=n.map(l=>({label:mY(l.timestamp),cost:Number(l.value.toFixed(2))}));return o.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de coste"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Coste por día ($)"}),D.jsx($f,{width:"100%",height:220,children:D.jsxs(pY,{data:o,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a",vertical:!1}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:l=>`$${l.toFixed(2)}`}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},labelStyle:{color:"#888888",fontSize:12},formatter:l=>[`$${l.toFixed(2)}`,"Coste"]}),D.jsx(fi,{dataKey:"cost",fill:"#a855f7",radius:[3,3,0,0]})]})})]})}function bY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.cache.read",e,v),ht.timeseries("claude_code.tokens.cache.creation",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>({label:new Date(v).toLocaleString("es",{hour:"2-digit",day:"numeric",month:"short"}),read:f.get(v)??0,create:d.get(v)??0}));return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de caché"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Tokens de caché"}),D.jsx($f,{width:"100%",height:220,children:D.jsxs(eD,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:v=>v>=1e3?`${(v/1e3).toFixed(0)}K`:String(v)}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"}}),D.jsx(ba,{wrapperStyle:{fontSize:12,color:"#888888"}}),D.jsx(Yn,{type:"monotone",dataKey:"read",name:"Leído",stroke:"#00d4aa",fill:"#00d4aa",fillOpacity:.2,strokeWidth:2}),D.jsx(Yn,{type:"monotone",dataKey:"create",name:"Creado",stroke:"#4da6ff",fill:"#4da6ff",fillOpacity:.2,strokeWidth:2})]})})]})}function xY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.input",e,v),ht.timeseries("claude_code.tokens.output",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>{const y=f.get(v)??0,g=d.get(v)??0;return{label:new Date(v).toLocaleString("es",{hour:"2-digit",day:"numeric",month:"short"}),efficiency:y>0?Number((g/y).toFixed(3)):0}});return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de eficiencia"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Ratio output/input"}),D.jsx($f,{width:"100%",height:220,children:D.jsxs(hY,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,domain:[0,"auto"]}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},formatter:v=>[v.toFixed(3),"Eficiencia"]}),D.jsx(Ff,{y:.5,stroke:"#444444",strokeDasharray:"4 4",label:{value:"0.5",fill:"#666",fontSize:10}}),D.jsx(Il,{type:"monotone",dataKey:"efficiency",stroke:"#a855f7",strokeWidth:2,dot:!1})]})})]})}function SY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState(null),[c,f]=W.useState([]),[d,h]=W.useState(null),[v,y]=W.useState("");W.useEffect(()=>{ht.sessions(50).then(r).catch(()=>{})},[e,t]);function g(S){o===S?(l(null),f([])):(f([]),l(S),ht.sessionEvents(S).then(f).catch(()=>{}))}function x(S,b,w){w.stopPropagation(),h(S),y(b??"")}async function _(S){v.trim()&&(await ht.labelSession(S,v.trim()).catch(()=>{}),r(b=>b.map(w=>w.sessionId===S?{...w,project:v.trim()}:w))),h(null)}return n.length===0?D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin sesiones registradas"}):D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:D.jsxs("table",{className:"w-full text-sm",children:[D.jsx("thead",{children:D.jsxs("tr",{className:"border-b border-bg-border",children:[D.jsx("th",{className:"w-6 px-3 py-2"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"ID"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Proyecto"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Modelo"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Inicio"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Duración"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Input"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Output"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Coste"})]})}),D.jsx("tbody",{children:n.map(S=>D.jsxs(W.Fragment,{children:[D.jsxs("tr",{className:"border-b border-bg-border hover:bg-bg-card-hover cursor-pointer",onClick:()=>g(S.sessionId),children:[D.jsx("td",{className:"px-3 py-2 text-text-muted",children:o===S.sessionId?D.jsx(IR,{size:14}):D.jsx(GR,{size:14})}),D.jsxs("td",{className:"px-3 py-2 font-mono text-text-secondary text-xs",children:[S.sessionId.slice(0,8),"…"]}),D.jsx("td",{className:"px-3 py-2",onClick:b=>b.stopPropagation(),children:d===S.sessionId?D.jsxs("span",{className:"flex items-center gap-1",children:[D.jsx("input",{autoFocus:!0,value:v,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&_(S.sessionId),b.key==="Escape"&&h(null)},className:"bg-bg-base border border-bg-border rounded px-1 py-0.5 text-xs text-text-primary w-24 outline-none focus:border-accent-green"}),D.jsx("button",{onClick:()=>_(S.sessionId),className:"text-accent-green",children:D.jsx(Bb,{size:12})}),D.jsx("button",{onClick:()=>h(null),className:"text-accent-orange",children:D.jsx(I2,{size:12})})]}):D.jsxs("span",{onClick:b=>x(S.sessionId,S.project,b),className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bg-base border border-bg-border text-text-secondary hover:border-accent-green cursor-pointer transition-colors",children:[S.project??"—",D.jsx(ZR,{size:10,className:"opacity-50"})]})}),D.jsx("td",{className:"px-3 py-2 text-text-secondary font-mono text-xs",children:S.model??"—"}),D.jsx("td",{className:"px-3 py-2 text-text-secondary",children:u3(S.startTime)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-text-secondary",children:Lb(S.durationActiveMs)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-blue",children:er(S.tokensInput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-green",children:er(S.tokensOutput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-purple",children:ei(S.cost)})]}),o===S.sessionId&&D.jsx("tr",{children:D.jsx("td",{colSpan:9,className:"bg-bg-subtle px-6 py-3",children:D.jsx("div",{className:"text-xs font-mono space-y-0.5 max-h-40 overflow-y-auto",children:c.length===0?D.jsx("span",{className:"text-text-muted",children:"Sin eventos"}):c.slice(-20).map((b,w)=>D.jsxs("div",{className:"flex gap-2 text-text-secondary",children:[D.jsx("span",{className:"text-text-muted shrink-0",children:new Date(b.timestamp).toLocaleTimeString()}),D.jsx("span",{className:"text-accent-teal",children:b.eventName})]},`${b.timestamp}-${b.eventName}-${w}`))})})})]},S.sessionId))})]})})}function OY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState(null),c=W.useCallback(()=>{ht.projects(e).then(r).catch(()=>{})},[e]);W.useEffect(()=>{c()},[c,t]);const f=async h=>{if(confirm(`¿Resetear todos los datos del proyecto "${h}"?`)){l(h);try{await ht.resetProject(h),c()}finally{l(null)}}};if(n.length===0)return D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin proyectos registrados"});const d=Math.max(...n.map(h=>h.cost),1e-4);return D.jsxs("div",{className:"flex flex-col gap-4",children:[D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4 space-y-3",children:n.map(h=>D.jsxs("div",{children:[D.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[D.jsx("span",{className:"text-text-primary font-medium",children:h.project}),D.jsx("span",{className:"text-accent-purple font-mono",children:ei(h.cost)})]}),D.jsx("div",{className:"h-2 bg-bg-base rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-accent-purple rounded-full",style:{width:`${h.cost/d*100}%`}})})]},h.project))}),D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:D.jsxs("table",{className:"w-full text-sm",children:[D.jsx("thead",{children:D.jsxs("tr",{className:"border-b border-bg-border",children:[D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Proyecto"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Sesiones"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Input"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Output"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Caché %"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Coste"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Commits"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"LOC +/-"}),D.jsx("th",{className:"px-3 py-2"})]})}),D.jsx("tbody",{children:n.map(h=>D.jsxs("tr",{className:"border-b border-bg-border hover:bg-bg-card-hover",children:[D.jsx("td",{className:"px-3 py-2 text-text-primary font-medium",children:h.project}),D.jsx("td",{className:"px-3 py-2 text-right text-text-secondary",children:h.sessions}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-blue",children:er(h.tokensInput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-green",children:er(h.tokensOutput)}),D.jsxs("td",{className:"px-3 py-2 text-right font-mono text-accent-teal",children:[(h.cacheHitRate*100).toFixed(1),"%"]}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-purple",children:ei(h.cost)}),D.jsx("td",{className:"px-3 py-2 text-right text-text-secondary",children:h.commits}),D.jsxs("td",{className:"px-3 py-2 text-right font-mono text-xs",children:[D.jsxs("span",{className:"text-accent-green",children:["+",h.linesAdded]}),D.jsx("span",{className:"text-text-muted",children:" / "}),D.jsxs("span",{className:"text-accent-orange",children:["-",h.linesRemoved]})]}),D.jsx("td",{className:"px-3 py-2 text-right",children:D.jsx("button",{onClick:()=>f(h.project),disabled:o===h.project,title:"Resetear proyecto",className:"p-1 rounded text-text-muted hover:text-accent-orange hover:bg-bg-base transition-colors disabled:opacity-40",children:D.jsx(e3,{size:13})})})]},h.project))})]})})]})}function _Y({timeRange:e,sseVersion:t}){const[n,r]=W.useState(null);if(W.useEffect(()=>{ht.tools(e).then(r).catch(()=>{})},[e,t]),!n||n.usage.length===0)return D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin datos de herramientas"});const o=Math.max(...n.usage.map(f=>f.count),1),l=n.decisionRate.approved+n.decisionRate.rejected,c=l>0?(n.decisionRate.approved/l*100).toFixed(1):"—";return D.jsxs("div",{className:"flex flex-col gap-4",children:[D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("span",{className:"text-text-secondary text-sm",children:"Tasa de aprobación: "}),D.jsxs("span",{className:"text-accent-green font-mono font-bold",children:[c,"%"]}),D.jsxs("span",{className:"text-text-muted text-xs ml-2",children:["(",n.decisionRate.approved," aprobadas / ",n.decisionRate.rejected," rechazadas)"]})]}),D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4 space-y-2",children:n.usage.map(f=>D.jsxs("div",{children:[D.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[D.jsx("span",{className:"font-mono text-text-primary",children:f.toolName}),D.jsxs("span",{className:"text-text-secondary",children:[f.count," usos · ",(f.successRate*100).toFixed(0),"% éxito"]})]}),D.jsx("div",{className:"h-1.5 bg-bg-base rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-accent-teal rounded-full",style:{width:`${f.count/o*100}%`}})})]},f.toolName))})]})}const Ss={"claude-opus-4-8":{input:15,output:75,cacheWrite:18.75,cacheRead:1.5},"claude-sonnet-4-6":{input:3,output:15,cacheWrite:3.75,cacheRead:.3},"claude-haiku-4-5":{input:.8,output:4,cacheWrite:1,cacheRead:.08}},k2=Ss["claude-sonnet-4-6"];function tD(e){if(!e)return k2;const t=e.toLowerCase();return t.includes("opus")?Ss["claude-opus-4-8"]:t.includes("haiku")?Ss["claude-haiku-4-5"]:t.includes("sonnet")?Ss["claude-sonnet-4-6"]:k2}function AY(e,t){const n=tD(t);return e*(n.input-n.cacheRead)/1e6}const wY=[{id:"all",label:"Todos"},{id:"api",label:"API"},{id:"tools",label:"Tools"},{id:"prompts",label:"Prompts"},{id:"errors",label:"Errores"}];function TY(e){return e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(3)}`:`$${e.toFixed(4)}`}function EY(e){const t=e.attributes;if(typeof t.cost=="number"&&t.cost>0)return t.cost;const n=Number(t.input_tokens??t["tokens.input"]??0),r=Number(t.output_tokens??t["tokens.output"]??0),o=Number(t.cache_read_input_tokens??t["tokens.cache_read"]??0),l=Number(t.cache_creation_input_tokens??t["tokens.cache_creation"]??0);if(n===0&&r===0)return null;const c=tD(e.model);return n*c.input/1e6+r*c.output/1e6+o*c.cacheRead/1e6+l*c.cacheWrite/1e6}function jY(e){return e.includes("error")?"text-accent-orange":e==="user_prompt"?"text-accent-blue":e==="api_request"?"text-accent-green":e==="tool_use"?"text-accent-teal":e.startsWith("hook_")?"text-accent-yellow":"text-text-secondary"}function MY(e,t){return t==="all"?!0:t==="api"?e.eventName.includes("api"):t==="tools"?e.eventName.includes("tool"):t==="prompts"?e.eventName.includes("prompt"):t==="errors"?e.eventName.includes("error"):!0}function CY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState("all"),[c,f]=W.useState(!1);W.useEffect(()=>{c||ht.events(500).then(r).catch(()=>{})},[e,t,c]);const d=n.filter(h=>MY(h,o));return D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg flex flex-col h-[600px]",children:[D.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-bg-border flex-wrap",children:[wY.map(({id:h,label:v})=>D.jsx("button",{onClick:()=>l(h),className:`px-2 py-1 rounded text-xs transition-colors ${o===h?"bg-accent-green text-black font-medium":"text-text-secondary hover:text-text-primary"}`,children:v},h)),D.jsx("div",{className:"flex-1"}),D.jsxs("button",{onClick:()=>f(h=>!h),className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-text-secondary hover:text-text-primary",children:[c?D.jsx(WR,{size:12}):D.jsx(VR,{size:12}),D.jsx("span",{children:c?"Reanudar":"Pausar"})]})]}),D.jsx("div",{className:"flex-1 overflow-y-auto p-3 font-mono text-xs space-y-0.5",children:d.length===0?D.jsx("span",{className:"text-text-muted",children:"Sin eventos"}):d.map((h,v)=>{const y=EY(h);return D.jsxs("div",{className:"flex gap-2 hover:bg-bg-base px-1 rounded",children:[D.jsx("span",{className:"text-text-muted shrink-0",children:new Date(h.timestamp).toLocaleTimeString()}),D.jsx("span",{className:`shrink-0 ${jY(h.eventName)}`,children:h.eventName}),h.sessionId&&D.jsxs("span",{className:"text-text-muted",children:[h.sessionId.slice(0,6),"…"]}),y!==null&&D.jsx("span",{className:"text-accent-purple ml-auto shrink-0",children:TY(y)})]},`${h.sessionId??""}-${h.timestamp}-${h.eventName}-${v}`)})})]})}function NY({sseVersion:e}){const[t,n]=W.useState([]);if(W.useEffect(()=>{ht.agents().then(n).catch(()=>{})},[e]),t.length===0)return D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-8 flex items-center justify-center",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de agentes. Aparece cuando hay múltiples agentes en trazas OTLP."})});const r=t.filter(c=>!c.parentAgentId),o=c=>t.filter(f=>f.parentAgentId===c);function l({agent:c,depth:f=0}){const d=o(c.agentId);return D.jsxs("div",{style:{paddingLeft:`${f*16}px`},children:[D.jsxs("div",{className:"flex items-center gap-4 py-2 border-b border-bg-border text-sm hover:bg-bg-card-hover px-2",children:[D.jsxs("span",{className:"font-mono text-text-muted text-xs w-20 shrink-0",children:[c.agentId.slice(0,8),"…"]}),D.jsx("span",{className:"font-mono text-accent-blue",children:er(c.tokensInput)}),D.jsx("span",{className:"font-mono text-accent-green",children:er(c.tokensOutput)}),D.jsx("span",{className:"font-mono text-accent-purple",children:ei(c.cost)}),D.jsx("span",{className:"text-text-secondary",children:Lb(c.durationMs)}),D.jsxs("span",{className:"text-text-muted text-xs",children:[c.toolCalls," tools"]})]}),d.map(h=>D.jsx(l,{agent:h,depth:f+1},h.agentId))]})}return D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:[D.jsxs("div",{className:"px-3 py-2 border-b border-bg-border grid grid-cols-6 text-xs text-text-muted",children:[D.jsx("span",{children:"Agent ID"}),D.jsx("span",{children:"Input"}),D.jsx("span",{children:"Output"}),D.jsx("span",{children:"Coste"}),D.jsx("span",{children:"Duración"}),D.jsx("span",{children:"Tools"})]}),r.map(c=>D.jsx(l,{agent:c},c.agentId))]})}function DY(){const[e,t]=W.useState("now-24h");return{timeRange:e,setTimeRange:t}}function PY(e){W.useEffect(()=>{let t=null,n;function r(){t=new EventSource("/api/stream"),t.onmessage=o=>{try{const{type:l,payload:c}=JSON.parse(o.data);l!=="ping"&&e(l,c)}catch{}},t.onerror=()=>{t==null||t.close(),t=null,n=setTimeout(r,3e3)}}return r(),()=>{clearTimeout(n),t==null||t.close()}},[])}function RY(e){const[t,n]=W.useState({connected:!1,lastSeen:null,sessionCount:0,totalEvents:0,uptime:0}),[r,o]=W.useState(null),[l,c]=W.useState(0),f=W.useRef(0),d=W.useRef(0),h=W.useCallback(async()=>{f.current=Date.now();try{const[y,g]=await Promise.all([ht.status(),ht.summary(e)]);n(y),o(g)}catch{}},[e]);W.useEffect(()=>{h()},[h]);const v=W.useCallback((y,g)=>{Date.now()-f.current>5e3?h():ht.status().then(n).catch(()=>{});const x=Date.now();x-d.current>5e3&&(d.current=x,c(_=>_+1))},[h]);return PY(v),{status:t,summary:r,refetch:h,sseVersion:l}}function $Y(){const[e,t]=W.useState("overview"),{timeRange:n,setTimeRange:r}=DY(),{status:o,summary:l,sseVersion:c}=RY(n);return!o.connected&&o.totalEvents===0?D.jsxs("div",{className:"min-h-screen bg-bg-base text-text-primary flex flex-col",children:[D.jsx(JO,{timeRange:n,onTimeRangeChange:r,connected:!1,lastSeen:null}),D.jsx(n3,{})]}):D.jsxs("div",{className:"min-h-screen bg-bg-base text-text-primary flex flex-col",children:[D.jsx(JO,{timeRange:n,onTimeRangeChange:r,connected:o.connected,lastSeen:o.lastSeen}),D.jsx(i3,{onLabeled:()=>{}}),D.jsx(RR,{activeTab:e,onTabChange:t}),D.jsxs("main",{className:"flex-1 p-4 max-w-screen-2xl mx-auto w-full",children:[e==="overview"&&D.jsxs("div",{className:"flex flex-col gap-4",children:[l&&D.jsx(l3,{summary:l}),D.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[D.jsx(yY,{timeRange:n,sseVersion:c}),D.jsx(gY,{timeRange:n,sseVersion:c})]})]}),e==="sessions"&&D.jsx(SY,{timeRange:n,sseVersion:c}),e==="projects"&&D.jsx(OY,{timeRange:n,sseVersion:c}),e==="tools"&&D.jsx(_Y,{timeRange:n,sseVersion:c}),e==="agents"&&D.jsx(NY,{sseVersion:c}),e==="events"&&D.jsx(CY,{timeRange:n,sseVersion:c}),e==="costs"&&D.jsxs("div",{className:"flex flex-col gap-4",children:[l&&D.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Coste período"}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-purple",children:ei(l.cost)})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Eficiencia"}),D.jsxs("div",{className:"text-2xl font-mono font-bold text-accent-green",children:[(l.efficiency*100).toFixed(1),"%"]})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Tokens caché"}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-teal",children:er(l.tokens.cache)})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Ahorro caché est."}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-yellow",children:ei(AY(l.tokens.cache))})]})]}),D.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[D.jsx(bY,{timeRange:n,sseVersion:c}),D.jsx(xY,{timeRange:n,sseVersion:c})]})]})]})]})}CR.createRoot(document.getElementById("root")).render(D.jsx(W.StrictMode,{children:D.jsx($Y,{})}));
187
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZN(e,t){if(e){if(typeof e=="string")return $b(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 $b(e,t)}}function JG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function eY(e){if(Array.isArray(e))return $b(e)}function $b(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 q2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?q2(Object(n),!0).forEach(function(r){be(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function be(e,t,n){return t=QN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function QN(e){var t=tY(e,"string");return Co(t)=="symbol"?t:t+""}function tY(e,t){if(Co(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Co(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var nY={xAxis:["bottom","top"],yAxis:["left","right"]},rY={width:"100%",height:"100%"},WN={x:0,y:0};function xs(e){return e}var aY=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},iY=function(t,n,r,o){var l=n.find(function(v){return v&&v.index===r});if(l){if(t==="horizontal")return{x:l.coordinate,y:o.y};if(t==="vertical")return{x:o.x,y:l.coordinate};if(t==="centric"){var c=l.coordinate,f=o.radius;return ne(ne(ne({},o),qt(o.cx,o.cy,f,c)),{},{angle:c,radius:f})}var d=l.coordinate,h=o.angle;return ne(ne(ne({},o),qt(o.cx,o.cy,d,h)),{},{angle:h,radius:d})}return WN},ed=function(t,n){var r=n.graphicalItems,o=n.dataStartIndex,l=n.dataEndIndex,c=(r??[]).reduce(function(f,d){var h=d.props.data;return h&&h.length?[].concat(No(f),No(h)):f},[]);return c.length>0?c:t&&t.length&&fe(o)&&fe(l)?t.slice(o,l+1):[]};function JN(e){return e==="number"?[0,"auto"]:void 0}var qb=function(t,n,r,o){var l=t.graphicalItems,c=t.tooltipAxis,f=ed(n,t);return r<0||!l||!l.length||r>=f.length?null:l.reduce(function(d,h){var v,y=(v=h.props.data)!==null&&v!==void 0?v:n;y&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(y=y.slice(t.dataStartIndex,t.dataEndIndex+1));var g;if(c.dataKey&&!c.allowDuplicatedCategory){var x=y===void 0?f:y;g=Os(x,c.dataKey,o)}else g=y&&y[r]||f[r];return g?[].concat(No(d),[ZC(h,g)]):d},[])},z2=function(t,n,r,o){var l=o||{x:t.chartX,y:t.chartY},c=aY(l,r),f=t.orderedTooltipTicks,d=t.tooltipAxis,h=t.tooltipTicks,v=i5(c,f,h,d);if(v>=0&&h){var y=h[v]&&h[v].value,g=qb(t,n,v,y),x=iY(r,f,v,l);return{activeTooltipIndex:v,activeLabel:y,activePayload:g,activeCoordinate:x}}return null},oY=function(t,n){var r=n.axes,o=n.graphicalItems,l=n.axisType,c=n.axisIdKey,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,y=t.children,g=t.stackOffset,x=KC(v,l);return r.reduce(function(_,S){var b,w=S.type.defaultProps!==void 0?ne(ne({},S.type.defaultProps),S.props):S.props,E=w.type,j=w.dataKey,N=w.allowDataOverflow,A=w.allowDuplicatedCategory,T=w.scale,C=w.ticks,$=w.includeHidden,z=w[c];if(_[z])return _;var Z=ed(t.data,{graphicalItems:o.filter(function(I){var re,se=c in I.props?I.props[c]:(re=I.type.defaultProps)===null||re===void 0?void 0:re[c];return se===z}),dataStartIndex:d,dataEndIndex:h}),U=Z.length,B,V,Q;DG(w.domain,N,E)&&(B=Jg(w.domain,null,N),x&&(E==="number"||T!=="auto")&&(Q=Zu(Z,j,"category")));var F=JN(E);if(!B||B.length===0){var R,G=(R=w.domain)!==null&&R!==void 0?R:F;if(j){if(B=Zu(Z,j,E),E==="category"&&x){var ee=Q3(B);A&&ee?(V=B,B=lf(0,U)):A||(B=FE(G,B,S).reduce(function(I,re){return I.indexOf(re)>=0?I:[].concat(No(I),[re])},[]))}else if(E==="category")A?B=B.filter(function(I){return I!==""&&!je(I)}):B=FE(G,B,S).reduce(function(I,re){return I.indexOf(re)>=0||re===""||je(re)?I:[].concat(No(I),[re])},[]);else if(E==="number"){var oe=s5(Z,o.filter(function(I){var re,se,pe=c in I.props?I.props[c]:(re=I.type.defaultProps)===null||re===void 0?void 0:re[c],me="hide"in I.props?I.props.hide:(se=I.type.defaultProps)===null||se===void 0?void 0:se.hide;return pe===z&&($||!me)}),j,l,v);oe&&(B=oe)}x&&(E==="number"||T!=="auto")&&(Q=Zu(Z,j,"category"))}else x?B=lf(0,U):f&&f[z]&&f[z].hasStack&&E==="number"?B=g==="expand"?[0,1]:FC(f[z].stackGroups,d,h):B=XC(Z,o.filter(function(I){var re=c in I.props?I.props[c]:I.type.defaultProps[c],se="hide"in I.props?I.props.hide:I.type.defaultProps.hide;return re===z&&($||!se)}),E,v,!0);if(E==="number")B=Pb(y,B,z,l,C),G&&(B=Jg(G,B,N));else if(E==="category"&&G){var le=G,P=B.every(function(I){return le.indexOf(I)>=0});P&&(B=le)}}return ne(ne({},_),{},be({},z,ne(ne({},w),{},{axisType:l,domain:B,categoricalDomain:Q,duplicateDomain:V,originalDomain:(b=w.domain)!==null&&b!==void 0?b:F,isCategorical:x,layout:v})))},{})},uY=function(t,n){var r=n.graphicalItems,o=n.Axis,l=n.axisType,c=n.axisIdKey,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.layout,y=t.children,g=ed(t.data,{graphicalItems:r,dataStartIndex:d,dataEndIndex:h}),x=g.length,_=KC(v,l),S=-1;return r.reduce(function(b,w){var E=w.type.defaultProps!==void 0?ne(ne({},w.type.defaultProps),w.props):w.props,j=E[c],N=JN("number");if(!b[j]){S++;var A;return _?A=lf(0,x):f&&f[j]&&f[j].hasStack?(A=FC(f[j].stackGroups,d,h),A=Pb(y,A,j,l)):(A=Jg(N,XC(g,r.filter(function(T){var C,$,z=c in T.props?T.props[c]:(C=T.type.defaultProps)===null||C===void 0?void 0:C[c],Z="hide"in T.props?T.props.hide:($=T.type.defaultProps)===null||$===void 0?void 0:$.hide;return z===j&&!Z}),"number",v),o.defaultProps.allowDataOverflow),A=Pb(y,A,j,l)),ne(ne({},b),{},be({},j,ne(ne({axisType:l},o.defaultProps),{},{hide:!0,orientation:Cn(nY,"".concat(l,".").concat(S%2),null),domain:A,originalDomain:N,isCategorical:_,layout:v})))}return b},{})},lY=function(t,n){var r=n.axisType,o=r===void 0?"xAxis":r,l=n.AxisComp,c=n.graphicalItems,f=n.stackGroups,d=n.dataStartIndex,h=n.dataEndIndex,v=t.children,y="".concat(o,"Id"),g=Nn(v,l),x={};return g&&g.length?x=oY(t,{axes:g,graphicalItems:c,axisType:o,axisIdKey:y,stackGroups:f,dataStartIndex:d,dataEndIndex:h}):c&&c.length&&(x=uY(t,{Axis:l,graphicalItems:c,axisType:o,axisIdKey:y,stackGroups:f,dataStartIndex:d,dataEndIndex:h})),x},cY=function(t){var n=ya(t),r=jr(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:o0(r,function(o){return o.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Qs(n,r)}},B2=function(t){var n=t.children,r=t.defaultShowTooltip,o=hn(n,xo),l=0,c=0;return t.data&&t.data.length!==0&&(c=t.data.length-1),o&&o.props&&(o.props.startIndex>=0&&(l=o.props.startIndex),o.props.endIndex>=0&&(c=o.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:l,dataEndIndex:c,activeTooltipIndex:-1,isTooltipActive:!!r}},sY=function(t){return!t||!t.length?!1:t.some(function(n){var r=Mr(n&&n.type);return r&&r.indexOf("Bar")>=0})},L2=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"}},fY=function(t,n){var r=t.props,o=t.graphicalItems,l=t.xAxisMap,c=l===void 0?{}:l,f=t.yAxisMap,d=f===void 0?{}:f,h=r.width,v=r.height,y=r.children,g=r.margin||{},x=hn(y,xo),_=hn(y,ba),S=Object.keys(d).reduce(function(A,T){var C=d[T],$=C.orientation;return!C.mirror&&!C.hide?ne(ne({},A),{},be({},$,A[$]+C.width)):A},{left:g.left||0,right:g.right||0}),b=Object.keys(c).reduce(function(A,T){var C=c[T],$=C.orientation;return!C.mirror&&!C.hide?ne(ne({},A),{},be({},$,Cn(A,"".concat($))+C.height)):A},{top:g.top||0,bottom:g.bottom||0}),w=ne(ne({},b),S),E=w.bottom;x&&(w.bottom+=x.props.height||xo.defaultProps.height),_&&n&&(w=l5(w,o,r,n));var j=h-w.left-w.right,N=v-w.top-w.bottom;return ne(ne({brushBottom:E},w),{},{width:Math.max(j,0),height:Math.max(N,0)})},dY=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},H0=function(t){var n=t.chartName,r=t.GraphicalChild,o=t.defaultTooltipEventType,l=o===void 0?"axis":o,c=t.validateTooltipEventTypes,f=c===void 0?["axis"]:c,d=t.axisComponents,h=t.legendContent,v=t.formatAxisMap,y=t.defaultProps,g=function(w,E){var j=E.graphicalItems,N=E.stackGroups,A=E.offset,T=E.updateId,C=E.dataStartIndex,$=E.dataEndIndex,z=w.barSize,Z=w.layout,U=w.barGap,B=w.barCategoryGap,V=w.maxBarSize,Q=L2(Z),F=Q.numericAxisName,R=Q.cateAxisName,G=sY(j),ee=[];return j.forEach(function(oe,le){var P=ed(w.data,{graphicalItems:[oe],dataStartIndex:C,dataEndIndex:$}),I=oe.type.defaultProps!==void 0?ne(ne({},oe.type.defaultProps),oe.props):oe.props,re=I.dataKey,se=I.maxBarSize,pe=I["".concat(F,"Id")],me=I["".concat(R,"Id")],Me={},ke=d.reduce(function($n,or){var Uo=E["".concat(or.axisType,"Map")],Bt=I["".concat(or.axisType,"Id")];Uo&&Uo[Bt]||or.axisType==="zAxis"||ai();var Hl=Uo[Bt];return ne(ne({},$n),{},be(be({},or.axisType,Hl),"".concat(or.axisType,"Ticks"),jr(Hl)))},Me),ce=ke[R],xe=ke["".concat(R,"Ticks")],Se=N&&N[pe]&&N[pe].hasStack&&O5(oe,N[pe].stackGroups),ue=Mr(oe.type).indexOf("Bar")>=0,et=Qs(ce,xe),we=[],ot=G&&o5({barSize:z,stackGroups:N,totalSize:dY(ke,R)});if(ue){var ut,zt,Rn=je(se)?V:se,Kn=(ut=(zt=Qs(ce,xe,!0))!==null&&zt!==void 0?zt:Rn)!==null&&ut!==void 0?ut:0;we=u5({barGap:U,barCategoryGap:B,bandSize:Kn!==et?Kn:et,sizeList:ot[me],maxBarSize:Rn}),Kn!==et&&(we=we.map(function($n){return ne(ne({},$n),{},{position:ne(ne({},$n.position),{},{offset:$n.position.offset-Kn/2})})}))}var Ir=oe&&oe.type&&oe.type.getComposedData;Ir&&ee.push({props:ne(ne({},Ir(ne(ne({},ke),{},{displayedData:P,props:w,dataKey:re,item:oe,bandSize:et,barPosition:we,offset:A,stackedData:Se,layout:Z,dataStartIndex:C,dataEndIndex:$}))),{},be(be(be({key:oe.key||"item-".concat(le)},F,ke[F]),R,ke[R]),"animationId",T)),childIndex:c$(oe,w.children),item:oe})}),ee},x=function(w,E){var j=w.props,N=w.dataStartIndex,A=w.dataEndIndex,T=w.updateId;if(!sA({props:j}))return null;var C=j.children,$=j.layout,z=j.stackOffset,Z=j.data,U=j.reverseStackOrder,B=L2($),V=B.numericAxisName,Q=B.cateAxisName,F=Nn(C,r),R=b5(Z,F,"".concat(V,"Id"),"".concat(Q,"Id"),z,U),G=d.reduce(function(I,re){var se="".concat(re.axisType,"Map");return ne(ne({},I),{},be({},se,lY(j,ne(ne({},re),{},{graphicalItems:F,stackGroups:re.axisType===V&&R,dataStartIndex:N,dataEndIndex:A}))))},{}),ee=fY(ne(ne({},G),{},{props:j,graphicalItems:F}),E==null?void 0:E.legendBBox);Object.keys(G).forEach(function(I){G[I]=v(j,G[I],ee,I.replace("Map",""),n)});var oe=G["".concat(Q,"Map")],le=cY(oe),P=g(j,ne(ne({},G),{},{dataStartIndex:N,dataEndIndex:A,updateId:T,graphicalItems:F,stackGroups:R,offset:ee}));return ne(ne({formattedGraphicalItems:P,graphicalItems:F,offset:ee,stackGroups:R},le),G)},_=(function(b){function w(E){var j,N,A;return YG(this,w),A=VG(this,w,[E]),be(A,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),be(A,"accessibilityManager",new NG),be(A,"handleLegendBBoxUpdate",function(T){if(T){var C=A.state,$=C.dataStartIndex,z=C.dataEndIndex,Z=C.updateId;A.setState(ne({legendBBox:T},x({props:A.props,dataStartIndex:$,dataEndIndex:z,updateId:Z},ne(ne({},A.state),{},{legendBBox:T}))))}}),be(A,"handleReceiveSyncEvent",function(T,C,$){if(A.props.syncId===T){if($===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(C)}}),be(A,"handleBrushChange",function(T){var C=T.startIndex,$=T.endIndex;if(C!==A.state.dataStartIndex||$!==A.state.dataEndIndex){var z=A.state.updateId;A.setState(function(){return ne({dataStartIndex:C,dataEndIndex:$},x({props:A.props,dataStartIndex:C,dataEndIndex:$,updateId:z},A.state))}),A.triggerSyncEvent({dataStartIndex:C,dataEndIndex:$})}}),be(A,"handleMouseEnter",function(T){var C=A.getMouseInfo(T);if(C){var $=ne(ne({},C),{},{isTooltipActive:!0});A.setState($),A.triggerSyncEvent($);var z=A.props.onMouseEnter;Ae(z)&&z($,T)}}),be(A,"triggeredAfterMouseMove",function(T){var C=A.getMouseInfo(T),$=C?ne(ne({},C),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState($),A.triggerSyncEvent($);var z=A.props.onMouseMove;Ae(z)&&z($,T)}),be(A,"handleItemMouseEnter",function(T){A.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),be(A,"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),be(A,"handleMouseMove",function(T){T.persist(),A.throttleTriggeredAfterMouseMove(T)}),be(A,"handleMouseLeave",function(T){A.throttleTriggeredAfterMouseMove.cancel();var C={isTooltipActive:!1};A.setState(C),A.triggerSyncEvent(C);var $=A.props.onMouseLeave;Ae($)&&$(C,T)}),be(A,"handleOuterEvent",function(T){var C=l$(T),$=Cn(A.props,"".concat(C));if(C&&Ae($)){var z,Z;/.*touch.*/i.test(C)?Z=A.getMouseInfo(T.changedTouches[0]):Z=A.getMouseInfo(T),$((z=Z)!==null&&z!==void 0?z:{},T)}}),be(A,"handleClick",function(T){var C=A.getMouseInfo(T);if(C){var $=ne(ne({},C),{},{isTooltipActive:!0});A.setState($),A.triggerSyncEvent($);var z=A.props.onClick;Ae(z)&&z($,T)}}),be(A,"handleMouseDown",function(T){var C=A.props.onMouseDown;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleMouseUp",function(T){var C=A.props.onMouseUp;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),be(A,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.handleMouseDown(T.changedTouches[0])}),be(A,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&A.handleMouseUp(T.changedTouches[0])}),be(A,"handleDoubleClick",function(T){var C=A.props.onDoubleClick;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"handleContextMenu",function(T){var C=A.props.onContextMenu;if(Ae(C)){var $=A.getMouseInfo(T);C($,T)}}),be(A,"triggerSyncEvent",function(T){A.props.syncId!==void 0&&yg.emit(mg,A.props.syncId,T,A.eventEmitterSymbol)}),be(A,"applySyncEvent",function(T){var C=A.props,$=C.layout,z=C.syncMethod,Z=A.state.updateId,U=T.dataStartIndex,B=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)A.setState(ne({dataStartIndex:U,dataEndIndex:B},x({props:A.props,dataStartIndex:U,dataEndIndex:B,updateId:Z},A.state)));else if(T.activeTooltipIndex!==void 0){var V=T.chartX,Q=T.chartY,F=T.activeTooltipIndex,R=A.state,G=R.offset,ee=R.tooltipTicks;if(!G)return;if(typeof z=="function")F=z(ee,T);else if(z==="value"){F=-1;for(var oe=0;oe<ee.length;oe++)if(ee[oe].value===T.activeLabel){F=oe;break}}var le=ne(ne({},G),{},{x:G.left,y:G.top}),P=Math.min(V,le.x+le.width),I=Math.min(Q,le.y+le.height),re=ee[F]&&ee[F].value,se=qb(A.state,A.props.data,F),pe=ee[F]?{x:$==="horizontal"?ee[F].coordinate:P,y:$==="horizontal"?I:ee[F].coordinate}:WN;A.setState(ne(ne({},T),{},{activeLabel:re,activeCoordinate:pe,activePayload:se,activeTooltipIndex:F}))}else A.setState(T)}),be(A,"renderCursor",function(T){var C,$=A.state,z=$.isTooltipActive,Z=$.activeCoordinate,U=$.activePayload,B=$.offset,V=$.activeTooltipIndex,Q=$.tooltipAxisBandSize,F=A.getTooltipEventType(),R=(C=T.props.active)!==null&&C!==void 0?C:z,G=A.props.layout,ee=T.key||"_recharts-cursor";return L.createElement(BG,{key:ee,activeCoordinate:Z,activePayload:U,activeTooltipIndex:V,chartName:n,element:T,isActive:R,layout:G,offset:B,tooltipAxisBandSize:Q,tooltipEventType:F})}),be(A,"renderPolarAxis",function(T,C,$){var z=Cn(T,"type.axisType"),Z=Cn(A.state,"".concat(z,"Map")),U=T.type.defaultProps,B=U!==void 0?ne(ne({},U),T.props):T.props,V=Z&&Z[B["".concat(z,"Id")]];return W.cloneElement(T,ne(ne({},V),{},{className:$e(z,V.className),key:T.key||"".concat(C,"-").concat($),ticks:jr(V,!0)}))}),be(A,"renderPolarGrid",function(T){var C=T.props,$=C.radialLines,z=C.polarAngles,Z=C.polarRadius,U=A.state,B=U.radiusAxisMap,V=U.angleAxisMap,Q=ya(B),F=ya(V),R=F.cx,G=F.cy,ee=F.innerRadius,oe=F.outerRadius;return W.cloneElement(T,{polarAngles:Array.isArray(z)?z:jr(F,!0).map(function(le){return le.coordinate}),polarRadius:Array.isArray(Z)?Z:jr(Q,!0).map(function(le){return le.coordinate}),cx:R,cy:G,innerRadius:ee,outerRadius:oe,key:T.key||"polar-grid",radialLines:$})}),be(A,"renderLegend",function(){var T=A.state.formattedGraphicalItems,C=A.props,$=C.children,z=C.width,Z=C.height,U=A.props.margin||{},B=z-(U.left||0)-(U.right||0),V=GC({children:$,formattedGraphicalItems:T,legendWidth:B,legendContent:h});if(!V)return null;var Q=V.item,F=$2(V,LG);return W.cloneElement(Q,ne(ne({},F),{},{chartWidth:z,chartHeight:Z,margin:U,onBBoxUpdate:A.handleLegendBBoxUpdate}))}),be(A,"renderTooltip",function(){var T,C=A.props,$=C.children,z=C.accessibilityLayer,Z=hn($,pn);if(!Z)return null;var U=A.state,B=U.isTooltipActive,V=U.activeCoordinate,Q=U.activePayload,F=U.activeLabel,R=U.offset,G=(T=Z.props.active)!==null&&T!==void 0?T:B;return W.cloneElement(Z,{viewBox:ne(ne({},R),{},{x:R.left,y:R.top}),active:G,label:F,payload:G?Q:[],coordinate:V,accessibilityLayer:z})}),be(A,"renderBrush",function(T){var C=A.props,$=C.margin,z=C.data,Z=A.state,U=Z.offset,B=Z.dataStartIndex,V=Z.dataEndIndex,Q=Z.updateId;return W.cloneElement(T,{key:T.key||"_recharts-brush",onChange:vs(A.handleBrushChange,T.props.onChange),data:z,x:fe(T.props.x)?T.props.x:U.left,y:fe(T.props.y)?T.props.y:U.top+U.height+U.brushBottom-($.bottom||0),width:fe(T.props.width)?T.props.width:U.width,startIndex:B,endIndex:V,updateId:"brush-".concat(Q)})}),be(A,"renderReferenceElement",function(T,C,$){if(!T)return null;var z=A,Z=z.clipPathId,U=A.state,B=U.xAxisMap,V=U.yAxisMap,Q=U.offset,F=T.type.defaultProps||{},R=T.props,G=R.xAxisId,ee=G===void 0?F.xAxisId:G,oe=R.yAxisId,le=oe===void 0?F.yAxisId:oe;return W.cloneElement(T,{key:T.key||"".concat(C,"-").concat($),xAxis:B[ee],yAxis:V[le],viewBox:{x:Q.left,y:Q.top,width:Q.width,height:Q.height},clipPathId:Z})}),be(A,"renderActivePoints",function(T){var C=T.item,$=T.activePoint,z=T.basePoint,Z=T.childIndex,U=T.isRange,B=[],V=C.props.key,Q=C.item.type.defaultProps!==void 0?ne(ne({},C.item.type.defaultProps),C.item.props):C.item.props,F=Q.activeDot,R=Q.dataKey,G=ne(ne({index:Z,dataKey:R,cx:$.x,cy:$.y,r:4,fill:D0(C.item),strokeWidth:2,stroke:"#fff",payload:$.payload,value:$.value},Ee(F,!1)),_s(F));return B.push(w.renderActiveDot(F,G,"".concat(V,"-activePoint-").concat(Z))),z?B.push(w.renderActiveDot(F,ne(ne({},G),{},{cx:z.x,cy:z.y}),"".concat(V,"-basePoint-").concat(Z))):U&&B.push(null),B}),be(A,"renderGraphicChild",function(T,C,$){var z=A.filterFormatItem(T,C,$);if(!z)return null;var Z=A.getTooltipEventType(),U=A.state,B=U.isTooltipActive,V=U.tooltipAxis,Q=U.activeTooltipIndex,F=U.activeLabel,R=A.props.children,G=hn(R,pn),ee=z.props,oe=ee.points,le=ee.isRange,P=ee.baseLine,I=z.item.type.defaultProps!==void 0?ne(ne({},z.item.type.defaultProps),z.item.props):z.item.props,re=I.activeDot,se=I.hide,pe=I.activeBar,me=I.activeShape,Me=!!(!se&&B&&G&&(re||pe||me)),ke={};Z!=="axis"&&G&&G.props.trigger==="click"?ke={onClick:vs(A.handleItemMouseEnter,T.props.onClick)}:Z!=="axis"&&(ke={onMouseLeave:vs(A.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:vs(A.handleItemMouseEnter,T.props.onMouseEnter)});var ce=W.cloneElement(T,ne(ne({},z.props),ke));function xe(or){return typeof V.dataKey=="function"?V.dataKey(or.payload):null}if(Me)if(Q>=0){var Se,ue;if(V.dataKey&&!V.allowDuplicatedCategory){var et=typeof V.dataKey=="function"?xe:"payload.".concat(V.dataKey.toString());Se=Os(oe,et,F),ue=le&&P&&Os(P,et,F)}else Se=oe==null?void 0:oe[Q],ue=le&&P&&P[Q];if(me||pe){var we=T.props.activeIndex!==void 0?T.props.activeIndex:Q;return[W.cloneElement(T,ne(ne(ne({},z.props),ke),{},{activeIndex:we})),null,null]}if(!je(Se))return[ce].concat(No(A.renderActivePoints({item:z,activePoint:Se,basePoint:ue,childIndex:Q,isRange:le})))}else{var ot,ut=(ot=A.getItemByXY(A.state.activeCoordinate))!==null&&ot!==void 0?ot:{graphicalItem:ce},zt=ut.graphicalItem,Rn=zt.item,Kn=Rn===void 0?T:Rn,Ir=zt.childIndex,$n=ne(ne(ne({},z.props),ke),{},{activeIndex:Ir});return[W.cloneElement(Kn,$n),null,null]}return le?[ce,null,null]:[ce,null]}),be(A,"renderCustomized",function(T,C,$){return W.cloneElement(T,ne(ne({key:"recharts-customized-".concat($)},A.props),A.state))}),be(A,"renderMap",{CartesianGrid:{handler:xs,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:xs},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:xs},YAxis:{handler:xs},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((j=E.id)!==null&&j!==void 0?j:$o("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=GM(A.triggeredAfterMouseMove,(N=E.throttleDelay)!==null&&N!==void 0?N:1e3/60),A.state={},A}return QG(w,b),KG(w,[{key:"componentDidMount",value:function(){var j,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var j=this.props,N=j.children,A=j.data,T=j.height,C=j.layout,$=hn(N,pn);if($){var z=$.props.defaultIndex;if(!(typeof z!="number"||z<0||z>this.state.tooltipTicks.length-1)){var Z=this.state.tooltipTicks[z]&&this.state.tooltipTicks[z].value,U=qb(this.state,A,z,Z),B=this.state.tooltipTicks[z].coordinate,V=(this.state.offset.top+T)/2,Q=C==="horizontal",F=Q?{x:B,y:V}:{y:B,x:V},R=this.state.formattedGraphicalItems.find(function(ee){var oe=ee.item;return oe.type.name==="Scatter"});R&&(F=ne(ne({},F),R.props.points[z].tooltipPosition),U=R.props.points[z].tooltipPayload);var G={activeTooltipIndex:z,isTooltipActive:!0,activeLabel:Z,activePayload:U,activeCoordinate:F};this.setState(G),this.renderCursor($),this.accessibilityManager.setIndex(z)}}}},{key:"getSnapshotBeforeUpdate",value:function(j,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==j.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==j.margin){var A,T;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(j){Sg([hn(j.children,pn)],[hn(this.props.children,pn)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var j=hn(this.props.children,pn);if(j&&typeof j.props.shared=="boolean"){var N=j.props.shared?"axis":"item";return f.indexOf(N)>=0?N:l}return l}},{key:"getMouseInfo",value:function(j){if(!this.container)return null;var N=this.container,A=N.getBoundingClientRect(),T=F8(A),C={chartX:Math.round(j.pageX-T.left),chartY:Math.round(j.pageY-T.top)},$=A.width/N.offsetWidth||1,z=this.inRange(C.chartX,C.chartY,$);if(!z)return null;var Z=this.state,U=Z.xAxisMap,B=Z.yAxisMap,V=this.getTooltipEventType(),Q=z2(this.state,this.props.data,this.props.layout,z);if(V!=="axis"&&U&&B){var F=ya(U).scale,R=ya(B).scale,G=F&&F.invert?F.invert(C.chartX):null,ee=R&&R.invert?R.invert(C.chartY):null;return ne(ne({},C),{},{xValue:G,yValue:ee},Q)}return Q?ne(ne({},C),Q):null}},{key:"inRange",value:function(j,N){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,C=j/A,$=N/A;if(T==="horizontal"||T==="vertical"){var z=this.state.offset,Z=C>=z.left&&C<=z.left+z.width&&$>=z.top&&$<=z.top+z.height;return Z?{x:C,y:$}:null}var U=this.state,B=U.angleAxisMap,V=U.radiusAxisMap;if(B&&V){var Q=ya(B);return WE({x:C,y:$},Q)}return null}},{key:"parseEventsOfWrapper",value:function(){var j=this.props.children,N=this.getTooltipEventType(),A=hn(j,pn),T={};A&&N==="axis"&&(A.props.trigger==="click"?T={onClick:this.handleClick}:T={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 C=_s(this.props,this.handleOuterEvent);return ne(ne({},C),T)}},{key:"addListener",value:function(){yg.on(mg,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){yg.removeListener(mg,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(j,N,A){for(var T=this.state.formattedGraphicalItems,C=0,$=T.length;C<$;C++){var z=T[C];if(z.item===j||z.props.key===j.key||N===Mr(z.item.type)&&A===z.childIndex)return z}return null}},{key:"renderClipPath",value:function(){var j=this.clipPathId,N=this.state.offset,A=N.left,T=N.top,C=N.height,$=N.width;return L.createElement("defs",null,L.createElement("clipPath",{id:j},L.createElement("rect",{x:A,y:T,height:C,width:$})))}},{key:"getXScales",value:function(){var j=this.state.xAxisMap;return j?Object.entries(j).reduce(function(N,A){var T=R2(A,2),C=T[0],$=T[1];return ne(ne({},N),{},be({},C,$.scale))},{}):null}},{key:"getYScales",value:function(){var j=this.state.yAxisMap;return j?Object.entries(j).reduce(function(N,A){var T=R2(A,2),C=T[0],$=T[1];return ne(ne({},N),{},be({},C,$.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(j){var N;return(N=this.state.xAxisMap)===null||N===void 0||(N=N[j])===null||N===void 0?void 0:N.scale}},{key:"getYScaleByAxisId",value:function(j){var N;return(N=this.state.yAxisMap)===null||N===void 0||(N=N[j])===null||N===void 0?void 0:N.scale}},{key:"getItemByXY",value:function(j){var N=this.state,A=N.formattedGraphicalItems,T=N.activeItem;if(A&&A.length)for(var C=0,$=A.length;C<$;C++){var z=A[C],Z=z.props,U=z.item,B=U.type.defaultProps!==void 0?ne(ne({},U.type.defaultProps),U.props):U.props,V=Mr(U.type);if(V==="Bar"){var Q=(Z.data||[]).find(function(ee){return yI(j,ee)});if(Q)return{graphicalItem:z,payload:Q}}else if(V==="RadialBar"){var F=(Z.data||[]).find(function(ee){return WE(j,ee)});if(F)return{graphicalItem:z,payload:F}}else if(Xf(z,T)||Kf(z,T)||El(z,T)){var R=oH({graphicalItem:z,activeTooltipItem:T,itemData:B.data}),G=B.activeIndex===void 0?R:B.activeIndex;return{graphicalItem:ne(ne({},z),{},{childIndex:G}),payload:El(z,T)?B.data[R]:z.props.data[R]}}}return null}},{key:"render",value:function(){var j=this;if(!sA(this))return null;var N=this.props,A=N.children,T=N.className,C=N.width,$=N.height,z=N.style,Z=N.compact,U=N.title,B=N.desc,V=$2(N,kG),Q=Ee(V,!1);if(Z)return L.createElement(h2,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement(_g,no({},Q,{width:C,height:$,title:U,desc:B}),this.renderClipPath(),dA(A,this.renderMap)));if(this.props.accessibilityLayer){var F,R;Q.tabIndex=(F=this.props.tabIndex)!==null&&F!==void 0?F:0,Q.role=(R=this.props.role)!==null&&R!==void 0?R:"application",Q.onKeyDown=function(ee){j.accessibilityManager.keyboardEvent(ee)},Q.onFocus=function(){j.accessibilityManager.focus()}}var G=this.parseEventsOfWrapper();return L.createElement(h2,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement("div",no({className:$e("recharts-wrapper",T),style:ne({position:"relative",cursor:"default",width:C,height:$},z)},G,{ref:function(oe){j.container=oe}}),L.createElement(_g,no({},Q,{width:C,height:$,title:U,desc:B,style:rY}),this.renderClipPath(),dA(A,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(W.Component);be(_,"displayName",n),be(_,"defaultProps",ne({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},y)),be(_,"getDerivedStateFromProps",function(b,w){var E=b.dataKey,j=b.data,N=b.children,A=b.width,T=b.height,C=b.layout,$=b.stackOffset,z=b.margin,Z=w.dataStartIndex,U=w.dataEndIndex;if(w.updateId===void 0){var B=B2(b);return ne(ne(ne({},B),{},{updateId:0},x(ne(ne({props:b},B),{},{updateId:0}),w)),{},{prevDataKey:E,prevData:j,prevWidth:A,prevHeight:T,prevLayout:C,prevStackOffset:$,prevMargin:z,prevChildren:N})}if(E!==w.prevDataKey||j!==w.prevData||A!==w.prevWidth||T!==w.prevHeight||C!==w.prevLayout||$!==w.prevStackOffset||!ro(z,w.prevMargin)){var V=B2(b),Q={chartX:w.chartX,chartY:w.chartY,isTooltipActive:w.isTooltipActive},F=ne(ne({},z2(w,j,C)),{},{updateId:w.updateId+1}),R=ne(ne(ne({},V),Q),F);return ne(ne(ne({},R),x(ne({props:b},R),w)),{},{prevDataKey:E,prevData:j,prevWidth:A,prevHeight:T,prevLayout:C,prevStackOffset:$,prevMargin:z,prevChildren:N})}if(!Sg(N,w.prevChildren)){var G,ee,oe,le,P=hn(N,xo),I=P&&(G=(ee=P.props)===null||ee===void 0?void 0:ee.startIndex)!==null&&G!==void 0?G:Z,re=P&&(oe=(le=P.props)===null||le===void 0?void 0:le.endIndex)!==null&&oe!==void 0?oe:U,se=I!==Z||re!==U,pe=!je(j),me=pe&&!se?w.updateId:w.updateId+1;return ne(ne({updateId:me},x(ne(ne({props:b},w),{},{updateId:me,dataStartIndex:I,dataEndIndex:re}),w)),{},{prevChildren:N,dataStartIndex:I,dataEndIndex:re})}return null}),be(_,"renderActiveDot",function(b,w,E){var j;return W.isValidElement(b)?j=W.cloneElement(b,w):Ae(b)?j=b(w):j=L.createElement(Yf,w),L.createElement(Je,{className:"recharts-active-dot",key:E},j)});var S=W.forwardRef(function(w,E){return L.createElement(_,no({},w,{ref:E}))});return S.displayName=_.displayName,S},hY=H0({chartName:"LineChart",GraphicalChild:Il,axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:R0}),pY=H0({chartName:"BarChart",GraphicalChild:fi,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:R0}),eD=H0({chartName:"AreaChart",GraphicalChild:Yn,axisComponents:[{axisType:"xAxis",AxisComp:kr},{axisType:"yAxis",AxisComp:Ur}],formatAxisMap:R0});function vY(e){return new Date(e).toLocaleString("es",{hour:"2-digit",minute:"2-digit",day:"numeric",month:"short"})}function yY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.input",e,v),ht.timeseries("claude_code.tokens.output",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>({ts:v,label:vY(v),input:f.get(v)??0,output:d.get(v)??0}));return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de tokens"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Tokens por período"}),D.jsx($f,{width:"100%",height:220,children:D.jsxs(eD,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsxs("defs",{children:[D.jsxs("linearGradient",{id:"colorInput",x1:"0",y1:"0",x2:"0",y2:"1",children:[D.jsx("stop",{offset:"5%",stopColor:"#4da6ff",stopOpacity:.3}),D.jsx("stop",{offset:"95%",stopColor:"#4da6ff",stopOpacity:0})]}),D.jsxs("linearGradient",{id:"colorOutput",x1:"0",y1:"0",x2:"0",y2:"1",children:[D.jsx("stop",{offset:"5%",stopColor:"#00ff88",stopOpacity:.3}),D.jsx("stop",{offset:"95%",stopColor:"#00ff88",stopOpacity:0})]})]}),D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:v=>v>=1e3?`${(v/1e3).toFixed(0)}K`:String(v)}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},labelStyle:{color:"#888888",fontSize:12},itemStyle:{fontSize:12}}),D.jsx(ba,{wrapperStyle:{fontSize:12,color:"#888888"}}),D.jsx(Yn,{type:"monotone",dataKey:"input",name:"Input",stroke:"#4da6ff",fill:"url(#colorInput)",strokeWidth:2}),D.jsx(Yn,{type:"monotone",dataKey:"output",name:"Output",stroke:"#00ff88",fill:"url(#colorOutput)",strokeWidth:2})]})})]})}function mY(e){return new Date(e).toLocaleDateString("es",{day:"numeric",month:"short"})}function gY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]);W.useEffect(()=>{ht.timeseries("claude_code.cost",e,"1d").then(r).catch(()=>{})},[e,t]);const o=n.map(l=>({label:mY(l.timestamp),cost:Number(l.value.toFixed(2))}));return o.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de coste"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Coste por día ($)"}),D.jsx($f,{width:"100%",height:220,children:D.jsxs(pY,{data:o,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a",vertical:!1}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:l=>`$${l.toFixed(2)}`}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},labelStyle:{color:"#888888",fontSize:12},formatter:l=>[`$${l.toFixed(2)}`,"Coste"]}),D.jsx(fi,{dataKey:"cost",fill:"#a855f7",radius:[3,3,0,0]})]})})]})}function bY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.cache.read",e,v),ht.timeseries("claude_code.tokens.cache.creation",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>({label:new Date(v).toLocaleString("es",{hour:"2-digit",day:"numeric",month:"short"}),read:f.get(v)??0,create:d.get(v)??0}));return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de caché"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Tokens de caché"}),D.jsx($f,{width:"100%",height:220,children:D.jsxs(eD,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:v=>v>=1e3?`${(v/1e3).toFixed(0)}K`:String(v)}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"}}),D.jsx(ba,{wrapperStyle:{fontSize:12,color:"#888888"}}),D.jsx(Yn,{type:"monotone",dataKey:"read",name:"Leído",stroke:"#00d4aa",fill:"#00d4aa",fillOpacity:.2,strokeWidth:2}),D.jsx(Yn,{type:"monotone",dataKey:"create",name:"Creado",stroke:"#4da6ff",fill:"#4da6ff",fillOpacity:.2,strokeWidth:2})]})})]})}function xY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState([]);W.useEffect(()=>{const v=e==="now-24h"?"1h":"1d";Promise.all([ht.timeseries("claude_code.tokens.input",e,v),ht.timeseries("claude_code.tokens.output",e,v)]).then(([y,g])=>{r(y),l(g)}).catch(()=>{})},[e,t]);const c=new Set([...n.map(v=>v.timestamp),...o.map(v=>v.timestamp)]),f=new Map(n.map(v=>[v.timestamp,v.value])),d=new Map(o.map(v=>[v.timestamp,v.value])),h=Array.from(c).sort().map(v=>{const y=f.get(v)??0,g=d.get(v)??0;return{label:new Date(v).toLocaleString("es",{hour:"2-digit",day:"numeric",month:"short"}),efficiency:y>0?Number((g/y).toFixed(3)):0}});return h.length===0?D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-6 flex items-center justify-center h-48",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de eficiencia"})}):D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("h3",{className:"text-sm font-medium text-text-secondary mb-4",children:"Ratio output/input"}),D.jsx($f,{width:"100%",height:220,children:D.jsxs(hY,{data:h,margin:{top:4,right:8,left:0,bottom:0},children:[D.jsx(Ul,{strokeDasharray:"3 3",stroke:"#1a1a1a"}),D.jsx(kr,{dataKey:"label",tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:{stroke:"#1a1a1a"}}),D.jsx(Ur,{tick:{fill:"#888888",fontSize:11},tickLine:!1,axisLine:!1,domain:[0,"auto"]}),D.jsx(pn,{contentStyle:{background:"#0d0d0d",border:"1px solid #1a1a1a",borderRadius:"6px"},formatter:v=>[v.toFixed(3),"Eficiencia"]}),D.jsx(Ff,{y:.5,stroke:"#444444",strokeDasharray:"4 4",label:{value:"0.5",fill:"#666",fontSize:10}}),D.jsx(Il,{type:"monotone",dataKey:"efficiency",stroke:"#a855f7",strokeWidth:2,dot:!1})]})})]})}function SY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState(null),[c,f]=W.useState([]),[d,h]=W.useState(null),[v,y]=W.useState("");W.useEffect(()=>{ht.sessions(50).then(r).catch(()=>{})},[e,t]);function g(S){o===S?(l(null),f([])):(f([]),l(S),ht.sessionEvents(S).then(f).catch(()=>{}))}function x(S,b,w){w.stopPropagation(),h(S),y(b??"")}async function _(S){v.trim()&&(await ht.labelSession(S,v.trim()).catch(()=>{}),r(b=>b.map(w=>w.sessionId===S?{...w,project:v.trim()}:w))),h(null)}return n.length===0?D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin sesiones registradas"}):D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:D.jsxs("table",{className:"w-full text-sm",children:[D.jsx("thead",{children:D.jsxs("tr",{className:"border-b border-bg-border",children:[D.jsx("th",{className:"w-6 px-3 py-2"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"ID"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Proyecto"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Modelo"}),D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Inicio"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Duración"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Input"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Output"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Coste"})]})}),D.jsx("tbody",{children:n.map(S=>D.jsxs(W.Fragment,{children:[D.jsxs("tr",{className:"border-b border-bg-border hover:bg-bg-card-hover cursor-pointer",onClick:()=>g(S.sessionId),children:[D.jsx("td",{className:"px-3 py-2 text-text-muted",children:o===S.sessionId?D.jsx(IR,{size:14}):D.jsx(GR,{size:14})}),D.jsxs("td",{className:"px-3 py-2 font-mono text-text-secondary text-xs",children:[S.sessionId.slice(0,8),"…"]}),D.jsx("td",{className:"px-3 py-2",onClick:b=>b.stopPropagation(),children:d===S.sessionId?D.jsxs("span",{className:"flex items-center gap-1",children:[D.jsx("input",{autoFocus:!0,value:v,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&_(S.sessionId),b.key==="Escape"&&h(null)},className:"bg-bg-base border border-bg-border rounded px-1 py-0.5 text-xs text-text-primary w-24 outline-none focus:border-accent-green"}),D.jsx("button",{onClick:()=>_(S.sessionId),className:"text-accent-green",children:D.jsx(Bb,{size:12})}),D.jsx("button",{onClick:()=>h(null),className:"text-accent-orange",children:D.jsx(I2,{size:12})})]}):D.jsxs("span",{onClick:b=>x(S.sessionId,S.project,b),className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bg-base border border-bg-border text-text-secondary hover:border-accent-green cursor-pointer transition-colors",children:[S.project??"—",D.jsx(ZR,{size:10,className:"opacity-50"})]})}),D.jsx("td",{className:"px-3 py-2 text-text-secondary font-mono text-xs",children:S.model??"—"}),D.jsx("td",{className:"px-3 py-2 text-text-secondary",children:u3(S.startTime)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-text-secondary",children:Lb(S.durationActiveMs)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-blue",children:er(S.tokensInput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-green",children:er(S.tokensOutput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-purple",children:ei(S.cost)})]}),o===S.sessionId&&D.jsx("tr",{children:D.jsx("td",{colSpan:9,className:"bg-bg-subtle px-6 py-3",children:D.jsx("div",{className:"text-xs font-mono space-y-0.5 max-h-40 overflow-y-auto",children:c.length===0?D.jsx("span",{className:"text-text-muted",children:"Sin eventos"}):c.slice(-20).map((b,w)=>D.jsxs("div",{className:"flex gap-2 text-text-secondary",children:[D.jsx("span",{className:"text-text-muted shrink-0",children:new Date(b.timestamp).toLocaleTimeString()}),D.jsx("span",{className:"text-accent-teal",children:b.eventName})]},`${b.timestamp}-${b.eventName}-${w}`))})})})]},S.sessionId))})]})})}function OY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState(null),c=W.useCallback(()=>{ht.projects(e).then(r).catch(()=>{})},[e]);W.useEffect(()=>{c()},[c,t]);const f=async h=>{if(confirm(`¿Resetear todos los datos del proyecto "${h}"?`)){l(h);try{await ht.resetProject(h),c()}finally{l(null)}}};if(n.length===0)return D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin proyectos registrados"});const d=Math.max(...n.map(h=>h.cost),1e-4);return D.jsxs("div",{className:"flex flex-col gap-4",children:[D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4 space-y-3",children:n.map(h=>D.jsxs("div",{children:[D.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[D.jsx("span",{className:"text-text-primary font-medium",children:h.project}),D.jsx("span",{className:"text-accent-purple font-mono",children:ei(h.cost)})]}),D.jsx("div",{className:"h-2 bg-bg-base rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-accent-purple rounded-full",style:{width:`${h.cost/d*100}%`}})})]},h.project))}),D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-x-auto",children:D.jsxs("table",{className:"w-full text-sm min-w-[640px]",children:[D.jsx("thead",{children:D.jsxs("tr",{className:"border-b border-bg-border",children:[D.jsx("th",{className:"text-left px-3 py-2 text-text-muted font-medium",children:"Proyecto"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Sesiones"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Input"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Output"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Caché %"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Coste"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"Commits"}),D.jsx("th",{className:"text-right px-3 py-2 text-text-muted font-medium",children:"LOC +/-"}),D.jsx("th",{className:"px-3 py-2"})]})}),D.jsx("tbody",{children:n.map(h=>D.jsxs("tr",{className:"border-b border-bg-border hover:bg-bg-card-hover",children:[D.jsx("td",{className:"px-3 py-2 text-text-primary font-medium",children:h.project}),D.jsx("td",{className:"px-3 py-2 text-right text-text-secondary",children:h.sessions}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-blue",children:er(h.tokensInput)}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-green",children:er(h.tokensOutput)}),D.jsxs("td",{className:"px-3 py-2 text-right font-mono text-accent-teal",children:[(h.cacheHitRate*100).toFixed(1),"%"]}),D.jsx("td",{className:"px-3 py-2 text-right font-mono text-accent-purple",children:ei(h.cost)}),D.jsx("td",{className:"px-3 py-2 text-right text-text-secondary",children:h.commits}),D.jsxs("td",{className:"px-3 py-2 text-right font-mono text-xs",children:[D.jsxs("span",{className:"text-accent-green",children:["+",h.linesAdded]}),D.jsx("span",{className:"text-text-muted",children:" / "}),D.jsxs("span",{className:"text-accent-orange",children:["-",h.linesRemoved]})]}),D.jsx("td",{className:"px-3 py-2 text-right",children:D.jsx("button",{onClick:()=>f(h.project),disabled:o===h.project,title:"Resetear proyecto",className:"p-1 rounded text-text-muted hover:text-accent-orange hover:bg-bg-base transition-colors disabled:opacity-40",children:D.jsx(e3,{size:13})})})]},h.project))})]})})]})}function _Y({timeRange:e,sseVersion:t}){const[n,r]=W.useState(null);if(W.useEffect(()=>{ht.tools(e).then(r).catch(()=>{})},[e,t]),!n||n.usage.length===0)return D.jsx("div",{className:"text-text-muted text-sm p-4",children:"Sin datos de herramientas"});const o=Math.max(...n.usage.map(f=>f.count),1),l=n.decisionRate.approved+n.decisionRate.rejected,c=l>0?(n.decisionRate.approved/l*100).toFixed(1):"—";return D.jsxs("div",{className:"flex flex-col gap-4",children:[D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("span",{className:"text-text-secondary text-sm",children:"Tasa de aprobación: "}),D.jsxs("span",{className:"text-accent-green font-mono font-bold",children:[c,"%"]}),D.jsxs("span",{className:"text-text-muted text-xs ml-2",children:["(",n.decisionRate.approved," aprobadas / ",n.decisionRate.rejected," rechazadas)"]})]}),D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4 space-y-2",children:n.usage.map(f=>D.jsxs("div",{children:[D.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[D.jsx("span",{className:"font-mono text-text-primary",children:f.toolName}),D.jsxs("span",{className:"text-text-secondary",children:[f.count," usos · ",(f.successRate*100).toFixed(0),"% éxito"]})]}),D.jsx("div",{className:"h-1.5 bg-bg-base rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-accent-teal rounded-full",style:{width:`${f.count/o*100}%`}})})]},f.toolName))})]})}const Ss={"claude-opus-4-8":{input:15,output:75,cacheWrite:18.75,cacheRead:1.5},"claude-sonnet-4-6":{input:3,output:15,cacheWrite:3.75,cacheRead:.3},"claude-haiku-4-5":{input:.8,output:4,cacheWrite:1,cacheRead:.08}},k2=Ss["claude-sonnet-4-6"];function tD(e){if(!e)return k2;const t=e.toLowerCase();return t.includes("opus")?Ss["claude-opus-4-8"]:t.includes("haiku")?Ss["claude-haiku-4-5"]:t.includes("sonnet")?Ss["claude-sonnet-4-6"]:k2}function AY(e,t){const n=tD(t);return e*(n.input-n.cacheRead)/1e6}const wY=[{id:"all",label:"Todos"},{id:"api",label:"API"},{id:"tools",label:"Tools"},{id:"prompts",label:"Prompts"},{id:"errors",label:"Errores"}];function TY(e){return e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(3)}`:`$${e.toFixed(4)}`}function EY(e){const t=e.attributes;if(typeof t.cost=="number"&&t.cost>0)return t.cost;const n=Number(t.input_tokens??t["tokens.input"]??0),r=Number(t.output_tokens??t["tokens.output"]??0),o=Number(t.cache_read_input_tokens??t["tokens.cache_read"]??0),l=Number(t.cache_creation_input_tokens??t["tokens.cache_creation"]??0);if(n===0&&r===0)return null;const c=tD(e.model);return n*c.input/1e6+r*c.output/1e6+o*c.cacheRead/1e6+l*c.cacheWrite/1e6}function jY(e){return e.includes("error")?"text-accent-orange":e==="user_prompt"?"text-accent-blue":e==="api_request"?"text-accent-green":e==="tool_use"?"text-accent-teal":e.startsWith("hook_")?"text-accent-yellow":"text-text-secondary"}function MY(e,t){return t==="all"?!0:t==="api"?e.eventName.includes("api"):t==="tools"?e.eventName.includes("tool"):t==="prompts"?e.eventName.includes("prompt"):t==="errors"?e.eventName.includes("error"):!0}function CY({timeRange:e,sseVersion:t}){const[n,r]=W.useState([]),[o,l]=W.useState("all"),[c,f]=W.useState(!1);W.useEffect(()=>{c||ht.events(500).then(r).catch(()=>{})},[e,t,c]);const d=n.filter(h=>MY(h,o));return D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg flex flex-col h-[600px]",children:[D.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-bg-border flex-wrap",children:[wY.map(({id:h,label:v})=>D.jsx("button",{onClick:()=>l(h),className:`px-2 py-1 rounded text-xs transition-colors ${o===h?"bg-accent-green text-black font-medium":"text-text-secondary hover:text-text-primary"}`,children:v},h)),D.jsx("div",{className:"flex-1"}),D.jsxs("button",{onClick:()=>f(h=>!h),className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-text-secondary hover:text-text-primary",children:[c?D.jsx(WR,{size:12}):D.jsx(VR,{size:12}),D.jsx("span",{children:c?"Reanudar":"Pausar"})]})]}),D.jsx("div",{className:"flex-1 overflow-y-auto p-3 font-mono text-xs space-y-0.5",children:d.length===0?D.jsx("span",{className:"text-text-muted",children:"Sin eventos"}):d.map((h,v)=>{const y=EY(h);return D.jsxs("div",{className:"flex gap-2 hover:bg-bg-base px-1 rounded",children:[D.jsx("span",{className:"text-text-muted shrink-0",children:new Date(h.timestamp).toLocaleTimeString()}),D.jsx("span",{className:`shrink-0 ${jY(h.eventName)}`,children:h.eventName}),h.sessionId&&D.jsxs("span",{className:"text-text-muted",children:[h.sessionId.slice(0,6),"…"]}),y!==null&&D.jsx("span",{className:"text-accent-purple ml-auto shrink-0",children:TY(y)})]},`${h.sessionId??""}-${h.timestamp}-${h.eventName}-${v}`)})})]})}function NY({sseVersion:e}){const[t,n]=W.useState([]);if(W.useEffect(()=>{ht.agents().then(n).catch(()=>{})},[e]),t.length===0)return D.jsx("div",{className:"bg-bg-card border border-bg-border rounded-lg p-8 flex items-center justify-center",children:D.jsx("span",{className:"text-text-muted text-sm",children:"Sin datos de agentes. Aparece cuando hay múltiples agentes en trazas OTLP."})});const r=t.filter(c=>!c.parentAgentId),o=c=>t.filter(f=>f.parentAgentId===c);function l({agent:c,depth:f=0}){const d=o(c.agentId);return D.jsxs("div",{style:{paddingLeft:`${f*16}px`},children:[D.jsxs("div",{className:"flex items-center gap-4 py-2 border-b border-bg-border text-sm hover:bg-bg-card-hover px-2",children:[D.jsxs("span",{className:"font-mono text-text-muted text-xs w-20 shrink-0",children:[c.agentId.slice(0,8),"…"]}),D.jsx("span",{className:"font-mono text-accent-blue",children:er(c.tokensInput)}),D.jsx("span",{className:"font-mono text-accent-green",children:er(c.tokensOutput)}),D.jsx("span",{className:"font-mono text-accent-purple",children:ei(c.cost)}),D.jsx("span",{className:"text-text-secondary",children:Lb(c.durationMs)}),D.jsxs("span",{className:"text-text-muted text-xs",children:[c.toolCalls," tools"]})]}),d.map(h=>D.jsx(l,{agent:h,depth:f+1},h.agentId))]})}return D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg overflow-hidden",children:[D.jsxs("div",{className:"px-3 py-2 border-b border-bg-border grid grid-cols-6 text-xs text-text-muted",children:[D.jsx("span",{children:"Agent ID"}),D.jsx("span",{children:"Input"}),D.jsx("span",{children:"Output"}),D.jsx("span",{children:"Coste"}),D.jsx("span",{children:"Duración"}),D.jsx("span",{children:"Tools"})]}),r.map(c=>D.jsx(l,{agent:c},c.agentId))]})}function DY(){const[e,t]=W.useState("now-24h");return{timeRange:e,setTimeRange:t}}function PY(e){W.useEffect(()=>{let t=null,n;function r(){t=new EventSource("/api/stream"),t.onmessage=o=>{try{const{type:l,payload:c}=JSON.parse(o.data);l!=="ping"&&e(l,c)}catch{}},t.onerror=()=>{t==null||t.close(),t=null,n=setTimeout(r,3e3)}}return r(),()=>{clearTimeout(n),t==null||t.close()}},[])}function RY(e){const[t,n]=W.useState({connected:!1,lastSeen:null,sessionCount:0,totalEvents:0,uptime:0}),[r,o]=W.useState(null),[l,c]=W.useState(0),f=W.useRef(0),d=W.useRef(0),h=W.useCallback(async()=>{f.current=Date.now();try{const[y,g]=await Promise.all([ht.status(),ht.summary(e)]);n(y),o(g)}catch{}},[e]);W.useEffect(()=>{h()},[h]);const v=W.useCallback((y,g)=>{Date.now()-f.current>5e3?h():ht.status().then(n).catch(()=>{});const x=Date.now();x-d.current>5e3&&(d.current=x,c(_=>_+1))},[h]);return PY(v),{status:t,summary:r,refetch:h,sseVersion:l}}function $Y(){const[e,t]=W.useState("overview"),{timeRange:n,setTimeRange:r}=DY(),{status:o,summary:l,sseVersion:c}=RY(n);return!o.connected&&o.totalEvents===0?D.jsxs("div",{className:"min-h-screen bg-bg-base text-text-primary flex flex-col",children:[D.jsx(JO,{timeRange:n,onTimeRangeChange:r,connected:!1,lastSeen:null}),D.jsx(n3,{})]}):D.jsxs("div",{className:"min-h-screen bg-bg-base text-text-primary flex flex-col",children:[D.jsx(JO,{timeRange:n,onTimeRangeChange:r,connected:o.connected,lastSeen:o.lastSeen}),D.jsx(i3,{onLabeled:()=>{}}),D.jsx(RR,{activeTab:e,onTabChange:t}),D.jsxs("main",{className:"flex-1 p-4 max-w-screen-2xl mx-auto w-full",children:[e==="overview"&&D.jsxs("div",{className:"flex flex-col gap-4",children:[l&&D.jsx(l3,{summary:l}),D.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[D.jsx(yY,{timeRange:n,sseVersion:c}),D.jsx(gY,{timeRange:n,sseVersion:c})]})]}),e==="sessions"&&D.jsx(SY,{timeRange:n,sseVersion:c}),e==="projects"&&D.jsx(OY,{timeRange:n,sseVersion:c}),e==="tools"&&D.jsx(_Y,{timeRange:n,sseVersion:c}),e==="agents"&&D.jsx(NY,{sseVersion:c}),e==="events"&&D.jsx(CY,{timeRange:n,sseVersion:c}),e==="costs"&&D.jsxs("div",{className:"flex flex-col gap-4",children:[l&&D.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Coste período"}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-purple",children:ei(l.cost)})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Eficiencia"}),D.jsxs("div",{className:"text-2xl font-mono font-bold text-accent-green",children:[(l.efficiency*100).toFixed(1),"%"]})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Tokens caché"}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-teal",children:er(l.tokens.cache)})]}),D.jsxs("div",{className:"bg-bg-card border border-bg-border rounded-lg p-4",children:[D.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1",children:"Ahorro caché est."}),D.jsx("div",{className:"text-2xl font-mono font-bold text-accent-yellow",children:ei(AY(l.tokens.cache))})]})]}),D.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[D.jsx(bY,{timeRange:n,sseVersion:c}),D.jsx(xY,{timeRange:n,sseVersion:c})]})]})]})]})}CR.createRoot(document.getElementById("root")).render(D.jsx(W.StrictMode,{children:D.jsx($Y,{})}));
@@ -0,0 +1 @@
1
+ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,Fira Code,Menlo,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.right-2{right:.5rem}.top-0{top:0}.top-10{top:2.5rem}.top-2{top:.5rem}.z-40{z-index:40}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-2{height:.5rem}.h-48{height:12rem}.h-\[600px\]{height:600px}.h-full{height:100%}.max-h-40{max-height:10rem}.min-h-\[60vh\]{min-height:60vh}.min-h-screen{min-height:100vh}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-32{width:8rem}.w-6{width:1.5rem}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[640px\]{min-width:640px}.max-w-screen-2xl{max-width:1536px}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-accent-green{--tw-border-opacity: 1;border-color:rgb(255 107 53 / var(--tw-border-opacity, 1))}.border-bg-border{--tw-border-opacity: 1;border-color:rgb(26 26 26 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.bg-accent-green{--tw-bg-opacity: 1;background-color:rgb(255 107 53 / var(--tw-bg-opacity, 1))}.bg-accent-purple{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-accent-teal{--tw-bg-opacity: 1;background-color:rgb(0 212 170 / var(--tw-bg-opacity, 1))}.bg-accent-yellow{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-bg-base{--tw-bg-opacity: 1;background-color:rgb(20 25 31 / var(--tw-bg-opacity, 1))}.bg-bg-card,.bg-bg-subtle{--tw-bg-opacity: 1;background-color:rgb(33 38 43 / var(--tw-bg-opacity, 1))}.bg-text-muted{--tw-bg-opacity: 1;background-color:rgb(68 68 68 / var(--tw-bg-opacity, 1))}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,Fira Code,Menlo,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-wider{letter-spacing:.05em}.text-accent-blue{--tw-text-opacity: 1;color:rgb(77 166 255 / var(--tw-text-opacity, 1))}.text-accent-green,.text-accent-orange{--tw-text-opacity: 1;color:rgb(255 107 53 / var(--tw-text-opacity, 1))}.text-accent-purple{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-accent-teal{--tw-text-opacity: 1;color:rgb(0 212 170 / var(--tw-text-opacity, 1))}.text-accent-yellow{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-text-muted{--tw-text-opacity: 1;color:rgb(68 68 68 / var(--tw-text-opacity, 1))}.text-text-primary{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-text-secondary{--tw-text-opacity: 1;color:rgb(136 136 136 / var(--tw-text-opacity, 1))}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{--bg-base: #14191F;--bg-card: #21262B;--bg-card-hover: #272d33;--bg-border: #1a1a1a;--bg-subtle: #21262B;--text-primary: #ffffff;--text-secondary: #888888;--text-muted: #444444;--accent-green: #ff6b35;--accent-blue: #4da6ff;--accent-purple: #a855f7;--accent-orange: #ff6b35;--accent-teal: #00d4aa;--accent-yellow: #fbbf24}*{box-sizing:border-box}html,body,#root{height:100%;margin:0;padding:0;background-color:#14191f;color:#fff}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;-webkit-font-smoothing:antialiased}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:#0d0d0d}::-webkit-scrollbar-thumb{background:#333;border-radius:3px}::-webkit-scrollbar-thumb:hover{background:#444}.hover\:border-accent-green:hover{--tw-border-opacity: 1;border-color:rgb(255 107 53 / var(--tw-border-opacity, 1))}.hover\:bg-bg-base:hover{--tw-bg-opacity: 1;background-color:rgb(20 25 31 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-card:hover{--tw-bg-opacity: 1;background-color:rgb(33 38 43 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-card-hover:hover{--tw-bg-opacity: 1;background-color:rgb(39 45 51 / var(--tw-bg-opacity, 1))}.hover\:text-accent-orange:hover{--tw-text-opacity: 1;color:rgb(255 107 53 / var(--tw-text-opacity, 1))}.hover\:text-text-primary:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.focus\:border-accent-green:focus{--tw-border-opacity: 1;border-color:rgb(255 107 53 / var(--tw-border-opacity, 1))}.disabled\:opacity-40:disabled{opacity:.4}@media(min-width:768px){.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(min-width:1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}
package/dist/index.html CHANGED
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>tokenrace</title>
7
- <script type="module" crossorigin src="/assets/index-B-htjFDg.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-52-EmhaW.css">
7
+ <script type="module" crossorigin src="/assets/index-D6Cb6-ut.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-nNt1YQNh.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokenrace",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Monitor en tiempo real para Claude Code",
5
5
  "bin": {
6
6
  "tokenrace": "bin/cli.js"
package/src/store.js CHANGED
@@ -554,17 +554,29 @@ export function getSummary(from) {
554
554
  let activeTimeMs = 0
555
555
  const sessionSet = new Set()
556
556
 
557
+ // Coste desde timeseries: filtrado por timestamp exacto, sin doble conteo
558
+ const sessionsWithCost = new Set()
559
+ for (const point of state.timeseries.get('claude_code.cost') ?? []) {
560
+ if (point.ts < minTs) continue
561
+ const sid = point.labels['session.id']
562
+ if (sid && state.ignoredSessions.has(sid)) continue
563
+ cost += point.value
564
+ if (sid) sessionsWithCost.add(sid)
565
+ }
566
+
557
567
  for (const session of state.sessions.values()) {
558
568
  if (state.ignoredSessions.has(session.sessionId)) continue
559
569
  if (session.lastSeen < minTs) continue
560
570
  tokensInput += session.tokensInput
561
571
  tokensOutput += session.tokensOutput
562
572
  tokensCache += session.tokensCache
563
- cost += session.cost > 0
564
- ? session.cost
565
- : estimateCost(session.model, session.tokensInput, session.tokensOutput, session.tokensCache)
566
573
  activeTimeMs += session.durationActiveMs
567
574
  sessionSet.add(session.sessionId)
575
+
576
+ // Estimar solo si no llegaron métricas de coste reales para esta sesión
577
+ if (!sessionsWithCost.has(session.sessionId)) {
578
+ cost += estimateCost(session.model, session.tokensInput, session.tokensOutput, session.tokensCache)
579
+ }
568
580
  }
569
581
 
570
582
  // Commits, PRs y líneas desde timeseries
@@ -650,20 +662,37 @@ export function getProjects(from) {
650
662
  }
651
663
  }
652
664
 
665
+ // Coste por proyecto desde timeseries (filtrado por timestamp)
666
+ const projectCostTs = new Map() // projectName → cost acumulado en timeseries
667
+ const sessionHasCost = new Set() // sessionIds con coste real en el rango
668
+
669
+ for (const point of state.timeseries.get('claude_code.cost') ?? []) {
670
+ if (point.ts < minTs) continue
671
+ const sid = point.labels['session.id']
672
+ if (sid && state.ignoredSessions.has(sid)) continue
673
+ const proj = resolveProject(sid, point.labels.project)
674
+ if (!proj) continue
675
+ projectCostTs.set(proj, (projectCostTs.get(proj) ?? 0) + point.value)
676
+ if (sid) sessionHasCost.add(sid)
677
+ }
678
+
653
679
  for (const [project, proj] of state.projects.entries()) {
654
680
  const activeSessions = new Set()
655
- let cost = 0, tokensInput = 0, tokensOutput = 0, tokensCache = 0
681
+ let cost = projectCostTs.get(project) ?? 0
682
+ let tokensInput = 0, tokensOutput = 0, tokensCache = 0
656
683
 
657
684
  for (const sessionId of proj.sessions) {
658
685
  const session = state.sessions.get(sessionId)
659
686
  if (!session || session.lastSeen < minTs) continue
660
687
  activeSessions.add(sessionId)
661
- cost += session.cost > 0
662
- ? session.cost
663
- : estimateCost(session.model, session.tokensInput, session.tokensOutput, session.tokensCache)
664
688
  tokensInput += session.tokensInput
665
689
  tokensOutput += session.tokensOutput
666
690
  tokensCache += session.tokensCache
691
+
692
+ // Estimar solo si no llegaron métricas de coste reales para esta sesión
693
+ if (!sessionHasCost.has(sessionId)) {
694
+ cost += estimateCost(session.model, session.tokensInput, session.tokensOutput, session.tokensCache)
695
+ }
667
696
  }
668
697
 
669
698
  if (activeSessions.size === 0 && minTs > 0) continue
@@ -828,14 +857,15 @@ export function saveSync() {
828
857
  fs.mkdirSync(dataDir, { recursive: true, mode: 0o700 })
829
858
 
830
859
  const data = {
831
- timeseries: Array.from(state.timeseries.entries()),
832
- sessions: Array.from(state.sessions.values()),
833
- sessionMappings: Array.from(state.sessionMappings.entries()),
834
- ignoredSessions: Array.from(state.ignoredSessions),
835
- events: state.events,
836
- eventIndex: state.eventIndex,
837
- totalEvents: state.totalEvents,
838
- startTime: state.startTime
860
+ timeseries: Array.from(state.timeseries.entries()),
861
+ sessions: Array.from(state.sessions.values()),
862
+ sessionMappings: Array.from(state.sessionMappings.entries()),
863
+ ignoredSessions: Array.from(state.ignoredSessions),
864
+ cumulativeValues: Array.from(state.cumulativeValues.entries()),
865
+ events: state.events,
866
+ eventIndex: state.eventIndex,
867
+ totalEvents: state.totalEvents,
868
+ startTime: state.startTime
839
869
  }
840
870
 
841
871
  fs.writeFileSync(dataFile, JSON.stringify(data), { mode: 0o600 })
@@ -885,6 +915,13 @@ export function loadFromDisk() {
885
915
  }
886
916
  }
887
917
 
918
+ // Restaurar baselines de métricas cumulativas (evita doble conteo al reiniciar)
919
+ if (Array.isArray(data.cumulativeValues)) {
920
+ for (const [k, v] of data.cumulativeValues) {
921
+ state.cumulativeValues.set(k, v)
922
+ }
923
+ }
924
+
888
925
  // Restaurar buffer de eventos
889
926
  if (Array.isArray(data.events)) {
890
927
  state.events.push(...data.events)
@@ -1 +0,0 @@
1
- *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,Fira Code,Menlo,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.right-2{right:.5rem}.top-0{top:0}.top-10{top:2.5rem}.top-2{top:.5rem}.z-40{z-index:40}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-2{height:.5rem}.h-48{height:12rem}.h-\[600px\]{height:600px}.h-full{height:100%}.max-h-40{max-height:10rem}.min-h-\[60vh\]{min-height:60vh}.min-h-screen{min-height:100vh}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-32{width:8rem}.w-6{width:1.5rem}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-screen-2xl{max-width:1536px}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-accent-green{--tw-border-opacity: 1;border-color:rgb(255 107 53 / var(--tw-border-opacity, 1))}.border-bg-border{--tw-border-opacity: 1;border-color:rgb(26 26 26 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.bg-accent-green{--tw-bg-opacity: 1;background-color:rgb(255 107 53 / var(--tw-bg-opacity, 1))}.bg-accent-purple{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-accent-teal{--tw-bg-opacity: 1;background-color:rgb(0 212 170 / var(--tw-bg-opacity, 1))}.bg-accent-yellow{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-bg-base{--tw-bg-opacity: 1;background-color:rgb(20 25 31 / var(--tw-bg-opacity, 1))}.bg-bg-card,.bg-bg-subtle{--tw-bg-opacity: 1;background-color:rgb(33 38 43 / var(--tw-bg-opacity, 1))}.bg-text-muted{--tw-bg-opacity: 1;background-color:rgb(68 68 68 / var(--tw-bg-opacity, 1))}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,Fira Code,Menlo,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-wider{letter-spacing:.05em}.text-accent-blue{--tw-text-opacity: 1;color:rgb(77 166 255 / var(--tw-text-opacity, 1))}.text-accent-green,.text-accent-orange{--tw-text-opacity: 1;color:rgb(255 107 53 / var(--tw-text-opacity, 1))}.text-accent-purple{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-accent-teal{--tw-text-opacity: 1;color:rgb(0 212 170 / var(--tw-text-opacity, 1))}.text-accent-yellow{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-text-muted{--tw-text-opacity: 1;color:rgb(68 68 68 / var(--tw-text-opacity, 1))}.text-text-primary{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-text-secondary{--tw-text-opacity: 1;color:rgb(136 136 136 / var(--tw-text-opacity, 1))}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{--bg-base: #14191F;--bg-card: #21262B;--bg-card-hover: #272d33;--bg-border: #1a1a1a;--bg-subtle: #21262B;--text-primary: #ffffff;--text-secondary: #888888;--text-muted: #444444;--accent-green: #ff6b35;--accent-blue: #4da6ff;--accent-purple: #a855f7;--accent-orange: #ff6b35;--accent-teal: #00d4aa;--accent-yellow: #fbbf24}*{box-sizing:border-box}html,body,#root{height:100%;margin:0;padding:0;background-color:#14191f;color:#fff}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;-webkit-font-smoothing:antialiased}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:#0d0d0d}::-webkit-scrollbar-thumb{background:#333;border-radius:3px}::-webkit-scrollbar-thumb:hover{background:#444}.hover\:border-accent-green:hover{--tw-border-opacity: 1;border-color:rgb(255 107 53 / var(--tw-border-opacity, 1))}.hover\:bg-bg-base:hover{--tw-bg-opacity: 1;background-color:rgb(20 25 31 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-card:hover{--tw-bg-opacity: 1;background-color:rgb(33 38 43 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-card-hover:hover{--tw-bg-opacity: 1;background-color:rgb(39 45 51 / var(--tw-bg-opacity, 1))}.hover\:text-accent-orange:hover{--tw-text-opacity: 1;color:rgb(255 107 53 / var(--tw-text-opacity, 1))}.hover\:text-text-primary:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.focus\:border-accent-green:focus{--tw-border-opacity: 1;border-color:rgb(255 107 53 / var(--tw-border-opacity, 1))}.disabled\:opacity-40:disabled{opacity:.4}@media(min-width:768px){.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(min-width:1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}