heyio 3.1.14 → 3.1.16

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.
@@ -499,7 +499,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
499
499
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dre(t,e){if(t){if(typeof t=="string")return hw(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hw(t,e)}}function fre(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function hre(t){if(Array.isArray(t))return hw(t)}function hw(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function pre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mN(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,uM(n.key),n)}}function mre(t,e,r){return e&&mN(t.prototype,e),r&&mN(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function gre(t,e,r){return e=Fh(e),yre(t,cM()?Reflect.construct(e,r||[],Fh(t).constructor):e.apply(t,r))}function yre(t,e){if(e&&(ul(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vre(t)}function vre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function cM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cM=function(){return!!t})()}function Fh(t){return Fh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Fh(t)}function bre(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pw(t,e)}function pw(t,e){return pw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},pw(t,e)}function Wn(t,e,r){return e=uM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function uM(t){var e=xre(t,"string");return ul(e)=="symbol"?e:e+""}function xre(t,e){if(ul(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ul(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Hu=(function(t){function e(){var r;pre(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=gre(this,e,[].concat(i)),Wn(r,"state",{isAnimationFinished:!0,totalLength:0}),Wn(r,"generateSimpleStrokeDasharray",function(o,c){return"".concat(c,"px ").concat(o-c,"px")}),Wn(r,"getStrokeDasharray",function(o,c,u){var d=u.reduce(function(S,A){return S+A});if(!d)return r.generateSimpleStrokeDasharray(c,o);for(var p=Math.floor(o/d),f=o%d,g=c-o,v=[],x=0,_=0;x<u.length;_+=u[x],++x)if(_+u[x]>f){v=[].concat(Ts(u.slice(0,x)),[f-_]);break}var b=v.length%2===0?[0,g]:[g];return[].concat(Ts(e.repeat(u,p)),Ts(v),b).map(function(S){return"".concat(S,"px")}).join(", ")}),Wn(r,"id",Lu("recharts-line-")),Wn(r,"pathRef",function(o){r.mainCurve=o}),Wn(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Wn(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return bre(e,t),mre(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,c=a.xAxis,u=a.yAxis,d=a.layout,p=a.children,f=jn(p,Fu);if(!f)return null;var g=function(_,b){return{x:_.x,y:_.y,value:_.value,errorVal:dn(_.payload,b)}},v={clipPath:n?"url(#clipPath-".concat(i,")"):null};return L.createElement(Xt,v,f.map(function(x){return L.cloneElement(x,{key:"bar-".concat(x.props.dataKey),data:o,xAxis:c,yAxis:u,layout:d,dataPointFormatter:g})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var c=this.props,u=c.dot,d=c.points,p=c.dataKey,f=it(this.props,!1),g=it(u,!0),v=d.map(function(_,b){var S=an(an(an({key:"dot-".concat(b),r:3},f),g),{},{index:b,cx:_.x,cy:_.y,value:_.value,dataKey:p,payload:_.payload,points:d});return e.renderDotItem(u,S)}),x={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return L.createElement(Xt,zc({className:"recharts-line-dots",key:"dots"},x),v)}},{key:"renderCurveStatically",value:function(n,i,a,o){var c=this.props,u=c.type,d=c.layout,p=c.connectNulls;c.ref;var f=hN(c,sre),g=an(an(an({},it(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:u,layout:d,connectNulls:p});return L.createElement(Wx,zc({},g,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,c=o.points,u=o.strokeDasharray,d=o.isAnimationActive,p=o.animationBegin,f=o.animationDuration,g=o.animationEasing,v=o.animationId,x=o.animateNewValues,_=o.width,b=o.height,S=this.state,A=S.prevPoints,O=S.totalLength;return L.createElement(Qi,{begin:p,duration:f,isActive:d,easing:g,from:{t:0},to:{t:1},key:"line-".concat(v),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(j){var E=j.t;if(A){var T=A.length/c.length,N=c.map(function(B,K){var W=Math.floor(K*T);if(A[W]){var X=A[W],Y=Vn(X.x,B.x),te=Vn(X.y,B.y);return an(an({},B),{},{x:Y(E),y:te(E)})}if(x){var H=Vn(_*2,B.x),Q=Vn(b/2,B.y);return an(an({},B),{},{x:H(E),y:Q(E)})}return an(an({},B),{},{x:B.x,y:B.y})});return a.renderCurveStatically(N,n,i)}var R=Vn(0,O),M=R(E),J;if(u){var F="".concat(u).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});J=a.getStrokeDasharray(M,O,F)}else J=a.generateSimpleStrokeDasharray(O,M);return a.renderCurveStatically(c,n,i,{strokeDasharray:J})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,c=a.isAnimationActive,u=this.state,d=u.prevPoints,p=u.totalLength;return c&&o&&o.length&&(!d&&p>0||!Tp(d,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,c=i.points,u=i.className,d=i.xAxis,p=i.yAxis,f=i.top,g=i.left,v=i.width,x=i.height,_=i.isAnimationActive,b=i.id;if(a||!c||!c.length)return null;var S=this.state.isAnimationFinished,A=c.length===1,O=ot("recharts-line",u),j=d&&d.allowDataOverflow,E=p&&p.allowDataOverflow,T=j||E,N=et(b)?this.id:b,R=(n=it(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},M=R.r,J=M===void 0?3:M,F=R.strokeWidth,B=F===void 0?2:F,K=$9(o)?o:{},W=K.clipDot,X=W===void 0?!0:W,Y=J*2+B;return L.createElement(Xt,{className:O},j||E?L.createElement("defs",null,L.createElement("clipPath",{id:"clipPath-".concat(N)},L.createElement("rect",{x:j?g:g-v/2,y:E?f:f-x/2,width:j?v:v*2,height:E?x:x*2})),!X&&L.createElement("clipPath",{id:"clipPath-dots-".concat(N)},L.createElement("rect",{x:g-Y/2,y:f-Y/2,width:v+Y,height:x+Y}))):null,!A&&this.renderCurve(T,N),this.renderErrorBar(T,N),(A||o)&&this.renderDots(T,X,N),(!_||S)&&Da.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(Ts(n),[0]):n,o=[],c=0;c<i;++c)o=[].concat(Ts(o),Ts(a));return o}},{key:"renderDotItem",value:function(n,i){var a;if(L.isValidElement(n))a=L.cloneElement(n,i);else if(Je(n))a=n(i);else{var o=i.key,c=hN(i,lre),u=ot("recharts-line-dot",typeof n!="boolean"?n.className:"");a=L.createElement(X1,zc({key:o},c,{className:u}))}return a}}])})(P.PureComponent);Wn(Hu,"displayName","Line");Wn(Hu,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!kl.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Wn(Hu,"getComposedData",function(t){var e=t.props,r=t.xAxis,n=t.yAxis,i=t.xAxisTicks,a=t.yAxisTicks,o=t.dataKey,c=t.bandSize,u=t.displayedData,d=t.offset,p=e.layout,f=u.map(function(g,v){var x=dn(g,o);return p==="horizontal"?{x:Pj({axis:r,ticks:i,bandSize:c,entry:g,index:v}),y:et(x)?null:n.scale(x),value:x,payload:g}:{x:et(x)?null:r.scale(x),y:Pj({axis:n,ticks:a,bandSize:c,entry:g,index:v}),value:x,payload:g}});return an({points:f,layout:p},d)});function dl(t){"@babel/helpers - typeof";return dl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dl(t)}function wre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _re(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hM(n.key),n)}}function Sre(t,e,r){return e&&_re(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function kre(t,e,r){return e=Hh(e),Ere(t,dM()?Reflect.construct(e,r||[],Hh(t).constructor):e.apply(t,r))}function Ere(t,e){if(e&&(dl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ore(t)}function Ore(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function dM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dM=function(){return!!t})()}function Hh(t){return Hh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Hh(t)}function Are(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mw(t,e)}function mw(t,e){return mw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},mw(t,e)}function fM(t,e,r){return e=hM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hM(t){var e=Tre(t,"string");return dl(e)=="symbol"?e:e+""}function Tre(t,e){if(dl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(dl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function gw(){return gw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},gw.apply(this,arguments)}function jre(t){var e=t.xAxisId,r=Q1(),n=e_(),i=J$(e);return i==null?null:P.createElement(Tl,gw({},i,{className:ot("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return Wi(o,!0)}}))}var Ba=(function(t){function e(){return wre(this,e),kre(this,e,arguments)}return Are(e,t),Sre(e,[{key:"render",value:function(){return P.createElement(jre,this.props)}}])})(P.Component);fM(Ba,"displayName","XAxis");fM(Ba,"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 fl(t){"@babel/helpers - typeof";return fl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fl(t)}function Cre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Nre(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,gM(n.key),n)}}function Pre(t,e,r){return e&&Nre(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Rre(t,e,r){return e=Wh(e),Ire(t,pM()?Reflect.construct(e,r||[],Wh(t).constructor):e.apply(t,r))}function Ire(t,e){if(e&&(fl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $re(t)}function $re(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pM=function(){return!!t})()}function Wh(t){return Wh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Wh(t)}function Mre(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yw(t,e)}function yw(t,e){return yw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},yw(t,e)}function mM(t,e,r){return e=gM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gM(t){var e=Lre(t,"string");return fl(e)=="symbol"?e:e+""}function Lre(t,e){if(fl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(fl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function vw(){return vw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},vw.apply(this,arguments)}var Dre=function(e){var r=e.yAxisId,n=Q1(),i=e_(),a=Z$(r);return a==null?null:P.createElement(Tl,vw({},a,{className:ot("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:i},ticksGenerator:function(c){return Wi(c,!0)}}))},Ua=(function(t){function e(){return Cre(this,e),Rre(this,e,arguments)}return Mre(e,t),Pre(e,[{key:"render",value:function(){return P.createElement(Dre,this.props)}}])})(P.Component);mM(Ua,"displayName","YAxis");mM(Ua,"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 gN(t){return qre(t)||Ure(t)||Bre(t)||zre()}function zre(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
500
500
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bre(t,e){if(t){if(typeof t=="string")return bw(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bw(t,e)}}function Ure(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function qre(t){if(Array.isArray(t))return bw(t)}function bw(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var xw=function(e,r,n,i,a){var o=jn(e,r_),c=jn(e,$p),u=[].concat(gN(o),gN(c)),d=jn(e,Lp),p="".concat(i,"Id"),f=i[0],g=r;if(u.length&&(g=u.reduce(function(_,b){if(b.props[p]===n&&ki(b.props,"extendDomain")&&ge(b.props[f])){var S=b.props[f];return[Math.min(_[0],S),Math.max(_[1],S)]}return _},g)),d.length){var v="".concat(f,"1"),x="".concat(f,"2");g=d.reduce(function(_,b){if(b.props[p]===n&&ki(b.props,"extendDomain")&&ge(b.props[v])&&ge(b.props[x])){var S=b.props[v],A=b.props[x];return[Math.min(_[0],S,A),Math.max(_[1],S,A)]}return _},g)}return a&&a.length&&(g=a.reduce(function(_,b){return ge(b)?[Math.min(_[0],b),Math.max(_[1],b)]:_},g)),g},Pb={exports:{}},yN;function Fre(){return yN||(yN=1,(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,d,p){this.fn=u,this.context=d,this.once=p||!1}function a(u,d,p,f,g){if(typeof p!="function")throw new TypeError("The listener must be a function");var v=new i(p,f||u,g),x=r?r+d:d;return u._events[x]?u._events[x].fn?u._events[x]=[u._events[x],v]:u._events[x].push(v):(u._events[x]=v,u._eventsCount++),u}function o(u,d){--u._eventsCount===0?u._events=new n:delete u._events[d]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var d=[],p,f;if(this._eventsCount===0)return d;for(f in p=this._events)e.call(p,f)&&d.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(p)):d},c.prototype.listeners=function(d){var p=r?r+d:d,f=this._events[p];if(!f)return[];if(f.fn)return[f.fn];for(var g=0,v=f.length,x=new Array(v);g<v;g++)x[g]=f[g].fn;return x},c.prototype.listenerCount=function(d){var p=r?r+d:d,f=this._events[p];return f?f.fn?1:f.length:0},c.prototype.emit=function(d,p,f,g,v,x){var _=r?r+d:d;if(!this._events[_])return!1;var b=this._events[_],S=arguments.length,A,O;if(b.fn){switch(b.once&&this.removeListener(d,b.fn,void 0,!0),S){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,p),!0;case 3:return b.fn.call(b.context,p,f),!0;case 4:return b.fn.call(b.context,p,f,g),!0;case 5:return b.fn.call(b.context,p,f,g,v),!0;case 6:return b.fn.call(b.context,p,f,g,v,x),!0}for(O=1,A=new Array(S-1);O<S;O++)A[O-1]=arguments[O];b.fn.apply(b.context,A)}else{var j=b.length,E;for(O=0;O<j;O++)switch(b[O].once&&this.removeListener(d,b[O].fn,void 0,!0),S){case 1:b[O].fn.call(b[O].context);break;case 2:b[O].fn.call(b[O].context,p);break;case 3:b[O].fn.call(b[O].context,p,f);break;case 4:b[O].fn.call(b[O].context,p,f,g);break;default:if(!A)for(E=1,A=new Array(S-1);E<S;E++)A[E-1]=arguments[E];b[O].fn.apply(b[O].context,A)}}return!0},c.prototype.on=function(d,p,f){return a(this,d,p,f,!1)},c.prototype.once=function(d,p,f){return a(this,d,p,f,!0)},c.prototype.removeListener=function(d,p,f,g){var v=r?r+d:d;if(!this._events[v])return this;if(!p)return o(this,v),this;var x=this._events[v];if(x.fn)x.fn===p&&(!g||x.once)&&(!f||x.context===f)&&o(this,v);else{for(var _=0,b=[],S=x.length;_<S;_++)(x[_].fn!==p||g&&!x[_].once||f&&x[_].context!==f)&&b.push(x[_]);b.length?this._events[v]=b.length===1?b[0]:b:o(this,v)}return this},c.prototype.removeAllListeners=function(d){var p;return d?(p=r?r+d:d,this._events[p]&&o(this,p)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t.exports=c})(Pb)),Pb.exports}var Hre=Fre();const Wre=vt(Hre);var Rb=new Wre,Ib="recharts.syncMouseEvents";function Tu(t){"@babel/helpers - typeof";return Tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tu(t)}function Gre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Kre(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yM(n.key),n)}}function Vre(t,e,r){return e&&Kre(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function $b(t,e,r){return e=yM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yM(t){var e=Xre(t,"string");return Tu(e)=="symbol"?e:e+""}function Xre(t,e){if(Tu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Tu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Yre=(function(){function t(){Gre(this,t),$b(this,"activeIndex",0),$b(this,"coordinateList",[]),$b(this,"layout","horizontal")}return Vre(t,[{key:"setDetails",value:function(r){var n,i=r.coordinateList,a=i===void 0?null:i,o=r.container,c=o===void 0?null:o,u=r.layout,d=u===void 0?null:u,p=r.offset,f=p===void 0?null:p,g=r.mouseHandlerCallback,v=g===void 0?null:g;this.coordinateList=(n=a??this.coordinateList)!==null&&n!==void 0?n:[],this.container=c??this.container,this.layout=d??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=v??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(r){if(this.coordinateList.length!==0)switch(r.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(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),a=i.x,o=i.y,c=i.height,u=this.coordinateList[this.activeIndex].coordinate,d=((r=window)===null||r===void 0?void 0:r.scrollX)||0,p=((n=window)===null||n===void 0?void 0:n.scrollY)||0,f=a+u+d,g=o+this.offset.top+c/2+p;this.mouseHandlerCallback({pageX:f,pageY:g})}}}])})();function Jre(t,e,r){if(r==="number"&&e===!0&&Array.isArray(t)){var n=t==null?void 0:t[0],i=t==null?void 0:t[1];if(n&&i&&ge(n)&&ge(i))return!0}return!1}function Zre(t,e,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:r.left+.5,y:t==="horizontal"?r.top+.5:e.y-i,width:t==="horizontal"?n:r.width-1,height:t==="horizontal"?r.height-1:n}}function vM(t){var e=t.cx,r=t.cy,n=t.radius,i=t.startAngle,a=t.endAngle,o=_r(e,r,n,i),c=_r(e,r,n,a);return{points:[o,c],cx:e,cy:r,radius:n,startAngle:i,endAngle:a}}function Qre(t,e,r){var n,i,a,o;if(t==="horizontal")n=e.x,a=n,i=r.top,o=r.top+r.height;else if(t==="vertical")i=e.y,o=i,n=r.left,a=r.left+r.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var c=e.cx,u=e.cy,d=e.innerRadius,p=e.outerRadius,f=e.angle,g=_r(c,u,d,f),v=_r(c,u,p,f);n=g.x,i=g.y,a=v.x,o=v.y}else return vM(e);return[{x:n,y:i},{x:a,y:o}]}function ju(t){"@babel/helpers - typeof";return ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ju(t)}function vN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ef(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vN(Object(r),!0).forEach(function(n){ene(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ene(t,e,r){return e=tne(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function tne(t){var e=rne(t,"string");return ju(e)=="symbol"?e:e+""}function rne(t,e){if(ju(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ju(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nne(t){var e,r,n=t.element,i=t.tooltipEventType,a=t.isActive,o=t.activeCoordinate,c=t.activePayload,u=t.offset,d=t.activeTooltipIndex,p=t.tooltipAxisBandSize,f=t.layout,g=t.chartName,v=(e=n.props.cursor)!==null&&e!==void 0?e:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!v||!a||!o||g!=="ScatterChart"&&i!=="axis")return null;var x,_=Wx;if(g==="ScatterChart")x=o,_=tQ;else if(g==="BarChart")x=Zre(f,o,u,p),_=V1;else if(f==="radial"){var b=vM(o),S=b.cx,A=b.cy,O=b.radius,j=b.startAngle,E=b.endAngle;x={cx:S,cy:A,startAngle:j,endAngle:E,innerRadius:O,outerRadius:O},_=O$}else x={points:Qre(f,o,u)},_=Wx;var T=Ef(Ef(Ef(Ef({stroke:"#ccc",pointerEvents:"none"},u),x),it(v,!1)),{},{payload:c,payloadIndex:d,className:ot("recharts-tooltip-cursor",v.className)});return P.isValidElement(v)?P.cloneElement(v,T):P.createElement(_,T)}var ine=["item"],ane=["children","className","width","height","style","compact","title","desc"];function hl(t){"@babel/helpers - typeof";return hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hl(t)}function Ls(){return Ls=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ls.apply(this,arguments)}function bN(t,e){return lne(t)||sne(t,e)||xM(t,e)||one()}function one(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
501
501
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sne(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function lne(t){if(Array.isArray(t))return t}function xN(t,e){if(t==null)return{};var r=cne(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function cne(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function une(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,wM(n.key),n)}}function fne(t,e,r){return e&&dne(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function hne(t,e,r){return e=Gh(e),pne(t,bM()?Reflect.construct(e,r||[],Gh(t).constructor):e.apply(t,r))}function pne(t,e){if(e&&(hl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mne(t)}function mne(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bM=function(){return!!t})()}function Gh(t){return Gh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Gh(t)}function gne(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ww(t,e)}function ww(t,e){return ww=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ww(t,e)}function pl(t){return bne(t)||vne(t)||xM(t)||yne()}function yne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
502
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xM(t,e){if(t){if(typeof t=="string")return _w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _w(t,e)}}function vne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function bne(t){if(Array.isArray(t))return _w(t)}function _w(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function wN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wN(Object(r),!0).forEach(function(n){ze(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ze(t,e,r){return e=wM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wM(t){var e=xne(t,"string");return hl(e)=="symbol"?e:e+""}function xne(t,e){if(hl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(hl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var wne={xAxis:["bottom","top"],yAxis:["left","right"]},_ne={width:"100%",height:"100%"},_M={x:0,y:0};function Of(t){return t}var Sne=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},kne=function(e,r,n,i){var a=r.find(function(p){return p&&p.index===n});if(a){if(e==="horizontal")return{x:a.coordinate,y:i.y};if(e==="vertical")return{x:i.x,y:a.coordinate};if(e==="centric"){var o=a.coordinate,c=i.radius;return ie(ie(ie({},i),_r(i.cx,i.cy,c,o)),{},{angle:o,radius:c})}var u=a.coordinate,d=i.angle;return ie(ie(ie({},i),_r(i.cx,i.cy,u,d)),{},{angle:d,radius:u})}return _M},Dp=function(e,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(c,u){var d=u.props.data;return d&&d.length?[].concat(pl(c),pl(d)):c},[]);return o.length>0?o:e&&e.length&&ge(i)&&ge(a)?e.slice(i,a+1):[]};function SM(t){return t==="number"?[0,"auto"]:void 0}var Sw=function(e,r,n,i){var a=e.graphicalItems,o=e.tooltipAxis,c=Dp(r,e);return n<0||!a||!a.length||n>=c.length?null:a.reduce(function(u,d){var p,f=(p=d.props.data)!==null&&p!==void 0?p:r;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var g;if(o.dataKey&&!o.allowDuplicatedCategory){var v=f===void 0?c:f;g=Vf(v,o.dataKey,i)}else g=f&&f[n]||c[n];return g?[].concat(pl(u),[S$(d,g)]):u},[])},_N=function(e,r,n,i){var a=i||{x:e.chartX,y:e.chartY},o=Sne(a,n),c=e.orderedTooltipTicks,u=e.tooltipAxis,d=e.tooltipTicks,p=IX(o,c,d,u);if(p>=0&&d){var f=d[p]&&d[p].value,g=Sw(e,r,p,f),v=kne(n,c,p,a);return{activeTooltipIndex:p,activeLabel:f,activePayload:g,activeCoordinate:v}}return null},Ene=function(e,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,g=e.stackOffset,v=x$(p,a);return n.reduce(function(x,_){var b,S=_.type.defaultProps!==void 0?ie(ie({},_.type.defaultProps),_.props):_.props,A=S.type,O=S.dataKey,j=S.allowDataOverflow,E=S.allowDuplicatedCategory,T=S.scale,N=S.ticks,R=S.includeHidden,M=S[o];if(x[M])return x;var J=Dp(e.data,{graphicalItems:i.filter(function($){var V,oe=o in $.props?$.props[o]:(V=$.type.defaultProps)===null||V===void 0?void 0:V[o];return oe===M}),dataStartIndex:u,dataEndIndex:d}),F=J.length,B,K,W;Jre(S.domain,j,A)&&(B=Bx(S.domain,null,j),v&&(A==="number"||T!=="auto")&&(W=Lc(J,O,"category")));var X=SM(A);if(!B||B.length===0){var Y,te=(Y=S.domain)!==null&&Y!==void 0?Y:X;if(O){if(B=Lc(J,O,A),A==="category"&&v){var H=E9(B);E&&H?(K=B,B=Rh(0,F)):E||(B=Mj(te,B,_).reduce(function($,V){return $.indexOf(V)>=0?$:[].concat(pl($),[V])},[]))}else if(A==="category")E?B=B.filter(function($){return $!==""&&!et($)}):B=Mj(te,B,_).reduce(function($,V){return $.indexOf(V)>=0||V===""||et(V)?$:[].concat(pl($),[V])},[]);else if(A==="number"){var Q=zX(J,i.filter(function($){var V,oe,le=o in $.props?$.props[o]:(V=$.type.defaultProps)===null||V===void 0?void 0:V[o],ve="hide"in $.props?$.props.hide:(oe=$.type.defaultProps)===null||oe===void 0?void 0:oe.hide;return le===M&&(R||!ve)}),O,a,p);Q&&(B=Q)}v&&(A==="number"||T!=="auto")&&(W=Lc(J,O,"category"))}else v?B=Rh(0,F):c&&c[M]&&c[M].hasStack&&A==="number"?B=g==="expand"?[0,1]:_$(c[M].stackGroups,u,d):B=b$(J,i.filter(function($){var V=o in $.props?$.props[o]:$.type.defaultProps[o],oe="hide"in $.props?$.props.hide:$.type.defaultProps.hide;return V===M&&(R||!oe)}),A,p,!0);if(A==="number")B=xw(f,B,M,a,N),te&&(B=Bx(te,B,j));else if(A==="category"&&te){var U=te,I=B.every(function($){return U.indexOf($)>=0});I&&(B=U)}}return ie(ie({},x),{},ze({},M,ie(ie({},S),{},{axisType:a,domain:B,categoricalDomain:W,duplicateDomain:K,originalDomain:(b=S.domain)!==null&&b!==void 0?b:X,isCategorical:v,layout:p})))},{})},One=function(e,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,g=Dp(e.data,{graphicalItems:n,dataStartIndex:u,dataEndIndex:d}),v=g.length,x=x$(p,a),_=-1;return n.reduce(function(b,S){var A=S.type.defaultProps!==void 0?ie(ie({},S.type.defaultProps),S.props):S.props,O=A[o],j=SM("number");if(!b[O]){_++;var E;return x?E=Rh(0,v):c&&c[O]&&c[O].hasStack?(E=_$(c[O].stackGroups,u,d),E=xw(f,E,O,a)):(E=Bx(j,b$(g,n.filter(function(T){var N,R,M=o in T.props?T.props[o]:(N=T.type.defaultProps)===null||N===void 0?void 0:N[o],J="hide"in T.props?T.props.hide:(R=T.type.defaultProps)===null||R===void 0?void 0:R.hide;return M===O&&!J}),"number",p),i.defaultProps.allowDataOverflow),E=xw(f,E,O,a)),ie(ie({},b),{},ze({},O,ie(ie({axisType:a},i.defaultProps),{},{hide:!0,orientation:Tn(wne,"".concat(a,".").concat(_%2),null),domain:E,originalDomain:j,isCategorical:x,layout:p})))}return b},{})},Ane=function(e,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.children,f="".concat(i,"Id"),g=jn(p,a),v={};return g&&g.length?v=Ene(e,{axes:g,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d}):o&&o.length&&(v=One(e,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d})),v},Tne=function(e){var r=Pa(e),n=Wi(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:w1(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Sh(r,n)}},SN=function(e){var r=e.children,n=e.defaultShowTooltip,i=sn(r,il),a=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},jne=function(e){return!e||!e.length?!1:e.some(function(r){var n=Gi(r&&r.type);return n&&n.indexOf("Bar")>=0})},kN=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Cne=function(e,r){var n=e.props,i=e.graphicalItems,a=e.xAxisMap,o=a===void 0?{}:a,c=e.yAxisMap,u=c===void 0?{}:c,d=n.width,p=n.height,f=n.children,g=n.margin||{},v=sn(f,il),x=sn(f,qs),_=Object.keys(u).reduce(function(E,T){var N=u[T],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},E),{},ze({},R,E[R]+N.width)):E},{left:g.left||0,right:g.right||0}),b=Object.keys(o).reduce(function(E,T){var N=o[T],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},E),{},ze({},R,Tn(E,"".concat(R))+N.height)):E},{top:g.top||0,bottom:g.bottom||0}),S=ie(ie({},b),_),A=S.bottom;v&&(S.bottom+=v.props.height||il.defaultProps.height),x&&r&&(S=LX(S,i,n,r));var O=d-S.left-S.right,j=p-S.top-S.bottom;return ie(ie({brushBottom:A},S),{},{width:Math.max(O,0),height:Math.max(j,0)})},Nne=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},kM=function(e){var r=e.chartName,n=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,o=e.validateTooltipEventTypes,c=o===void 0?["axis"]:o,u=e.axisComponents,d=e.legendContent,p=e.formatAxisMap,f=e.defaultProps,g=function(S,A){var O=A.graphicalItems,j=A.stackGroups,E=A.offset,T=A.updateId,N=A.dataStartIndex,R=A.dataEndIndex,M=S.barSize,J=S.layout,F=S.barGap,B=S.barCategoryGap,K=S.maxBarSize,W=kN(J),X=W.numericAxisName,Y=W.cateAxisName,te=jne(O),H=[];return O.forEach(function(Q,U){var I=Dp(S.data,{graphicalItems:[Q],dataStartIndex:N,dataEndIndex:R}),$=Q.type.defaultProps!==void 0?ie(ie({},Q.type.defaultProps),Q.props):Q.props,V=$.dataKey,oe=$.maxBarSize,le=$["".concat(X,"Id")],ve=$["".concat(Y,"Id")],qe={},xe=u.reduce(function(lr,_t){var kr=A["".concat(_t.axisType,"Map")],Ir=$["".concat(_t.axisType,"Id")];kr&&kr[Ir]||_t.axisType==="zAxis"||Lo();var ni=kr[Ir];return ie(ie({},lr),{},ze(ze({},_t.axisType,ni),"".concat(_t.axisType,"Ticks"),Wi(ni)))},qe),ae=xe[Y],Se=xe["".concat(Y,"Ticks")],Me=j&&j[le]&&j[le].hasStack&&JX(Q,j[le].stackGroups),se=Gi(Q.type).indexOf("Bar")>=0,tt=Sh(ae,Se),Fe=[],kt=te&&$X({barSize:M,stackGroups:j,totalSize:Nne(xe,Y)});if(se){var wt,Et,Sr=et(oe)?K:oe,Ut=(wt=(Et=Sh(ae,Se,!0))!==null&&Et!==void 0?Et:Sr)!==null&&wt!==void 0?wt:0;Fe=MX({barGap:F,barCategoryGap:B,bandSize:Ut!==tt?Ut:tt,sizeList:kt[ve],maxBarSize:Sr}),Ut!==tt&&(Fe=Fe.map(function(lr){return ie(ie({},lr),{},{position:ie(ie({},lr.position),{},{offset:lr.position.offset-Ut/2})})}))}var Rr=Q&&Q.type&&Q.type.getComposedData;Rr&&H.push({props:ie(ie({},Rr(ie(ie({},xe),{},{displayedData:I,props:S,dataKey:V,item:Q,bandSize:tt,barPosition:Fe,offset:E,stackedData:Me,layout:J,dataStartIndex:N,dataEndIndex:R}))),{},ze(ze(ze({key:Q.key||"item-".concat(U)},X,xe[X]),Y,xe[Y]),"animationId",T)),childIndex:D9(Q,S.children),item:Q})}),H},v=function(S,A){var O=S.props,j=S.dataStartIndex,E=S.dataEndIndex,T=S.updateId;if(!YO({props:O}))return null;var N=O.children,R=O.layout,M=O.stackOffset,J=O.data,F=O.reverseStackOrder,B=kN(R),K=B.numericAxisName,W=B.cateAxisName,X=jn(N,n),Y=VX(J,X,"".concat(K,"Id"),"".concat(W,"Id"),M,F),te=u.reduce(function($,V){var oe="".concat(V.axisType,"Map");return ie(ie({},$),{},ze({},oe,Ane(O,ie(ie({},V),{},{graphicalItems:X,stackGroups:V.axisType===K&&Y,dataStartIndex:j,dataEndIndex:E}))))},{}),H=Cne(ie(ie({},te),{},{props:O,graphicalItems:X}),A==null?void 0:A.legendBBox);Object.keys(te).forEach(function($){te[$]=p(O,te[$],H,$.replace("Map",""),r)});var Q=te["".concat(W,"Map")],U=Tne(Q),I=g(O,ie(ie({},te),{},{dataStartIndex:j,dataEndIndex:E,updateId:T,graphicalItems:X,stackGroups:Y,offset:H}));return ie(ie({formattedGraphicalItems:I,graphicalItems:X,offset:H,stackGroups:Y},U),te)},x=(function(b){function S(A){var O,j,E;return une(this,S),E=hne(this,S,[A]),ze(E,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ze(E,"accessibilityManager",new Yre),ze(E,"handleLegendBBoxUpdate",function(T){if(T){var N=E.state,R=N.dataStartIndex,M=N.dataEndIndex,J=N.updateId;E.setState(ie({legendBBox:T},v({props:E.props,dataStartIndex:R,dataEndIndex:M,updateId:J},ie(ie({},E.state),{},{legendBBox:T}))))}}),ze(E,"handleReceiveSyncEvent",function(T,N,R){if(E.props.syncId===T){if(R===E.eventEmitterSymbol&&typeof E.props.syncMethod!="function")return;E.applySyncEvent(N)}}),ze(E,"handleBrushChange",function(T){var N=T.startIndex,R=T.endIndex;if(N!==E.state.dataStartIndex||R!==E.state.dataEndIndex){var M=E.state.updateId;E.setState(function(){return ie({dataStartIndex:N,dataEndIndex:R},v({props:E.props,dataStartIndex:N,dataEndIndex:R,updateId:M},E.state))}),E.triggerSyncEvent({dataStartIndex:N,dataEndIndex:R})}}),ze(E,"handleMouseEnter",function(T){var N=E.getMouseInfo(T);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});E.setState(R),E.triggerSyncEvent(R);var M=E.props.onMouseEnter;Je(M)&&M(R,T)}}),ze(E,"triggeredAfterMouseMove",function(T){var N=E.getMouseInfo(T),R=N?ie(ie({},N),{},{isTooltipActive:!0}):{isTooltipActive:!1};E.setState(R),E.triggerSyncEvent(R);var M=E.props.onMouseMove;Je(M)&&M(R,T)}),ze(E,"handleItemMouseEnter",function(T){E.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),ze(E,"handleItemMouseLeave",function(){E.setState(function(){return{isTooltipActive:!1}})}),ze(E,"handleMouseMove",function(T){T.persist(),E.throttleTriggeredAfterMouseMove(T)}),ze(E,"handleMouseLeave",function(T){E.throttleTriggeredAfterMouseMove.cancel();var N={isTooltipActive:!1};E.setState(N),E.triggerSyncEvent(N);var R=E.props.onMouseLeave;Je(R)&&R(N,T)}),ze(E,"handleOuterEvent",function(T){var N=L9(T),R=Tn(E.props,"".concat(N));if(N&&Je(R)){var M,J;/.*touch.*/i.test(N)?J=E.getMouseInfo(T.changedTouches[0]):J=E.getMouseInfo(T),R((M=J)!==null&&M!==void 0?M:{},T)}}),ze(E,"handleClick",function(T){var N=E.getMouseInfo(T);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});E.setState(R),E.triggerSyncEvent(R);var M=E.props.onClick;Je(M)&&M(R,T)}}),ze(E,"handleMouseDown",function(T){var N=E.props.onMouseDown;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"handleMouseUp",function(T){var N=E.props.onMouseUp;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&E.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),ze(E,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&E.handleMouseDown(T.changedTouches[0])}),ze(E,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&E.handleMouseUp(T.changedTouches[0])}),ze(E,"handleDoubleClick",function(T){var N=E.props.onDoubleClick;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"handleContextMenu",function(T){var N=E.props.onContextMenu;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"triggerSyncEvent",function(T){E.props.syncId!==void 0&&Rb.emit(Ib,E.props.syncId,T,E.eventEmitterSymbol)}),ze(E,"applySyncEvent",function(T){var N=E.props,R=N.layout,M=N.syncMethod,J=E.state.updateId,F=T.dataStartIndex,B=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)E.setState(ie({dataStartIndex:F,dataEndIndex:B},v({props:E.props,dataStartIndex:F,dataEndIndex:B,updateId:J},E.state)));else if(T.activeTooltipIndex!==void 0){var K=T.chartX,W=T.chartY,X=T.activeTooltipIndex,Y=E.state,te=Y.offset,H=Y.tooltipTicks;if(!te)return;if(typeof M=="function")X=M(H,T);else if(M==="value"){X=-1;for(var Q=0;Q<H.length;Q++)if(H[Q].value===T.activeLabel){X=Q;break}}var U=ie(ie({},te),{},{x:te.left,y:te.top}),I=Math.min(K,U.x+U.width),$=Math.min(W,U.y+U.height),V=H[X]&&H[X].value,oe=Sw(E.state,E.props.data,X),le=H[X]?{x:R==="horizontal"?H[X].coordinate:I,y:R==="horizontal"?$:H[X].coordinate}:_M;E.setState(ie(ie({},T),{},{activeLabel:V,activeCoordinate:le,activePayload:oe,activeTooltipIndex:X}))}else E.setState(T)}),ze(E,"renderCursor",function(T){var N,R=E.state,M=R.isTooltipActive,J=R.activeCoordinate,F=R.activePayload,B=R.offset,K=R.activeTooltipIndex,W=R.tooltipAxisBandSize,X=E.getTooltipEventType(),Y=(N=T.props.active)!==null&&N!==void 0?N:M,te=E.props.layout,H=T.key||"_recharts-cursor";return L.createElement(nne,{key:H,activeCoordinate:J,activePayload:F,activeTooltipIndex:K,chartName:r,element:T,isActive:Y,layout:te,offset:B,tooltipAxisBandSize:W,tooltipEventType:X})}),ze(E,"renderPolarAxis",function(T,N,R){var M=Tn(T,"type.axisType"),J=Tn(E.state,"".concat(M,"Map")),F=T.type.defaultProps,B=F!==void 0?ie(ie({},F),T.props):T.props,K=J&&J[B["".concat(M,"Id")]];return P.cloneElement(T,ie(ie({},K),{},{className:ot(M,K.className),key:T.key||"".concat(N,"-").concat(R),ticks:Wi(K,!0)}))}),ze(E,"renderPolarGrid",function(T){var N=T.props,R=N.radialLines,M=N.polarAngles,J=N.polarRadius,F=E.state,B=F.radiusAxisMap,K=F.angleAxisMap,W=Pa(B),X=Pa(K),Y=X.cx,te=X.cy,H=X.innerRadius,Q=X.outerRadius;return P.cloneElement(T,{polarAngles:Array.isArray(M)?M:Wi(X,!0).map(function(U){return U.coordinate}),polarRadius:Array.isArray(J)?J:Wi(W,!0).map(function(U){return U.coordinate}),cx:Y,cy:te,innerRadius:H,outerRadius:Q,key:T.key||"polar-grid",radialLines:R})}),ze(E,"renderLegend",function(){var T=E.state.formattedGraphicalItems,N=E.props,R=N.children,M=N.width,J=N.height,F=E.props.margin||{},B=M-(F.left||0)-(F.right||0),K=y$({children:R,formattedGraphicalItems:T,legendWidth:B,legendContent:d});if(!K)return null;var W=K.item,X=xN(K,ine);return P.cloneElement(W,ie(ie({},X),{},{chartWidth:M,chartHeight:J,margin:F,onBBoxUpdate:E.handleLegendBBoxUpdate}))}),ze(E,"renderTooltip",function(){var T,N=E.props,R=N.children,M=N.accessibilityLayer,J=sn(R,ln);if(!J)return null;var F=E.state,B=F.isTooltipActive,K=F.activeCoordinate,W=F.activePayload,X=F.activeLabel,Y=F.offset,te=(T=J.props.active)!==null&&T!==void 0?T:B;return P.cloneElement(J,{viewBox:ie(ie({},Y),{},{x:Y.left,y:Y.top}),active:te,label:X,payload:te?W:[],coordinate:K,accessibilityLayer:M})}),ze(E,"renderBrush",function(T){var N=E.props,R=N.margin,M=N.data,J=E.state,F=J.offset,B=J.dataStartIndex,K=J.dataEndIndex,W=J.updateId;return P.cloneElement(T,{key:T.key||"_recharts-brush",onChange:wf(E.handleBrushChange,T.props.onChange),data:M,x:ge(T.props.x)?T.props.x:F.left,y:ge(T.props.y)?T.props.y:F.top+F.height+F.brushBottom-(R.bottom||0),width:ge(T.props.width)?T.props.width:F.width,startIndex:B,endIndex:K,updateId:"brush-".concat(W)})}),ze(E,"renderReferenceElement",function(T,N,R){if(!T)return null;var M=E,J=M.clipPathId,F=E.state,B=F.xAxisMap,K=F.yAxisMap,W=F.offset,X=T.type.defaultProps||{},Y=T.props,te=Y.xAxisId,H=te===void 0?X.xAxisId:te,Q=Y.yAxisId,U=Q===void 0?X.yAxisId:Q;return P.cloneElement(T,{key:T.key||"".concat(N,"-").concat(R),xAxis:B[H],yAxis:K[U],viewBox:{x:W.left,y:W.top,width:W.width,height:W.height},clipPathId:J})}),ze(E,"renderActivePoints",function(T){var N=T.item,R=T.activePoint,M=T.basePoint,J=T.childIndex,F=T.isRange,B=[],K=N.props.key,W=N.item.type.defaultProps!==void 0?ie(ie({},N.item.type.defaultProps),N.item.props):N.item.props,X=W.activeDot,Y=W.dataKey,te=ie(ie({index:J,dataKey:Y,cx:R.x,cy:R.y,r:4,fill:K1(N.item),strokeWidth:2,stroke:"#fff",payload:R.payload,value:R.value},it(X,!1)),Xf(X));return B.push(S.renderActiveDot(X,te,"".concat(K,"-activePoint-").concat(J))),M?B.push(S.renderActiveDot(X,ie(ie({},te),{},{cx:M.x,cy:M.y}),"".concat(K,"-basePoint-").concat(J))):F&&B.push(null),B}),ze(E,"renderGraphicChild",function(T,N,R){var M=E.filterFormatItem(T,N,R);if(!M)return null;var J=E.getTooltipEventType(),F=E.state,B=F.isTooltipActive,K=F.tooltipAxis,W=F.activeTooltipIndex,X=F.activeLabel,Y=E.props.children,te=sn(Y,ln),H=M.props,Q=H.points,U=H.isRange,I=H.baseLine,$=M.item.type.defaultProps!==void 0?ie(ie({},M.item.type.defaultProps),M.item.props):M.item.props,V=$.activeDot,oe=$.hide,le=$.activeBar,ve=$.activeShape,qe=!!(!oe&&B&&te&&(V||le||ve)),xe={};J!=="axis"&&te&&te.props.trigger==="click"?xe={onClick:wf(E.handleItemMouseEnter,T.props.onClick)}:J!=="axis"&&(xe={onMouseLeave:wf(E.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:wf(E.handleItemMouseEnter,T.props.onMouseEnter)});var ae=P.cloneElement(T,ie(ie({},M.props),xe));function Se(_t){return typeof K.dataKey=="function"?K.dataKey(_t.payload):null}if(qe)if(W>=0){var Me,se;if(K.dataKey&&!K.allowDuplicatedCategory){var tt=typeof K.dataKey=="function"?Se:"payload.".concat(K.dataKey.toString());Me=Vf(Q,tt,X),se=U&&I&&Vf(I,tt,X)}else Me=Q==null?void 0:Q[W],se=U&&I&&I[W];if(ve||le){var Fe=T.props.activeIndex!==void 0?T.props.activeIndex:W;return[P.cloneElement(T,ie(ie(ie({},M.props),xe),{},{activeIndex:Fe})),null,null]}if(!et(Me))return[ae].concat(pl(E.renderActivePoints({item:M,activePoint:Me,basePoint:se,childIndex:W,isRange:U})))}else{var kt,wt=(kt=E.getItemByXY(E.state.activeCoordinate))!==null&&kt!==void 0?kt:{graphicalItem:ae},Et=wt.graphicalItem,Sr=Et.item,Ut=Sr===void 0?T:Sr,Rr=Et.childIndex,lr=ie(ie(ie({},M.props),xe),{},{activeIndex:Rr});return[P.cloneElement(Ut,lr),null,null]}return U?[ae,null,null]:[ae,null]}),ze(E,"renderCustomized",function(T,N,R){return P.cloneElement(T,ie(ie({key:"recharts-customized-".concat(R)},E.props),E.state))}),ze(E,"renderMap",{CartesianGrid:{handler:Of,once:!0},ReferenceArea:{handler:E.renderReferenceElement},ReferenceLine:{handler:Of},ReferenceDot:{handler:E.renderReferenceElement},XAxis:{handler:Of},YAxis:{handler:Of},Brush:{handler:E.renderBrush,once:!0},Bar:{handler:E.renderGraphicChild},Line:{handler:E.renderGraphicChild},Area:{handler:E.renderGraphicChild},Radar:{handler:E.renderGraphicChild},RadialBar:{handler:E.renderGraphicChild},Scatter:{handler:E.renderGraphicChild},Pie:{handler:E.renderGraphicChild},Funnel:{handler:E.renderGraphicChild},Tooltip:{handler:E.renderCursor,once:!0},PolarGrid:{handler:E.renderPolarGrid,once:!0},PolarAngleAxis:{handler:E.renderPolarAxis},PolarRadiusAxis:{handler:E.renderPolarAxis},Customized:{handler:E.renderCustomized}}),E.clipPathId="".concat((O=A.id)!==null&&O!==void 0?O:Lu("recharts"),"-clip"),E.throttleTriggeredAfterMouseMove=yI(E.triggeredAfterMouseMove,(j=A.throttleDelay)!==null&&j!==void 0?j:1e3/60),E.state={},E}return gne(S,b),fne(S,[{key:"componentDidMount",value:function(){var O,j;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(O=this.props.margin.left)!==null&&O!==void 0?O:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var O=this.props,j=O.children,E=O.data,T=O.height,N=O.layout,R=sn(j,ln);if(R){var M=R.props.defaultIndex;if(!(typeof M!="number"||M<0||M>this.state.tooltipTicks.length-1)){var J=this.state.tooltipTicks[M]&&this.state.tooltipTicks[M].value,F=Sw(this.state,E,M,J),B=this.state.tooltipTicks[M].coordinate,K=(this.state.offset.top+T)/2,W=N==="horizontal",X=W?{x:B,y:K}:{y:B,x:K},Y=this.state.formattedGraphicalItems.find(function(H){var Q=H.item;return Q.type.name==="Scatter"});Y&&(X=ie(ie({},X),Y.props.points[M].tooltipPosition),F=Y.props.points[M].tooltipPayload);var te={activeTooltipIndex:M,isTooltipActive:!0,activeLabel:J,activePayload:F,activeCoordinate:X};this.setState(te),this.renderCursor(R),this.accessibilityManager.setIndex(M)}}}},{key:"getSnapshotBeforeUpdate",value:function(O,j){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==j.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==O.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==O.margin){var E,T;this.accessibilityManager.setDetails({offset:{left:(E=this.props.margin.left)!==null&&E!==void 0?E:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(O){lx([sn(O.children,ln)],[sn(this.props.children,ln)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var O=sn(this.props.children,ln);if(O&&typeof O.props.shared=="boolean"){var j=O.props.shared?"axis":"item";return c.indexOf(j)>=0?j:a}return a}},{key:"getMouseInfo",value:function(O){if(!this.container)return null;var j=this.container,E=j.getBoundingClientRect(),T=kW(E),N={chartX:Math.round(O.pageX-T.left),chartY:Math.round(O.pageY-T.top)},R=E.width/j.offsetWidth||1,M=this.inRange(N.chartX,N.chartY,R);if(!M)return null;var J=this.state,F=J.xAxisMap,B=J.yAxisMap,K=this.getTooltipEventType(),W=_N(this.state,this.props.data,this.props.layout,M);if(K!=="axis"&&F&&B){var X=Pa(F).scale,Y=Pa(B).scale,te=X&&X.invert?X.invert(N.chartX):null,H=Y&&Y.invert?Y.invert(N.chartY):null;return ie(ie({},N),{},{xValue:te,yValue:H},W)}return W?ie(ie({},N),W):null}},{key:"inRange",value:function(O,j){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,N=O/E,R=j/E;if(T==="horizontal"||T==="vertical"){var M=this.state.offset,J=N>=M.left&&N<=M.left+M.width&&R>=M.top&&R<=M.top+M.height;return J?{x:N,y:R}:null}var F=this.state,B=F.angleAxisMap,K=F.radiusAxisMap;if(B&&K){var W=Pa(B);return zj({x:N,y:R},W)}return null}},{key:"parseEventsOfWrapper",value:function(){var O=this.props.children,j=this.getTooltipEventType(),E=sn(O,ln),T={};E&&j==="axis"&&(E.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 N=Xf(this.props,this.handleOuterEvent);return ie(ie({},N),T)}},{key:"addListener",value:function(){Rb.on(Ib,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Rb.removeListener(Ib,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(O,j,E){for(var T=this.state.formattedGraphicalItems,N=0,R=T.length;N<R;N++){var M=T[N];if(M.item===O||M.props.key===O.key||j===Gi(M.item.type)&&E===M.childIndex)return M}return null}},{key:"renderClipPath",value:function(){var O=this.clipPathId,j=this.state.offset,E=j.left,T=j.top,N=j.height,R=j.width;return L.createElement("defs",null,L.createElement("clipPath",{id:O},L.createElement("rect",{x:E,y:T,height:N,width:R})))}},{key:"getXScales",value:function(){var O=this.state.xAxisMap;return O?Object.entries(O).reduce(function(j,E){var T=bN(E,2),N=T[0],R=T[1];return ie(ie({},j),{},ze({},N,R.scale))},{}):null}},{key:"getYScales",value:function(){var O=this.state.yAxisMap;return O?Object.entries(O).reduce(function(j,E){var T=bN(E,2),N=T[0],R=T[1];return ie(ie({},j),{},ze({},N,R.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(O){var j;return(j=this.state.xAxisMap)===null||j===void 0||(j=j[O])===null||j===void 0?void 0:j.scale}},{key:"getYScaleByAxisId",value:function(O){var j;return(j=this.state.yAxisMap)===null||j===void 0||(j=j[O])===null||j===void 0?void 0:j.scale}},{key:"getItemByXY",value:function(O){var j=this.state,E=j.formattedGraphicalItems,T=j.activeItem;if(E&&E.length)for(var N=0,R=E.length;N<R;N++){var M=E[N],J=M.props,F=M.item,B=F.type.defaultProps!==void 0?ie(ie({},F.type.defaultProps),F.props):F.props,K=Gi(F.type);if(K==="Bar"){var W=(J.data||[]).find(function(H){return WZ(O,H)});if(W)return{graphicalItem:M,payload:W}}else if(K==="RadialBar"){var X=(J.data||[]).find(function(H){return zj(O,H)});if(X)return{graphicalItem:M,payload:X}}else if(Np(M,T)||Pp(M,T)||_u(M,T)){var Y=$Q({graphicalItem:M,activeTooltipItem:T,itemData:B.data}),te=B.activeIndex===void 0?Y:B.activeIndex;return{graphicalItem:ie(ie({},M),{},{childIndex:te}),payload:_u(M,T)?B.data[Y]:M.props.data[Y]}}}return null}},{key:"render",value:function(){var O=this;if(!YO(this))return null;var j=this.props,E=j.children,T=j.className,N=j.width,R=j.height,M=j.style,J=j.compact,F=j.title,B=j.desc,K=xN(j,ane),W=it(K,!1);if(J)return L.createElement(eN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement(ux,Ls({},W,{width:N,height:R,title:F,desc:B}),this.renderClipPath(),ZO(E,this.renderMap)));if(this.props.accessibilityLayer){var X,Y;W.tabIndex=(X=this.props.tabIndex)!==null&&X!==void 0?X:0,W.role=(Y=this.props.role)!==null&&Y!==void 0?Y:"application",W.onKeyDown=function(H){O.accessibilityManager.keyboardEvent(H)},W.onFocus=function(){O.accessibilityManager.focus()}}var te=this.parseEventsOfWrapper();return L.createElement(eN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement("div",Ls({className:ot("recharts-wrapper",T),style:ie({position:"relative",cursor:"default",width:N,height:R},M)},te,{ref:function(Q){O.container=Q}}),L.createElement(ux,Ls({},W,{width:N,height:R,title:F,desc:B,style:_ne}),this.renderClipPath(),ZO(E,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(P.Component);ze(x,"displayName",r),ze(x,"defaultProps",ie({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ze(x,"getDerivedStateFromProps",function(b,S){var A=b.dataKey,O=b.data,j=b.children,E=b.width,T=b.height,N=b.layout,R=b.stackOffset,M=b.margin,J=S.dataStartIndex,F=S.dataEndIndex;if(S.updateId===void 0){var B=SN(b);return ie(ie(ie({},B),{},{updateId:0},v(ie(ie({props:b},B),{},{updateId:0}),S)),{},{prevDataKey:A,prevData:O,prevWidth:E,prevHeight:T,prevLayout:N,prevStackOffset:R,prevMargin:M,prevChildren:j})}if(A!==S.prevDataKey||O!==S.prevData||E!==S.prevWidth||T!==S.prevHeight||N!==S.prevLayout||R!==S.prevStackOffset||!Us(M,S.prevMargin)){var K=SN(b),W={chartX:S.chartX,chartY:S.chartY,isTooltipActive:S.isTooltipActive},X=ie(ie({},_N(S,O,N)),{},{updateId:S.updateId+1}),Y=ie(ie(ie({},K),W),X);return ie(ie(ie({},Y),v(ie({props:b},Y),S)),{},{prevDataKey:A,prevData:O,prevWidth:E,prevHeight:T,prevLayout:N,prevStackOffset:R,prevMargin:M,prevChildren:j})}if(!lx(j,S.prevChildren)){var te,H,Q,U,I=sn(j,il),$=I&&(te=(H=I.props)===null||H===void 0?void 0:H.startIndex)!==null&&te!==void 0?te:J,V=I&&(Q=(U=I.props)===null||U===void 0?void 0:U.endIndex)!==null&&Q!==void 0?Q:F,oe=$!==J||V!==F,le=!et(O),ve=le&&!oe?S.updateId:S.updateId+1;return ie(ie({updateId:ve},v(ie(ie({props:b},S),{},{updateId:ve,dataStartIndex:$,dataEndIndex:V}),S)),{},{prevChildren:j,dataStartIndex:$,dataEndIndex:V})}return null}),ze(x,"renderActiveDot",function(b,S,A){var O;return P.isValidElement(b)?O=P.cloneElement(b,S):Je(b)?O=b(S):O=L.createElement(X1,S),L.createElement(Xt,{className:"recharts-active-dot",key:A},O)});var _=P.forwardRef(function(S,A){return L.createElement(x,Ls({},S,{ref:A}))});return _.displayName=x.displayName,_},Pne=kM({chartName:"LineChart",GraphicalChild:Hu,axisComponents:[{axisType:"xAxis",AxisComp:Ba},{axisType:"yAxis",AxisComp:Ua}],formatAxisMap:F$}),kw=kM({chartName:"BarChart",GraphicalChild:ea,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ba},{axisType:"yAxis",AxisComp:Ua}],formatAxisMap:F$});const Kh={backgroundColor:"#1e1e1e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#e4e0dc",fontSize:"11px",fontFamily:"JetBrains Mono, monospace"};function It(t){return t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.round(t))}function Zn(t){return`$${t.toFixed(2)}`}function $a({label:t,value:e,sub:r,accent:n}){return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-5 py-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mb-1",children:t}),y.jsx("p",{className:`text-xl font-mono font-medium ${n?"text-[#E43A9C]":"text-zinc-100"}`,children:e}),r&&y.jsx("p",{className:"text-[10px] font-mono text-zinc-600 mt-0.5",children:r})]})}const Rne={summary:"Summary","by squad":"By Squad","by agent":"By Agent",io:"IO",timeline:"Timeline"};function Ine({tabs:t,active:e,onChange:r}){return y.jsx("div",{className:"flex gap-0 border-b border-white/[0.06] mb-5",children:t.map(n=>y.jsx("button",{type:"button",onClick:()=>r(n),className:`px-4 py-2 text-[11px] font-mono transition-colors border-b-2 -mb-px cursor-pointer ${e===n?"text-[#E43A9C] border-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 border-transparent"}`,children:Rne[n]??n},n))})}function $ne({records:t,totals:e}){const r=e.totalInputTokens+e.totalOutputTokens,n=new Map;for(const o of t){const c=o.squadId??"__io__",u=o.squadName??(o.squadId?`${o.squadId.slice(0,8)} (deleted)`:"IO Orchestrator"),d=n.get(c)??{name:u,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=o.inputTokens,d.outputTokens+=o.outputTokens,d.calls+=1,d.cost+=o.estimatedCostUsd??0,n.set(c,d)}const i=Array.from(n.values()).sort((o,c)=>c.cost-o.cost),a=i.map(o=>({name:o.name.length>12?`${o.name.slice(0,12)}…`:o.name,cost:Number.parseFloat(o.cost.toFixed(2)),tokens:Math.round((o.inputTokens+o.outputTokens)/1e3)}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx($a,{label:"Total Tokens",value:It(r),sub:`${It(e.totalInputTokens)} in · ${It(e.totalOutputTokens)} out`}),y.jsx($a,{label:"Total Cost",value:Zn(e.totalCostUsd),accent:!0}),y.jsx($a,{label:"API Calls",value:It(e.callCount),sub:"across all entities"}),y.jsx($a,{label:"Avg Cost / Call",value:e.callCount>0?Zn(e.totalCostUsd/e.callCount):"$0.00",sub:`over ${e.callCount} calls`})]}),y.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost by entity"}),a.length>0?y.jsx(oh,{width:"100%",height:180,children:y.jsxs(kw,{data:a,barCategoryGap:"35%",children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`$${o}`,width:40}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`$${o.toFixed(2)}`,"Cost"]}),y.jsx(ea,{dataKey:"cost",fill:"url(#costGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens by entity (k)"}),a.length>0?y.jsx(oh,{width:"100%",height:180,children:y.jsxs(kw,{data:a,barCategoryGap:"35%",children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`${o}k`,width:40}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`${o}k`,"Tokens"]}),y.jsx(ea,{dataKey:"tokens",fill:"url(#tokenGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#818cf8"}),y.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Entity","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsxs("tbody",{children:[i.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name)),y.jsxs("tr",{className:"bg-[#1a1a1a]",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-200 font-medium",children:"Total"}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalInputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalOutputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:e.callCount}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C] font-medium",children:Zn(e.totalCostUsd)})]})]})]})})]})}function Mne({records:t}){const[e,r]=P.useState([]),[n,i]=P.useState("cost"),[a,o]=P.useState("desc");function c(f){f===n?o(g=>g==="asc"?"desc":"asc"):(i(f),o("desc"))}const u=P.useMemo(()=>{const f=new Map;for(const v of t){if(!v.squadId)continue;const x=f.get(v.squadId)??{id:v.squadId,name:v.squadName??`${v.squadId.slice(0,8)} (deleted)`,agents:new Map,inputTokens:0,outputTokens:0,calls:0,cost:0};x.inputTokens+=v.inputTokens,x.outputTokens+=v.outputTokens,x.calls+=1,x.cost+=v.estimatedCostUsd??0;const _=`${v.agentRole??"unknown"}:${v.model}`,b=x.agents.get(_)??{role:v.agentRole??"unknown",model:v.model,inputTokens:0,outputTokens:0,calls:0,cost:0};b.inputTokens+=v.inputTokens,b.outputTokens+=v.outputTokens,b.calls+=1,b.cost+=v.estimatedCostUsd??0,x.agents.set(_,b),f.set(v.squadId,x)}return[...Array.from(f.values())].sort((v,x)=>{const _=v[n],b=x[n],S=typeof _=="string"?_.localeCompare(b):_-b;return a==="desc"?-S:S})},[t,n,a]),d=f=>r(g=>g.includes(f)?g.filter(v=>v!==f):[...g,f]),p=[{key:"name",label:"Squad"},{key:"inputTokens",label:"In"},{key:"outputTokens",label:"Out"},{key:"calls",label:"Calls"},{key:"cost",label:"Cost"}];return u.length===0?y.jsx("div",{className:"text-center py-12 text-zinc-700 text-[11px] font-mono",children:"No squad usage data"}):y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-1 px-1 mb-1",children:[y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 mr-1",children:"sort by"}),p.map(f=>y.jsxs("button",{type:"button",onClick:()=>c(f.key),className:`flex items-center gap-0.5 px-2 py-1 rounded-lg text-[10px] font-mono transition-colors ${n===f.key?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400 hover:bg-white/[0.04]"}`,style:n===f.key?{background:"rgba(228,58,156,0.1)"}:void 0,children:[f.label,n===f.key&&y.jsx("span",{className:"text-[9px]",children:a==="desc"?"↓":"↑"})]},f.key))]}),u.map(f=>{const g=e.includes(f.id),v=Array.from(f.agents.values());return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl overflow-hidden",children:[y.jsxs("button",{type:"button",onClick:()=>d(f.id),className:"w-full flex items-center gap-3 px-4 py-3.5 hover:bg-white/[0.02] transition-colors text-left cursor-pointer",children:[y.jsx("div",{className:`transition-transform ${g?"rotate-90":""}`,children:y.jsx($w,{className:"w-3.5 h-3.5 text-zinc-600"})}),y.jsx("span",{className:"text-sm font-mono text-zinc-100 flex-1",children:f.name}),y.jsxs("div",{className:"flex items-center gap-6 text-[11px] font-mono",children:[y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"in"}),It(f.inputTokens)]}),y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"out"}),It(f.outputTokens)]}),y.jsxs("span",{className:"text-zinc-500",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"calls"}),f.calls]}),y.jsx("span",{className:"text-[#E43A9C] font-medium w-16 text-right",children:Zn(f.cost)})]})]}),g&&y.jsx("div",{className:"border-t border-white/[0.05]",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"bg-[#191919]",children:["Agent","Model","Input","Output","Calls","Cost"].map(x=>y.jsx("th",{className:`text-left px-4 py-2 text-zinc-700 font-medium ${x==="Cost"?"text-right":""}`,children:x},x))})}),y.jsx("tbody",{children:v.map(x=>y.jsxs("tr",{className:"border-t border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-2.5 text-zinc-300",children:x.role}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-600",children:x.model}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(x.inputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(x.outputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:x.calls}),y.jsx("td",{className:"px-4 py-2.5 text-right text-[#E43A9C]",children:Zn(x.cost)})]},x.role))})]})})]},f.id)})]})}function Lne({records:t}){const e=P.useMemo(()=>{const n=new Map;for(const i of t){const a=`${i.squadId??"io"}:${i.agentRole??"orchestrator"}:${i.model}`,o=n.get(a)??{name:i.agentRole??"orchestrator",squad:i.squadName??(i.squadId?i.squadId.slice(0,8):"IO"),model:i.model,inputTokens:0,outputTokens:0,calls:0,cost:0};o.inputTokens+=i.inputTokens,o.outputTokens+=i.outputTokens,o.calls+=1,o.cost+=i.estimatedCostUsd??0,n.set(a,o)}return Array.from(n.values()).sort((i,a)=>a.cost-i.cost)},[t]),r=e.reduce((n,i)=>n+i.cost,0);return y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Agent","Squad","Model","Input","Output","Calls","Cost","% of total"].map(n=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${n==="Cost"?"text-right":""}`,children:n},n))})}),y.jsx("tbody",{children:e.map(n=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:n.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.squad}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:n.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(n.cost)}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"w-16 h-1.5 rounded-full bg-[#252525] overflow-hidden",children:y.jsx("div",{className:"h-full bg-[#E43A9C] rounded-full",style:{width:`${r>0?n.cost/r*100:0}%`}})}),y.jsx("span",{className:"text-zinc-600 text-[10px]",children:r>0?`${(n.cost/r*100).toFixed(1)}%`:"0%"})]})})]},`${n.squad}:${n.name}`))})]})})}function Dne({records:t}){const e=P.useMemo(()=>t.filter(o=>!o.squadId),[t]),r=P.useMemo(()=>{const o=new Map;for(const c of e){const u=`${c.agentRole??"orchestrator"}:${c.model}`,d=o.get(u)??{name:c.agentRole??"orchestrator",model:c.model,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=c.inputTokens,d.outputTokens+=c.outputTokens,d.calls+=1,d.cost+=c.estimatedCostUsd??0,o.set(u,d)}return Array.from(o.values()).sort((c,u)=>u.cost-c.cost)},[e]),n=e.reduce((o,c)=>o+c.inputTokens,0),i=e.reduce((o,c)=>o+c.outputTokens,0),a=e.reduce((o,c)=>o+(c.estimatedCostUsd??0),0);return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx($a,{label:"IO Tokens",value:It(n+i),sub:`${It(n)} in · ${It(i)} out`}),y.jsx($a,{label:"IO Cost",value:Zn(a),accent:!0}),y.jsx($a,{label:"IO Calls",value:It(e.length)}),y.jsx($a,{label:"IO Roles",value:String(r.length)})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Role","Model","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsx("tbody",{children:r.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:o.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name))})]})})]})}function zne({records:t}){const e=qa(),r=P.useMemo(()=>{const i=new Map;for(const a of t){const o=a.timestamp.slice(0,10),c=i.get(o)??{date:o,inputTokens:0,outputTokens:0,cost:0,calls:0};c.inputTokens+=a.inputTokens,c.outputTokens+=a.outputTokens,c.cost+=a.estimatedCostUsd??0,c.calls+=1,i.set(o,c)}return Array.from(i.values()).sort((a,o)=>a.date.localeCompare(o.date))},[t]),n=r.map(i=>({...i,label:Z4(i.date,e),tokens:i.inputTokens+i.outputTokens}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens per day"}),n.length>0?y.jsx(oh,{width:"100%",height:220,children:y.jsxs(Pne,{data:n,children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:It,width:44}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[It(i),"Tokens"]}),y.jsx(Hu,{type:"monotone",dataKey:"tokens",stroke:"#E43A9C",strokeWidth:2,dot:!1})]})}):y.jsx("div",{className:"h-[220px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost per day"}),n.length>0?y.jsx(oh,{width:"100%",height:180,children:y.jsxs(kw,{data:n,barCategoryGap:"20%",children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:i=>`$${i.toFixed(2)}`,width:44}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[Zn(i),"Cost"]}),y.jsx(ea,{dataKey:"cost",fill:"url(#costGradTl)",radius:[4,4,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGradTl",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Date","Input","Output","Calls","Cost"].map(i=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${i==="Cost"?"text-right":""}`,children:i},i))})}),y.jsx("tbody",{children:r.map(i=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:i.date}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:i.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(i.cost)})]},i.date))})]})})]})}function Bne(){const[t,e]=P.useState("summary"),[r,n]=P.useState(null),[i,a]=P.useState("14d"),o=["summary","by squad","by agent","io","timeline"];if(P.useEffect(()=>{const u=new Date;i==="7d"?u.setDate(u.getDate()-7):i==="14d"?u.setDate(u.getDate()-14):i==="30d"?u.setDate(u.getDate()-30):u.setDate(u.getDate()-1),Ve.get(`/usage?since=${u.toISOString()}`).then(n).catch(()=>{})},[i]),!r)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600 font-mono text-[11px]",children:"Loading..."});const c=i==="1d"?"Today":`Last ${i}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[y.jsxs("div",{className:"flex items-start justify-between mb-5 gap-4 flex-wrap",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Usage"}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:c})]}),y.jsx("div",{className:"flex gap-1 p-1 rounded-xl bg-white/[0.03] border border-white/[0.07]",children:["1d","7d","14d","30d"].map(u=>y.jsx("button",{type:"button",onClick:()=>a(u),className:`px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors cursor-pointer ${i===u?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400"}`,style:i===u?{background:"rgba(228,58,156,0.12)"}:void 0,children:u},u))})]}),y.jsx(Ine,{tabs:o,active:t,onChange:u=>e(u)}),t==="summary"&&y.jsx($ne,{records:r.records,totals:r.totals}),t==="by squad"&&y.jsx(Mne,{records:r.records}),t==="by agent"&&y.jsx(Lne,{records:r.records}),t==="io"&&y.jsx(Dne,{records:r.records}),t==="timeline"&&y.jsx(zne,{records:r.records})]})}function EM(t){return[...t].sort((e,r)=>e.isDir!==r.isDir?e.isDir?-1:1:e.name.localeCompare(r.name)).map(e=>({...e,children:EM(e.children)}))}function Une(t){const e=[];for(const r of t){const n=r.path.split("/").filter(Boolean);let i=e,a="";if(r.isDir){for(const o of n){a=a?`${a}/${o}`:o;let c=i.find(u=>u.path===a);c||(c={name:o,path:a,isDir:!0,children:[]},i.push(c)),i=c.children}continue}for(const[o,c]of n.entries()){const u=o===n.length-1;a=a?`${a}/${c}`:c;let d=i.find(p=>p.path===a);d||(d={name:u&&r.name||c,path:a,isDir:!u,children:[]},i.push(d)),i=d.children}}return EM(e)}function OM(t,e){return e?t.flatMap(r=>{const n=r.name.toLowerCase().includes(e)||r.path.toLowerCase().includes(e);if(!r.isDir)return n?[r]:[];if(n)return[r];const i=OM(r.children,e);return i.length?[{...r,children:i}]:[]}):t}function Ew(t){const e=new Set;for(const r of t)if(r.isDir){e.add(r.path);for(const n of Ew(r.children))e.add(n)}return e}function qne(t){const e=t.split("/").filter(Boolean),r=[];let n="";for(const i of e.slice(0,-1))n=n?`${n}/${i}`:i,r.push(n);return r}function AM({node:t,depth:e,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u}){const d=r===t.path,p=t.isDir&&(n.has(t.path)||i.has(t.path)),f=12+e*16,g=t.isDir&&["io","shared","squads","templates"].includes(t.path);return t.isDir?y.jsxs("div",{children:[y.jsxs("div",{className:"flex w-full items-center group rounded-lg py-2 pr-3 text-left text-[11px] font-mono text-zinc-400 transition-colors hover:bg-white/[0.04] hover:text-zinc-200",style:{paddingLeft:f},children:[y.jsxs("button",{type:"button",onClick:()=>a(t.path),className:"flex items-center gap-2 flex-1 min-w-0",children:[y.jsx($w,{size:14,className:`shrink-0 transition-transform ${p?"rotate-90":""}`}),p?y.jsx(o4,{size:14,className:"shrink-0 text-zinc-500"}):y.jsx(l4,{size:14,className:"shrink-0 text-zinc-500"}),y.jsx("span",{className:"truncate",children:t.name})]}),y.jsxs("div",{className:"flex items-center gap-0.5",children:[!g&&y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),u(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-red-500/20 transition-opacity text-zinc-600 hover:text-red-400",title:`Delete ${t.name}`,children:y.jsx(Ma,{size:12})}),y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),c(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-white/[0.08] transition-opacity text-zinc-600 hover:text-zinc-300",title:`Add page to ${t.name}`,children:y.jsx(zw,{size:12})})]})]}),p&&y.jsx("div",{children:t.children.map(v=>y.jsx(AM,{node:v,depth:e+1,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u},v.path))})]}):y.jsxs("button",{type:"button",onClick:()=>o(t.path),className:`flex w-full items-center gap-2 rounded-lg py-2 pr-3 text-left text-[11px] font-mono transition-colors ${d?"border-l-2 border-[#E43A9C] bg-[#E43A9C]/10 text-[#E43A9C]":"text-zinc-500 hover:bg-white/[0.04] hover:text-zinc-300"}`,style:{paddingLeft:f},children:[y.jsx(i4,{size:14,className:"shrink-0"}),y.jsx("span",{className:"truncate",children:t.name})]})}function Fne(){const[t,e]=P.useState([]),[r,n]=P.useState(null),[i,a]=P.useState(""),[o,c]=P.useState(!1),[u,d]=P.useState(""),[p,f]=P.useState(""),[g,v]=P.useState(""),[x,_]=P.useState(new Set),[b,S]=P.useState(!1),[A,O]=P.useState(null),j=P.useRef(null);P.useEffect(()=>{F()},[]);const E=P.useMemo(()=>Une(t),[t]),T=g.trim().toLowerCase(),N=P.useMemo(()=>OM(E,T),[E,T]),R=P.useMemo(()=>{const I=T?Ew(N):new Set;if(r)for(const $ of qne(r))I.add($);return I},[N,T,r]),M=r?(function I($){for(const V of $){if(V.path===r)return V;const oe=I(V.children);if(oe)return oe}return null})(N):null,J=(M==null?void 0:M.name)??(r?r.split("/").pop()??"":"");P.useEffect(()=>{const I=Ew(E);_($=>new Set([...$,...I]))},[E]);async function F(){try{const I=await Ve.get("/wiki/all");e(I.pages)}catch{e([])}}function B(I){if(I.startsWith("squads/")){const $=I.split("/"),V=$[1]??"",oe=$.slice(2).join("/");return{scope:V,relativePath:oe}}return I.startsWith("io/")?{scope:"io",relativePath:I.slice(3)}:I.startsWith("shared/")?{scope:"shared",relativePath:I.slice(7)}:{scope:"shared",relativePath:I}}async function K(I){try{const{scope:$,relativePath:V}=B(I),oe=await Ve.get(`/wiki/${$}/${V}`);a(oe.content),d(oe.content),n(I),c(!1)}catch{at.error("Failed to load page")}}async function W(){if(r)try{const{scope:I,relativePath:$}=B(r);await Ve.put(`/wiki/${I}/${$}`,{content:u}),a(u),c(!1),at.success("Page saved")}catch{at.error("Failed to save page")}}async function X(){if(r)try{const{scope:I,relativePath:$}=B(r);await Ve.delete(`/wiki/${I}/${$}`),at.success("Page deleted"),n(null),a(""),d(""),c(!1),F()}catch{at.error("Failed to delete page")}}function Y(I){f(`${I}/`),setTimeout(()=>{const $=j.current;$&&($.focus(),$.setSelectionRange($.value.length,$.value.length))},0)}function te(I){O(I)}async function H(){if(A)try{await Ve.delete(`/wiki/dir/${A}`),at.success(`Deleted ${A}`),r!=null&&r.startsWith(A)&&(n(null),a(""),d(""),c(!1)),F()}catch{at.error("Failed to delete directory")}finally{O(null)}}async function Q(){let I=p.trim().replace(/^\/+|\/+$/g,"");if(!I)return;I=I.replace(/\.md$/i,"");const $=I.startsWith("io/")||I.startsWith("shared/")||I.startsWith("squads/")?I:`shared/${I}`;S(!0);try{const{scope:V,relativePath:oe}=B($),le=oe.split("/").slice(-1)[0]??oe;await Ve.put(`/wiki/${V}/${oe}`,{content:`# ${le}
502
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xM(t,e){if(t){if(typeof t=="string")return _w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _w(t,e)}}function vne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function bne(t){if(Array.isArray(t))return _w(t)}function _w(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function wN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wN(Object(r),!0).forEach(function(n){ze(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ze(t,e,r){return e=wM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wM(t){var e=xne(t,"string");return hl(e)=="symbol"?e:e+""}function xne(t,e){if(hl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(hl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var wne={xAxis:["bottom","top"],yAxis:["left","right"]},_ne={width:"100%",height:"100%"},_M={x:0,y:0};function Of(t){return t}var Sne=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},kne=function(e,r,n,i){var a=r.find(function(p){return p&&p.index===n});if(a){if(e==="horizontal")return{x:a.coordinate,y:i.y};if(e==="vertical")return{x:i.x,y:a.coordinate};if(e==="centric"){var o=a.coordinate,c=i.radius;return ie(ie(ie({},i),_r(i.cx,i.cy,c,o)),{},{angle:o,radius:c})}var u=a.coordinate,d=i.angle;return ie(ie(ie({},i),_r(i.cx,i.cy,u,d)),{},{angle:d,radius:u})}return _M},Dp=function(e,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(c,u){var d=u.props.data;return d&&d.length?[].concat(pl(c),pl(d)):c},[]);return o.length>0?o:e&&e.length&&ge(i)&&ge(a)?e.slice(i,a+1):[]};function SM(t){return t==="number"?[0,"auto"]:void 0}var Sw=function(e,r,n,i){var a=e.graphicalItems,o=e.tooltipAxis,c=Dp(r,e);return n<0||!a||!a.length||n>=c.length?null:a.reduce(function(u,d){var p,f=(p=d.props.data)!==null&&p!==void 0?p:r;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var g;if(o.dataKey&&!o.allowDuplicatedCategory){var v=f===void 0?c:f;g=Vf(v,o.dataKey,i)}else g=f&&f[n]||c[n];return g?[].concat(pl(u),[S$(d,g)]):u},[])},_N=function(e,r,n,i){var a=i||{x:e.chartX,y:e.chartY},o=Sne(a,n),c=e.orderedTooltipTicks,u=e.tooltipAxis,d=e.tooltipTicks,p=IX(o,c,d,u);if(p>=0&&d){var f=d[p]&&d[p].value,g=Sw(e,r,p,f),v=kne(n,c,p,a);return{activeTooltipIndex:p,activeLabel:f,activePayload:g,activeCoordinate:v}}return null},Ene=function(e,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,g=e.stackOffset,v=x$(p,a);return n.reduce(function(x,_){var b,S=_.type.defaultProps!==void 0?ie(ie({},_.type.defaultProps),_.props):_.props,A=S.type,O=S.dataKey,j=S.allowDataOverflow,E=S.allowDuplicatedCategory,T=S.scale,N=S.ticks,R=S.includeHidden,M=S[o];if(x[M])return x;var J=Dp(e.data,{graphicalItems:i.filter(function($){var V,oe=o in $.props?$.props[o]:(V=$.type.defaultProps)===null||V===void 0?void 0:V[o];return oe===M}),dataStartIndex:u,dataEndIndex:d}),F=J.length,B,K,W;Jre(S.domain,j,A)&&(B=Bx(S.domain,null,j),v&&(A==="number"||T!=="auto")&&(W=Lc(J,O,"category")));var X=SM(A);if(!B||B.length===0){var Y,te=(Y=S.domain)!==null&&Y!==void 0?Y:X;if(O){if(B=Lc(J,O,A),A==="category"&&v){var H=E9(B);E&&H?(K=B,B=Rh(0,F)):E||(B=Mj(te,B,_).reduce(function($,V){return $.indexOf(V)>=0?$:[].concat(pl($),[V])},[]))}else if(A==="category")E?B=B.filter(function($){return $!==""&&!et($)}):B=Mj(te,B,_).reduce(function($,V){return $.indexOf(V)>=0||V===""||et(V)?$:[].concat(pl($),[V])},[]);else if(A==="number"){var Q=zX(J,i.filter(function($){var V,oe,le=o in $.props?$.props[o]:(V=$.type.defaultProps)===null||V===void 0?void 0:V[o],ve="hide"in $.props?$.props.hide:(oe=$.type.defaultProps)===null||oe===void 0?void 0:oe.hide;return le===M&&(R||!ve)}),O,a,p);Q&&(B=Q)}v&&(A==="number"||T!=="auto")&&(W=Lc(J,O,"category"))}else v?B=Rh(0,F):c&&c[M]&&c[M].hasStack&&A==="number"?B=g==="expand"?[0,1]:_$(c[M].stackGroups,u,d):B=b$(J,i.filter(function($){var V=o in $.props?$.props[o]:$.type.defaultProps[o],oe="hide"in $.props?$.props.hide:$.type.defaultProps.hide;return V===M&&(R||!oe)}),A,p,!0);if(A==="number")B=xw(f,B,M,a,N),te&&(B=Bx(te,B,j));else if(A==="category"&&te){var U=te,I=B.every(function($){return U.indexOf($)>=0});I&&(B=U)}}return ie(ie({},x),{},ze({},M,ie(ie({},S),{},{axisType:a,domain:B,categoricalDomain:W,duplicateDomain:K,originalDomain:(b=S.domain)!==null&&b!==void 0?b:X,isCategorical:v,layout:p})))},{})},One=function(e,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,g=Dp(e.data,{graphicalItems:n,dataStartIndex:u,dataEndIndex:d}),v=g.length,x=x$(p,a),_=-1;return n.reduce(function(b,S){var A=S.type.defaultProps!==void 0?ie(ie({},S.type.defaultProps),S.props):S.props,O=A[o],j=SM("number");if(!b[O]){_++;var E;return x?E=Rh(0,v):c&&c[O]&&c[O].hasStack?(E=_$(c[O].stackGroups,u,d),E=xw(f,E,O,a)):(E=Bx(j,b$(g,n.filter(function(T){var N,R,M=o in T.props?T.props[o]:(N=T.type.defaultProps)===null||N===void 0?void 0:N[o],J="hide"in T.props?T.props.hide:(R=T.type.defaultProps)===null||R===void 0?void 0:R.hide;return M===O&&!J}),"number",p),i.defaultProps.allowDataOverflow),E=xw(f,E,O,a)),ie(ie({},b),{},ze({},O,ie(ie({axisType:a},i.defaultProps),{},{hide:!0,orientation:Tn(wne,"".concat(a,".").concat(_%2),null),domain:E,originalDomain:j,isCategorical:x,layout:p})))}return b},{})},Ane=function(e,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.children,f="".concat(i,"Id"),g=jn(p,a),v={};return g&&g.length?v=Ene(e,{axes:g,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d}):o&&o.length&&(v=One(e,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d})),v},Tne=function(e){var r=Pa(e),n=Wi(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:w1(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Sh(r,n)}},SN=function(e){var r=e.children,n=e.defaultShowTooltip,i=sn(r,il),a=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},jne=function(e){return!e||!e.length?!1:e.some(function(r){var n=Gi(r&&r.type);return n&&n.indexOf("Bar")>=0})},kN=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Cne=function(e,r){var n=e.props,i=e.graphicalItems,a=e.xAxisMap,o=a===void 0?{}:a,c=e.yAxisMap,u=c===void 0?{}:c,d=n.width,p=n.height,f=n.children,g=n.margin||{},v=sn(f,il),x=sn(f,qs),_=Object.keys(u).reduce(function(E,T){var N=u[T],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},E),{},ze({},R,E[R]+N.width)):E},{left:g.left||0,right:g.right||0}),b=Object.keys(o).reduce(function(E,T){var N=o[T],R=N.orientation;return!N.mirror&&!N.hide?ie(ie({},E),{},ze({},R,Tn(E,"".concat(R))+N.height)):E},{top:g.top||0,bottom:g.bottom||0}),S=ie(ie({},b),_),A=S.bottom;v&&(S.bottom+=v.props.height||il.defaultProps.height),x&&r&&(S=LX(S,i,n,r));var O=d-S.left-S.right,j=p-S.top-S.bottom;return ie(ie({brushBottom:A},S),{},{width:Math.max(O,0),height:Math.max(j,0)})},Nne=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},kM=function(e){var r=e.chartName,n=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,o=e.validateTooltipEventTypes,c=o===void 0?["axis"]:o,u=e.axisComponents,d=e.legendContent,p=e.formatAxisMap,f=e.defaultProps,g=function(S,A){var O=A.graphicalItems,j=A.stackGroups,E=A.offset,T=A.updateId,N=A.dataStartIndex,R=A.dataEndIndex,M=S.barSize,J=S.layout,F=S.barGap,B=S.barCategoryGap,K=S.maxBarSize,W=kN(J),X=W.numericAxisName,Y=W.cateAxisName,te=jne(O),H=[];return O.forEach(function(Q,U){var I=Dp(S.data,{graphicalItems:[Q],dataStartIndex:N,dataEndIndex:R}),$=Q.type.defaultProps!==void 0?ie(ie({},Q.type.defaultProps),Q.props):Q.props,V=$.dataKey,oe=$.maxBarSize,le=$["".concat(X,"Id")],ve=$["".concat(Y,"Id")],qe={},xe=u.reduce(function(lr,_t){var kr=A["".concat(_t.axisType,"Map")],Ir=$["".concat(_t.axisType,"Id")];kr&&kr[Ir]||_t.axisType==="zAxis"||Lo();var ni=kr[Ir];return ie(ie({},lr),{},ze(ze({},_t.axisType,ni),"".concat(_t.axisType,"Ticks"),Wi(ni)))},qe),ae=xe[Y],Se=xe["".concat(Y,"Ticks")],Me=j&&j[le]&&j[le].hasStack&&JX(Q,j[le].stackGroups),se=Gi(Q.type).indexOf("Bar")>=0,tt=Sh(ae,Se),Fe=[],kt=te&&$X({barSize:M,stackGroups:j,totalSize:Nne(xe,Y)});if(se){var wt,Et,Sr=et(oe)?K:oe,Ut=(wt=(Et=Sh(ae,Se,!0))!==null&&Et!==void 0?Et:Sr)!==null&&wt!==void 0?wt:0;Fe=MX({barGap:F,barCategoryGap:B,bandSize:Ut!==tt?Ut:tt,sizeList:kt[ve],maxBarSize:Sr}),Ut!==tt&&(Fe=Fe.map(function(lr){return ie(ie({},lr),{},{position:ie(ie({},lr.position),{},{offset:lr.position.offset-Ut/2})})}))}var Rr=Q&&Q.type&&Q.type.getComposedData;Rr&&H.push({props:ie(ie({},Rr(ie(ie({},xe),{},{displayedData:I,props:S,dataKey:V,item:Q,bandSize:tt,barPosition:Fe,offset:E,stackedData:Me,layout:J,dataStartIndex:N,dataEndIndex:R}))),{},ze(ze(ze({key:Q.key||"item-".concat(U)},X,xe[X]),Y,xe[Y]),"animationId",T)),childIndex:D9(Q,S.children),item:Q})}),H},v=function(S,A){var O=S.props,j=S.dataStartIndex,E=S.dataEndIndex,T=S.updateId;if(!YO({props:O}))return null;var N=O.children,R=O.layout,M=O.stackOffset,J=O.data,F=O.reverseStackOrder,B=kN(R),K=B.numericAxisName,W=B.cateAxisName,X=jn(N,n),Y=VX(J,X,"".concat(K,"Id"),"".concat(W,"Id"),M,F),te=u.reduce(function($,V){var oe="".concat(V.axisType,"Map");return ie(ie({},$),{},ze({},oe,Ane(O,ie(ie({},V),{},{graphicalItems:X,stackGroups:V.axisType===K&&Y,dataStartIndex:j,dataEndIndex:E}))))},{}),H=Cne(ie(ie({},te),{},{props:O,graphicalItems:X}),A==null?void 0:A.legendBBox);Object.keys(te).forEach(function($){te[$]=p(O,te[$],H,$.replace("Map",""),r)});var Q=te["".concat(W,"Map")],U=Tne(Q),I=g(O,ie(ie({},te),{},{dataStartIndex:j,dataEndIndex:E,updateId:T,graphicalItems:X,stackGroups:Y,offset:H}));return ie(ie({formattedGraphicalItems:I,graphicalItems:X,offset:H,stackGroups:Y},U),te)},x=(function(b){function S(A){var O,j,E;return une(this,S),E=hne(this,S,[A]),ze(E,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ze(E,"accessibilityManager",new Yre),ze(E,"handleLegendBBoxUpdate",function(T){if(T){var N=E.state,R=N.dataStartIndex,M=N.dataEndIndex,J=N.updateId;E.setState(ie({legendBBox:T},v({props:E.props,dataStartIndex:R,dataEndIndex:M,updateId:J},ie(ie({},E.state),{},{legendBBox:T}))))}}),ze(E,"handleReceiveSyncEvent",function(T,N,R){if(E.props.syncId===T){if(R===E.eventEmitterSymbol&&typeof E.props.syncMethod!="function")return;E.applySyncEvent(N)}}),ze(E,"handleBrushChange",function(T){var N=T.startIndex,R=T.endIndex;if(N!==E.state.dataStartIndex||R!==E.state.dataEndIndex){var M=E.state.updateId;E.setState(function(){return ie({dataStartIndex:N,dataEndIndex:R},v({props:E.props,dataStartIndex:N,dataEndIndex:R,updateId:M},E.state))}),E.triggerSyncEvent({dataStartIndex:N,dataEndIndex:R})}}),ze(E,"handleMouseEnter",function(T){var N=E.getMouseInfo(T);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});E.setState(R),E.triggerSyncEvent(R);var M=E.props.onMouseEnter;Je(M)&&M(R,T)}}),ze(E,"triggeredAfterMouseMove",function(T){var N=E.getMouseInfo(T),R=N?ie(ie({},N),{},{isTooltipActive:!0}):{isTooltipActive:!1};E.setState(R),E.triggerSyncEvent(R);var M=E.props.onMouseMove;Je(M)&&M(R,T)}),ze(E,"handleItemMouseEnter",function(T){E.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),ze(E,"handleItemMouseLeave",function(){E.setState(function(){return{isTooltipActive:!1}})}),ze(E,"handleMouseMove",function(T){T.persist(),E.throttleTriggeredAfterMouseMove(T)}),ze(E,"handleMouseLeave",function(T){E.throttleTriggeredAfterMouseMove.cancel();var N={isTooltipActive:!1};E.setState(N),E.triggerSyncEvent(N);var R=E.props.onMouseLeave;Je(R)&&R(N,T)}),ze(E,"handleOuterEvent",function(T){var N=L9(T),R=Tn(E.props,"".concat(N));if(N&&Je(R)){var M,J;/.*touch.*/i.test(N)?J=E.getMouseInfo(T.changedTouches[0]):J=E.getMouseInfo(T),R((M=J)!==null&&M!==void 0?M:{},T)}}),ze(E,"handleClick",function(T){var N=E.getMouseInfo(T);if(N){var R=ie(ie({},N),{},{isTooltipActive:!0});E.setState(R),E.triggerSyncEvent(R);var M=E.props.onClick;Je(M)&&M(R,T)}}),ze(E,"handleMouseDown",function(T){var N=E.props.onMouseDown;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"handleMouseUp",function(T){var N=E.props.onMouseUp;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&E.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),ze(E,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&E.handleMouseDown(T.changedTouches[0])}),ze(E,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&E.handleMouseUp(T.changedTouches[0])}),ze(E,"handleDoubleClick",function(T){var N=E.props.onDoubleClick;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"handleContextMenu",function(T){var N=E.props.onContextMenu;if(Je(N)){var R=E.getMouseInfo(T);N(R,T)}}),ze(E,"triggerSyncEvent",function(T){E.props.syncId!==void 0&&Rb.emit(Ib,E.props.syncId,T,E.eventEmitterSymbol)}),ze(E,"applySyncEvent",function(T){var N=E.props,R=N.layout,M=N.syncMethod,J=E.state.updateId,F=T.dataStartIndex,B=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)E.setState(ie({dataStartIndex:F,dataEndIndex:B},v({props:E.props,dataStartIndex:F,dataEndIndex:B,updateId:J},E.state)));else if(T.activeTooltipIndex!==void 0){var K=T.chartX,W=T.chartY,X=T.activeTooltipIndex,Y=E.state,te=Y.offset,H=Y.tooltipTicks;if(!te)return;if(typeof M=="function")X=M(H,T);else if(M==="value"){X=-1;for(var Q=0;Q<H.length;Q++)if(H[Q].value===T.activeLabel){X=Q;break}}var U=ie(ie({},te),{},{x:te.left,y:te.top}),I=Math.min(K,U.x+U.width),$=Math.min(W,U.y+U.height),V=H[X]&&H[X].value,oe=Sw(E.state,E.props.data,X),le=H[X]?{x:R==="horizontal"?H[X].coordinate:I,y:R==="horizontal"?$:H[X].coordinate}:_M;E.setState(ie(ie({},T),{},{activeLabel:V,activeCoordinate:le,activePayload:oe,activeTooltipIndex:X}))}else E.setState(T)}),ze(E,"renderCursor",function(T){var N,R=E.state,M=R.isTooltipActive,J=R.activeCoordinate,F=R.activePayload,B=R.offset,K=R.activeTooltipIndex,W=R.tooltipAxisBandSize,X=E.getTooltipEventType(),Y=(N=T.props.active)!==null&&N!==void 0?N:M,te=E.props.layout,H=T.key||"_recharts-cursor";return L.createElement(nne,{key:H,activeCoordinate:J,activePayload:F,activeTooltipIndex:K,chartName:r,element:T,isActive:Y,layout:te,offset:B,tooltipAxisBandSize:W,tooltipEventType:X})}),ze(E,"renderPolarAxis",function(T,N,R){var M=Tn(T,"type.axisType"),J=Tn(E.state,"".concat(M,"Map")),F=T.type.defaultProps,B=F!==void 0?ie(ie({},F),T.props):T.props,K=J&&J[B["".concat(M,"Id")]];return P.cloneElement(T,ie(ie({},K),{},{className:ot(M,K.className),key:T.key||"".concat(N,"-").concat(R),ticks:Wi(K,!0)}))}),ze(E,"renderPolarGrid",function(T){var N=T.props,R=N.radialLines,M=N.polarAngles,J=N.polarRadius,F=E.state,B=F.radiusAxisMap,K=F.angleAxisMap,W=Pa(B),X=Pa(K),Y=X.cx,te=X.cy,H=X.innerRadius,Q=X.outerRadius;return P.cloneElement(T,{polarAngles:Array.isArray(M)?M:Wi(X,!0).map(function(U){return U.coordinate}),polarRadius:Array.isArray(J)?J:Wi(W,!0).map(function(U){return U.coordinate}),cx:Y,cy:te,innerRadius:H,outerRadius:Q,key:T.key||"polar-grid",radialLines:R})}),ze(E,"renderLegend",function(){var T=E.state.formattedGraphicalItems,N=E.props,R=N.children,M=N.width,J=N.height,F=E.props.margin||{},B=M-(F.left||0)-(F.right||0),K=y$({children:R,formattedGraphicalItems:T,legendWidth:B,legendContent:d});if(!K)return null;var W=K.item,X=xN(K,ine);return P.cloneElement(W,ie(ie({},X),{},{chartWidth:M,chartHeight:J,margin:F,onBBoxUpdate:E.handleLegendBBoxUpdate}))}),ze(E,"renderTooltip",function(){var T,N=E.props,R=N.children,M=N.accessibilityLayer,J=sn(R,ln);if(!J)return null;var F=E.state,B=F.isTooltipActive,K=F.activeCoordinate,W=F.activePayload,X=F.activeLabel,Y=F.offset,te=(T=J.props.active)!==null&&T!==void 0?T:B;return P.cloneElement(J,{viewBox:ie(ie({},Y),{},{x:Y.left,y:Y.top}),active:te,label:X,payload:te?W:[],coordinate:K,accessibilityLayer:M})}),ze(E,"renderBrush",function(T){var N=E.props,R=N.margin,M=N.data,J=E.state,F=J.offset,B=J.dataStartIndex,K=J.dataEndIndex,W=J.updateId;return P.cloneElement(T,{key:T.key||"_recharts-brush",onChange:wf(E.handleBrushChange,T.props.onChange),data:M,x:ge(T.props.x)?T.props.x:F.left,y:ge(T.props.y)?T.props.y:F.top+F.height+F.brushBottom-(R.bottom||0),width:ge(T.props.width)?T.props.width:F.width,startIndex:B,endIndex:K,updateId:"brush-".concat(W)})}),ze(E,"renderReferenceElement",function(T,N,R){if(!T)return null;var M=E,J=M.clipPathId,F=E.state,B=F.xAxisMap,K=F.yAxisMap,W=F.offset,X=T.type.defaultProps||{},Y=T.props,te=Y.xAxisId,H=te===void 0?X.xAxisId:te,Q=Y.yAxisId,U=Q===void 0?X.yAxisId:Q;return P.cloneElement(T,{key:T.key||"".concat(N,"-").concat(R),xAxis:B[H],yAxis:K[U],viewBox:{x:W.left,y:W.top,width:W.width,height:W.height},clipPathId:J})}),ze(E,"renderActivePoints",function(T){var N=T.item,R=T.activePoint,M=T.basePoint,J=T.childIndex,F=T.isRange,B=[],K=N.props.key,W=N.item.type.defaultProps!==void 0?ie(ie({},N.item.type.defaultProps),N.item.props):N.item.props,X=W.activeDot,Y=W.dataKey,te=ie(ie({index:J,dataKey:Y,cx:R.x,cy:R.y,r:4,fill:K1(N.item),strokeWidth:2,stroke:"#fff",payload:R.payload,value:R.value},it(X,!1)),Xf(X));return B.push(S.renderActiveDot(X,te,"".concat(K,"-activePoint-").concat(J))),M?B.push(S.renderActiveDot(X,ie(ie({},te),{},{cx:M.x,cy:M.y}),"".concat(K,"-basePoint-").concat(J))):F&&B.push(null),B}),ze(E,"renderGraphicChild",function(T,N,R){var M=E.filterFormatItem(T,N,R);if(!M)return null;var J=E.getTooltipEventType(),F=E.state,B=F.isTooltipActive,K=F.tooltipAxis,W=F.activeTooltipIndex,X=F.activeLabel,Y=E.props.children,te=sn(Y,ln),H=M.props,Q=H.points,U=H.isRange,I=H.baseLine,$=M.item.type.defaultProps!==void 0?ie(ie({},M.item.type.defaultProps),M.item.props):M.item.props,V=$.activeDot,oe=$.hide,le=$.activeBar,ve=$.activeShape,qe=!!(!oe&&B&&te&&(V||le||ve)),xe={};J!=="axis"&&te&&te.props.trigger==="click"?xe={onClick:wf(E.handleItemMouseEnter,T.props.onClick)}:J!=="axis"&&(xe={onMouseLeave:wf(E.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:wf(E.handleItemMouseEnter,T.props.onMouseEnter)});var ae=P.cloneElement(T,ie(ie({},M.props),xe));function Se(_t){return typeof K.dataKey=="function"?K.dataKey(_t.payload):null}if(qe)if(W>=0){var Me,se;if(K.dataKey&&!K.allowDuplicatedCategory){var tt=typeof K.dataKey=="function"?Se:"payload.".concat(K.dataKey.toString());Me=Vf(Q,tt,X),se=U&&I&&Vf(I,tt,X)}else Me=Q==null?void 0:Q[W],se=U&&I&&I[W];if(ve||le){var Fe=T.props.activeIndex!==void 0?T.props.activeIndex:W;return[P.cloneElement(T,ie(ie(ie({},M.props),xe),{},{activeIndex:Fe})),null,null]}if(!et(Me))return[ae].concat(pl(E.renderActivePoints({item:M,activePoint:Me,basePoint:se,childIndex:W,isRange:U})))}else{var kt,wt=(kt=E.getItemByXY(E.state.activeCoordinate))!==null&&kt!==void 0?kt:{graphicalItem:ae},Et=wt.graphicalItem,Sr=Et.item,Ut=Sr===void 0?T:Sr,Rr=Et.childIndex,lr=ie(ie(ie({},M.props),xe),{},{activeIndex:Rr});return[P.cloneElement(Ut,lr),null,null]}return U?[ae,null,null]:[ae,null]}),ze(E,"renderCustomized",function(T,N,R){return P.cloneElement(T,ie(ie({key:"recharts-customized-".concat(R)},E.props),E.state))}),ze(E,"renderMap",{CartesianGrid:{handler:Of,once:!0},ReferenceArea:{handler:E.renderReferenceElement},ReferenceLine:{handler:Of},ReferenceDot:{handler:E.renderReferenceElement},XAxis:{handler:Of},YAxis:{handler:Of},Brush:{handler:E.renderBrush,once:!0},Bar:{handler:E.renderGraphicChild},Line:{handler:E.renderGraphicChild},Area:{handler:E.renderGraphicChild},Radar:{handler:E.renderGraphicChild},RadialBar:{handler:E.renderGraphicChild},Scatter:{handler:E.renderGraphicChild},Pie:{handler:E.renderGraphicChild},Funnel:{handler:E.renderGraphicChild},Tooltip:{handler:E.renderCursor,once:!0},PolarGrid:{handler:E.renderPolarGrid,once:!0},PolarAngleAxis:{handler:E.renderPolarAxis},PolarRadiusAxis:{handler:E.renderPolarAxis},Customized:{handler:E.renderCustomized}}),E.clipPathId="".concat((O=A.id)!==null&&O!==void 0?O:Lu("recharts"),"-clip"),E.throttleTriggeredAfterMouseMove=yI(E.triggeredAfterMouseMove,(j=A.throttleDelay)!==null&&j!==void 0?j:1e3/60),E.state={},E}return gne(S,b),fne(S,[{key:"componentDidMount",value:function(){var O,j;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(O=this.props.margin.left)!==null&&O!==void 0?O:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var O=this.props,j=O.children,E=O.data,T=O.height,N=O.layout,R=sn(j,ln);if(R){var M=R.props.defaultIndex;if(!(typeof M!="number"||M<0||M>this.state.tooltipTicks.length-1)){var J=this.state.tooltipTicks[M]&&this.state.tooltipTicks[M].value,F=Sw(this.state,E,M,J),B=this.state.tooltipTicks[M].coordinate,K=(this.state.offset.top+T)/2,W=N==="horizontal",X=W?{x:B,y:K}:{y:B,x:K},Y=this.state.formattedGraphicalItems.find(function(H){var Q=H.item;return Q.type.name==="Scatter"});Y&&(X=ie(ie({},X),Y.props.points[M].tooltipPosition),F=Y.props.points[M].tooltipPayload);var te={activeTooltipIndex:M,isTooltipActive:!0,activeLabel:J,activePayload:F,activeCoordinate:X};this.setState(te),this.renderCursor(R),this.accessibilityManager.setIndex(M)}}}},{key:"getSnapshotBeforeUpdate",value:function(O,j){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==j.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==O.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==O.margin){var E,T;this.accessibilityManager.setDetails({offset:{left:(E=this.props.margin.left)!==null&&E!==void 0?E:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(O){lx([sn(O.children,ln)],[sn(this.props.children,ln)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var O=sn(this.props.children,ln);if(O&&typeof O.props.shared=="boolean"){var j=O.props.shared?"axis":"item";return c.indexOf(j)>=0?j:a}return a}},{key:"getMouseInfo",value:function(O){if(!this.container)return null;var j=this.container,E=j.getBoundingClientRect(),T=kW(E),N={chartX:Math.round(O.pageX-T.left),chartY:Math.round(O.pageY-T.top)},R=E.width/j.offsetWidth||1,M=this.inRange(N.chartX,N.chartY,R);if(!M)return null;var J=this.state,F=J.xAxisMap,B=J.yAxisMap,K=this.getTooltipEventType(),W=_N(this.state,this.props.data,this.props.layout,M);if(K!=="axis"&&F&&B){var X=Pa(F).scale,Y=Pa(B).scale,te=X&&X.invert?X.invert(N.chartX):null,H=Y&&Y.invert?Y.invert(N.chartY):null;return ie(ie({},N),{},{xValue:te,yValue:H},W)}return W?ie(ie({},N),W):null}},{key:"inRange",value:function(O,j){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,N=O/E,R=j/E;if(T==="horizontal"||T==="vertical"){var M=this.state.offset,J=N>=M.left&&N<=M.left+M.width&&R>=M.top&&R<=M.top+M.height;return J?{x:N,y:R}:null}var F=this.state,B=F.angleAxisMap,K=F.radiusAxisMap;if(B&&K){var W=Pa(B);return zj({x:N,y:R},W)}return null}},{key:"parseEventsOfWrapper",value:function(){var O=this.props.children,j=this.getTooltipEventType(),E=sn(O,ln),T={};E&&j==="axis"&&(E.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 N=Xf(this.props,this.handleOuterEvent);return ie(ie({},N),T)}},{key:"addListener",value:function(){Rb.on(Ib,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Rb.removeListener(Ib,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(O,j,E){for(var T=this.state.formattedGraphicalItems,N=0,R=T.length;N<R;N++){var M=T[N];if(M.item===O||M.props.key===O.key||j===Gi(M.item.type)&&E===M.childIndex)return M}return null}},{key:"renderClipPath",value:function(){var O=this.clipPathId,j=this.state.offset,E=j.left,T=j.top,N=j.height,R=j.width;return L.createElement("defs",null,L.createElement("clipPath",{id:O},L.createElement("rect",{x:E,y:T,height:N,width:R})))}},{key:"getXScales",value:function(){var O=this.state.xAxisMap;return O?Object.entries(O).reduce(function(j,E){var T=bN(E,2),N=T[0],R=T[1];return ie(ie({},j),{},ze({},N,R.scale))},{}):null}},{key:"getYScales",value:function(){var O=this.state.yAxisMap;return O?Object.entries(O).reduce(function(j,E){var T=bN(E,2),N=T[0],R=T[1];return ie(ie({},j),{},ze({},N,R.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(O){var j;return(j=this.state.xAxisMap)===null||j===void 0||(j=j[O])===null||j===void 0?void 0:j.scale}},{key:"getYScaleByAxisId",value:function(O){var j;return(j=this.state.yAxisMap)===null||j===void 0||(j=j[O])===null||j===void 0?void 0:j.scale}},{key:"getItemByXY",value:function(O){var j=this.state,E=j.formattedGraphicalItems,T=j.activeItem;if(E&&E.length)for(var N=0,R=E.length;N<R;N++){var M=E[N],J=M.props,F=M.item,B=F.type.defaultProps!==void 0?ie(ie({},F.type.defaultProps),F.props):F.props,K=Gi(F.type);if(K==="Bar"){var W=(J.data||[]).find(function(H){return WZ(O,H)});if(W)return{graphicalItem:M,payload:W}}else if(K==="RadialBar"){var X=(J.data||[]).find(function(H){return zj(O,H)});if(X)return{graphicalItem:M,payload:X}}else if(Np(M,T)||Pp(M,T)||_u(M,T)){var Y=$Q({graphicalItem:M,activeTooltipItem:T,itemData:B.data}),te=B.activeIndex===void 0?Y:B.activeIndex;return{graphicalItem:ie(ie({},M),{},{childIndex:te}),payload:_u(M,T)?B.data[Y]:M.props.data[Y]}}}return null}},{key:"render",value:function(){var O=this;if(!YO(this))return null;var j=this.props,E=j.children,T=j.className,N=j.width,R=j.height,M=j.style,J=j.compact,F=j.title,B=j.desc,K=xN(j,ane),W=it(K,!1);if(J)return L.createElement(eN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement(ux,Ls({},W,{width:N,height:R,title:F,desc:B}),this.renderClipPath(),ZO(E,this.renderMap)));if(this.props.accessibilityLayer){var X,Y;W.tabIndex=(X=this.props.tabIndex)!==null&&X!==void 0?X:0,W.role=(Y=this.props.role)!==null&&Y!==void 0?Y:"application",W.onKeyDown=function(H){O.accessibilityManager.keyboardEvent(H)},W.onFocus=function(){O.accessibilityManager.focus()}}var te=this.parseEventsOfWrapper();return L.createElement(eN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},L.createElement("div",Ls({className:ot("recharts-wrapper",T),style:ie({position:"relative",cursor:"default",width:N,height:R},M)},te,{ref:function(Q){O.container=Q}}),L.createElement(ux,Ls({},W,{width:N,height:R,title:F,desc:B,style:_ne}),this.renderClipPath(),ZO(E,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(P.Component);ze(x,"displayName",r),ze(x,"defaultProps",ie({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ze(x,"getDerivedStateFromProps",function(b,S){var A=b.dataKey,O=b.data,j=b.children,E=b.width,T=b.height,N=b.layout,R=b.stackOffset,M=b.margin,J=S.dataStartIndex,F=S.dataEndIndex;if(S.updateId===void 0){var B=SN(b);return ie(ie(ie({},B),{},{updateId:0},v(ie(ie({props:b},B),{},{updateId:0}),S)),{},{prevDataKey:A,prevData:O,prevWidth:E,prevHeight:T,prevLayout:N,prevStackOffset:R,prevMargin:M,prevChildren:j})}if(A!==S.prevDataKey||O!==S.prevData||E!==S.prevWidth||T!==S.prevHeight||N!==S.prevLayout||R!==S.prevStackOffset||!Us(M,S.prevMargin)){var K=SN(b),W={chartX:S.chartX,chartY:S.chartY,isTooltipActive:S.isTooltipActive},X=ie(ie({},_N(S,O,N)),{},{updateId:S.updateId+1}),Y=ie(ie(ie({},K),W),X);return ie(ie(ie({},Y),v(ie({props:b},Y),S)),{},{prevDataKey:A,prevData:O,prevWidth:E,prevHeight:T,prevLayout:N,prevStackOffset:R,prevMargin:M,prevChildren:j})}if(!lx(j,S.prevChildren)){var te,H,Q,U,I=sn(j,il),$=I&&(te=(H=I.props)===null||H===void 0?void 0:H.startIndex)!==null&&te!==void 0?te:J,V=I&&(Q=(U=I.props)===null||U===void 0?void 0:U.endIndex)!==null&&Q!==void 0?Q:F,oe=$!==J||V!==F,le=!et(O),ve=le&&!oe?S.updateId:S.updateId+1;return ie(ie({updateId:ve},v(ie(ie({props:b},S),{},{updateId:ve,dataStartIndex:$,dataEndIndex:V}),S)),{},{prevChildren:j,dataStartIndex:$,dataEndIndex:V})}return null}),ze(x,"renderActiveDot",function(b,S,A){var O;return P.isValidElement(b)?O=P.cloneElement(b,S):Je(b)?O=b(S):O=L.createElement(X1,S),L.createElement(Xt,{className:"recharts-active-dot",key:A},O)});var _=P.forwardRef(function(S,A){return L.createElement(x,Ls({},S,{ref:A}))});return _.displayName=x.displayName,_},Pne=kM({chartName:"LineChart",GraphicalChild:Hu,axisComponents:[{axisType:"xAxis",AxisComp:Ba},{axisType:"yAxis",AxisComp:Ua}],formatAxisMap:F$}),kw=kM({chartName:"BarChart",GraphicalChild:ea,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ba},{axisType:"yAxis",AxisComp:Ua}],formatAxisMap:F$});const Kh={backgroundColor:"#1e1e1e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#e4e0dc",fontSize:"11px",fontFamily:"JetBrains Mono, monospace"};function It(t){return t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.round(t))}function Zn(t){return`$${t.toFixed(2)}`}function $a({label:t,value:e,sub:r,accent:n}){return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-5 py-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mb-1",children:t}),y.jsx("p",{className:`text-xl font-mono font-medium ${n?"text-[#E43A9C]":"text-zinc-100"}`,children:e}),r&&y.jsx("p",{className:"text-[10px] font-mono text-zinc-600 mt-0.5",children:r})]})}const Rne={summary:"Summary","by squad":"By Squad","by agent":"By Agent",io:"IO",timeline:"Timeline"};function Ine({tabs:t,active:e,onChange:r}){return y.jsx("div",{className:"flex gap-0 border-b border-white/[0.06] mb-5",children:t.map(n=>y.jsx("button",{type:"button",onClick:()=>r(n),className:`px-4 py-2 text-[11px] font-mono transition-colors border-b-2 -mb-px cursor-pointer ${e===n?"text-[#E43A9C] border-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 border-transparent"}`,children:Rne[n]??n},n))})}function $ne({records:t,totals:e}){const r=e.totalInputTokens+e.totalOutputTokens,n=new Map;for(const o of t){const c=o.squadId??"__io__",u=o.squadName??(o.squadId?`${o.squadId.slice(0,8)} (deleted)`:"IO Orchestrator"),d=n.get(c)??{name:u,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=o.inputTokens,d.outputTokens+=o.outputTokens,d.calls+=1,d.cost+=o.estimatedCostUsd??0,n.set(c,d)}const i=Array.from(n.values()).sort((o,c)=>c.cost-o.cost),a=i.map(o=>({name:o.name.length>12?`${o.name.slice(0,12)}…`:o.name,cost:Number.parseFloat(o.cost.toFixed(2)),tokens:Math.round((o.inputTokens+o.outputTokens)/1e3)}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx($a,{label:"Total Tokens",value:It(r),sub:`${It(e.totalInputTokens)} in · ${It(e.totalOutputTokens)} out`}),y.jsx($a,{label:"Total Cost",value:Zn(e.totalCostUsd),accent:!0}),y.jsx($a,{label:"API Calls",value:It(e.callCount),sub:"across all entities"}),y.jsx($a,{label:"Avg Cost / Call",value:e.callCount>0?Zn(e.totalCostUsd/e.callCount):"$0.00",sub:`over ${e.callCount} calls`})]}),y.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost by entity"}),a.length>0?y.jsx(oh,{width:"100%",height:180,children:y.jsxs(kw,{data:a,barCategoryGap:"35%",children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`$${o}`,width:40}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`$${o.toFixed(2)}`,"Cost"]}),y.jsx(ea,{dataKey:"cost",fill:"url(#costGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens by entity (k)"}),a.length>0?y.jsx(oh,{width:"100%",height:180,children:y.jsxs(kw,{data:a,barCategoryGap:"35%",children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`${o}k`,width:40}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`${o}k`,"Tokens"]}),y.jsx(ea,{dataKey:"tokens",fill:"url(#tokenGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#818cf8"}),y.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Entity","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsxs("tbody",{children:[i.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name)),y.jsxs("tr",{className:"bg-[#1a1a1a]",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-200 font-medium",children:"Total"}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalInputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:It(e.totalOutputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:e.callCount}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C] font-medium",children:Zn(e.totalCostUsd)})]})]})]})})]})}function Mne({records:t}){const[e,r]=P.useState([]),[n,i]=P.useState("cost"),[a,o]=P.useState("desc");function c(f){f===n?o(g=>g==="asc"?"desc":"asc"):(i(f),o("desc"))}const u=P.useMemo(()=>{const f=new Map;for(const v of t){if(!v.squadId)continue;const x=f.get(v.squadId)??{id:v.squadId,name:v.squadName??`${v.squadId.slice(0,8)} (deleted)`,agents:new Map,inputTokens:0,outputTokens:0,calls:0,cost:0};x.inputTokens+=v.inputTokens,x.outputTokens+=v.outputTokens,x.calls+=1,x.cost+=v.estimatedCostUsd??0;const _=`${v.agentRole??"unknown"}:${v.model}`,b=x.agents.get(_)??{role:v.agentRole??"unknown",model:v.model,inputTokens:0,outputTokens:0,calls:0,cost:0};b.inputTokens+=v.inputTokens,b.outputTokens+=v.outputTokens,b.calls+=1,b.cost+=v.estimatedCostUsd??0,x.agents.set(_,b),f.set(v.squadId,x)}return[...Array.from(f.values())].sort((v,x)=>{const _=v[n],b=x[n],S=typeof _=="string"?_.localeCompare(b):_-b;return a==="desc"?-S:S})},[t,n,a]),d=f=>r(g=>g.includes(f)?g.filter(v=>v!==f):[...g,f]),p=[{key:"name",label:"Squad"},{key:"inputTokens",label:"In"},{key:"outputTokens",label:"Out"},{key:"calls",label:"Calls"},{key:"cost",label:"Cost"}];return u.length===0?y.jsx("div",{className:"text-center py-12 text-zinc-700 text-[11px] font-mono",children:"No squad usage data"}):y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-1 px-1 mb-1",children:[y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 mr-1",children:"sort by"}),p.map(f=>y.jsxs("button",{type:"button",onClick:()=>c(f.key),className:`flex items-center gap-0.5 px-2 py-1 rounded-lg text-[10px] font-mono transition-colors ${n===f.key?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400 hover:bg-white/[0.04]"}`,style:n===f.key?{background:"rgba(228,58,156,0.1)"}:void 0,children:[f.label,n===f.key&&y.jsx("span",{className:"text-[9px]",children:a==="desc"?"↓":"↑"})]},f.key))]}),u.map(f=>{const g=e.includes(f.id),v=Array.from(f.agents.values());return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl overflow-hidden",children:[y.jsxs("button",{type:"button",onClick:()=>d(f.id),className:"w-full flex items-center gap-3 px-4 py-3.5 hover:bg-white/[0.02] transition-colors text-left cursor-pointer",children:[y.jsx("div",{className:`transition-transform ${g?"rotate-90":""}`,children:y.jsx($w,{className:"w-3.5 h-3.5 text-zinc-600"})}),y.jsx("span",{className:"text-sm font-mono text-zinc-100 flex-1",children:f.name}),y.jsxs("div",{className:"flex items-center gap-6 text-[11px] font-mono",children:[y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"in"}),It(f.inputTokens)]}),y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"out"}),It(f.outputTokens)]}),y.jsxs("span",{className:"text-zinc-500",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"calls"}),f.calls]}),y.jsx("span",{className:"text-[#E43A9C] font-medium w-16 text-right",children:Zn(f.cost)})]})]}),g&&y.jsx("div",{className:"border-t border-white/[0.05]",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"bg-[#191919]",children:["Agent","Model","Input","Output","Calls","Cost"].map(x=>y.jsx("th",{className:`text-left px-4 py-2 text-zinc-700 font-medium ${x==="Cost"?"text-right":""}`,children:x},x))})}),y.jsx("tbody",{children:v.map(x=>y.jsxs("tr",{className:"border-t border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-2.5 text-zinc-300",children:x.role}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-600",children:x.model}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(x.inputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:It(x.outputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:x.calls}),y.jsx("td",{className:"px-4 py-2.5 text-right text-[#E43A9C]",children:Zn(x.cost)})]},x.role))})]})})]},f.id)})]})}function Lne({records:t}){const e=P.useMemo(()=>{const n=new Map;for(const i of t){const a=`${i.squadId??"io"}:${i.agentRole??"orchestrator"}:${i.model}`,o=n.get(a)??{name:i.agentRole??"orchestrator",squad:i.squadName??(i.squadId?i.squadId.slice(0,8):"IO"),model:i.model,inputTokens:0,outputTokens:0,calls:0,cost:0};o.inputTokens+=i.inputTokens,o.outputTokens+=i.outputTokens,o.calls+=1,o.cost+=i.estimatedCostUsd??0,n.set(a,o)}return Array.from(n.values()).sort((i,a)=>a.cost-i.cost)},[t]),r=e.reduce((n,i)=>n+i.cost,0);return y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Agent","Squad","Model","Input","Output","Calls","Cost","% of total"].map(n=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${n==="Cost"?"text-right":""}`,children:n},n))})}),y.jsx("tbody",{children:e.map(n=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:n.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.squad}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(n.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:n.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(n.cost)}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"w-16 h-1.5 rounded-full bg-[#252525] overflow-hidden",children:y.jsx("div",{className:"h-full bg-[#E43A9C] rounded-full",style:{width:`${r>0?n.cost/r*100:0}%`}})}),y.jsx("span",{className:"text-zinc-600 text-[10px]",children:r>0?`${(n.cost/r*100).toFixed(1)}%`:"0%"})]})})]},`${n.squad}:${n.name}`))})]})})}function Dne({records:t}){const e=P.useMemo(()=>t.filter(o=>!o.squadId),[t]),r=P.useMemo(()=>{const o=new Map;for(const c of e){const u=`${c.agentRole??"orchestrator"}:${c.model}`,d=o.get(u)??{name:c.agentRole??"orchestrator",model:c.model,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=c.inputTokens,d.outputTokens+=c.outputTokens,d.calls+=1,d.cost+=c.estimatedCostUsd??0,o.set(u,d)}return Array.from(o.values()).sort((c,u)=>u.cost-c.cost)},[e]),n=e.reduce((o,c)=>o+c.inputTokens,0),i=e.reduce((o,c)=>o+c.outputTokens,0),a=e.reduce((o,c)=>o+(c.estimatedCostUsd??0),0);return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx($a,{label:"IO Tokens",value:It(n+i),sub:`${It(n)} in · ${It(i)} out`}),y.jsx($a,{label:"IO Cost",value:Zn(a),accent:!0}),y.jsx($a,{label:"IO Calls",value:It(e.length)}),y.jsx($a,{label:"IO Roles",value:String(r.length)})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Role","Model","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsx("tbody",{children:r.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:o.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name))})]})})]})}function zne({records:t}){const e=qa(),r=P.useMemo(()=>{const i=new Map;for(const a of t){const o=a.timestamp.slice(0,10),c=i.get(o)??{date:o,inputTokens:0,outputTokens:0,cost:0,calls:0};c.inputTokens+=a.inputTokens,c.outputTokens+=a.outputTokens,c.cost+=a.estimatedCostUsd??0,c.calls+=1,i.set(o,c)}return Array.from(i.values()).sort((a,o)=>a.date.localeCompare(o.date))},[t]),n=r.map(i=>({...i,label:Z4(i.date,e),tokens:i.inputTokens+i.outputTokens}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens per day"}),n.length>0?y.jsx(oh,{width:"100%",height:220,children:y.jsxs(Pne,{data:n,children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:It,width:44}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[It(i),"Tokens"]}),y.jsx(Hu,{type:"monotone",dataKey:"tokens",stroke:"#E43A9C",strokeWidth:2,dot:!1})]})}):y.jsx("div",{className:"h-[220px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost per day"}),n.length>0?y.jsx(oh,{width:"100%",height:180,children:y.jsxs(kw,{data:n,barCategoryGap:"20%",children:[y.jsx(Au,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ba,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(Ua,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:i=>`$${i.toFixed(2)}`,width:44}),y.jsx(ln,{contentStyle:Kh,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[Zn(i),"Cost"]}),y.jsx(ea,{dataKey:"cost",fill:"url(#costGradTl)",radius:[4,4,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGradTl",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Date","Input","Output","Calls","Cost"].map(i=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${i==="Cost"?"text-right":""}`,children:i},i))})}),y.jsx("tbody",{children:r.map(i=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:i.date}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:It(i.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:i.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(i.cost)})]},i.date))})]})})]})}function Bne(){const[t,e]=P.useState("summary"),[r,n]=P.useState(null),[i,a]=P.useState("14d"),o=["summary","by squad","by agent","io","timeline"];if(P.useEffect(()=>{const u=new Date;i==="7d"?u.setDate(u.getDate()-7):i==="14d"?u.setDate(u.getDate()-14):i==="30d"?u.setDate(u.getDate()-30):u.setDate(u.getDate()-1),Ve.get(`/usage?since=${u.toISOString()}`).then(n).catch(()=>{})},[i]),!r)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600 font-mono text-[11px]",children:"Loading..."});const c=i==="1d"?"Today":`Last ${i}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[y.jsxs("div",{className:"flex items-start justify-between mb-5 gap-4 flex-wrap",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Usage"}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:c})]}),y.jsx("div",{className:"flex gap-1 p-1 rounded-xl bg-white/[0.03] border border-white/[0.07]",children:["1d","7d","14d","30d"].map(u=>y.jsx("button",{type:"button",onClick:()=>a(u),className:`px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors cursor-pointer ${i===u?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400"}`,style:i===u?{background:"rgba(228,58,156,0.12)"}:void 0,children:u},u))})]}),y.jsx(Ine,{tabs:o,active:t,onChange:u=>e(u)}),t==="summary"&&y.jsx($ne,{records:r.records,totals:r.totals}),t==="by squad"&&y.jsx(Mne,{records:r.records}),t==="by agent"&&y.jsx(Lne,{records:r.records}),t==="io"&&y.jsx(Dne,{records:r.records}),t==="timeline"&&y.jsx(zne,{records:r.records})]})}function EM(t){return[...t].sort((e,r)=>e.isDir!==r.isDir?e.isDir?-1:1:e.name.localeCompare(r.name)).map(e=>({...e,children:EM(e.children)}))}function Une(t){const e=[];for(const r of t){const n=r.path.split("/").filter(Boolean);let i=e,a="";if(r.isDir){for(const o of n){a=a?`${a}/${o}`:o;let c=i.find(u=>u.path===a);c||(c={name:o,path:a,isDir:!0,children:[]},i.push(c)),i=c.children}continue}for(const[o,c]of n.entries()){const u=o===n.length-1;a=a?`${a}/${c}`:c;let d=i.find(p=>p.path===a);d||(d={name:u&&r.name||c,path:a,isDir:!u,children:[]},i.push(d)),i=d.children}}return EM(e)}function OM(t,e){return e?t.flatMap(r=>{const n=r.name.toLowerCase().includes(e)||r.path.toLowerCase().includes(e);if(!r.isDir)return n?[r]:[];if(n)return[r];const i=OM(r.children,e);return i.length?[{...r,children:i}]:[]}):t}function Ew(t){const e=new Set;for(const r of t)if(r.isDir){e.add(r.path);for(const n of Ew(r.children))e.add(n)}return e}function qne(t){const e=t.split("/").filter(Boolean),r=[];let n="";for(const i of e.slice(0,-1))n=n?`${n}/${i}`:i,r.push(n);return r}function AM({node:t,depth:e,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u}){const d=r===t.path,p=t.isDir&&(n.has(t.path)||i.has(t.path)),f=12+e*16,g=t.isDir&&["io","shared","squads","templates"].includes(t.path);return t.isDir?y.jsxs("div",{children:[y.jsxs("div",{className:"flex w-full items-center group rounded-lg py-2 pr-3 text-left text-[11px] font-mono text-zinc-400 transition-colors hover:bg-white/[0.04] hover:text-zinc-200",style:{paddingLeft:f},children:[y.jsxs("button",{type:"button",onClick:()=>a(t.path),className:"flex items-center gap-2 flex-1 min-w-0",children:[y.jsx($w,{size:14,className:`shrink-0 transition-transform ${p?"rotate-90":""}`}),p?y.jsx(o4,{size:14,className:"shrink-0 text-zinc-500"}):y.jsx(l4,{size:14,className:"shrink-0 text-zinc-500"}),y.jsx("span",{className:"truncate",children:t.name})]}),y.jsxs("div",{className:"flex items-center gap-0.5",children:[!g&&y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),u(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-red-500/20 transition-opacity text-zinc-600 hover:text-red-400",title:`Delete ${t.name}`,children:y.jsx(Ma,{size:12})}),y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),c(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-white/[0.08] transition-opacity text-zinc-600 hover:text-zinc-300",title:`Add page to ${t.name}`,children:y.jsx(zw,{size:12})})]})]}),p&&y.jsx("div",{children:t.children.map(v=>y.jsx(AM,{node:v,depth:e+1,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u},v.path))})]}):y.jsxs("button",{type:"button",onClick:()=>o(t.path),className:`flex w-full items-center gap-2 rounded-lg py-2 pr-3 text-left text-[11px] font-mono transition-colors ${d?"border-l-2 border-[#E43A9C] bg-[#E43A9C]/10 text-[#E43A9C]":"text-zinc-500 hover:bg-white/[0.04] hover:text-zinc-300"}`,style:{paddingLeft:f},children:[y.jsx(i4,{size:14,className:"shrink-0"}),y.jsx("span",{className:"truncate",children:t.name})]})}function Fne(){const[t,e]=P.useState([]),[r,n]=P.useState(null),[i,a]=P.useState(""),[o,c]=P.useState(!1),[u,d]=P.useState(""),[p,f]=P.useState(""),[g,v]=P.useState(""),[x,_]=P.useState(new Set),[b,S]=P.useState(!1),[A,O]=P.useState(null),j=P.useRef(null);P.useEffect(()=>{F()},[]);const E=P.useMemo(()=>Une(t),[t]),T=g.trim().toLowerCase(),N=P.useMemo(()=>OM(E,T),[E,T]),R=P.useMemo(()=>{const I=T?Ew(N):new Set;if(r)for(const $ of qne(r))I.add($);return I},[N,T,r]),M=r?(function I($){for(const V of $){if(V.path===r)return V;const oe=I(V.children);if(oe)return oe}return null})(N):null,J=(M==null?void 0:M.name)??(r?r.split("/").pop()??"":"");P.useEffect(()=>{const I=Ew(E);_($=>new Set([...$,...I]))},[E]);async function F(){try{const I=await Ve.get("/wiki/all");e(I.pages)}catch{e([])}}function B(I){if(I.startsWith("squads/")){const $=I.split("/"),V=$[1]??"",oe=$.slice(2).join("/");return{scope:V,relativePath:oe}}return I.startsWith("templates/")?{scope:"templates",relativePath:I.slice(10)}:I.startsWith("io/")?{scope:"io",relativePath:I.slice(3)}:I.startsWith("shared/")?{scope:"shared",relativePath:I.slice(7)}:{scope:"shared",relativePath:I}}async function K(I){try{const{scope:$,relativePath:V}=B(I),oe=await Ve.get(`/wiki/${$}/${V}`);a(oe.content),d(oe.content),n(I),c(!1)}catch{at.error("Failed to load page")}}async function W(){if(r)try{const{scope:I,relativePath:$}=B(r);await Ve.put(`/wiki/${I}/${$}`,{content:u}),a(u),c(!1),at.success("Page saved")}catch{at.error("Failed to save page")}}async function X(){if(r)try{const{scope:I,relativePath:$}=B(r);await Ve.delete(`/wiki/${I}/${$}`),at.success("Page deleted"),n(null),a(""),d(""),c(!1),F()}catch{at.error("Failed to delete page")}}function Y(I){f(`${I}/`),setTimeout(()=>{const $=j.current;$&&($.focus(),$.setSelectionRange($.value.length,$.value.length))},0)}function te(I){O(I)}async function H(){if(A)try{await Ve.delete(`/wiki/dir/${A}`),at.success(`Deleted ${A}`),r!=null&&r.startsWith(A)&&(n(null),a(""),d(""),c(!1)),F()}catch{at.error("Failed to delete directory")}finally{O(null)}}async function Q(){let I=p.trim().replace(/^\/+|\/+$/g,"");if(!I)return;I=I.replace(/\.md$/i,"");const $=I.startsWith("io/")||I.startsWith("shared/")||I.startsWith("squads/")?I:`shared/${I}`;S(!0);try{const{scope:V,relativePath:oe}=B($),le=oe.split("/").slice(-1)[0]??oe;await Ve.put(`/wiki/${V}/${oe}`,{content:`# ${le}
503
503
 
504
504
  `}),at.success("Page created"),f(""),await F(),await K($)}catch{at.error("Failed to create page")}finally{S(!1)}}function U(I){_($=>{const V=new Set($);return V.has(I)?V.delete(I):V.add(I),V})}return y.jsxs("div",{className:"flex h-full",children:[y.jsxs("div",{className:"flex h-full w-64 flex-col border-r border-white/[0.07] bg-[#181818]",children:[y.jsx("div",{className:"border-b border-white/[0.07] p-3",children:y.jsxs("div",{className:"relative",children:[y.jsx(eP,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-zinc-600"}),y.jsx("input",{type:"text",value:g,onChange:I=>v(I.target.value),placeholder:"Search pages...",className:"w-full rounded-lg border border-white/[0.07] bg-white/[0.04] py-2 pl-8 pr-3 text-[11px] font-mono text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-[#E43A9C]/50"})]})}),y.jsx("div",{className:"flex-1 overflow-y-auto px-2 py-3",children:N.length>0?N.map(I=>y.jsx(AM,{node:I,depth:0,selectedPage:r,expandedPaths:x,autoExpandedPaths:R,onToggle:U,onSelect:K,onAddToFolder:Y,onDeleteFolder:te},I.path)):y.jsx("p",{className:"py-4 text-center font-mono text-[11px] text-zinc-700",children:"No pages found"})}),y.jsx("div",{className:"border-t border-white/[0.07] p-3",children:y.jsxs("div",{className:"space-y-2",children:[y.jsx("input",{ref:j,type:"text",value:p,onChange:I=>f(I.target.value),onKeyDown:I=>{I.key==="Enter"&&Q(),I.key==="Escape"&&f("")},placeholder:"folder/new-page",className:"w-full rounded-lg border border-white/[0.07] bg-white/[0.04] px-3 py-2 text-[11px] font-mono text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-[#E43A9C]/50"}),y.jsx(za,{onClick:Q,disabled:!p.trim()||b,className:"w-full justify-center px-3 py-2",children:b?y.jsxs(y.Fragment,{children:[y.jsx(js,{size:13,className:"animate-spin"})," Creating..."]}):y.jsxs(y.Fragment,{children:[y.jsx(zw,{size:13})," Add Page"]})})]})})]}),y.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:r?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-white/[0.07] px-6",children:[y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate font-mono text-sm text-zinc-100",children:J}),y.jsxs("p",{className:"truncate font-mono text-[11px] text-zinc-500",children:[r,".md"]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[o?y.jsxs(y.Fragment,{children:[y.jsxs(za,{onClick:W,className:"px-3 py-1.5",children:[y.jsx(Bw,{size:12})," Save"]}),y.jsx(_i,{onClick:()=>{c(!1),d(i)},className:"px-3 py-1.5",children:"Cancel"})]}):y.jsxs(_i,{onClick:()=>{c(!0),d(i)},className:"px-3 py-1.5",children:[y.jsx(Ub,{size:12})," Edit"]}),y.jsxs(zf,{onClick:X,className:"px-3 py-1.5",children:[y.jsx(Ma,{size:12})," Delete"]})]})]}),y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o?y.jsx("textarea",{value:u,onChange:I=>d(I.target.value),className:"h-full min-h-[320px] w-full resize-none rounded-xl border border-white/[0.07] bg-[#181818] p-4 font-mono text-sm text-zinc-300 outline-none focus:border-[#E43A9C]/50"}):y.jsx("div",{className:"mx-auto max-w-4xl",children:y.jsx("div",{className:"prose-io text-sm text-zinc-300",dangerouslySetInnerHTML:{__html:nt.parse(i)}})})})]}):y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsxs("div",{className:"text-center",children:[y.jsx(KN,{size:48,className:"mx-auto mb-3 text-zinc-800"}),y.jsx("p",{className:"font-mono text-[11px] text-zinc-700",children:"Select a page to view"})]})})}),A&&y.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:y.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-white/[0.07] bg-[#1a1a1a] p-6 shadow-2xl",children:[y.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-100",children:"Delete directory?"}),y.jsxs("p",{className:"mb-4 text-xs text-zinc-400",children:["This will permanently delete ",y.jsx("span",{className:"font-mono text-zinc-200",children:A})," and all its contents."]}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx(_i,{onClick:()=>O(null),className:"px-3 py-1.5",children:"Cancel"}),y.jsxs(zf,{onClick:H,className:"px-3 py-1.5",children:[y.jsx(Ma,{size:12})," Delete"]})]})]})})]})}function Hne({children:t}){const{session:e,supabase:r,loading:n}=op();return n?y.jsx("div",{className:"min-h-screen flex items-center justify-center text-[var(--color-muted-foreground)]",children:"Loading..."}):r?e?y.jsx(y.Fragment,{children:t}):y.jsx(gq,{}):y.jsx(y.Fragment,{children:t})}function Wne(){const{pathname:t}=ti(),e=t==="/"||t==="/chat"||t.startsWith("/chat/");return y.jsxs(y.Fragment,{children:[y.jsx(yD,{children:y.jsxs(nn,{element:y.jsx(KU,{}),children:[y.jsx(nn,{index:!0,element:y.jsx(VU,{})}),y.jsx(nn,{path:"squads",element:y.jsx($g,{})}),y.jsx(nn,{path:"squads/:name",element:y.jsx($g,{})}),y.jsx(nn,{path:"squads/:name/instances/:instanceId",element:y.jsx($g,{})}),y.jsx(nn,{path:"feed",element:y.jsx(mq,{})}),y.jsx(nn,{path:"skills",element:y.jsx(Aq,{})}),y.jsx(nn,{path:"schedules",element:y.jsx(bq,{})}),y.jsx(nn,{path:"wiki",element:y.jsx(Fne,{})}),y.jsx(nn,{path:"settings",element:y.jsx(Sq,{})}),y.jsx(nn,{path:"usage",element:y.jsx(Bne,{})}),y.jsx(nn,{path:"*",element:y.jsx(pD,{to:"/",replace:!0})})]})}),!e&&y.jsx(Xz,{})]})}function Gne(){return y.jsx(HU,{children:y.jsx(Hne,{children:y.jsx(Y4,{children:y.jsx(sz,{children:y.jsx(Wne,{})})})})})}pL.createRoot(document.getElementById("root")).render(y.jsx(P.StrictMode,{children:y.jsxs(UD,{children:[y.jsx(Gne,{}),y.jsx(k5,{theme:"dark",position:"bottom-right"})]})}));
505
- //# sourceMappingURL=index-CnXqSrcz.js.map
505
+ //# sourceMappingURL=index-BtGuO--O.js.map