tokmon 0.19.4 → 0.19.5

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.
@@ -1,2 +1,2 @@
1
- import{R as m,r as nt,j as d,P as xt,E as At,f as at,a as Pt,b as Y,S as wt}from"./index-CYYYW9md.js";import{i as it,c as ot,D as Nt,f as Qt,E as Zt,L as K,a as $,C as rt,A as Tt,b as T,d as mt,e as Z,h as $t,g as It,j as st,u as Rt,G as Bt,k as lt,m as et,l as X,n as te,o as Ft,X as H,Y as tt,p as Wt,q as Ot,r as jt,R as St,s as ct,t as ut,v as V,T as pt,w as ft,x as vt}from"./chart-BcpjNTdg.js";var ee=["type","layout","connectNulls","ref"],re=["key"];function U(t){"@babel/helpers - typeof";return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},U(t)}function kt(t,r){if(t==null)return{};var n=ne(t,r),e,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a<o.length;a++)e=o[a],!(r.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}function ne(t,r){if(t==null)return{};var n={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(r.indexOf(e)>=0)continue;n[e]=t[e]}return n}function Q(){return Q=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t},Q.apply(this,arguments)}function Et(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,e)}return n}function _(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Et(Object(n),!0).forEach(function(e){N(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Et(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function G(t){return se(t)||oe(t)||ie(t)||ae()}function ae(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{R as m,r as nt,j as d,P as xt,E as At,f as at,a as Pt,b as Y,S as wt}from"./index-mgYwFiX4.js";import{i as it,c as ot,D as Nt,f as Qt,E as Zt,L as K,a as $,C as rt,A as Tt,b as T,d as mt,e as Z,h as $t,g as It,j as st,u as Rt,G as Bt,k as lt,m as et,l as X,n as te,o as Ft,X as H,Y as tt,p as Wt,q as Ot,r as jt,R as St,s as ct,t as ut,v as V,T as pt,w as ft,x as vt}from"./chart-C6EyXc8D.js";var ee=["type","layout","connectNulls","ref"],re=["key"];function U(t){"@babel/helpers - typeof";return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},U(t)}function kt(t,r){if(t==null)return{};var n=ne(t,r),e,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a<o.length;a++)e=o[a],!(r.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}function ne(t,r){if(t==null)return{};var n={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(r.indexOf(e)>=0)continue;n[e]=t[e]}return n}function Q(){return Q=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t},Q.apply(this,arguments)}function Et(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,e)}return n}function _(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Et(Object(n),!0).forEach(function(e){N(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Et(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function G(t){return se(t)||oe(t)||ie(t)||ae()}function ae(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ie(t,r){if(t){if(typeof t=="string")return yt(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yt(t,r)}}function oe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function se(t){if(Array.isArray(t))return yt(t)}function yt(t,r){(r==null||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}function le(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function Dt(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,Kt(e.key),e)}}function ce(t,r,n){return r&&Dt(t.prototype,r),n&&Dt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ue(t,r,n){return r=dt(r),pe(t,Mt()?Reflect.construct(r,n||[],dt(t).constructor):r.apply(t,n))}function pe(t,r){if(r&&(U(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fe(t)}function fe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Mt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Mt=function(){return!!t})()}function dt(t){return dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},dt(t)}function de(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&bt(t,r)}function bt(t,r){return bt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,a){return e.__proto__=a,e},bt(t,r)}function N(t,r,n){return r=Kt(r),r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function Kt(t){var r=he(t,"string");return U(r)=="symbol"?r:r+""}function he(t,r){if(U(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var e=n.call(t,r);if(U(e)!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var J=(function(t){function r(){var n;le(this,r);for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];return n=ue(this,r,[].concat(a)),N(n,"state",{isAnimationFinished:!0,totalLength:0}),N(n,"generateSimpleStrokeDasharray",function(i,s){return"".concat(s,"px ").concat(i-s,"px")}),N(n,"getStrokeDasharray",function(i,s,l){var c=l.reduce(function(P,A){return P+A});if(!c)return n.generateSimpleStrokeDasharray(s,i);for(var f=Math.floor(i/c),u=i%c,h=s-i,y=[],p=0,v=0;p<l.length;v+=l[p],++p)if(v+l[p]>u){y=[].concat(G(l.slice(0,p)),[u-v]);break}var b=y.length%2===0?[0,h]:[h];return[].concat(G(r.repeat(l,f)),G(y),b).map(function(P){return"".concat(P,"px")}).join(", ")}),N(n,"id",Rt("recharts-line-")),N(n,"pathRef",function(i){n.mainCurve=i}),N(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),N(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return de(r,t),ce(r,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:"getTotalLength",value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(e,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,i=o.points,s=o.xAxis,l=o.yAxis,c=o.layout,f=o.children,u=Qt(f,Zt);if(!u)return null;var h=function(v,b){return{x:v.x,y:v.y,value:v.value,errorVal:st(v.payload,b)}},y={clipPath:e?"url(#clipPath-".concat(a,")"):null};return m.createElement(K,y,u.map(function(p){return m.cloneElement(p,{key:"bar-".concat(p.props.dataKey),data:i,xAxis:s,yAxis:l,layout:c,dataPointFormatter:h})}))}},{key:"renderDots",value:function(e,a,o){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var s=this.props,l=s.dot,c=s.points,f=s.dataKey,u=$(this.props,!1),h=$(l,!0),y=c.map(function(v,b){var P=_(_(_({key:"dot-".concat(b),r:3},u),h),{},{index:b,cx:v.x,cy:v.y,value:v.value,dataKey:f,payload:v.payload,points:c});return r.renderDotItem(l,P)}),p={clipPath:e?"url(#clipPath-".concat(a?"":"dots-").concat(o,")"):null};return m.createElement(K,Q({className:"recharts-line-dots",key:"dots"},p),y)}},{key:"renderCurveStatically",value:function(e,a,o,i){var s=this.props,l=s.type,c=s.layout,f=s.connectNulls;s.ref;var u=kt(s,ee),h=_(_(_({},$(u,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(o,")"):null,points:e},i),{},{type:l,layout:c,connectNulls:f});return m.createElement(rt,Q({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(e,a){var o=this,i=this.props,s=i.points,l=i.strokeDasharray,c=i.isAnimationActive,f=i.animationBegin,u=i.animationDuration,h=i.animationEasing,y=i.animationId,p=i.animateNewValues,v=i.width,b=i.height,P=this.state,A=P.prevPoints,k=P.totalLength;return m.createElement(Tt,{begin:f,duration:u,isActive:c,easing:h,from:{t:0},to:{t:1},key:"line-".concat(y),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(x){var g=x.t;if(A){var O=A.length/s.length,S=s.map(function(j,R){var F=Math.floor(R*O);if(A[F]){var W=A[F],L=T(W.x,j.x),Ut=T(W.y,j.y);return _(_({},j),{},{x:L(g),y:Ut(g)})}if(p){var qt=T(v*2,j.x),Jt=T(b/2,j.y);return _(_({},j),{},{x:qt(g),y:Jt(g)})}return _(_({},j),{},{x:j.x,y:j.y})});return o.renderCurveStatically(S,e,a)}var w=T(0,k),C=w(g),E;if(l){var D="".concat(l).split(/[,\s]+/gim).map(function(j){return parseFloat(j)});E=o.getStrokeDasharray(C,k,D)}else E=o.generateSimpleStrokeDasharray(k,C);return o.renderCurveStatically(s,e,a,{strokeDasharray:E})})}},{key:"renderCurve",value:function(e,a){var o=this.props,i=o.points,s=o.isAnimationActive,l=this.state,c=l.prevPoints,f=l.totalLength;return s&&i&&i.length&&(!c&&f>0||!mt(c,i))?this.renderCurveWithAnimation(e,a):this.renderCurveStatically(i,e,a)}},{key:"render",value:function(){var e,a=this.props,o=a.hide,i=a.dot,s=a.points,l=a.className,c=a.xAxis,f=a.yAxis,u=a.top,h=a.left,y=a.width,p=a.height,v=a.isAnimationActive,b=a.id;if(o||!s||!s.length)return null;var P=this.state.isAnimationFinished,A=s.length===1,k=ot("recharts-line",l),x=c&&c.allowDataOverflow,g=f&&f.allowDataOverflow,O=x||g,S=Z(b)?this.id:b,w=(e=$(i,!1))!==null&&e!==void 0?e:{r:3,strokeWidth:2},C=w.r,E=C===void 0?3:C,D=w.strokeWidth,j=D===void 0?2:D,R=$t(i)?i:{},F=R.clipDot,W=F===void 0?!0:F,L=E*2+j;return m.createElement(K,{className:k},x||g?m.createElement("defs",null,m.createElement("clipPath",{id:"clipPath-".concat(S)},m.createElement("rect",{x:x?h:h-y/2,y:g?u:u-p/2,width:x?y:y*2,height:g?p:p*2})),!W&&m.createElement("clipPath",{id:"clipPath-dots-".concat(S)},m.createElement("rect",{x:h-L/2,y:u-L/2,width:y+L,height:p+L}))):null,!A&&this.renderCurve(O,S),this.renderErrorBar(O,S),(A||i)&&this.renderDots(O,W,S),(!v||P)&&It.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(e,a){return e.animationId!==a.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:a.curPoints}:e.points!==a.curPoints?{curPoints:e.points}:null}},{key:"repeat",value:function(e,a){for(var o=e.length%2!==0?[].concat(G(e),[0]):e,i=[],s=0;s<a;++s)i=[].concat(G(i),G(o));return i}},{key:"renderDotItem",value:function(e,a){var o;if(m.isValidElement(e))o=m.cloneElement(e,a);else if(it(e))o=e(a);else{var i=a.key,s=kt(a,re),l=ot("recharts-line-dot",typeof e!="boolean"?e.className:"");o=m.createElement(Nt,Q({key:i},s,{className:l}))}return o}}])})(nt.PureComponent);N(J,"displayName","Line");N(J,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Bt.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});N(J,"getComposedData",function(t){var r=t.props,n=t.xAxis,e=t.yAxis,a=t.xAxisTicks,o=t.yAxisTicks,i=t.dataKey,s=t.bandSize,l=t.displayedData,c=t.offset,f=r.layout,u=l.map(function(h,y){var p=st(h,i);return f==="horizontal"?{x:lt({axis:n,ticks:a,bandSize:s,entry:h,index:y}),y:Z(p)?null:e.scale(p),value:p,payload:h}:{x:Z(p)?null:n.scale(p),y:lt({axis:e,ticks:o,bandSize:s,entry:h,index:y}),value:p,payload:h}});return _({points:u,layout:f},c)});var ve=["layout","type","stroke","connectNulls","isRange","ref"],me=["key"],zt;function q(t){"@babel/helpers - typeof";return q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},q(t)}function Vt(t,r){if(t==null)return{};var n=ye(t,r),e,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a<o.length;a++)e=o[a],!(r.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}function ye(t,r){if(t==null)return{};var n={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(r.indexOf(e)>=0)continue;n[e]=t[e]}return n}function z(){return z=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t},z.apply(this,arguments)}function _t(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,e)}return n}function M(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?_t(Object(n),!0).forEach(function(e){I(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_t(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function be(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function Ct(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,Xt(e.key),e)}}function ge(t,r,n){return r&&Ct(t.prototype,r),n&&Ct(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xe(t,r,n){return r=ht(r),Ae(t,Gt()?Reflect.construct(r,n||[],ht(t).constructor):r.apply(t,n))}function Ae(t,r){if(r&&(q(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pe(t)}function Pe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Gt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Gt=function(){return!!t})()}function ht(t){return ht=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ht(t)}function Oe(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&gt(t,r)}function gt(t,r){return gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,a){return e.__proto__=a,e},gt(t,r)}function I(t,r,n){return r=Xt(r),r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function Xt(t){var r=je(t,"string");return q(r)=="symbol"?r:r+""}function je(t,r){if(q(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var e=n.call(t,r);if(q(e)!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var B=(function(t){function r(){var n;be(this,r);for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];return n=xe(this,r,[].concat(a)),I(n,"state",{isAnimationFinished:!0}),I(n,"id",Rt("recharts-area-")),I(n,"handleAnimationEnd",function(){var i=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),it(i)&&i()}),I(n,"handleAnimationStart",function(){var i=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),it(i)&&i()}),n}return Oe(r,t),ge(r,[{key:"renderDots",value:function(e,a,o){var i=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(i&&!s)return null;var l=this.props,c=l.dot,f=l.points,u=l.dataKey,h=$(this.props,!1),y=$(c,!0),p=f.map(function(b,P){var A=M(M(M({key:"dot-".concat(P),r:3},h),y),{},{index:P,cx:b.x,cy:b.y,dataKey:u,value:b.value,payload:b.payload,points:f});return r.renderDotItem(c,A)}),v={clipPath:e?"url(#clipPath-".concat(a?"":"dots-").concat(o,")"):null};return m.createElement(K,z({className:"recharts-area-dots"},v),p)}},{key:"renderHorizontalRect",value:function(e){var a=this.props,o=a.baseLine,i=a.points,s=a.strokeWidth,l=i[0].x,c=i[i.length-1].x,f=e*Math.abs(l-c),u=et(i.map(function(h){return h.y||0}));return X(o)&&typeof o=="number"?u=Math.max(o,u):o&&Array.isArray(o)&&o.length&&(u=Math.max(et(o.map(function(h){return h.y||0})),u)),X(u)?m.createElement("rect",{x:l<c?l:l-f,y:0,width:f,height:Math.floor(u+(s?parseInt("".concat(s),10):1))}):null}},{key:"renderVerticalRect",value:function(e){var a=this.props,o=a.baseLine,i=a.points,s=a.strokeWidth,l=i[0].y,c=i[i.length-1].y,f=e*Math.abs(l-c),u=et(i.map(function(h){return h.x||0}));return X(o)&&typeof o=="number"?u=Math.max(o,u):o&&Array.isArray(o)&&o.length&&(u=Math.max(et(o.map(function(h){return h.x||0})),u)),X(u)?m.createElement("rect",{x:0,y:l<c?l:l-f,width:u+(s?parseInt("".concat(s),10):1),height:Math.floor(f)}):null}},{key:"renderClipRect",value:function(e){var a=this.props.layout;return a==="vertical"?this.renderVerticalRect(e):this.renderHorizontalRect(e)}},{key:"renderAreaStatically",value:function(e,a,o,i){var s=this.props,l=s.layout,c=s.type,f=s.stroke,u=s.connectNulls,h=s.isRange;s.ref;var y=Vt(s,ve);return m.createElement(K,{clipPath:o?"url(#clipPath-".concat(i,")"):null},m.createElement(rt,z({},$(y,!0),{points:e,connectNulls:u,type:c,baseLine:a,layout:l,stroke:"none",className:"recharts-area-area"})),f!=="none"&&m.createElement(rt,z({},$(this.props,!1),{className:"recharts-area-curve",layout:l,type:c,connectNulls:u,fill:"none",points:e})),f!=="none"&&h&&m.createElement(rt,z({},$(this.props,!1),{className:"recharts-area-curve",layout:l,type:c,connectNulls:u,fill:"none",points:a})))}},{key:"renderAreaWithAnimation",value:function(e,a){var o=this,i=this.props,s=i.points,l=i.baseLine,c=i.isAnimationActive,f=i.animationBegin,u=i.animationDuration,h=i.animationEasing,y=i.animationId,p=this.state,v=p.prevPoints,b=p.prevBaseLine;return m.createElement(Tt,{begin:f,duration:u,isActive:c,easing:h,from:{t:0},to:{t:1},key:"area-".concat(y),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(P){var A=P.t;if(v){var k=v.length/s.length,x=s.map(function(w,C){var E=Math.floor(C*k);if(v[E]){var D=v[E],j=T(D.x,w.x),R=T(D.y,w.y);return M(M({},w),{},{x:j(A),y:R(A)})}return w}),g;if(X(l)&&typeof l=="number"){var O=T(b,l);g=O(A)}else if(Z(l)||te(l)){var S=T(b,0);g=S(A)}else g=l.map(function(w,C){var E=Math.floor(C*k);if(b[E]){var D=b[E],j=T(D.x,w.x),R=T(D.y,w.y);return M(M({},w),{},{x:j(A),y:R(A)})}return w});return o.renderAreaStatically(x,g,e,a)}return m.createElement(K,null,m.createElement("defs",null,m.createElement("clipPath",{id:"animationClipPath-".concat(a)},o.renderClipRect(A))),m.createElement(K,{clipPath:"url(#animationClipPath-".concat(a,")")},o.renderAreaStatically(s,l,e,a)))})}},{key:"renderArea",value:function(e,a){var o=this.props,i=o.points,s=o.baseLine,l=o.isAnimationActive,c=this.state,f=c.prevPoints,u=c.prevBaseLine,h=c.totalLength;return l&&i&&i.length&&(!f&&h>0||!mt(f,i)||!mt(u,s))?this.renderAreaWithAnimation(e,a):this.renderAreaStatically(i,s,e,a)}},{key:"render",value:function(){var e,a=this.props,o=a.hide,i=a.dot,s=a.points,l=a.className,c=a.top,f=a.left,u=a.xAxis,h=a.yAxis,y=a.width,p=a.height,v=a.isAnimationActive,b=a.id;if(o||!s||!s.length)return null;var P=this.state.isAnimationFinished,A=s.length===1,k=ot("recharts-area",l),x=u&&u.allowDataOverflow,g=h&&h.allowDataOverflow,O=x||g,S=Z(b)?this.id:b,w=(e=$(i,!1))!==null&&e!==void 0?e:{r:3,strokeWidth:2},C=w.r,E=C===void 0?3:C,D=w.strokeWidth,j=D===void 0?2:D,R=$t(i)?i:{},F=R.clipDot,W=F===void 0?!0:F,L=E*2+j;return m.createElement(K,{className:k},x||g?m.createElement("defs",null,m.createElement("clipPath",{id:"clipPath-".concat(S)},m.createElement("rect",{x:x?f:f-y/2,y:g?c:c-p/2,width:x?y:y*2,height:g?p:p*2})),!W&&m.createElement("clipPath",{id:"clipPath-dots-".concat(S)},m.createElement("rect",{x:f-L/2,y:c-L/2,width:y+L,height:p+L}))):null,A?null:this.renderArea(O,S),(i||A)&&this.renderDots(O,W,S),(!v||P)&&It.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(e,a){return e.animationId!==a.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:a.curPoints,prevBaseLine:a.curBaseLine}:e.points!==a.curPoints||e.baseLine!==a.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null}}])})(nt.PureComponent);zt=B;I(B,"displayName","Area");I(B,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Bt.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});I(B,"getBaseValue",function(t,r,n,e){var a=t.layout,o=t.baseValue,i=r.props.baseValue,s=i??o;if(X(s)&&typeof s=="number")return s;var l=a==="horizontal"?e:n,c=l.scale.domain();if(l.type==="number"){var f=Math.max(c[0],c[1]),u=Math.min(c[0],c[1]);return s==="dataMin"?u:s==="dataMax"||f<0?f:Math.max(Math.min(c[0],c[1]),0)}return s==="dataMin"?c[0]:s==="dataMax"?c[1]:c[0]});I(B,"getComposedData",function(t){var r=t.props,n=t.item,e=t.xAxis,a=t.yAxis,o=t.xAxisTicks,i=t.yAxisTicks,s=t.bandSize,l=t.dataKey,c=t.stackedData,f=t.dataStartIndex,u=t.displayedData,h=t.offset,y=r.layout,p=c&&c.length,v=zt.getBaseValue(r,n,e,a),b=y==="horizontal",P=!1,A=u.map(function(x,g){var O;p?O=c[f+g]:(O=st(x,l),Array.isArray(O)?P=!0:O=[v,O]);var S=O[1]==null||p&&st(x,l)==null;return b?{x:lt({axis:e,ticks:o,bandSize:s,entry:x,index:g}),y:S?null:a.scale(O[1]),value:O,payload:x}:{x:S?null:e.scale(O[1]),y:lt({axis:a,ticks:i,bandSize:s,entry:x,index:g}),value:O,payload:x}}),k;return p||P?k=A.map(function(x){var g=Array.isArray(x.value)?x.value[0]:null;return b?{x:x.x,y:g!=null&&x.y!=null?a.scale(g):null}:{x:g!=null?e.scale(g):null,y:x.y}}):k=b?a.scale(v):e.scale(v),M({points:A,baseLine:k,layout:y,isRange:P},h)});I(B,"renderDotItem",function(t,r){var n;if(m.isValidElement(t))n=m.cloneElement(t,r);else if(it(t))n=t(r);else{var e=ot("recharts-area-dot",typeof t!="boolean"?t.className:""),a=r.key,o=Vt(r,me);n=m.createElement(Nt,z({},o,{key:a,className:e}))}return n});var Yt=Ft({chartName:"LineChart",GraphicalChild:J,axisComponents:[{axisType:"xAxis",AxisComp:H},{axisType:"yAxis",AxisComp:tt}],formatAxisMap:Wt}),Ht=Ft({chartName:"AreaChart",GraphicalChild:B,axisComponents:[{axisType:"xAxis",AxisComp:H},{axisType:"yAxis",AxisComp:tt}],formatAxisMap:Wt});const Se=[{value:"linear",label:"lin"},{value:"log",label:"log"}],we=[{value:"combined",label:"merged"},{value:"byProvider",label:"split"}],Lt="flex items-center overflow-hidden rounded border border-line text-[10px]",ke=vt(t=>{const r=t.filter(e=>e.dataKey!=="total"&&(e.value??0)>0).map(e=>({label:String(e.name??e.dataKey),value:Y(e.value??0),color:e.color})),n=t.reduce((e,a)=>e+(a.dataKey==="total"?0:a.value??0),0);return r.length>1&&r.push({label:"total",value:Y(n),color:"var(--color-fg-bright)"}),r}),Ee=vt(t=>{var r;return[{label:"total",value:Y(((r=t[0])==null?void 0:r.value)??0),color:"var(--color-cost)"}]});function Ne({derived:t,title:r="cost over time",height:n=260,periodLabel:e,heightClass:a}){const o=Ot(),i=t.byProvider,s=i.length>1,[l,c]=nt.useState("linear"),[f,u]=nt.useState(s?"byProvider":"combined"),h=t.timeline.map(p=>{const v={date:p.date,total:p.total,...p.byProvider};if(l==="log")for(const b of Object.keys(v))b!=="date"&&v[b]===0&&(v[b]=null);return v}),y=d.jsx(tt,{...V,width:52,tickFormatter:Pt,scale:l,allowDataOverflow:l==="log",domain:l==="log"?[.1,"auto"]:[0,"auto"]});return d.jsx(xt,{title:r,titleTag:e,captureName:"cost-over-time",right:d.jsxs("div",{className:"flex items-center gap-1.5",children:[s&&d.jsx(wt,{options:we,value:f,onChange:u,size:"xs",containerClassName:Lt,ariaLabel:"combine providers"}),d.jsx(wt,{options:Se,value:l,onChange:c,size:"xs",containerClassName:Lt,ariaLabel:"value scale"})]}),children:h.length===0?d.jsx(At,{children:"no spend in period"}):d.jsx(jt,{height:n,heightClass:a,children:d.jsx(St,{children:f==="combined"?d.jsxs(Ht,{data:h,margin:{top:8,right:8,left:0,bottom:0},children:[d.jsx("defs",{children:d.jsxs("linearGradient",{id:"g-cost",x1:"0",y1:"0",x2:"0",y2:"1",children:[d.jsx("stop",{offset:"0%",stopColor:"var(--color-cost)",stopOpacity:.16}),d.jsx("stop",{offset:"100%",stopColor:"var(--color-cost)",stopOpacity:.02})]})}),d.jsx(ct,{...ut}),d.jsx(H,{dataKey:"date",...V,tickFormatter:at,minTickGap:28}),y,d.jsx(pt,{content:Ee,cursor:ft}),d.jsx(B,{type:"monotone",dataKey:"total",stroke:"var(--color-cost)",strokeWidth:1.8,fill:"url(#g-cost)",connectNulls:!0,isAnimationActive:o,animationDuration:350})]}):d.jsxs(Yt,{data:h,margin:{top:8,right:8,left:0,bottom:0},children:[d.jsx(ct,{...ut}),d.jsx(H,{dataKey:"date",...V,tickFormatter:at,minTickGap:28}),y,d.jsx(pt,{content:ke,cursor:ft}),i.map(p=>d.jsx(J,{type:"monotone",dataKey:p.id,name:p.name,stroke:p.color,strokeWidth:1.6,dot:!1,connectNulls:!0,isAnimationActive:o,animationDuration:350},p.id))]})})})})}const De=vt(t=>{var r;return[{label:"cumulative",value:Y(((r=t[0])==null?void 0:r.value)??0),color:"var(--color-cost)"}]});function Te({derived:t,height:r=220,periodLabel:n}){const e=Ot(),a=t.cumulative;return d.jsx(xt,{title:"cumulative spend",titleTag:n,captureName:"cumulative",children:a.length===0?d.jsx(At,{children:"no spend in period"}):d.jsx(jt,{height:r,children:d.jsx(St,{children:d.jsxs(Yt,{data:a,margin:{top:8,right:8,left:0,bottom:0},children:[d.jsx(ct,{...ut}),d.jsx(H,{dataKey:"date",...V,tickFormatter:at,minTickGap:28}),d.jsx(tt,{...V,width:52,tickFormatter:Pt}),d.jsx(pt,{content:De,cursor:ft}),d.jsx(J,{type:"monotone",dataKey:"total",stroke:"var(--color-cost)",strokeWidth:1.8,dot:!1,isAnimationActive:e,animationDuration:350})]})})})})}const _e=vt(t=>{var r;return[{label:"cache saved",value:Y(((r=t[0])==null?void 0:r.value)??0),color:"var(--color-positive)"}]});function $e({derived:t,height:r=220,periodLabel:n}){const e=Ot(),a=t.cacheSavingsSeries,o=t.totals.cacheSavings;return d.jsx(xt,{title:"cache savings",titleTag:n,captureName:"cache-savings",right:d.jsx("span",{className:"tnum text-xs text-positive",children:Y(o)}),children:a.length===0?d.jsx(At,{children:"no cache reads in period"}):d.jsx(jt,{height:r,children:d.jsx(St,{children:d.jsxs(Ht,{data:a,margin:{top:8,right:8,left:0,bottom:0},children:[d.jsx("defs",{children:d.jsxs("linearGradient",{id:"g-save",x1:"0",y1:"0",x2:"0",y2:"1",children:[d.jsx("stop",{offset:"0%",stopColor:"var(--color-positive)",stopOpacity:.18}),d.jsx("stop",{offset:"100%",stopColor:"var(--color-positive)",stopOpacity:.02})]})}),d.jsx(ct,{...ut}),d.jsx(H,{dataKey:"date",...V,tickFormatter:at,minTickGap:28}),d.jsx(tt,{...V,width:52,tickFormatter:Pt}),d.jsx(pt,{content:_e,cursor:ft}),d.jsx(B,{type:"monotone",dataKey:"value",stroke:"var(--color-positive)",strokeWidth:1.6,fill:"url(#g-save)",isAnimationActive:e,animationDuration:350})]})})})})}export{$e as CacheSavings,Ne as CostTimeline,Te as CumulativeSpend};
@@ -11,8 +11,8 @@
11
11
  // Apply saved theme before first paint to avoid a flash. Default: dark.
12
12
  try { if (localStorage.getItem('tokmon-theme') === 'light') document.documentElement.classList.add('light') } catch (e) {}
13
13
  </script>
14
- <script type="module" crossorigin src="./assets/index-CYYYW9md.js"></script>
15
- <link rel="stylesheet" crossorigin href="./assets/index-DSET6l6i.css">
14
+ <script type="module" crossorigin src="./assets/index-mgYwFiX4.js"></script>
15
+ <link rel="stylesheet" crossorigin href="./assets/index-CN07mDjO.css">
16
16
  </head>
17
17
  <body>
18
18
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokmon",
3
- "version": "0.19.4",
3
+ "version": "0.19.5",
4
4
  "description": "Terminal + web dashboard for Claude Code, Codex, Cursor, opencode, pi, Copilot, Gemini & more — usage, limits, and costs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,4 +0,0 @@
1
- import{R as m,g as Qe,r as ue,j as u,P as fe,E as pe,a as Ye,s as J,b as G,c as z,d as Je,T as re}from"./index-CYYYW9md.js";import{c as N,a as A,y as et,z as xt,B as tt,F as At,i as C,H as Oe,I as S,L as _,J as rt,K as Pe,M as nt,D as kt,C as Ot,e as W,j as F,S as Pt,A as jt,N as _t,b as De,d as wt,l as M,g as je,u as Tt,G as St,O as ie,f as Et,P as _e,Q as Rt,U as ne,V as Be,o as it,W as we,X as Te,Y as Se,p as Nt,Z as It,q as Ee,_ as at,r as Re,R as Ne,s as ot,t as st,v as oe,T as ct,x as Ie}from"./chart-BcpjNTdg.js";var Lt=["points","className","baseLinePoints","connectNulls"];function V(){return V=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},V.apply(this,arguments)}function $t(r,e){if(r==null)return{};var n=Ct(r,e),t,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)t=a[i],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(r,t)&&(n[t]=r[t])}return n}function Ct(r,e){if(r==null)return{};var n={};for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(e.indexOf(t)>=0)continue;n[t]=r[t]}return n}function Ke(r){return Ft(r)||Kt(r)||Bt(r)||Dt()}function Dt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bt(r,e){if(r){if(typeof r=="string")return be(r,e);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor&&(n=r.constructor.name),n==="Map"||n==="Set")return Array.from(r);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return be(r,e)}}function Kt(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Ft(r){if(Array.isArray(r))return be(r)}function be(r,e){(e==null||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}var Fe=function(e){return e&&e.x===+e.x&&e.y===+e.y},Mt=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(t){Fe(t)?n[n.length-1].push(t):n[n.length-1].length>0&&n.push([])}),Fe(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Q=function(e,n){var t=Mt(e);n&&(t=[t.reduce(function(a,o){return[].concat(Ke(a),Ke(o))},[])]);var i=t.map(function(a){return a.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return t.length===1?"".concat(i,"Z"):i},Vt=function(e,n,t){var i=Q(e,t);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(Q(n.reverse(),t).slice(1))},qt=function(e){var n=e.points,t=e.className,i=e.baseLinePoints,a=e.connectNulls,o=$t(e,Lt);if(!n||!n.length)return null;var l=N("recharts-polygon",t);if(i&&i.length){var c=o.stroke&&o.stroke!=="none",s=Vt(n,i,a);return m.createElement("g",{className:l},m.createElement("path",V({},A(o,!0),{fill:s.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:s})),c?m.createElement("path",V({},A(o,!0),{fill:"none",d:Q(n,a)})):null,c?m.createElement("path",V({},A(o,!0),{fill:"none",d:Q(i,a)})):null)}var f=Q(n,a);return m.createElement("path",V({},A(o,!0),{fill:f.slice(-1)==="Z"?o.fill:"none",className:l,d:f}))},ye,Me;function zt(){if(Me)return ye;Me=1;var r=et(),e=xt(),n=tt();function t(i,a){return i&&i.length?r(i,n(a,2),e):void 0}return ye=t,ye}var Wt=zt();const Gt=Qe(Wt);var ge,Ve;function Ht(){if(Ve)return ge;Ve=1;var r=et(),e=tt(),n=At();function t(i,a){return i&&i.length?r(i,e(a,2),n):void 0}return ge=t,ge}var Zt=Ht();const Ut=Qe(Zt);var Xt=["cx","cy","angle","ticks","axisLine"],Qt=["ticks","tick","angle","tickFormatter","stroke"];function H(r){"@babel/helpers - typeof";return H=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},H(r)}function Y(){return Y=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},Y.apply(this,arguments)}function qe(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),n.push.apply(n,t)}return n}function L(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qe(Object(n),!0).forEach(function(t){de(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):qe(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function ze(r,e){if(r==null)return{};var n=Yt(r,e),t,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)t=a[i],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(r,t)&&(n[t]=r[t])}return n}function Yt(r,e){if(r==null)return{};var n={};for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(e.indexOf(t)>=0)continue;n[t]=r[t]}return n}function Jt(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function We(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,ut(t.key),t)}}function er(r,e,n){return e&&We(r.prototype,e),n&&We(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function tr(r,e,n){return e=se(e),rr(r,lt()?Reflect.construct(e,n||[],se(r).constructor):e.apply(r,n))}function rr(r,e){if(e&&(H(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nr(r)}function nr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function lt(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lt=function(){return!!r})()}function se(r){return se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},se(r)}function ir(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&xe(r,e)}function xe(r,e){return xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},xe(r,e)}function de(r,e,n){return e=ut(e),e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function ut(r){var e=ar(r,"string");return H(e)=="symbol"?e:e+""}function ar(r,e){if(H(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,e);if(H(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var me=(function(r){function e(){return Jt(this,e),tr(this,e,arguments)}return ir(e,r),er(e,[{key:"getTickValueCoord",value:function(t){var i=t.coordinate,a=this.props,o=a.angle,l=a.cx,c=a.cy;return S(l,c,i,o)}},{key:"getTickTextAnchor",value:function(){var t=this.props.orientation,i;switch(t){case"left":i="end";break;case"right":i="start";break;default:i="middle";break}return i}},{key:"getViewBox",value:function(){var t=this.props,i=t.cx,a=t.cy,o=t.angle,l=t.ticks,c=Gt(l,function(f){return f.coordinate||0}),s=Ut(l,function(f){return f.coordinate||0});return{cx:i,cy:a,startAngle:o,endAngle:o,innerRadius:s.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var t=this.props,i=t.cx,a=t.cy,o=t.angle,l=t.ticks,c=t.axisLine,s=ze(t,Xt),f=l.reduce(function(v,p){return[Math.min(v[0],p.coordinate),Math.max(v[1],p.coordinate)]},[1/0,-1/0]),d=S(i,a,f[0],o),y=S(i,a,f[1],o),k=L(L(L({},A(s,!1)),{},{fill:"none"},A(c,!1)),{},{x1:d.x,y1:d.y,x2:y.x,y2:y.y});return m.createElement("line",Y({className:"recharts-polar-radius-axis-line"},k))}},{key:"renderTicks",value:function(){var t=this,i=this.props,a=i.ticks,o=i.tick,l=i.angle,c=i.tickFormatter,s=i.stroke,f=ze(i,Qt),d=this.getTickTextAnchor(),y=A(f,!1),k=A(o,!1),v=a.map(function(p,g){var b=t.getTickValueCoord(p),x=L(L(L(L({textAnchor:d,transform:"rotate(".concat(90-l,", ").concat(b.x,", ").concat(b.y,")")},y),{},{stroke:"none",fill:s},k),{},{index:g},b),{},{payload:p});return m.createElement(_,Y({className:N("recharts-polar-radius-axis-tick",rt(o)),key:"tick-".concat(p.coordinate)},Pe(t.props,p,g)),e.renderTickItem(o,x,c?c(p.value,g):p.value))});return m.createElement(_,{className:"recharts-polar-radius-axis-ticks"},v)}},{key:"render",value:function(){var t=this.props,i=t.ticks,a=t.axisLine,o=t.tick;return!i||!i.length?null:m.createElement(_,{className:N("recharts-polar-radius-axis",this.props.className)},a&&this.renderAxisLine(),o&&this.renderTicks(),nt.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(t,i,a){var o;return m.isValidElement(t)?o=m.cloneElement(t,i):C(t)?o=t(i):o=m.createElement(Oe,Y({},i,{className:"recharts-polar-radius-axis-tick-value"}),a),o}}])})(ue.PureComponent);de(me,"displayName","PolarRadiusAxis");de(me,"axisType","radiusAxis");de(me,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function Z(r){"@babel/helpers - typeof";return Z=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},Z(r)}function D(){return D=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},D.apply(this,arguments)}function Ge(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),n.push.apply(n,t)}return n}function $(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ge(Object(n),!0).forEach(function(t){ve(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function or(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function He(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,pt(t.key),t)}}function sr(r,e,n){return e&&He(r.prototype,e),n&&He(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function cr(r,e,n){return e=ce(e),lr(r,ft()?Reflect.construct(e,n||[],ce(r).constructor):e.apply(r,n))}function lr(r,e){if(e&&(Z(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ur(r)}function ur(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function ft(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ft=function(){return!!r})()}function ce(r){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ce(r)}function fr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&Ae(r,e)}function Ae(r,e){return Ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},Ae(r,e)}function ve(r,e,n){return e=pt(e),e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function pt(r){var e=pr(r,"string");return Z(e)=="symbol"?e:e+""}function pr(r,e){if(Z(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,e);if(Z(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var dr=Math.PI/180,Ze=1e-5,he=(function(r){function e(){return or(this,e),cr(this,e,arguments)}return fr(e,r),sr(e,[{key:"getTickLineCoord",value:function(t){var i=this.props,a=i.cx,o=i.cy,l=i.radius,c=i.orientation,s=i.tickSize,f=s||8,d=S(a,o,l,t.coordinate),y=S(a,o,l+(c==="inner"?-1:1)*f,t.coordinate);return{x1:d.x,y1:d.y,x2:y.x,y2:y.y}}},{key:"getTickTextAnchor",value:function(t){var i=this.props.orientation,a=Math.cos(-t.coordinate*dr),o;return a>Ze?o=i==="outer"?"start":"end":a<-Ze?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var t=this.props,i=t.cx,a=t.cy,o=t.radius,l=t.axisLine,c=t.axisLineType,s=$($({},A(this.props,!1)),{},{fill:"none"},A(l,!1));if(c==="circle")return m.createElement(kt,D({className:"recharts-polar-angle-axis-line"},s,{cx:i,cy:a,r:o}));var f=this.props.ticks,d=f.map(function(y){return S(i,a,o,y.coordinate)});return m.createElement(qt,D({className:"recharts-polar-angle-axis-line"},s,{points:d}))}},{key:"renderTicks",value:function(){var t=this,i=this.props,a=i.ticks,o=i.tick,l=i.tickLine,c=i.tickFormatter,s=i.stroke,f=A(this.props,!1),d=A(o,!1),y=$($({},f),{},{fill:"none"},A(l,!1)),k=a.map(function(v,p){var g=t.getTickLineCoord(v),b=t.getTickTextAnchor(v),x=$($($({textAnchor:b},f),{},{stroke:"none",fill:s},d),{},{index:p,payload:v,x:g.x2,y:g.y2});return m.createElement(_,D({className:N("recharts-polar-angle-axis-tick",rt(o)),key:"tick-".concat(v.coordinate)},Pe(t.props,v,p)),l&&m.createElement("line",D({className:"recharts-polar-angle-axis-tick-line"},y,g)),o&&e.renderTickItem(o,x,c?c(v.value,p):v.value))});return m.createElement(_,{className:"recharts-polar-angle-axis-ticks"},k)}},{key:"render",value:function(){var t=this.props,i=t.ticks,a=t.radius,o=t.axisLine;return a<=0||!i||!i.length?null:m.createElement(_,{className:N("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(t,i,a){var o;return m.isValidElement(t)?o=m.cloneElement(t,i):C(t)?o=t(i):o=m.createElement(Oe,D({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])})(ue.PureComponent);ve(he,"displayName","PolarAngleAxis");ve(he,"axisType","angleAxis");ve(he,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var ae;function U(r){"@babel/helpers - typeof";return U=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},U(r)}function q(){return q=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},q.apply(this,arguments)}function Ue(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),n.push.apply(n,t)}return n}function h(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ue(Object(n),!0).forEach(function(t){P(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):Ue(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function mr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Xe(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,mt(t.key),t)}}function vr(r,e,n){return e&&Xe(r.prototype,e),n&&Xe(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function hr(r,e,n){return e=le(e),yr(r,dt()?Reflect.construct(e,n||[],le(r).constructor):e.apply(r,n))}function yr(r,e){if(e&&(U(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gr(r)}function gr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function dt(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dt=function(){return!!r})()}function le(r){return le=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},le(r)}function br(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&ke(r,e)}function ke(r,e){return ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},ke(r,e)}function P(r,e,n){return e=mt(e),e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function mt(r){var e=xr(r,"string");return U(e)=="symbol"?e:e+""}function xr(r,e){if(U(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,e);if(U(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var E=(function(r){function e(n){var t;return mr(this,e),t=hr(this,e,[n]),P(t,"pieRef",null),P(t,"sectorRefs",[]),P(t,"id",Tt("recharts-pie-")),P(t,"handleAnimationEnd",function(){var i=t.props.onAnimationEnd;t.setState({isAnimationFinished:!0}),C(i)&&i()}),P(t,"handleAnimationStart",function(){var i=t.props.onAnimationStart;t.setState({isAnimationFinished:!1}),C(i)&&i()}),t.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},t}return br(e,r),vr(e,[{key:"isActiveIndex",value:function(t){var i=this.props.activeIndex;return Array.isArray(i)?i.indexOf(t)!==-1:t===i}},{key:"hasActiveIndex",value:function(){var t=this.props.activeIndex;return Array.isArray(t)?t.length!==0:t||t===0}},{key:"renderLabels",value:function(t){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.label,l=a.labelLine,c=a.dataKey,s=a.valueKey,f=A(this.props,!1),d=A(o,!1),y=A(l,!1),k=o&&o.offsetRadius||20,v=t.map(function(p,g){var b=(p.startAngle+p.endAngle)/2,x=S(p.cx,p.cy,p.outerRadius+k,b),j=h(h(h(h({},f),p),{},{stroke:"none"},d),{},{index:g,textAnchor:e.getTextAnchor(x.x,p.cx)},x),B=h(h(h(h({},f),p),{},{fill:"none",stroke:p.fill},y),{},{index:g,points:[S(p.cx,p.cy,p.outerRadius,b),x]}),w=c;return W(c)&&W(s)?w="value":W(c)&&(w=s),m.createElement(_,{key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(g)},l&&e.renderLabelLineItem(l,B,"line"),e.renderLabelItem(o,j,F(p,w)))});return m.createElement(_,{className:"recharts-pie-labels"},v)}},{key:"renderSectorsStatically",value:function(t){var i=this,a=this.props,o=a.activeShape,l=a.blendStroke,c=a.inactiveShape;return t.map(function(s,f){if((s==null?void 0:s.startAngle)===0&&(s==null?void 0:s.endAngle)===0&&t.length!==1)return null;var d=i.isActiveIndex(f),y=c&&i.hasActiveIndex()?c:null,k=d?o:y,v=h(h({},s),{},{stroke:l?s.fill:s.stroke,tabIndex:-1});return m.createElement(_,q({ref:function(g){g&&!i.sectorRefs.includes(g)&&i.sectorRefs.push(g)},tabIndex:-1,className:"recharts-pie-sector"},Pe(i.props,s,f),{key:"sector-".concat(s==null?void 0:s.startAngle,"-").concat(s==null?void 0:s.endAngle,"-").concat(s.midAngle,"-").concat(f)}),m.createElement(Pt,q({option:k,isActive:d,shapeType:"sector"},v)))})}},{key:"renderSectorsWithAnimation",value:function(){var t=this,i=this.props,a=i.sectors,o=i.isAnimationActive,l=i.animationBegin,c=i.animationDuration,s=i.animationEasing,f=i.animationId,d=this.state,y=d.prevSectors,k=d.prevIsAnimationActive;return m.createElement(jt,{begin:l,duration:c,isActive:o,easing:s,from:{t:0},to:{t:1},key:"pie-".concat(f,"-").concat(k),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(v){var p=v.t,g=[],b=a&&a[0],x=b.startAngle;return a.forEach(function(j,B){var w=y&&y[B],I=B>0?_t(j,"paddingAngle",0):0;if(w){var X=De(w.endAngle-w.startAngle,j.endAngle-j.startAngle),O=h(h({},j),{},{startAngle:x+I,endAngle:x+X(p)+I});g.push(O),x=O.endAngle}else{var K=j.endAngle,T=j.startAngle,ee=De(0,K-T),te=ee(p),R=h(h({},j),{},{startAngle:x+I,endAngle:x+te+I});g.push(R),x=R.endAngle}}),m.createElement(_,null,t.renderSectorsStatically(g))})}},{key:"attachKeyboardHandlers",value:function(t){var i=this;t.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[l].focus(),i.setState({sectorToFocus:l});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var t=this.props,i=t.sectors,a=t.isAnimationActive,o=this.state.prevSectors;return a&&i&&i.length&&(!o||!wt(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var t=this,i=this.props,a=i.hide,o=i.sectors,l=i.className,c=i.label,s=i.cx,f=i.cy,d=i.innerRadius,y=i.outerRadius,k=i.isAnimationActive,v=this.state.isAnimationFinished;if(a||!o||!o.length||!M(s)||!M(f)||!M(d)||!M(y))return null;var p=N("recharts-pie",l);return m.createElement(_,{tabIndex:this.props.rootTabIndex,className:p,ref:function(b){t.pieRef=b}},this.renderSectors(),c&&this.renderLabels(o),nt.renderCallByParent(this.props,null,!1),(!k||v)&&je.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(t,i){return i.prevIsAnimationActive!==t.isAnimationActive?{prevIsAnimationActive:t.isAnimationActive,prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:[],isAnimationFinished:!0}:t.isAnimationActive&&t.animationId!==i.prevAnimationId?{prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:t.sectors!==i.curSectors?{curSectors:t.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(t,i){return t>i?"start":t<i?"end":"middle"}},{key:"renderLabelLineItem",value:function(t,i,a){if(m.isValidElement(t))return m.cloneElement(t,i);if(C(t))return t(i);var o=N("recharts-pie-label-line",typeof t!="boolean"?t.className:"");return m.createElement(Ot,q({},i,{key:a,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(t,i,a){if(m.isValidElement(t))return m.cloneElement(t,i);var o=a;if(C(t)&&(o=t(i),m.isValidElement(o)))return o;var l=N("recharts-pie-label-text",typeof t!="boolean"&&!C(t)?t.className:"");return m.createElement(Oe,q({},i,{alignmentBaseline:"middle",className:l}),o)}}])})(ue.PureComponent);ae=E;P(E,"displayName","Pie");P(E,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!St.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});P(E,"parseDeltaAngle",function(r,e){var n=ie(e-r),t=Math.min(Math.abs(e-r),360);return n*t});P(E,"getRealPieData",function(r){var e=r.data,n=r.children,t=A(r,!1),i=Et(n,_e);return e&&e.length?e.map(function(a,o){return h(h(h({payload:a},t),a),i&&i[o]&&i[o].props)}):i&&i.length?i.map(function(a){return h(h({},t),a.props)}):[]});P(E,"parseCoordinateOfPie",function(r,e){var n=e.top,t=e.left,i=e.width,a=e.height,o=Rt(i,a),l=t+ne(r.cx,i,i/2),c=n+ne(r.cy,a,a/2),s=ne(r.innerRadius,o,0),f=ne(r.outerRadius,o,o*.8),d=r.maxRadius||Math.sqrt(i*i+a*a)/2;return{cx:l,cy:c,innerRadius:s,outerRadius:f,maxRadius:d}});P(E,"getComposedData",function(r){var e=r.item,n=r.offset,t=e.type.defaultProps!==void 0?h(h({},e.type.defaultProps),e.props):e.props,i=ae.getRealPieData(t);if(!i||!i.length)return null;var a=t.cornerRadius,o=t.startAngle,l=t.endAngle,c=t.paddingAngle,s=t.dataKey,f=t.nameKey,d=t.valueKey,y=t.tooltipType,k=Math.abs(t.minAngle),v=ae.parseCoordinateOfPie(t,n),p=ae.parseDeltaAngle(o,l),g=Math.abs(p),b=s;W(s)&&W(d)?(Be(!1,`Use "dataKey" to specify the value of pie,
3
- the props "valueKey" will be deprecated in 1.1.0`),b="value"):W(s)&&(Be(!1,`Use "dataKey" to specify the value of pie,
4
- the props "valueKey" will be deprecated in 1.1.0`),b=d);var x=i.filter(function(O){return F(O,b,0)!==0}).length,j=(g>=360?x:x-1)*c,B=g-x*k-j,w=i.reduce(function(O,K){var T=F(K,b,0);return O+(M(T)?T:0)},0),I;if(w>0){var X;I=i.map(function(O,K){var T=F(O,b,0),ee=F(O,f,K),te=(M(T)?T:0)/w,R;K?R=X.endAngle+ie(p)*c*(T!==0?1:0):R=o;var Le=R+ie(p)*((T!==0?k:0)+te*B),$e=(R+Le)/2,Ce=(v.innerRadius+v.outerRadius)/2,gt=[{name:ee,value:T,payload:O,dataKey:b,type:y}],bt=S(v.cx,v.cy,Ce,$e);return X=h(h(h({percent:te,cornerRadius:a,name:ee,tooltipPayload:gt,midAngle:$e,middleRadius:Ce,tooltipPosition:bt},O),v),{},{value:F(O,b),startAngle:R,endAngle:Le,payload:O,paddingAngle:ie(p)*c}),X})}return h(h({},v),{},{sectors:I,data:i})});var vt=it({chartName:"BarChart",GraphicalChild:we,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Te},{axisType:"yAxis",AxisComp:Se}],formatAxisMap:Nt}),Ar=it({chartName:"PieChart",GraphicalChild:E,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:he},{axisType:"radiusAxis",AxisComp:me}],formatAxisMap:It,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const ht={fill:"var(--color-bg-2)"},yt={fill:"var(--color-fg-dim)",fontSize:10,fontFamily:"var(--font-mono)"},kr=Ie(r=>{var e,n;return[{label:"cost",value:G(((e=r[0])==null?void 0:e.value)??0),color:(n=r[0])==null?void 0:n.color}]},{title:r=>J(r)}),Or=Ie(r=>{var e,n;return[{label:"tokens",value:z(((e=r[0])==null?void 0:e.value)??0),color:(n=r[0])==null?void 0:n.color}]},{title:r=>J(r)}),Pr=Ie(r=>{var e,n;return[{label:"saved",value:G(((e=r[0])==null?void 0:e.value)??0),color:(n=r[0])==null?void 0:n.color}]},{title:r=>J(r)});function wr({derived:r,height:e=280,limit:n=10,metric:t="cost",periodLabel:i}){const a=Ee(),o=at("(min-width: 768px)"),l=o?124:92,c=o?60:44,s=t==="tokens",f=[...r.byModel].sort((d,y)=>s?y.tokens-d.tokens:y.cost-d.cost).slice(0,n);return u.jsx(fe,{title:s?"tokens by model":"cost by model",titleTag:i,captureName:s?"tokens-by-model":"cost-by-model",children:f.length===0?u.jsx(pe,{children:"no models in period"}):u.jsx(Re,{height:e,children:u.jsx(Ne,{children:u.jsxs(vt,{data:f,layout:"vertical",margin:{top:4,right:c,left:4,bottom:0},children:[u.jsx(ot,{...st,horizontal:!1,vertical:!0}),u.jsx(Te,{type:"number",...oe,tickFormatter:s?z:Ye}),u.jsx(Se,{type:"category",dataKey:"model",...oe,width:l,tickFormatter:J}),u.jsx(ct,{content:s?Or:kr,cursor:ht}),u.jsxs(we,{dataKey:s?"tokens":"cost",radius:[0,3,3,0],isAnimationActive:a,animationDuration:350,children:[f.map(d=>u.jsx(_e,{fill:d.color},d.model)),u.jsx(je,{dataKey:s?"tokens":"cost",position:"right",offset:6,...yt,formatter:d=>s?z(d):G(d)})]})]})})})})}function Tr({derived:r,height:e=240,limit:n=12,periodLabel:t}){const i=Ee(),a=at("(min-width: 768px)"),o=a?124:92,l=a?60:44,c=[...r.byModel].filter(s=>s.cacheSavings>0).sort((s,f)=>f.cacheSavings-s.cacheSavings).slice(0,n);return u.jsx(fe,{title:"cache savings by model",titleTag:t,captureName:"cache-savings-by-model",children:c.length===0?u.jsx(pe,{children:"no cache savings in period"}):u.jsx(Re,{height:e,children:u.jsx(Ne,{children:u.jsxs(vt,{data:c,layout:"vertical",margin:{top:4,right:l,left:4,bottom:0},children:[u.jsx(ot,{...st,horizontal:!1,vertical:!0}),u.jsx(Te,{type:"number",...oe,tickFormatter:Ye}),u.jsx(Se,{type:"category",dataKey:"model",...oe,width:o,tickFormatter:J}),u.jsx(ct,{content:Pr,cursor:ht}),u.jsx(we,{dataKey:"cacheSavings",radius:[0,3,3,0],fill:"var(--color-positive)",isAnimationActive:i,animationDuration:350,children:u.jsx(je,{dataKey:"cacheSavings",position:"right",offset:6,...yt,formatter:s=>G(s)})})]})})})})}function Sr({derived:r,height:e=280,periodLabel:n}){const t=Ee(),i=r.byProvider,a=r.totals.cost,[o,l]=ue.useState(null),c=o!=null?i[o]:null,s=c&&a>0?c.cost/a:0;return u.jsx(fe,{title:"provider split",titleTag:n,captureName:"provider-split",children:i.length===0?u.jsx(pe,{children:"no spend in period"}):u.jsxs("div",{className:"relative",onMouseLeave:()=>l(null),children:[u.jsx(Re,{height:e,children:u.jsx(Ne,{children:u.jsx(Ar,{children:u.jsx(E,{data:i,dataKey:"cost",nameKey:"name",innerRadius:"60%",outerRadius:"88%",paddingAngle:i.length>1?2:0,stroke:"var(--color-bg-1)",strokeWidth:2,isAnimationActive:t,animationDuration:350,onMouseEnter:(f,d)=>l(d),children:i.map((f,d)=>u.jsx(_e,{fill:f.color,"aria-label":`${f.name}: ${G(f.cost)}`,fillOpacity:o==null||o===d?1:.32,style:{transition:"fill-opacity 150ms ease"}},f.id))})})})}),u.jsxs("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center",children:[u.jsx("div",{className:"tnum text-xl",style:{color:c?c.color:"var(--color-fg-bright)"},children:G(c?c.cost:a)}),u.jsx("div",{className:"font-display text-[10px] uppercase tracking-wide text-fg-faint",children:c?`${c.name} · ${Je(s,s>0&&s<.01?1:0)}`:"total"})]})]})})}function Er({derived:r,periodLabel:e}){const n=r.tokenComposition,t=n.input+n.output+n.cacheCreate+n.cacheRead,i=[{key:"cacheRead",label:"cache read",value:n.cacheRead,color:re.cacheRead},{key:"input",label:"input",value:n.input,color:re.input},{key:"output",label:"output",value:n.output,color:re.output},{key:"cacheCreate",label:"cache write",value:n.cacheCreate,color:re.cacheCreate}];return u.jsx(fe,{title:"token composition",titleTag:e,captureName:"token-composition",right:u.jsx("span",{className:"tnum text-xs text-fg-dim",children:z(t)}),children:t===0?u.jsx(pe,{children:"no tokens in period"}):u.jsxs("div",{className:"flex flex-col gap-4 pt-1",children:[u.jsx("div",{className:"flex h-3 w-full overflow-hidden rounded-full bg-bg-3",children:i.map(a=>a.value>0&&u.jsx("div",{style:{width:`${a.value/t*100}%`,minWidth:"2px",background:a.color},title:`${a.label}: ${z(a.value)}`},a.key))}),u.jsx("div",{className:"grid grid-cols-2 gap-x-6 gap-y-2.5",children:i.map(a=>{const o=t>0?a.value/t:0;return u.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[u.jsxs("span",{className:"flex items-center gap-1.5 text-fg-dim",children:[u.jsx("span",{className:"inline-block size-2 rounded-[2px]",style:{background:a.color}}),a.label]}),u.jsxs("span",{className:"text-fg",children:[u.jsx("span",{className:"tnum text-fg-bright",children:z(a.value)}),u.jsx("span",{className:"ml-1.5 text-fg-faint",children:Je(o,o>0&&o<.01?1:0)})]})]},a.key)})})]})})}export{Tr as CacheByModel,wr as CostByModel,Sr as ProviderDonut,Er as TokenComposition};