specrails-hub 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/dist/assets/{ActivityFeedPage-6wmP6pTL.js → ActivityFeedPage-DFxHtwR_.js} +1 -1
- package/client/dist/assets/{AnalyticsPage-E96_vZKD.js → AnalyticsPage-BVz38-mI.js} +2 -2
- package/client/dist/assets/CategoricalChart-7_Mi_kjI.js +33 -0
- package/client/dist/assets/{DocsDialog-Cd3cHZSk.js → DocsDialog-RRq1uz-9.js} +1 -1
- package/client/dist/assets/{DocsPage-DJ-giCpq.js → DocsPage-B02QsSfp.js} +2 -2
- package/client/dist/assets/HubAnalyticsPage-C0tE_S9b.js +1 -0
- package/client/dist/assets/{HubOverviewPage-CE9y58Ro.js → HubOverviewPage-B8gtksO9.js} +1 -1
- package/client/dist/assets/JobDetailPage-DlmMCUuz.js +16 -0
- package/client/dist/assets/PeriodSelector-DPw5NA_b.js +1 -0
- package/client/dist/assets/index-DDKXmFrQ.css +2 -0
- package/client/dist/assets/index-j3K-ZHbY.js +116 -0
- package/client/dist/assets/{lib-DgbSJD6q.js → lib-CxIlWzd9.js} +1 -1
- package/client/dist/assets/{useHub-DI8-BB7O.js → useHub-DCoRS6Ot.js} +1 -1
- package/client/dist/index.html +6 -6
- package/package.json +1 -1
- package/server/dist/docs-router.js +2 -3
- package/server/dist/setup-manager.js +1 -1
- package/client/dist/assets/CategoricalChart-BROeMi_r.js +0 -33
- package/client/dist/assets/HubAnalyticsPage-bsV3NNNd.js +0 -1
- package/client/dist/assets/JobDetailPage-CpoR-Zm6.js +0 -15
- package/client/dist/assets/PeriodSelector-CgxjTRWq.js +0 -1
- package/client/dist/assets/index-BbZmzCVT.js +0 -116
- package/client/dist/assets/index-Db9Uc2ib.css +0 -2
- package/docs/product/roadmap.md +0 -38
- /package/client/dist/assets/{useSharedWebSocket-j0gqXR8o.js → useSharedWebSocket-mH5cNEha.js} +0 -0
- /package/client/dist/assets/{x-C53vXlx8.js → x-lzRk0dr5.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t,r as n}from"./createLucideIcon-j4o5em8U.js";import"./react-dom-CzrF8Nvy.js";import{n as r}from"./useHub-
|
|
1
|
+
import{n as e,o as t,r as n}from"./createLucideIcon-j4o5em8U.js";import"./react-dom-CzrF8Nvy.js";import{n as r}from"./useHub-DCoRS6Ot.js";import"./useSharedWebSocket-mH5cNEha.js";import{A as i,D as a,F as o,I as s,j as c,t as l,w as u}from"./index-j3K-ZHbY.js";var d=t(n(),1),f=e();function p(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function m({type:e}){switch(e){case`job_completed`:return(0,f.jsx)(c,{className:`w-4 h-4 text-green-500 flex-shrink-0`});case`job_failed`:return(0,f.jsx)(i,{className:`w-4 h-4 text-red-500 flex-shrink-0`});case`job_canceled`:return(0,f.jsx)(o,{className:`w-4 h-4 text-muted-foreground flex-shrink-0`});default:return(0,f.jsx)(u,{className:`w-4 h-4 text-blue-500 flex-shrink-0`})}}function h(e){switch(e){case`job_completed`:return`Completed`;case`job_failed`:return`Failed`;case`job_canceled`:return`Canceled`;default:return`Started`}}function g(e){switch(e){case`job_completed`:return`text-green-500`;case`job_failed`:return`text-red-500`;case`job_canceled`:return`text-muted-foreground`;default:return`text-blue-500`}}function _(){let{activeProjectId:e}=r(),{items:t,loading:n,hasMore:i,loadMore:o}=l({activeProjectId:e}),c=(0,d.useRef)(null);return(0,d.useEffect)(()=>{let e=c.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&i&&!n&&o()},{threshold:.1});return t.observe(e),()=>t.disconnect()},[i,n,o]),(0,f.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 border-b border-border bg-background/50`,children:[(0,f.jsx)(s,{className:`w-4 h-4 text-muted-foreground`}),(0,f.jsx)(`h1`,{className:`text-sm font-medium`,children:`Activity`})]}),(0,f.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[n&&t.length===0?(0,f.jsx)(`div`,{className:`flex items-center justify-center h-32`,children:(0,f.jsx)(a,{className:`w-4 h-4 animate-spin text-muted-foreground`})}):t.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 gap-2 text-muted-foreground`,children:[(0,f.jsx)(s,{className:`w-8 h-8 opacity-40`}),(0,f.jsx)(`p`,{className:`text-sm`,children:`No activity yet`}),(0,f.jsx)(`p`,{className:`text-xs opacity-70`,children:`Job events will appear here when jobs run`})]}):(0,f.jsx)(`ul`,{className:`divide-y divide-border/50`,children:t.map(e=>(0,f.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-2.5 hover:bg-accent/30 transition-colors`,children:[(0,f.jsx)(m,{type:e.type}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-xs text-foreground truncate`,title:e.jobCommand,children:e.jobCommand}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium ${g(e.type)}`,children:h(e.type)}),e.costUsd!=null&&(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`$`,e.costUsd.toFixed(4)]})]})]}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0 tabular-nums`,children:p(e.timestamp)})]},`${e.type}:${e.jobId}`))}),(0,f.jsx)(`div`,{ref:c,className:`h-1`}),n&&t.length>0&&(0,f.jsx)(`div`,{className:`flex justify-center py-3`,children:(0,f.jsx)(a,{className:`w-4 h-4 animate-spin text-muted-foreground`})}),!i&&t.length>0&&(0,f.jsx)(`p`,{className:`text-center text-xs text-muted-foreground py-3`,children:`All activity loaded`})]})]})}export{_ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t,o as n,r,t as i}from"./createLucideIcon-j4o5em8U.js";import{t as a}from"./react-dom-CzrF8Nvy.js";import{n as o,r as s}from"./useHub-
|
|
1
|
+
import{i as e,n as t,o as n,r,t as i}from"./createLucideIcon-j4o5em8U.js";import{t as a}from"./react-dom-CzrF8Nvy.js";import{n as o,r as s}from"./useHub-DCoRS6Ot.js";import{n as c,t as l}from"./utils-DSsSbmuB.js";import{$ as u,A as d,An as f,Ar as p,B as m,Bn as h,Cn as g,Cr as _,D as v,Dn as y,Dr as b,En as x,Er as S,F as C,Fn as w,Fr as T,G as ee,Hn as te,I as ne,Ir as re,J as E,L as ie,Lr as ae,M as oe,Mn as se,Mr as ce,N as le,Nn as ue,Nr as de,O as fe,Or as pe,P as me,Q as he,Sn as ge,Sr as _e,Tn as ve,Tr as ye,V as be,Vn as xe,X as Se,Xn as Ce,Y as D,Z as we,Zn as O,_n as Te,_r as Ee,ar as k,bn as De,br as A,cr as Oe,dr as j,er as ke,et as Ae,gn as je,gr as Me,hn as Ne,hr as M,ir as Pe,j as Fe,jr as N,kr as Ie,ln as Le,lr as Re,mn as ze,mr as Be,n as Ve,nn as He,nr as Ue,nt as We,o as Ge,or as Ke,pn as qe,pr as Je,q as Ye,r as Xe,rr as Ze,rt as Qe,s as $e,sr as et,tr as tt,tt as nt,ur as rt,vn as it,wn as at,wr as ot,xn as st,xr as ct,yn as lt,yr as ut,zn as dt}from"./CategoricalChart-7_Mi_kjI.js";import{a as P,c as F,d as ft,i as I,l as pt,n as mt,o as L,r as ht,s as R,t as gt,u as _t}from"./PeriodSelector-DPw5NA_b.js";import"./useSharedWebSocket-mH5cNEha.js";import{N as vt,i as yt,n as bt,r as xt}from"./index-j3K-ZHbY.js";import{n as z,r as St,t as Ct}from"./dracula-colors-Ihy2wjP_.js";var wt=i(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Tt=i(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Et=i(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Dt=i(`trending-down`,[[`path`,{d:`M16 17h6v-6`,key:`t6n2it`}],[`path`,{d:`m22 17-8.5-8.5-5 5L2 7`,key:`x473p`}]]),B=n(r());function V(){return V=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},V.apply(null,arguments)}function Ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ot(Object(n),!0).forEach(function(t){At(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ot(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function At(e,t,n){return(t=jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jt(e){var t=Mt(e,`string`);return typeof t==`symbol`?t:t+``}function Mt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var H=32,Nt={align:`center`,iconSize:14,inactiveColor:`#ccc`,layout:`horizontal`,verticalAlign:`middle`,labelStyle:{}};function Pt(e){if(typeof e==`object`&&e&&`strokeDasharray`in e)return String(e.strokeDasharray)}function Ft(e){var{data:t,iconType:n,inactiveColor:r}=e,i=H/2,a=H/6,o=H/3,s=t.inactive?r:t.color,c=n??t.type;if(c===`none`)return null;if(c===`plainline`)return B.createElement(`line`,{strokeWidth:4,fill:`none`,stroke:s,strokeDasharray:Pt(t.payload),x1:0,y1:i,x2:H,y2:i,className:`recharts-legend-icon`});if(c===`line`)return B.createElement(`path`,{strokeWidth:4,fill:`none`,stroke:s,d:`M0,${i}h${o}
|
|
2
2
|
A${a},${a},0,1,1,${2*o},${i}
|
|
3
3
|
H${H}M${2*o},${i}
|
|
4
|
-
A${a},${a},0,1,1,${o},${i}`,className:`recharts-legend-icon`});if(c===`rect`)return B.createElement(`path`,{stroke:`none`,fill:s,d:`M0,${H/8}h${H}v${H*3/4}h${-H}z`,className:`recharts-legend-icon`});if(B.isValidElement(t.legendIcon)){var l=kt({},t);return delete l.legendIcon,B.cloneElement(t.legendIcon,l)}return B.createElement(Ve,{fill:s,cx:i,cy:i,size:H,sizeType:`diameter`,type:c})}function It(e){var{payload:t,iconSize:n,layout:r,formatter:i,inactiveColor:a,iconType:o,labelStyle:s}=e,l={x:0,y:0,width:H,height:H},u={display:r===`horizontal`?`inline-block`:`block`,marginRight:10},d={display:`inline-block`,verticalAlign:`middle`,marginRight:4};return t.map((t,r)=>{var f=t.formatter||i,p=c({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var m=typeof s==`object`?kt({},s):{};m.color=t.inactive?a:m.color||t.color;var h=f?f(t.value,t,r):t.value;return B.createElement(`li`,V({className:p,style:u,key:`legend-item-${r}`},Ye(e,t,r)),B.createElement(ce,{width:n,height:n,viewBox:l,style:d,"aria-label":`${h} legend icon`},B.createElement(Ft,{data:t,iconType:o,inactiveColor:a})),B.createElement(`span`,{className:`recharts-legend-item-text`,style:m},h))})}var Lt=e=>{var t=j(e,Nt),{payload:n,layout:r,align:i}=t;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return B.createElement(`ul`,{className:`recharts-default-legend`,style:a},B.createElement(It,V({},t,{payload:n})))};function Rt(){return k(We)}var zt=n(a()),Bt=[`contextPayload`];function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vt.apply(null,arguments)}function Ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ht(Object(n),!0).forEach(function(t){Ut(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ht(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ut(e,t,n){return(t=Wt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wt(e){var t=Gt(e,`string`);return typeof t==`symbol`?t:t+``}function Gt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Kt(e,t){if(e==null)return{};var n,r,i=qt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function qt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Jt(e){return e.value}function Yt(e){var{contextPayload:t}=e,n=Kt(e,Bt),r=qe(t,e.payloadUniqBy,Jt),i=U(U({},n),{},{payload:r});return B.isValidElement(e.content)?B.cloneElement(e.content,i):typeof e.content==`function`?B.createElement(e.content,i):B.createElement(Lt,i)}function Xt(e,t,n,r,i,a){var{layout:o,align:s,verticalAlign:c}=t,l,u;return(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))&&(l=s===`center`&&o===`vertical`?{left:((r||0)-a.width)/2}:s===`right`?{right:n&&n.right||0}:{left:n&&n.left||0}),(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))&&(u=c===`middle`?{top:((i||0)-a.height)/2}:c===`bottom`?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),U(U({},l),u)}function Zt(e){var t=Fe();return(0,B.useEffect)(()=>{t(ye(e))},[t,e]),null}function Qt(e){var t=Fe();return(0,B.useEffect)(()=>(t(x(e)),()=>{t(x({width:0,height:0}))}),[t,e]),null}function $t(e,t,n,r){return e===`vertical`&&t!=null?{height:t}:e===`horizontal`?{width:n||r}:null}var en={align:`center`,iconSize:14,inactiveColor:`#ccc`,itemSorter:`value`,layout:`horizontal`,verticalAlign:`bottom`};function tn(e){var t=j(e,en),n=Rt(),r=p(),i=ue(),{width:a,height:o,wrapperStyle:s,portal:c}=t,[l,u]=nt([n]),d=se(),m=f();if(d==null||m==null)return null;var h=d-(i?.left||0)-(i?.right||0),g=$t(t.layout,o,a,h),_=c?s:U(U({position:`absolute`,width:g?.width||a||`auto`,height:g?.height||o||`auto`},Xt(s,t,i,d,m,l)),s),v=c??r;return v==null||n==null?null:(0,zt.createPortal)(B.createElement(`div`,{className:`recharts-legend-wrapper`,style:_,ref:u},B.createElement(Zt,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!c&&B.createElement(Qt,{width:l.width,height:l.height}),B.createElement(Yt,Vt({},t,g,{margin:i,chartWidth:d,chartHeight:m,contextPayload:n}))),v)}var W=B.memo(tn,ot);W.displayName=`Legend`;var nn=[`points`,`className`,`baseLinePoints`,`connectNulls`],rn;function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},G.apply(null,arguments)}function an(e,t){if(e==null)return{};var n,r,i=on(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function on(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function sn(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var cn=e=>e!=null&&e.x===+e.x&&e.y===+e.y,ln=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=[[]];e.forEach(e=>{var n=t[t.length-1];cn(e)?n&&n.push(e):n&&n.length>0&&t.push([])});var n=e[0],r=t[t.length-1];cn(n)&&r&&r.push(n);var i=t[t.length-1];return i&&i.length<=0&&(t=t.slice(0,-1)),t},K=(e,t)=>{var n=ln(e);t&&(n=[n.reduce((e,t)=>[...e,...t],[])]);var r=n.map(e=>e.reduce((e,t,n)=>_(rn||=sn([``,``,``,`,`,``]),e,n===0?`M`:`L`,t.x,t.y),``)).join(``);return n.length===1?`${r}Z`:r},un=(e,t,n)=>{var r=K(e,n);return`${r.slice(-1)===`Z`?r.slice(0,-1):r}L${K(Array.from(t).reverse(),n).slice(1)}`},dn=e=>{var{points:t,className:n,baseLinePoints:r,connectNulls:i}=e,a=an(e,nn);if(!t||!t.length)return null;var o=c(`recharts-polygon`,n);if(r&&r.length){var s=a.stroke&&a.stroke!==`none`,l=un(t,r,i);return B.createElement(`g`,{className:o},B.createElement(`path`,G({},de(a),{fill:l.slice(-1)===`Z`?a.fill:`none`,stroke:`none`,d:l})),s?B.createElement(`path`,G({},de(a),{fill:`none`,d:K(t,i)})):null,s?B.createElement(`path`,G({},de(a),{fill:`none`,d:K(r,i)})):null)}var u=K(t,i);return B.createElement(`path`,G({},de(a),{fill:u.slice(-1)===`Z`?a.fill:`none`,className:o,d:u}))};function fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fn(Object(n),!0).forEach(function(t){mn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mn(e,t,n){return(t=hn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hn(e){var t=gn(e,`string`);return typeof t==`symbol`?t:t+``}function gn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var _n=Qe([yt,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`pie`).find(e=>e.id===t)),vn=[],yn=(e,t,n)=>n?.length===0?vn:n,bn=Qe([Re,_n,yn],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i=t?.data!=null&&t.data.length>0?t.data:r;if((!i||!i.length)&&n!=null&&(i=n.map(e=>pn(pn({},t.presentationProps),e.props))),i!=null)return i}}),xn=Qe([bn,_n,yn],(e,t,n)=>{if(!(e==null||t==null))return e.map((e,r)=>{var i,a=O(e,t.nameKey,t.name),o=n!=null&&(i=n[r])!=null&&(i=i.props)!=null&&i.fill?n[r].props.fill:typeof e==`object`&&e&&`fill`in e?e.fill:t.fill;return{value:we(a,t.dataKey),color:o,payload:e,type:t.legendType}})}),Sn=Qe([bn,_n,yn,ft],(e,t,n,r)=>{if(!(t==null||e==null))return Kn({offset:r,pieSettings:t,displayedData:e,cells:n})}),Cn=n(st()),wn=[`key`],Tn=[`onMouseEnter`,`onClick`,`onMouseLeave`],En=[`id`],Dn=[`id`];function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},q.apply(null,arguments)}function On(e,t){if(e==null)return{};var n,r,i=kn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function kn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function An(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?An(Object(n),!0).forEach(function(t){jn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):An(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function jn(e,t,n){return(t=Mn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mn(e){var t=Nn(e,`string`);return typeof t==`symbol`?t:t+``}function Nn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Pn(e){var t=(0,B.useMemo)(()=>ie(e.children,E),[e.children]),n=k(n=>xn(n,e.id,t));return n==null?null:B.createElement(d,{legendPayload:n})}function Fn(e){if(!(e==null||typeof e==`boolean`||typeof e==`function`)){if(B.isValidElement(e)){var t=e.props?.fill;return typeof t==`string`?t:void 0}var{fill:n}=e;return typeof n==`string`?n:void 0}}var In=B.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:s,hide:c,tooltipType:l,id:u,activeShape:d}=e,f=Fn(d),p={dataDefinedOnItem:r.map(e=>{var t=e.tooltipPayload;return f==null||t==null?t:t.map(e=>J(J({},e),{},{color:f,fill:f}))}),getPosition:e=>r[Number(e)]?.tooltipPosition,settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:we(s,t),hide:c,type:l,color:o,unit:``,graphicalItemId:u}};return B.createElement(Ie,{tooltipEntrySettings:p})}),Ln=(e,t)=>e>t?`start`:e<t?`end`:`middle`,Rn=(e,t,n)=>M(typeof t==`function`?t(e):t,n,n*.8),zn=(e,t,n)=>{var{top:r,left:i,width:a,height:o}=t,s=Be(a,o);return{cx:i+M(e.cx,a,a/2),cy:r+M(e.cy,o,o/2),innerRadius:M(e.innerRadius,s,0),outerRadius:Rn(n,e.outerRadius,s),maxRadius:e.maxRadius||Math.sqrt(a*a+o*o)/2}},Bn=(e,t)=>A(t-e)*Math.min(Math.abs(t-e),360),Vn=(e,t)=>{if(B.isValidElement(e))return B.cloneElement(e,t);if(typeof e==`function`)return e(t);var n=c(`recharts-pie-label-line`,typeof e==`boolean`?``:e.className),{key:r}=t,i=On(t,wn);return B.createElement(ct,q({},i,{type:`linear`,className:n}))},Hn=(e,t,n)=>{if(B.isValidElement(e))return B.cloneElement(e,t);var r=n;if(typeof e==`function`&&(r=e(t),B.isValidElement(r)))return r;var i=c(`recharts-pie-label-text`,pt(e));return B.createElement(ee,q({},t,{alignmentBaseline:`middle`,className:i}),r)};function Un(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var s=T(n),c=re(i),l=re(a),u=typeof i==`object`&&`offsetRadius`in i&&typeof i.offsetRadius==`number`&&i.offsetRadius||20,d=t.map((e,t)=>{var n=(e.startAngle+e.endAngle)/2,r=Pe(e.cx,e.cy,e.outerRadius+u,n),d=J(J(J(J({},s),e),{},{stroke:`none`},c),{},{index:t,textAnchor:Ln(r.x,e.cx)},r),f=J(J(J(J({},s),e),{},{fill:`none`,stroke:e.fill},l),{},{index:t,points:[Pe(e.cx,e.cy,e.outerRadius,n),r],key:`line`});return B.createElement(he,{zIndex:Ue.label,key:`label-${e.startAngle}-${e.endAngle}-${e.midAngle}-${t}`},B.createElement(N,null,a&&Vn(a,f),Hn(i,d,O(e,o))))});return B.createElement(N,{className:`recharts-pie-labels`},d)}function Wn(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i==`object`&&i&&`position`in i?B.createElement(m,{label:i}):B.createElement(Un,{sectors:t,props:n,showLabels:r})}function Gn(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,s=k(rt),c=k(u),l=k(je),{onMouseEnter:d,onClick:f,onMouseLeave:p}=i,m=On(i,Tn),h=le(d,i.dataKey,o),g=me(p),_=oe(f,i.dataKey,o);return t==null||t.length===0?null:B.createElement(B.Fragment,null,t.map((e,u)=>{if(e?.startAngle===0&&e?.endAngle===0&&t.length!==1)return null;var d=l==null||l===o,f=String(u)===s&&(c==null||i.dataKey===c)&&d,p=n&&f?n:s?r:null,v=J(J({},e),{},{stroke:e.stroke,tabIndex:-1,[te]:u,[Se]:o});return B.createElement(N,q({key:`sector-${e?.startAngle}-${e?.endAngle}-${e.midAngle}-${u}`,tabIndex:-1,className:`recharts-pie-sector`},Ye(m,e,u),{onMouseEnter:h(e,u),onMouseLeave:g(e,u),onClick:_(e,u)}),B.createElement(C,q({option:a??p,index:u,shapeType:`sector`,isActive:f},v)))}))}function Kn(e){var{pieSettings:t,displayedData:n,cells:r,offset:i}=e,{cornerRadius:a,startAngle:o,endAngle:s,dataKey:c,nameKey:l,tooltipType:u}=t,d=Math.abs(t.minAngle),f=Bn(o,s),p=Math.abs(f),m=n.length<=1?0:t.paddingAngle??0,h=n.filter(e=>O(e,c,0)!==0).length,g=(p>=360?h:h-1)*m,_=p-h*d-g,v=n.reduce((e,t)=>{var n=O(t,c,0);return e+(dt(n)?n:0)},0),y;if(v>0){var b;y=n.map((e,n)=>{var s=O(e,c,0),p=O(e,l,n),h=zn(t,i,e),g=(dt(s)?s:0)/v,y,x=J(J({},e),r&&r[n]&&r[n].props),S=x!=null&&`fill`in x&&typeof x.fill==`string`?x.fill:t.fill;y=n?b.endAngle+A(f)*m*(s===0?0:1):o;var C=y+A(f)*((s===0?0:d)+g*_),w=(y+C)/2,T=(h.innerRadius+h.outerRadius)/2,ee=[{name:p,value:s,payload:x,dataKey:c,type:u,color:S,fill:S,graphicalItemId:t.id}],te=Pe(h.cx,h.cy,T,w);return b=J(J(J(J({},t.presentationProps),{},{percent:g,cornerRadius:typeof a==`string`?parseFloat(a):a,name:p,tooltipPayload:ee,midAngle:w,middleRadius:T,tooltipPosition:te},x),h),{},{value:s,dataKey:c,startAngle:y,endAngle:C,payload:x,paddingAngle:A(f)*m}),b})}return y}function qn(e){var{showLabels:t,sectors:n,children:r}=e,i=(0,B.useMemo)(()=>!t||!n?[]:n.map(e=>({value:e.value,payload:e.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:e.cx,cy:e.cy,innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,clockWise:!1},fill:e.fill})),[n,t]);return B.createElement(xe,{value:t?i:void 0},r)}function Jn(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:s,animationEasing:c,activeShape:l,inactiveShape:u,onAnimationStart:d,onAnimationEnd:f}=t,p=Ee(t,`recharts-pie-`),m=n.current,[h,g]=(0,B.useState)(!1),_=(0,B.useCallback)(()=>{typeof f==`function`&&f(),g(!1)},[f]),v=(0,B.useCallback)(()=>{typeof d==`function`&&d(),g(!0)},[d]);return B.createElement(qn,{showLabels:!h,sectors:i},B.createElement(at,{animationId:p,begin:o,duration:s,isActive:a,easing:c,onAnimationStart:v,onAnimationEnd:_,key:p},e=>{var a=[],o=(i&&i[0])?.startAngle??0;return i?.forEach((t,n)=>{var r=m&&m[n],i=n>0?(0,Cn.default)(t,`paddingAngle`,0):0;if(r){var s=Ne(r.endAngle-r.startAngle,t.endAngle-t.startAngle,e),c=J(J({},t),{},{startAngle:o+i,endAngle:o+s+i});a.push(c),o=c.endAngle}else{var{endAngle:l,startAngle:u}=t,d=Ne(0,l-u,e),f=J(J({},t),{},{startAngle:o+i,endAngle:o+d+i});a.push(f),o=f.endAngle}}),n.current=a,B.createElement(N,null,B.createElement(Gn,{sectors:a,activeShape:l,inactiveShape:u,allOtherPieProps:t,shape:t.shape,id:r}))}),B.createElement(Wn,{showLabels:!h,sectors:i,props:t}),t.children)}var Yn={animationBegin:400,animationDuration:1500,animationEasing:`ease`,cx:`50%`,cy:`50%`,dataKey:`value`,endAngle:360,fill:`#808080`,hide:!1,innerRadius:0,isAnimationActive:`auto`,label:!1,labelLine:!0,legendType:`rect`,minAngle:0,nameKey:`name`,outerRadius:`80%`,paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:`#fff`,zIndex:Ue.area};function Xn(e){var{id:t}=e,n=On(e,En),{hide:r,className:i,rootTabIndex:a}=e,o=(0,B.useMemo)(()=>ie(e.children,E),[e.children]),s=k(e=>Sn(e,t,o)),l=(0,B.useRef)(null),u=c(`recharts-pie`,i);return r||s==null?(l.current=null,B.createElement(N,{tabIndex:a,className:u})):B.createElement(he,{zIndex:e.zIndex},B.createElement(In,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:s,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t,activeShape:e.activeShape}),B.createElement(N,{tabIndex:a,className:u},B.createElement(Jn,{props:J(J({},n),{},{sectors:s}),previousSectorsRef:l,id:t})))}function Zn(e){var t=j(e,Yn),{id:n}=t,r=On(t,Dn),i=T(r);return B.createElement(fe,{id:n,type:`pie`},e=>B.createElement(B.Fragment,null,B.createElement(v,{type:`pie`,id:e,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),B.createElement(Pn,q({},r,{id:e})),B.createElement(Xn,q({},r,{id:e}))))}var Qn=Zn;Qn.displayName=`Pie`;var $n={begin:0,duration:1e3,easing:`ease`,isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}};function er(e){var t=j(e,$n),{animationId:n,from:r,to:i,attributeName:a,isActive:o,canBegin:s,duration:c,easing:l,begin:u,onAnimationEnd:d,onAnimationStart:f,children:p}=t,m=_e(),h=o===`auto`?!g.isSsr&&!m:o,_=ut(n+a,t.animationManager),[v,y]=(0,B.useState)(()=>h?r:i),b=(0,B.useRef)(!1),x=(0,B.useCallback)(()=>{y(r),f()},[r,f]);return(0,B.useEffect)(()=>{if(!h||!s)return lt;b.current=!0;var e=_.subscribe(y);return _.start([x,u,i,c,d]),()=>{_.stop(),e&&e(),d()}},[h,s,c,l,u,x,d,_,i,r]),h?s&&b.current?p({transition:Oe([a],c,l),[a]:v}):p({[a]:r}):p({[a]:i})}function tr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tr(Object(n),!0).forEach(function(t){rr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rr(e,t,n){return(t=ir(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ir(e){var t=ar(e,`string`);return typeof t==`symbol`?t:t+``}function ar(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var or=[`item`],sr=nr(nr({},xt),{},{layout:`centric`,startAngle:0,endAngle:360}),cr=(0,B.forwardRef)((e,t)=>{var n=j(e,sr);return B.createElement(bt,{chartName:`PieChart`,defaultTooltipEventType:`item`,validateTooltipEventTypes:or,tooltipPayloadSearcher:Ce,categoricalChartProps:n,ref:t})}),lr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof Buffer<`u`&&Buffer.isBuffer(e)}e.isBuffer=t})),ur=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=e?.constructor;return e===(typeof t==`function`?t.prototype:Object.prototype)}e.isPrototype=t})),dr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=ke();function n(e){return t.isTypedArray(e)}e.isTypedArray=n})),fr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Je();function n(e){let n=t.toFinite(e),r=n%1;return r?n-r:n}e.toInteger=n})),pr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=fr();function n(e,n){if(e=t.toInteger(e),e<1||!Number.isSafeInteger(e))return[];let r=Array(e);for(let t=0;t<e;t++)r[t]=typeof n==`function`?n(t):t;return r}e.times=n})),mr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=lr(),n=ur(),r=it(),i=dr(),a=pr();function o(e){if(e==null)return[];switch(typeof e){case`object`:case`function`:return r.isArrayLike(e)?l(e):n.isPrototype(e)?c(e):s(e);default:return s(Object(e))}}function s(e){let t=[];for(let n in e)t.push(n);return t}function c(e){return s(e).filter(e=>e!==`constructor`)}function l(e){let n=a.times(e.length,e=>`${e}`),r=new Set(n);t.isBuffer(e)&&(r.add(`offset`),r.add(`parent`)),i.isTypedArray(e)&&(r.add(`buffer`),r.add(`byteLength`),r.add(`byteOffset`));let o=s(e).filter(e=>!r.has(e));return Array.isArray(e)?[...n,...o]:[...n.filter(t=>Object.hasOwn(e,t)),...o]}e.keysIn=o})),hr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=be(),n=Le(),r=pe(),i=b(),a=S();function o(e,t){if(e==null)return!0;switch(typeof t){case`symbol`:case`number`:case`object`:if(Array.isArray(t))return s(e,t);if(typeof t==`number`?t=i.toKey(t):typeof t==`object`&&(t=Object.is(t?.valueOf(),-0)?`-0`:String(t)),n.isUnsafeProperty(t))return!1;if(e?.[t]===void 0)return!0;try{return delete e[t],!0}catch{return!1}case`string`:if(e?.[t]===void 0&&r.isDeepKey(t))return s(e,a.toPath(t));if(n.isUnsafeProperty(t))return!1;try{return delete e[t],!0}catch{return!1}}}function s(e,r){let i=r.length===1?e:t.get(e,r.slice(0,-1)),a=r[r.length-1];if(i?.[a]===void 0)return!0;if(n.isUnsafeProperty(a))return!1;try{return delete i[a],!0}catch{return!1}}e.unset=o})),gr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=ze();function n(e){let n=[];for(;e;)n.push(...t.getSymbols(e)),e=Object.getPrototypeOf(e);return n}e.getSymbolsIn=n})),_r=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=it();function n(e,n=1){let r=[],i=Math.floor(n);if(!t.isArrayLike(e))return r;let a=(e,t)=>{for(let n=0;n<e.length;n++){let o=e[n];t<i&&(Array.isArray(o)||o?.[Symbol.isConcatSpreadable]||typeof o==`object`&&o&&Object.prototype.toString.call(o)===`[object Arguments]`)?a(Array.isArray(o)?o:Array.from(o),t+1):r.push(o)}};return a(Array.from(e),0),r}e.flatten=n})),vr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=tt(),n=mr(),r=hr(),i=gr(),a=pe(),o=_r(),s=ne();function c(e,...t){if(e==null)return{};t=o.flatten(t);let n=l(e,t);for(let e=0;e<t.length;e++){let i=t[e];switch(typeof i){case`object`:Array.isArray(i)||(i=Array.from(i));for(let e=0;e<i.length;e++){let t=i[e];r.unset(n,t)}break;case`string`:case`symbol`:case`number`:r.unset(n,i);break}}return n}function l(e,t){return t.some(e=>Array.isArray(e)||a.isDeepKey(e))?d(e):u(e)}function u(e){let t={},r=[...n.keysIn(e),...i.getSymbolsIn(e)];for(let n=0;n<r.length;n++){let i=r[n];t[i]=e[i]}return t}function d(e){let r={},a=[...n.keysIn(e),...i.getSymbolsIn(e)];for(let n=0;n<a.length;n++){let i=a[n];r[i]=t.cloneDeepWith(e[i],e=>{if(!s.isPlainObject(e))return e})}return r}e.omit=c})),yr=n(e(((e,t)=>{t.exports=vr().omit}))()),br=[`width`,`height`,`className`,`style`,`children`,`type`];function xr(e,t){if(e==null)return{};var n,r,i=Sr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Sr(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Y.apply(null,arguments)}function Cr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Cr(Object(n),!0).forEach(function(t){Z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Z(e,t,n){return(t=wr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wr(e){var t=Tr(e,`string`);return typeof t==`symbol`?t:t+``}function Tr(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Er=`value`;function Dr(e){return typeof e==`object`&&!!e&&`x`in e&&`y`in e&&`width`in e&&`height`in e&&typeof e.x==`number`&&typeof e.y==`number`&&typeof e.width==`number`&&typeof e.height==`number`}var Or=(e,t)=>{if(!(!e||!t))return(0,Cn.default)(e,t)},kr=function(e){return`${arguments.length>1&&arguments[1]!==void 0?arguments[1]:``}children[${e}]`},Ar={chartName:`Treemap`,defaultTooltipEventType:`item`,validateTooltipEventTypes:[`item`],tooltipPayloadSearcher:Or,eventEmitter:void 0},jr=e=>{var{depth:t,node:n,index:r,dataKey:i,nameKey:a,nestedActiveTooltipIndex:o}=e,s=t===0?``:kr(r,o),{children:c}=n,l=t+1,u=c&&c.length?c.map((e,t)=>jr({depth:l,node:e,index:t,dataKey:i,nameKey:a,nestedActiveTooltipIndex:s})):null,d;if(u&&u.length)d=u.reduce((e,t)=>e+t.value,0);else{var f=n[i],p=typeof f==`number`?f:0;d=De(p)||p<=0?0:p}return X(X({},n),{},{children:u,name:O(n,a,``),[Er]:d,depth:t,index:r,tooltipIndex:s})},Mr=e=>({x:e.x,y:e.y,width:e.width,height:e.height}),Nr=(e,t)=>{var n=t<0?0:t;return e.map(e=>{var t=e[Er]*n;return X(X({},e),{},{area:De(t)||t<=0?0:t})})},Pr=(e,t,n)=>{var r=t*t,i=e.area*e.area,{min:a,max:o}=e.reduce((e,t)=>({min:Math.min(e.min,t.area),max:Math.max(e.max,t.area)}),{min:1/0,max:0});return i?Math.max(r*o*n/i,i/(r*a*n)):1/0},Fr=(e,t,n,r)=>{var i=t?Math.round(e.area/t):0;(r||i>n.height)&&(i=n.height);for(var a=n.x,o,s=0,c=e.length;s<c;s++)o=e[s],o!=null&&(o.x=a,o.y=n.y,o.height=i,o.width=Math.min(i?Math.round(o.area/i):0,n.x+n.width-a),a+=o.width);return o!=null&&(o.width+=n.x+n.width-a),X(X({},n),{},{y:n.y+i,height:n.height-i})},Ir=(e,t,n,r)=>{var i=t?Math.round(e.area/t):0;(r||i>n.width)&&(i=n.width);for(var a=n.y,o,s=0,c=e.length;s<c;s++)o=e[s],o!=null&&(o.x=n.x,o.y=a,o.width=i,o.height=Math.min(i?Math.round(o.area/i):0,n.y+n.height-a),a+=o.height);return o&&(o.height+=n.y+n.height-a),X(X({},n),{},{x:n.x+i,width:n.width-i})},Lr=(e,t,n,r)=>t===n.width?Fr(e,t,n,r):Ir(e,t,n,r),Rr=(e,t)=>{var{children:n}=e;if(n&&n.length){var r=Mr(e),i=[],a=1/0,o,s,c=Math.min(r.width,r.height),l=Nr(n,r.width*r.height/e[Er]),u=l.slice();for(i.area=0;u.length>0;)[o]=u,o!=null&&(i.push(o),i.area+=o.area,s=Pr(i,c,t),s<=a?(u.shift(),a=s):(i.area-=i.pop()?.area??0,r=Lr(i,c,r,!1),c=Math.min(r.width,r.height),i.length=i.area=0,a=1/0));return i.length&&=(r=Lr(i,c,r,!0),i.area=0),X(X({},e),{},{children:l.map(e=>Rr(e,t))})}return e},zr=X({aspectRatio:.5*(1+Math.sqrt(5)),dataKey:`value`,nameKey:`name`,type:`flat`,isAnimationActive:`auto`,isUpdateAnimationActive:`auto`,animationBegin:0,animationDuration:1500,animationEasing:`linear`},et),Br={isAnimationFinished:!1,formatRoot:null,currentRoot:void 0,nestIndex:[],prevAspectRatio:zr.aspectRatio,prevDataKey:zr.dataKey};function Vr(e){var{content:t,nodeProps:n,type:r,colorPanel:i,onMouseEnter:a,onMouseLeave:o,onClick:s}=e;if(B.isValidElement(t))return B.createElement(N,{onMouseEnter:a,onMouseLeave:o,onClick:s},B.cloneElement(t,n));if(typeof t==`function`)return B.createElement(N,{onMouseEnter:a,onMouseLeave:o,onClick:s},t(n));var{x:c,y:l,width:u,height:d,index:f}=n,p=null;u>10&&d>10&&n.children&&r===`nest`&&(p=B.createElement(dn,{points:[{x:c+2,y:l+d/2},{x:c+6,y:l+d/2+3},{x:c+2,y:l+d/2+6}]}));var m=null,g=Xe(n.name);u>20&&d>20&&g.width<u&&g.height<d&&(m=B.createElement(`text`,{x:c+8,y:l+d/2+7,fontSize:14},n.name));var _=i||h;return B.createElement(`g`,null,B.createElement(Me,Y({fill:n.depth<2?_[f%_.length]:`rgba(255,255,255,0)`,stroke:`#fff`},(0,yr.default)(n,[`children`]),{onMouseEnter:a,onMouseLeave:o,onClick:s,"data-recharts-item-index":n.tooltipIndex})),p,m)}function Hr(e){var t=Fe(),n={x:e.nodeProps.x+e.nodeProps.width/2,y:e.nodeProps.y+e.nodeProps.height/2};return B.createElement(Vr,Y({},e,{onMouseEnter:()=>{t($e({activeIndex:e.nodeProps.tooltipIndex,activeDataKey:e.dataKey,activeCoordinate:n,activeGraphicalItemId:e.id}))},onMouseLeave:()=>{},onClick:()=>{t(Ge({activeIndex:e.nodeProps.tooltipIndex,activeDataKey:e.dataKey,activeCoordinate:n,activeGraphicalItemId:e.id}))}}))}var Ur=B.memo(e=>{var{dataKey:t,nameKey:n,stroke:r,fill:i,currentRoot:a,id:o}=e,s={dataDefinedOnItem:a,getPosition:lt,settings:{stroke:r,strokeWidth:void 0,fill:i,dataKey:t,nameKey:n,name:void 0,hide:!1,type:void 0,color:i,unit:``,graphicalItemId:o}};return B.createElement(Ie,{tooltipEntrySettings:s})}),Wr={top:0,right:0,bottom:0,left:0};function Gr(e){var{content:t,nodeProps:n,isLeaf:r,treemapProps:i,onNestClick:a}=e,{id:o,isAnimationActive:s,animationBegin:c,animationDuration:l,animationEasing:u,isUpdateAnimationActive:d,type:f,colorPanel:p,dataKey:m,onAnimationStart:h,onAnimationEnd:g,onMouseEnter:_,onClick:v,onMouseLeave:y}=i,{width:b,height:x,x:S,y:C}=n,w=-S-b,T=0,ee=e=>{(r||f===`nest`)&&typeof _==`function`&&_(n,e)},te=e=>{(r||f===`nest`)&&typeof y==`function`&&y(n,e)},ne=()=>{f===`nest`&&a(n),(r||f===`nest`)&&typeof v==`function`&&v(n)},re=(0,B.useCallback)(()=>{typeof g==`function`&&g()},[g]),E=(0,B.useCallback)(()=>{typeof h==`function`&&h()},[h]);return B.createElement(er,{animationId:`treemap-${n.tooltipIndex}`,from:`translate(${w}px, ${T}px)`,to:`translate(0, 0)`,attributeName:`transform`,begin:c,easing:u,isActive:s,duration:l,onAnimationStart:E,onAnimationEnd:re},e=>B.createElement(N,{onMouseEnter:ee,onMouseLeave:te,onClick:ne,style:X(X({},e),{},{transformOrigin:`${S} ${C}`})},B.createElement(Hr,{id:o,content:t,dataKey:m,nodeProps:X(X({},n),{},{isAnimationActive:s,isUpdateAnimationActive:!d,width:b,height:x,x:S,y:C}),type:f,colorPanel:p})))}var Kr=class extends B.PureComponent{constructor(){super(...arguments),Z(this,`state`,X({},Br)),Z(this,`handleClick`,e=>{var{onClick:t,type:n}=this.props;if(n===`nest`&&e.children){var{width:r,height:i,dataKey:a,nameKey:o,aspectRatio:s}=this.props,c=jr({depth:0,node:X(X({},e),{},{x:0,y:0,width:r,height:i}),index:0,dataKey:a,nameKey:o,nestedActiveTooltipIndex:e.tooltipIndex}),l=Rr(c,s),{nestIndex:u}=this.state;u.push(e),this.setState({formatRoot:l,currentRoot:c,nestIndex:u})}t&&t(e)}),Z(this,`handleTouchMove`,e=>{var t=e.touches[0];if(t!=null){var n=document.elementFromPoint(t.clientX,t.clientY);if(!(!n||!n.getAttribute||this.state.formatRoot==null)){var r=n.getAttribute(`data-recharts-item-index`),i=Or(this.state.formatRoot,r);if(Dr(i)){var{dataKey:a,dispatch:o}=this.props;o($e({activeIndex:r,activeDataKey:a,activeCoordinate:{x:i.x+i.width/2,y:i.y+i.height/2},activeGraphicalItemId:this.props.id}))}}}})}static getDerivedStateFromProps(e,t){if(e.data!==t.prevData||e.type!==t.prevType||e.width!==t.prevWidth||e.height!==t.prevHeight||e.dataKey!==t.prevDataKey||e.aspectRatio!==t.prevAspectRatio){var n=jr({depth:0,node:{children:e.data,x:0,y:0,width:e.width,height:e.height},index:0,dataKey:e.dataKey,nameKey:e.nameKey}),r=Rr(n,e.aspectRatio);return X(X({},t),{},{formatRoot:r,currentRoot:n,nestIndex:[n],prevAspectRatio:e.aspectRatio,prevData:e.data,prevWidth:e.width,prevHeight:e.height,prevDataKey:e.dataKey,prevType:e.type})}return null}handleNestIndex(e,t){var{nestIndex:n}=this.state,{width:r,height:i,dataKey:a,nameKey:o,aspectRatio:s}=this.props,c=Rr(jr({depth:0,node:X(X({},e),{},{x:0,y:0,width:r,height:i}),index:0,dataKey:a,nameKey:o,nestedActiveTooltipIndex:e.tooltipIndex}),s);n=n.slice(0,t+1),this.setState({formatRoot:c,currentRoot:e,nestIndex:n})}renderNode(e,t){var{content:n,type:r}=this.props,i=X(X(X({},T(this.props)),t),{},{root:e}),a=!t.children||!t.children.length,{currentRoot:o}=this.state;return!(o?.children||[]).filter(e=>e.depth===t.depth&&e.name===t.name).length&&e.depth&&r===`nest`?null:B.createElement(N,{key:`recharts-treemap-node-${i.x}-${i.y}-${i.name}`,className:`recharts-treemap-depth-${t.depth}`},B.createElement(Gr,{isLeaf:a,content:n,nodeProps:i,treemapProps:this.props,onNestClick:this.handleClick}),t.children&&t.children.length?t.children.map(e=>this.renderNode(t,e)):null)}renderAllNodes(){var{formatRoot:e}=this.state;return e?this.renderNode(e,e):null}renderNestIndex(){var{nameKey:e,nestIndexContent:t}=this.props,{nestIndex:n}=this.state;return B.createElement(`div`,{className:`recharts-treemap-nest-index-wrapper`,style:{marginTop:`8px`,textAlign:`center`}},n.map((n,r)=>{var i=(0,Cn.default)(n,e,`root`),a=typeof i==`string`?i:`root`,o;return B.isValidElement(t)&&(o=B.cloneElement(t,n,r)),o=typeof t==`function`?t(n,r):a,B.createElement(`div`,{onClick:this.handleNestIndex.bind(this,n,r),key:`nest-index-${ve()}`,className:`recharts-treemap-nest-index-box`,style:{cursor:`pointer`,display:`inline-block`,padding:`0 7px`,background:`#000`,color:`#fff`,marginRight:`3px`}},o)}))}render(){var e=this.props,{width:t,height:n,className:r,style:i,children:a,type:o}=e,s=T(xr(e,br));return B.createElement(B.Fragment,null,B.createElement(Ur,{dataKey:this.props.dataKey,nameKey:this.props.nameKey,stroke:this.props.stroke,fill:this.props.fill,currentRoot:this.state.currentRoot,id:this.props.id}),B.createElement(ce,Y({},s,{width:t,height:o===`nest`?n-30:n,onTouchMove:this.handleTouchMove}),this.renderAllNodes(),a),o===`nest`&&this.renderNestIndex())}};Z(Kr,`displayName`,`Treemap`);function qr(e){var t=Fe(),n=se(),r=f();if(!Ae(n)||!Ae(r))return null;var{id:i}=e;return B.createElement(fe,{id:i,type:`treemap`},i=>B.createElement(Kr,Y({},e,{id:i,width:n,height:r,dispatch:t})))}function Jr(e){var t=j(e,zr),{className:n,style:r,width:i,height:a,throttleDelay:o,throttledEvents:s}=t,[c,l]=(0,B.useState)(null);return B.createElement(Ke,{preloadedState:{options:Ar},reduxStoreName:t.className??`Treemap`},B.createElement(y,{margin:Wr}),B.createElement(Ze,{throttleDelay:o,throttledEvents:s}),B.createElement(He,{dispatchTouchEvents:!1,className:n,style:r,width:i,height:a,responsive:!1,ref:e=>{c==null&&e!=null&&l(e)},onMouseEnter:void 0,onMouseLeave:void 0,onClick:void 0,onMouseMove:void 0,onMouseDown:void 0,onMouseUp:void 0,onContextMenu:void 0,onDoubleClick:void 0,onTouchStart:void 0,onTouchMove:void 0,onTouchEnd:void 0},B.createElement(Te.Provider,{value:c},B.createElement(qr,t))))}var Q=t();function Yr(e){return`$${e.toFixed(4)}`}function Xr(e){if(e===null)return`—`;let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function Zr(e){return`${(e*100).toFixed(1)}%`}function Qr({delta:e,lowerIsBetter:t=!1,formatter:n}){if(e===null)return null;let r=e>0,i=t?e<0:e>0,a=e===0,o=n?n(Math.abs(e)):e>0?`+${e}`:`${e}`;return(0,Q.jsxs)(`span`,{className:l(`inline-flex items-center gap-0.5 text-[10px] font-medium px-1.5 py-0.5 rounded`,a?`text-muted-foreground bg-muted/40`:i?`text-green-400 bg-green-400/10`:`text-red-400 bg-red-400/10`),children:[a?(0,Q.jsx)(Et,{className:`w-2.5 h-2.5`}):r?(0,Q.jsx)(ae,{className:`w-2.5 h-2.5`}):(0,Q.jsx)(Dt,{className:`w-2.5 h-2.5`}),o]})}function $r({label:e,value:t,badge:n}){return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e}),(0,Q.jsxs)(`div`,{className:`flex items-end justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xl font-semibold tabular-nums`,children:t}),n]})]})}function ei({kpi:e}){return(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:[(0,Q.jsx)($r,{label:`Total Cost`,value:Yr(e.totalCostUsd),badge:(0,Q.jsx)(Qr,{delta:e.costDelta,lowerIsBetter:!0,formatter:e=>`$${e.toFixed(4)}`})}),(0,Q.jsx)($r,{label:`Total Jobs`,value:String(e.totalJobs),badge:(0,Q.jsx)(Qr,{delta:e.jobsDelta,lowerIsBetter:!1,formatter:e=>`+${e}`})}),(0,Q.jsx)($r,{label:`Success Rate`,value:Zr(e.successRate),badge:(0,Q.jsx)(Qr,{delta:e.successRateDelta,lowerIsBetter:!1,formatter:e=>`${(e*100).toFixed(1)}%`})}),(0,Q.jsx)($r,{label:`Avg Duration`,value:Xr(e.avgDurationMs),badge:(0,Q.jsx)(Qr,{delta:e.avgDurationDelta,lowerIsBetter:!0,formatter:e=>Xr(e)})})]})}function ti({active:e,payload:t,label:n}){return!e||!t?.length?null:(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),(0,Q.jsxs)(`p`,{className:`font-medium`,children:[`$`,t[0].value.toFixed(4)]})]})}function ni(e){try{return _t(new Date(e),`MMM d`)}catch{return e}}function ri({data:e}){if(!(e.length>0&&e.some(e=>e.costUsd>0)))return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Cost Over Time`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No cost data for this period`})]});let t=Math.max(1,Math.floor(e.length/7)),n=e.filter((e,n)=>n%t===0).map(e=>e.date);return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Cost Over Time`}),(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsxs)(ht,{data:e,margin:{top:4,right:8,left:0,bottom:0},children:[(0,Q.jsx)(F,{strokeDasharray:`3 3`,stroke:`var(--color-border)`}),(0,Q.jsx)(P,{dataKey:`date`,ticks:n,tickFormatter:ni,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,Q.jsx)(I,{tickFormatter:e=>`$${e.toFixed(2)}`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:55}),(0,Q.jsx)(D,{content:(0,Q.jsx)(ti,{})}),(0,Q.jsx)(R,{type:`monotone`,dataKey:`costUsd`,stroke:z.purple,strokeWidth:2,dot:!1,activeDot:{r:3,fill:z.purple}})]})})]})}function ii({active:e,payload:t}){if(!e||!t?.length)return null;let n=t[0];return(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`capitalize font-medium`,children:n.name}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground`,children:[n.value,` jobs`]})]})}function ai({data:e}){if(e.length===0)return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Jobs by Status`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No jobs in this period`})]});let t=e.reduce((e,t)=>e+t.count,0);return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Jobs by Status`}),(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Qn,{data:e,dataKey:`count`,nameKey:`status`,cx:`50%`,cy:`50%`,innerRadius:60,outerRadius:90,paddingAngle:2,children:e.map(e=>(0,Q.jsx)(E,{fill:St[e.status]??`var(--color-muted-foreground)`},e.status))}),(0,Q.jsx)(D,{content:(0,Q.jsx)(ii,{})}),(0,Q.jsx)(W,{formatter:n=>{let r=e.find(e=>e.status===n),i=r?(r.count/t*100).toFixed(0):`0`;return(0,Q.jsxs)(`span`,{className:`text-xs capitalize`,children:[n,` (`,r?.count??0,`, `,i,`%)`]})}})]})})]})}var oi=[`<1m`,`1-3m`,`3-5m`,`5-10m`,`>10m`];function si(e){if(e===null)return`—`;let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function ci({active:e,payload:t,label:n}){return!e||!t?.length?null:(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),(0,Q.jsxs)(`p`,{className:`font-medium`,children:[t[0].value,` jobs`]})]})}function li({data:e,percentiles:t}){let n=oi.map(t=>({bucket:t,count:e.find(e=>e.bucket===t)?.count??0}));return n.some(e=>e.count>0)?(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Duration Distribution`}),(0,Q.jsx)(w,{width:`100%`,height:180,children:(0,Q.jsxs)(mt,{data:n,margin:{top:4,right:8,left:0,bottom:0},children:[(0,Q.jsx)(F,{strokeDasharray:`3 3`,stroke:`var(--color-border)`,vertical:!1}),(0,Q.jsx)(P,{dataKey:`bucket`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,Q.jsx)(I,{allowDecimals:!1,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:30}),(0,Q.jsx)(D,{content:(0,Q.jsx)(ci,{})}),(0,Q.jsx)(L,{dataKey:`count`,fill:z.cyan,radius:[3,3,0,0]})]})}),(0,Q.jsx)(`div`,{className:`flex items-center gap-3 mt-2`,children:[`p50`,`p75`,`p95`].map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground uppercase`,children:[e,`:`]}),(0,Q.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums`,children:si(t[e])})]},e))})]}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Duration Distribution`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No duration data available`})]})}function ui({active:e,payload:t,label:n}){return!e||!t?.length?null:(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground mb-1 font-mono truncate max-w-48`,children:n}),t.map(e=>(0,Q.jsxs)(`p`,{style:{color:e.color},children:[e.name,`: `,e.value.toLocaleString()]},e.name))]})}function di({data:e}){if(e.length===0)return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Token Efficiency`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No token data for this period`})]});let t=e.map(e=>({...e,name:e.command.length>20?`…${e.command.slice(-18)}`:e.command}));return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Token Efficiency`}),(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsxs)(mt,{layout:`vertical`,data:t,margin:{top:4,right:8,left:0,bottom:0},children:[(0,Q.jsx)(F,{strokeDasharray:`3 3`,stroke:`var(--color-border)`,horizontal:!1}),(0,Q.jsx)(P,{type:`number`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,tickFormatter:e=>e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}),(0,Q.jsx)(I,{type:`category`,dataKey:`name`,width:110,tick:{fontSize:9,fill:`var(--color-muted-foreground)`,fontFamily:`monospace`},axisLine:!1,tickLine:!1}),(0,Q.jsx)(D,{content:(0,Q.jsx)(ui,{})}),(0,Q.jsx)(W,{formatter:e=>(0,Q.jsx)(`span`,{className:`text-xs`,children:e})}),(0,Q.jsx)(L,{dataKey:`tokensOut`,name:`Output tokens`,fill:z.purple,stackId:`a`,radius:[0,3,3,0]}),(0,Q.jsx)(L,{dataKey:`tokensCacheRead`,name:`Cached tokens`,fill:z.cyan,stackId:`a`,radius:[0,3,3,0]})]})})]})}function fi(e){return e===null?`—`:`$${e.toFixed(4)}`}function pi(e){if(e===null)return`—`;let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function mi({rate:e}){let t=(e*100).toFixed(0);return(0,Q.jsxs)(`span`,{className:l(`inline-block px-1.5 py-0.5 rounded text-[10px] font-medium`,e>=.8?`bg-green-400/10 text-green-400`:e>=.5?`bg-orange-400/10 text-orange-400`:`bg-red-400/10 text-red-400`),children:[t,`%`]})}function $({label:e,sortKey:t,current:n,dir:r,onSort:i}){return(0,Q.jsx)(`th`,{onClick:()=>i(t),className:`px-3 py-2 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide cursor-pointer select-none hover:text-foreground whitespace-nowrap`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[e,n===t?r===`asc`?(0,Q.jsx)(wt,{className:`w-3 h-3`}):(0,Q.jsx)(vt,{className:`w-3 h-3`}):(0,Q.jsx)(Tt,{className:`w-3 h-3 opacity-40`})]})})}function hi({data:e}){let[t,n]=(0,B.useState)(`totalCostUsd`),[r,i]=(0,B.useState)(`desc`);function a(e){e===t?i(e=>e===`asc`?`desc`:`asc`):(n(e),i(`desc`))}let o=[...e].sort((e,n)=>{let i=e[t]??-1/0,a=n[t]??-1/0,o=typeof i==`string`?i.localeCompare(a):i-a;return r===`asc`?o:-o});return e.length===0?(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Command Performance`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No command data for this period`})]}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Command Performance`}),(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border/30`,children:[(0,Q.jsx)($,{label:`Command`,sortKey:`command`,current:t,dir:r,onSort:a}),(0,Q.jsx)($,{label:`Runs`,sortKey:`totalRuns`,current:t,dir:r,onSort:a}),(0,Q.jsx)($,{label:`Success Rate`,sortKey:`successRate`,current:t,dir:r,onSort:a}),(0,Q.jsx)($,{label:`Avg Cost`,sortKey:`avgCostUsd`,current:t,dir:r,onSort:a}),(0,Q.jsx)($,{label:`Avg Duration`,sortKey:`avgDurationMs`,current:t,dir:r,onSort:a}),(0,Q.jsx)($,{label:`Total Cost`,sortKey:`totalCostUsd`,current:t,dir:r,onSort:a})]})}),(0,Q.jsx)(`tbody`,{children:o.map(e=>(0,Q.jsxs)(`tr`,{className:`border-b border-border/20 hover:bg-accent/20 transition-colors`,children:[(0,Q.jsx)(`td`,{className:`px-3 py-2 font-mono text-[10px] text-foreground`,children:e.command}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums`,children:e.totalRuns}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(mi,{rate:e.successRate})}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums`,children:fi(e.avgCostUsd)}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums`,children:pi(e.avgDurationMs)}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums font-medium`,children:fi(e.totalCostUsd)})]},e.command))})]})})]})}function gi({active:e,payload:t,label:n}){return!e||!t?.length?null:(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),t.map(e=>(0,Q.jsxs)(`p`,{style:{color:e.color},children:[e.name,`: `,e.value]},e.name))]})}function _i(e){try{return _t(new Date(e),`MMM d`)}catch{return e}}function vi({data:e}){if(!(e.length>0&&e.some(e=>e.completed+e.failed+e.canceled>0)))return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Daily Throughput`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No throughput data for this period`})]});let t=Math.max(1,Math.floor(e.length/7)),n=e.filter((e,n)=>n%t===0).map(e=>e.date);return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Daily Throughput`}),(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsxs)(mt,{data:e,margin:{top:4,right:8,left:0,bottom:0},children:[(0,Q.jsx)(F,{strokeDasharray:`3 3`,stroke:`var(--color-border)`,vertical:!1}),(0,Q.jsx)(P,{dataKey:`date`,ticks:n,tickFormatter:_i,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,Q.jsx)(I,{allowDecimals:!1,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:30}),(0,Q.jsx)(D,{content:(0,Q.jsx)(gi,{})}),(0,Q.jsx)(W,{formatter:e=>(0,Q.jsx)(`span`,{className:`text-xs capitalize`,children:e})}),(0,Q.jsx)(L,{dataKey:`completed`,name:`Completed`,stackId:`a`,fill:z.purple}),(0,Q.jsx)(L,{dataKey:`failed`,name:`Failed`,stackId:`a`,fill:z.pink}),(0,Q.jsx)(L,{dataKey:`canceled`,name:`Canceled`,stackId:`a`,fill:z.orange,radius:[3,3,0,0]})]})})]})}function yi({x:e=0,y:t=0,width:n=0,height:r=0,name:i=``,size:a=0,colorIndex:o=0}){let s=Ct[o%Ct.length];return(0,Q.jsxs)(`g`,{children:[(0,Q.jsx)(`rect`,{x:e,y:t,width:n,height:r,style:{fill:s,fillOpacity:.8,stroke:`var(--color-background)`,strokeWidth:2},rx:4}),n>50&&r>30&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`text`,{x:e+6,y:t+16,fill:`var(--color-background)`,fontSize:10,fontFamily:`monospace`,style:{overflow:`hidden`},children:i.length>Math.floor(n/6)?i.slice(0,Math.floor(n/6)-1)+`…`:i}),r>45&&(0,Q.jsxs)(`text`,{x:e+6,y:t+30,fill:`hsl(231 15% 18% / 0.7)`,fontSize:9,children:[`$`,a.toFixed(4)]})]})]})}function bi({active:e,payload:t}){if(!e||!t?.length)return null;let n=t[0].payload;return n?(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`font-mono font-medium mb-1`,children:n.name}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Cost: $`,n.size.toFixed(4)]}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Jobs: `,n.jobCount]})]}):null}function xi({data:e}){let t=e.filter(e=>e.totalCostUsd>0);if(t.length===0)return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Cost per Command`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No cost data for this period`})]});let n=t.map((e,t)=>({name:e.command,size:e.totalCostUsd,jobCount:e.jobCount,colorIndex:t}));return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Cost per Command`}),(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsx)(Jr,{data:n,dataKey:`size`,content:(0,Q.jsx)(yi,{}),children:(0,Q.jsx)(D,{content:(0,Q.jsx)(bi,{})})})})]})}function Si({label:e,value:t}){return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-3 space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide`,children:e}),(0,Q.jsx)(`p`,{className:`text-base font-semibold tabular-nums`,children:t})]})}function Ci({data:e}){let t=e.costPerSuccess===null?`—`:`$${e.costPerSuccess.toFixed(4)}`,n=e.apiEfficiencyPct===null?`—`:`${e.apiEfficiencyPct.toFixed(0)}%`,r=`$${e.failureCostUsd.toFixed(4)}`;return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Bonus Metrics`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,Q.jsx)(Si,{label:`Cost per Success`,value:t}),(0,Q.jsx)(Si,{label:`API Efficiency`,value:n}),(0,Q.jsx)(Si,{label:`Failure Cost`,value:r})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Model Breakdown`}),e.modelBreakdown.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No model data for this period`}):(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border/30`,children:[(0,Q.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide`,children:`Model`}),(0,Q.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide`,children:`Jobs`}),(0,Q.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide`,children:`Total Cost`})]})}),(0,Q.jsx)(`tbody`,{children:e.modelBreakdown.map(e=>(0,Q.jsxs)(`tr`,{className:`border-b border-border/20`,children:[(0,Q.jsx)(`td`,{className:`px-3 py-1.5 font-mono text-[10px]`,children:e.model}),(0,Q.jsx)(`td`,{className:`px-3 py-1.5 tabular-nums`,children:e.jobCount}),(0,Q.jsxs)(`td`,{className:`px-3 py-1.5 tabular-nums`,children:[`$`,e.totalCostUsd.toFixed(4)]})]},e.model))})]})})]})]})}var wi=[{key:`cost`,label:`Avg Cost ($)`,color:z.purple},{key:`duration`,label:`Avg Duration (min)`,color:z.cyan},{key:`successRate`,label:`Success Rate (%)`,color:z.green}];function Ti({active:e,payload:t,label:n}){return!e||!t?.length?null:(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),t.map(e=>(0,Q.jsxs)(`p`,{style:{color:e.color},children:[e.name,`: `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.value})]},e.name))]})}function Ei(e){try{return _t(new Date(e),`MMM d`)}catch{return e}}function Di({points:e}){let[t,n]=(0,B.useState)(new Set([`cost`,`successRate`])),r=e.some(e=>e.jobCount>0),i=e.map(e=>({date:e.date,cost:e.avgCostUsd===null?0:parseFloat(e.avgCostUsd.toFixed(4)),duration:e.avgDurationMs===null?0:parseFloat((e.avgDurationMs/6e4).toFixed(2)),successRate:parseFloat((e.successRate*100).toFixed(1)),jobCount:e.jobCount})),a=Math.max(1,Math.floor(e.length/7)),o=e.filter((e,t)=>t%a===0).map(e=>e.date);function s(e){n(t=>{let n=new Set(t);return n.has(e)?n.size>1&&n.delete(e):n.add(e),n})}return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Performance Trends`}),(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:wi.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>s(e.key),className:`flex items-center gap-1 text-[10px] px-2 py-0.5 rounded transition-colors ${t.has(e.key)?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:[(0,Q.jsx)(`span`,{className:`w-2 h-2 rounded-full inline-block shrink-0`,style:{background:e.color}}),e.label]},e.key))})]}),r?(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsxs)(ht,{data:i,margin:{top:4,right:8,left:0,bottom:0},children:[(0,Q.jsx)(F,{strokeDasharray:`3 3`,stroke:`var(--color-border)`}),(0,Q.jsx)(P,{dataKey:`date`,ticks:o,tickFormatter:Ei,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,Q.jsx)(I,{tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:40}),(0,Q.jsx)(D,{content:(0,Q.jsx)(Ti,{})}),(0,Q.jsx)(W,{wrapperStyle:{fontSize:`10px`,paddingTop:`8px`}}),t.has(`cost`)&&(0,Q.jsx)(R,{type:`monotone`,dataKey:`cost`,name:`Avg Cost ($)`,stroke:z.purple,strokeWidth:2,dot:!1,activeDot:{r:3,fill:z.purple}}),t.has(`duration`)&&(0,Q.jsx)(R,{type:`monotone`,dataKey:`duration`,name:`Avg Duration (min)`,stroke:z.cyan,strokeWidth:2,dot:!1,activeDot:{r:3,fill:z.cyan}}),t.has(`successRate`)&&(0,Q.jsx)(R,{type:`monotone`,dataKey:`successRate`,name:`Success Rate (%)`,stroke:z.green,strokeWidth:2,dot:!1,activeDot:{r:3,fill:z.green}})]})}):(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No job data for this period`})]})}function Oi(){return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:Array.from({length:4}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-20 rounded-lg border border-border/40 bg-card/50 animate-pulse`},t))}),(0,Q.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:Array.from({length:4}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-[260px] rounded-lg border border-border/40 bg-card/50 animate-pulse`},t))}),(0,Q.jsx)(`div`,{className:`h-[180px] rounded-lg border border-border/40 bg-card/50 animate-pulse`})]})}function ki({message:e,onRetry:t}){return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-red-400/30 bg-red-400/10 p-4 flex items-center justify-between`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-red-400`,children:e}),(0,Q.jsxs)(`button`,{onClick:t,className:`flex items-center gap-1.5 h-7 px-3 rounded-md text-xs text-red-400 border border-red-400/30 hover:bg-red-400/10 transition-colors`,children:[(0,Q.jsx)(ge,{className:`w-3 h-3`}),`Retry`]})]})}var Ai=[{value:`1d`,label:`1d`},{value:`7d`,label:`7d`},{value:`30d`,label:`30d`}];function ji(){let{activeProjectId:e}=o(),[t,n]=(0,B.useState)(`7d`),[r,i]=(0,B.useState)(``),[a,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!0),[p,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(0),[_,v]=(0,B.useState)(`7d`),[y,b]=(0,B.useState)(null),x=(0,B.useRef)(new Map);(0,B.useEffect)(()=>{if(e){let t=x.current.get(e);t&&(u(t),f(!1))}let n=new AbortController;!l&&!x.current.get(e??``)&&f(!0),m(null);let i=new URLSearchParams({period:t});if(t===`custom`){if(!r||!a){f(!1);return}i.set(`from`,r),i.set(`to`,a)}return fetch(`${s()}/analytics?${i}`,{signal:n.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{u(t),e&&x.current.set(e,t),f(!1)}).catch(e=>{e.name!==`AbortError`&&(m(e.message),f(!1))}),()=>n.abort()},[t,r,a,h,e]),(0,B.useEffect)(()=>{let e=new AbortController;return fetch(`${s()}/trends?period=${_}`,{signal:e.signal}).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(e=>b(e)).catch(e=>{e.name!==`AbortError`&&console.warn(`[analytics] trends fetch failed:`,e.message)}),()=>e.abort()},[_,e]);function S(e,t,r){n(e),i(t??``),c(r??``)}function C(){g(e=>e+1)}return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Analytics`}),l&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l.period.label})]}),(0,Q.jsx)(gt,{period:t,from:r,to:a,onChange:S})]}),d&&(0,Q.jsx)(Oi,{}),!d&&p&&(0,Q.jsx)(ki,{message:`Failed to load analytics: ${p}`,onRetry:C}),!d&&!p&&l&&(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(ei,{kpi:l.kpi}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,Q.jsx)(ri,{data:l.costTimeline}),(0,Q.jsx)(ai,{data:l.statusBreakdown}),(0,Q.jsx)(li,{data:l.durationHistogram,percentiles:l.durationPercentiles}),(0,Q.jsx)(di,{data:l.tokenEfficiency})]}),(0,Q.jsx)(hi,{data:l.commandPerformance}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,Q.jsx)(vi,{data:l.dailyThroughput}),(0,Q.jsx)(xi,{data:l.costPerCommand})]}),(0,Q.jsx)(Ci,{data:l.bonusMetrics}),y&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-medium`,children:`Trends`}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:Ai.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>v(e.value),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${_===e.value?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:e.label},e.value))})]}),(0,Q.jsx)(Di,{points:y.points})]})]})]})}export{ji as default};
|
|
4
|
+
A${a},${a},0,1,1,${o},${i}`,className:`recharts-legend-icon`});if(c===`rect`)return B.createElement(`path`,{stroke:`none`,fill:s,d:`M0,${H/8}h${H}v${H*3/4}h${-H}z`,className:`recharts-legend-icon`});if(B.isValidElement(t.legendIcon)){var l=kt({},t);return delete l.legendIcon,B.cloneElement(t.legendIcon,l)}return B.createElement(Be,{fill:s,cx:i,cy:i,size:H,sizeType:`diameter`,type:c})}function It(e){var{payload:t,iconSize:n,layout:r,formatter:i,inactiveColor:a,iconType:o,labelStyle:s}=e,l={x:0,y:0,width:H,height:H},u={display:r===`horizontal`?`inline-block`:`block`,marginRight:10},d={display:`inline-block`,verticalAlign:`middle`,marginRight:4};return t.map((t,r)=>{var f=t.formatter||i,p=c({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var m=typeof s==`object`?kt({},s):{};m.color=t.inactive?a:m.color||t.color;var h=f?f(t.value,t,r):t.value;return B.createElement(`li`,V({className:p,style:u,key:`legend-item-${r}`},Je(e,t,r)),B.createElement(ce,{width:n,height:n,viewBox:l,style:d,"aria-label":`${h} legend icon`},B.createElement(Ft,{data:t,iconType:o,inactiveColor:a})),B.createElement(`span`,{className:`recharts-legend-item-text`,style:m},h))})}var Lt=e=>{var t=j(e,Nt),{payload:n,layout:r,align:i}=t;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return B.createElement(`ul`,{className:`recharts-default-legend`,style:a},B.createElement(It,V({},t,{payload:n})))};function Rt(){return k(Ue)}var zt=n(a()),Bt=[`contextPayload`];function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vt.apply(null,arguments)}function Ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ht(Object(n),!0).forEach(function(t){Ut(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ht(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ut(e,t,n){return(t=Wt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wt(e){var t=Gt(e,`string`);return typeof t==`symbol`?t:t+``}function Gt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Kt(e,t){if(e==null)return{};var n,r,i=qt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function qt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Jt(e){return e.value}function Yt(e){var{contextPayload:t}=e,n=Kt(e,Bt),r=Ke(t,e.payloadUniqBy,Jt),i=U(U({},n),{},{payload:r});return B.isValidElement(e.content)?B.cloneElement(e.content,i):typeof e.content==`function`?B.createElement(e.content,i):B.createElement(Lt,i)}function Xt(e,t,n,r,i,a){var{layout:o,align:s,verticalAlign:c}=t,l,u;return(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))&&(l=s===`center`&&o===`vertical`?{left:((r||0)-a.width)/2}:s===`right`?{right:n&&n.right||0}:{left:n&&n.left||0}),(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))&&(u=c===`middle`?{top:((i||0)-a.height)/2}:c===`bottom`?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),U(U({},l),u)}function Zt(e){var t=Pe();return(0,B.useEffect)(()=>{t(ve(e))},[t,e]),null}function Qt(e){var t=Pe();return(0,B.useEffect)(()=>(t(x(e)),()=>{t(x({width:0,height:0}))}),[t,e]),null}function $t(e,t,n,r){return e===`vertical`&&t!=null?{height:t}:e===`horizontal`?{width:n||r}:null}var en={align:`center`,iconSize:14,inactiveColor:`#ccc`,itemSorter:`value`,layout:`horizontal`,verticalAlign:`bottom`};function tn(e){var t=j(e,en),n=Rt(),r=p(),i=ue(),{width:a,height:o,wrapperStyle:s,portal:c}=t,[l,u]=tt([n]),d=se(),m=f();if(d==null||m==null)return null;var h=d-(i?.left||0)-(i?.right||0),g=$t(t.layout,o,a,h),_=c?s:U(U({position:`absolute`,width:g?.width||a||`auto`,height:g?.height||o||`auto`},Xt(s,t,i,d,m,l)),s),v=c??r;return v==null||n==null?null:(0,zt.createPortal)(B.createElement(`div`,{className:`recharts-legend-wrapper`,style:_,ref:u},B.createElement(Zt,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!c&&B.createElement(Qt,{width:l.width,height:l.height}),B.createElement(Yt,Vt({},t,g,{margin:i,chartWidth:d,chartHeight:m,contextPayload:n}))),v)}var W=B.memo(tn,at);W.displayName=`Legend`;var nn=[`points`,`className`,`baseLinePoints`,`connectNulls`],rn;function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},G.apply(null,arguments)}function an(e,t){if(e==null)return{};var n,r,i=on(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function on(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function sn(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var cn=e=>e!=null&&e.x===+e.x&&e.y===+e.y,ln=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=[[]];e.forEach(e=>{var n=t[t.length-1];cn(e)?n&&n.push(e):n&&n.length>0&&t.push([])});var n=e[0],r=t[t.length-1];cn(n)&&r&&r.push(n);var i=t[t.length-1];return i&&i.length<=0&&(t=t.slice(0,-1)),t},K=(e,t)=>{var n=ln(e);t&&(n=[n.reduce((e,t)=>[...e,...t],[])]);var r=n.map(e=>e.reduce((e,t,n)=>_(rn||=sn([``,``,``,`,`,``]),e,n===0?`M`:`L`,t.x,t.y),``)).join(``);return n.length===1?`${r}Z`:r},un=(e,t,n)=>{var r=K(e,n);return`${r.slice(-1)===`Z`?r.slice(0,-1):r}L${K(Array.from(t).reverse(),n).slice(1)}`},dn=e=>{var{points:t,className:n,baseLinePoints:r,connectNulls:i}=e,a=an(e,nn);if(!t||!t.length)return null;var o=c(`recharts-polygon`,n);if(r&&r.length){var s=a.stroke&&a.stroke!==`none`,l=un(t,r,i);return B.createElement(`g`,{className:o},B.createElement(`path`,G({},de(a),{fill:l.slice(-1)===`Z`?a.fill:`none`,stroke:`none`,d:l})),s?B.createElement(`path`,G({},de(a),{fill:`none`,d:K(t,i)})):null,s?B.createElement(`path`,G({},de(a),{fill:`none`,d:K(r,i)})):null)}var u=K(t,i);return B.createElement(`path`,G({},de(a),{fill:u.slice(-1)===`Z`?a.fill:`none`,className:o,d:u}))};function fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fn(Object(n),!0).forEach(function(t){mn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mn(e,t,n){return(t=hn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hn(e){var t=gn(e,`string`);return typeof t==`symbol`?t:t+``}function gn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var _n=Ze([yt,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`pie`).find(e=>e.id===t)),vn=[],yn=(e,t,n)=>n?.length===0?vn:n,bn=Ze([Le,_n,yn],(e,t,n)=>{var{chartData:r}=e;if(t!=null){var i=t?.data!=null&&t.data.length>0?t.data:r;if((!i||!i.length)&&n!=null&&(i=n.map(e=>pn(pn({},t.presentationProps),e.props))),i!=null)return i}}),xn=Ze([bn,_n,yn],(e,t,n)=>{if(!(e==null||t==null))return e.map((e,r)=>{var i,a=O(e,t.nameKey,t.name),o=n!=null&&(i=n[r])!=null&&(i=i.props)!=null&&i.fill?n[r].props.fill:typeof e==`object`&&e&&`fill`in e?e.fill:t.fill;return{value:Ce(a,t.dataKey),color:o,payload:e,type:t.legendType}})}),Sn=Ze([bn,_n,yn,dt],(e,t,n,r)=>{if(!(t==null||e==null))return Kn({offset:r,pieSettings:t,displayedData:e,cells:n})}),Cn=n(ot()),wn=[`key`],Tn=[`onMouseEnter`,`onClick`,`onMouseLeave`],En=[`id`],Dn=[`id`];function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},q.apply(null,arguments)}function On(e,t){if(e==null)return{};var n,r,i=kn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function kn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function An(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?An(Object(n),!0).forEach(function(t){jn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):An(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function jn(e,t,n){return(t=Mn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mn(e){var t=Nn(e,`string`);return typeof t==`symbol`?t:t+``}function Nn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Pn(e){var t=(0,B.useMemo)(()=>ie(e.children,E),[e.children]),n=k(n=>xn(n,e.id,t));return n==null?null:B.createElement(d,{legendPayload:n})}function Fn(e){if(!(e==null||typeof e==`boolean`||typeof e==`function`)){if(B.isValidElement(e)){var t=e.props?.fill;return typeof t==`string`?t:void 0}var{fill:n}=e;return typeof n==`string`?n:void 0}}var In=B.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:s,hide:c,tooltipType:l,id:u,activeShape:d}=e,f=Fn(d),p={dataDefinedOnItem:r.map(e=>{var t=e.tooltipPayload;return f==null||t==null?t:t.map(e=>J(J({},e),{},{color:f,fill:f}))}),getPosition:e=>r[Number(e)]?.tooltipPosition,settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:Ce(s,t),hide:c,type:l,color:o,unit:``,graphicalItemId:u}};return B.createElement(Fe,{tooltipEntrySettings:p})}),Ln=(e,t)=>e>t?`start`:e<t?`end`:`middle`,Rn=(e,t,n)=>M(typeof t==`function`?t(e):t,n,n*.8),zn=(e,t,n)=>{var{top:r,left:i,width:a,height:o}=t,s=ze(a,o);return{cx:i+M(e.cx,a,a/2),cy:r+M(e.cy,o,o/2),innerRadius:M(e.innerRadius,s,0),outerRadius:Rn(n,e.outerRadius,s),maxRadius:e.maxRadius||Math.sqrt(a*a+o*o)/2}},Bn=(e,t)=>A(t-e)*Math.min(Math.abs(t-e),360),Vn=(e,t)=>{if(B.isValidElement(e))return B.cloneElement(e,t);if(typeof e==`function`)return e(t);var n=c(`recharts-pie-label-line`,typeof e==`boolean`?``:e.className),{key:r}=t,i=On(t,wn);return B.createElement(st,q({},i,{type:`linear`,className:n}))},Hn=(e,t,n)=>{if(B.isValidElement(e))return B.cloneElement(e,t);var r=n;if(typeof e==`function`&&(r=e(t),B.isValidElement(r)))return r;var i=c(`recharts-pie-label-text`,pt(e));return B.createElement(ee,q({},t,{alignmentBaseline:`middle`,className:i}),r)};function Un(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var s=T(n),c=re(i),l=re(a),u=typeof i==`object`&&`offsetRadius`in i&&typeof i.offsetRadius==`number`&&i.offsetRadius||20,d=t.map((e,t)=>{var n=(e.startAngle+e.endAngle)/2,r=Ne(e.cx,e.cy,e.outerRadius+u,n),d=J(J(J(J({},s),e),{},{stroke:`none`},c),{},{index:t,textAnchor:Ln(r.x,e.cx)},r),f=J(J(J(J({},s),e),{},{fill:`none`,stroke:e.fill},l),{},{index:t,points:[Ne(e.cx,e.cy,e.outerRadius,n),r],key:`line`});return B.createElement(he,{zIndex:He.label,key:`label-${e.startAngle}-${e.endAngle}-${e.midAngle}-${t}`},B.createElement(N,null,a&&Vn(a,f),Hn(i,d,O(e,o))))});return B.createElement(N,{className:`recharts-pie-labels`},d)}function Wn(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return typeof i==`object`&&i&&`position`in i?B.createElement(m,{label:i}):B.createElement(Un,{sectors:t,props:n,showLabels:r})}function Gn(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,s=k(nt),c=k(u),l=k(Ae),{onMouseEnter:d,onClick:f,onMouseLeave:p}=i,m=On(i,Tn),h=le(d,i.dataKey,o),g=me(p),_=oe(f,i.dataKey,o);return t==null||t.length===0?null:B.createElement(B.Fragment,null,t.map((e,u)=>{if(e?.startAngle===0&&e?.endAngle===0&&t.length!==1)return null;var d=l==null||l===o,f=String(u)===s&&(c==null||i.dataKey===c)&&d,p=n&&f?n:s?r:null,v=J(J({},e),{},{stroke:e.stroke,tabIndex:-1,[te]:u,[xe]:o});return B.createElement(N,q({key:`sector-${e?.startAngle}-${e?.endAngle}-${e.midAngle}-${u}`,tabIndex:-1,className:`recharts-pie-sector`},Je(m,e,u),{onMouseEnter:h(e,u),onMouseLeave:g(e,u),onClick:_(e,u)}),B.createElement(C,q({option:a??p,index:u,shapeType:`sector`,isActive:f},v)))}))}function Kn(e){var{pieSettings:t,displayedData:n,cells:r,offset:i}=e,{cornerRadius:a,startAngle:o,endAngle:s,dataKey:c,nameKey:l,tooltipType:u}=t,d=Math.abs(t.minAngle),f=Bn(o,s),p=Math.abs(f),m=n.length<=1?0:t.paddingAngle??0,h=n.filter(e=>O(e,c,0)!==0).length,g=(p>=360?h:h-1)*m,_=p-h*d-g,v=n.reduce((e,t)=>{var n=O(t,c,0);return e+(ut(n)?n:0)},0),y;if(v>0){var b;y=n.map((e,n)=>{var s=O(e,c,0),p=O(e,l,n),h=zn(t,i,e),g=(ut(s)?s:0)/v,y,x=J(J({},e),r&&r[n]&&r[n].props),S=x!=null&&`fill`in x&&typeof x.fill==`string`?x.fill:t.fill;y=n?b.endAngle+A(f)*m*(s===0?0:1):o;var C=y+A(f)*((s===0?0:d)+g*_),w=(y+C)/2,T=(h.innerRadius+h.outerRadius)/2,ee=[{name:p,value:s,payload:x,dataKey:c,type:u,color:S,fill:S,graphicalItemId:t.id}],te=Ne(h.cx,h.cy,T,w);return b=J(J(J(J({},t.presentationProps),{},{percent:g,cornerRadius:typeof a==`string`?parseFloat(a):a,name:p,tooltipPayload:ee,midAngle:w,middleRadius:T,tooltipPosition:te},x),h),{},{value:s,dataKey:c,startAngle:y,endAngle:C,payload:x,paddingAngle:A(f)*m}),b})}return y}function qn(e){var{showLabels:t,sectors:n,children:r}=e,i=(0,B.useMemo)(()=>!t||!n?[]:n.map(e=>({value:e.value,payload:e.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:e.cx,cy:e.cy,innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,clockWise:!1},fill:e.fill})),[n,t]);return B.createElement(be,{value:t?i:void 0},r)}function Jn(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:s,animationEasing:c,activeShape:l,inactiveShape:u,onAnimationStart:d,onAnimationEnd:f}=t,p=Te(t,`recharts-pie-`),m=n.current,[h,g]=(0,B.useState)(!1),_=(0,B.useCallback)(()=>{typeof f==`function`&&f(),g(!1)},[f]),v=(0,B.useCallback)(()=>{typeof d==`function`&&d(),g(!0)},[d]);return B.createElement(qn,{showLabels:!h,sectors:i},B.createElement(it,{animationId:p,begin:o,duration:s,isActive:a,easing:c,onAnimationStart:v,onAnimationEnd:_,key:p},e=>{var a=[],o=(i&&i[0])?.startAngle??0;return i?.forEach((t,n)=>{var r=m&&m[n],i=n>0?(0,Cn.default)(t,`paddingAngle`,0):0;if(r){var s=Me(r.endAngle-r.startAngle,t.endAngle-t.startAngle,e),c=J(J({},t),{},{startAngle:o+i,endAngle:o+s+i});a.push(c),o=c.endAngle}else{var{endAngle:l,startAngle:u}=t,d=Me(0,l-u,e),f=J(J({},t),{},{startAngle:o+i,endAngle:o+d+i});a.push(f),o=f.endAngle}}),n.current=a,B.createElement(N,null,B.createElement(Gn,{sectors:a,activeShape:l,inactiveShape:u,allOtherPieProps:t,shape:t.shape,id:r}))}),B.createElement(Wn,{showLabels:!h,sectors:i,props:t}),t.children)}var Yn={animationBegin:400,animationDuration:1500,animationEasing:`ease`,cx:`50%`,cy:`50%`,dataKey:`value`,endAngle:360,fill:`#808080`,hide:!1,innerRadius:0,isAnimationActive:`auto`,label:!1,labelLine:!0,legendType:`rect`,minAngle:0,nameKey:`name`,outerRadius:`80%`,paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:`#fff`,zIndex:He.area};function Xn(e){var{id:t}=e,n=On(e,En),{hide:r,className:i,rootTabIndex:a}=e,o=(0,B.useMemo)(()=>ie(e.children,E),[e.children]),s=k(e=>Sn(e,t,o)),l=(0,B.useRef)(null),u=c(`recharts-pie`,i);return r||s==null?(l.current=null,B.createElement(N,{tabIndex:a,className:u})):B.createElement(he,{zIndex:e.zIndex},B.createElement(In,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:s,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t,activeShape:e.activeShape}),B.createElement(N,{tabIndex:a,className:u},B.createElement(Jn,{props:J(J({},n),{},{sectors:s}),previousSectorsRef:l,id:t})))}function Zn(e){var t=j(e,Yn),{id:n}=t,r=On(t,Dn),i=T(r);return B.createElement(fe,{id:n,type:`pie`},e=>B.createElement(B.Fragment,null,B.createElement(v,{type:`pie`,id:e,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),B.createElement(Pn,q({},r,{id:e})),B.createElement(Xn,q({},r,{id:e}))))}var Qn=Zn;Qn.displayName=`Pie`;var $n={begin:0,duration:1e3,easing:`ease`,isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}};function er(e){var t=j(e,$n),{animationId:n,from:r,to:i,attributeName:a,isActive:o,canBegin:s,duration:c,easing:l,begin:u,onAnimationEnd:d,onAnimationStart:f,children:p}=t,m=ge(),h=o===`auto`?!g.isSsr&&!m:o,_=lt(n+a,t.animationManager),[v,y]=(0,B.useState)(()=>h?r:i),b=(0,B.useRef)(!1),x=(0,B.useCallback)(()=>{y(r),f()},[r,f]);return(0,B.useEffect)(()=>{if(!h||!s)return ct;b.current=!0;var e=_.subscribe(y);return _.start([x,u,i,c,d]),()=>{_.stop(),e&&e(),d()}},[h,s,c,l,u,x,d,_,i,r]),h?s&&b.current?p({transition:De([a],c,l),[a]:v}):p({[a]:r}):p({[a]:i})}function tr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tr(Object(n),!0).forEach(function(t){rr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rr(e,t,n){return(t=ir(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ir(e){var t=ar(e,`string`);return typeof t==`symbol`?t:t+``}function ar(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var or=[`item`],sr=nr(nr({},xt),{},{layout:`centric`,startAngle:0,endAngle:360}),cr=(0,B.forwardRef)((e,t)=>{var n=j(e,sr);return B.createElement(bt,{chartName:`PieChart`,defaultTooltipEventType:`item`,validateTooltipEventTypes:or,tooltipPayloadSearcher:Se,categoricalChartProps:n,ref:t})}),lr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof Buffer<`u`&&Buffer.isBuffer(e)}e.isBuffer=t})),ur=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=e?.constructor;return e===(typeof t==`function`?t.prototype:Object.prototype)}e.isPrototype=t})),dr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Oe();function n(e){return t.isTypedArray(e)}e.isTypedArray=n})),fr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=qe();function n(e){let n=t.toFinite(e),r=n%1;return r?n-r:n}e.toInteger=n})),pr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=fr();function n(e,n){if(e=t.toInteger(e),e<1||!Number.isSafeInteger(e))return[];let r=Array(e);for(let t=0;t<e;t++)r[t]=typeof n==`function`?n(t):t;return r}e.times=n})),mr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=lr(),n=ur(),r=rt(),i=dr(),a=pr();function o(e){if(e==null)return[];switch(typeof e){case`object`:case`function`:return r.isArrayLike(e)?l(e):n.isPrototype(e)?c(e):s(e);default:return s(Object(e))}}function s(e){let t=[];for(let n in e)t.push(n);return t}function c(e){return s(e).filter(e=>e!==`constructor`)}function l(e){let n=a.times(e.length,e=>`${e}`),r=new Set(n);t.isBuffer(e)&&(r.add(`offset`),r.add(`parent`)),i.isTypedArray(e)&&(r.add(`buffer`),r.add(`byteLength`),r.add(`byteOffset`));let o=s(e).filter(e=>!r.has(e));return Array.isArray(e)?[...n,...o]:[...n.filter(t=>Object.hasOwn(e,t)),...o]}e.keysIn=o})),hr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=ye(),n=Ie(),r=pe(),i=b(),a=S();function o(e,t){if(e==null)return!0;switch(typeof t){case`symbol`:case`number`:case`object`:if(Array.isArray(t))return s(e,t);if(typeof t==`number`?t=i.toKey(t):typeof t==`object`&&(t=Object.is(t?.valueOf(),-0)?`-0`:String(t)),n.isUnsafeProperty(t))return!1;if(e?.[t]===void 0)return!0;try{return delete e[t],!0}catch{return!1}case`string`:if(e?.[t]===void 0&&r.isDeepKey(t))return s(e,a.toPath(t));if(n.isUnsafeProperty(t))return!1;try{return delete e[t],!0}catch{return!1}}}function s(e,r){let i=r.length===1?e:t.get(e,r.slice(0,-1)),a=r[r.length-1];if(i?.[a]===void 0)return!0;if(n.isUnsafeProperty(a))return!1;try{return delete i[a],!0}catch{return!1}}e.unset=o})),gr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Re();function n(e){let n=[];for(;e;)n.push(...t.getSymbols(e)),e=Object.getPrototypeOf(e);return n}e.getSymbolsIn=n})),_r=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=rt();function n(e,n=1){let r=[],i=Math.floor(n);if(!t.isArrayLike(e))return r;let a=(e,t)=>{for(let n=0;n<e.length;n++){let o=e[n];t<i&&(Array.isArray(o)||o?.[Symbol.isConcatSpreadable]||typeof o==`object`&&o&&Object.prototype.toString.call(o)===`[object Arguments]`)?a(Array.isArray(o)?o:Array.from(o),t+1):r.push(o)}};return a(Array.from(e),0),r}e.flatten=n})),vr=e((e=>{Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=et(),n=mr(),r=hr(),i=gr(),a=pe(),o=_r(),s=ne();function c(e,...t){if(e==null)return{};t=o.flatten(t);let n=l(e,t);for(let e=0;e<t.length;e++){let i=t[e];switch(typeof i){case`object`:Array.isArray(i)||(i=Array.from(i));for(let e=0;e<i.length;e++){let t=i[e];r.unset(n,t)}break;case`string`:case`symbol`:case`number`:r.unset(n,i);break}}return n}function l(e,t){return t.some(e=>Array.isArray(e)||a.isDeepKey(e))?d(e):u(e)}function u(e){let t={},r=[...n.keysIn(e),...i.getSymbolsIn(e)];for(let n=0;n<r.length;n++){let i=r[n];t[i]=e[i]}return t}function d(e){let r={},a=[...n.keysIn(e),...i.getSymbolsIn(e)];for(let n=0;n<a.length;n++){let i=a[n];r[i]=t.cloneDeepWith(e[i],e=>{if(!s.isPlainObject(e))return e})}return r}e.omit=c})),yr=n(e(((e,t)=>{t.exports=vr().omit}))()),br=[`width`,`height`,`className`,`style`,`children`,`type`];function xr(e,t){if(e==null)return{};var n,r,i=Sr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Sr(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Y.apply(null,arguments)}function Cr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Cr(Object(n),!0).forEach(function(t){Z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Z(e,t,n){return(t=wr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wr(e){var t=Tr(e,`string`);return typeof t==`symbol`?t:t+``}function Tr(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Er=`value`;function Dr(e){return typeof e==`object`&&!!e&&`x`in e&&`y`in e&&`width`in e&&`height`in e&&typeof e.x==`number`&&typeof e.y==`number`&&typeof e.width==`number`&&typeof e.height==`number`}var Or=(e,t)=>{if(!(!e||!t))return(0,Cn.default)(e,t)},kr=function(e){return`${arguments.length>1&&arguments[1]!==void 0?arguments[1]:``}children[${e}]`},Ar={chartName:`Treemap`,defaultTooltipEventType:`item`,validateTooltipEventTypes:[`item`],tooltipPayloadSearcher:Or,eventEmitter:void 0},jr=e=>{var{depth:t,node:n,index:r,dataKey:i,nameKey:a,nestedActiveTooltipIndex:o}=e,s=t===0?``:kr(r,o),{children:c}=n,l=t+1,u=c&&c.length?c.map((e,t)=>jr({depth:l,node:e,index:t,dataKey:i,nameKey:a,nestedActiveTooltipIndex:s})):null,d;if(u&&u.length)d=u.reduce((e,t)=>e+t.value,0);else{var f=n[i],p=typeof f==`number`?f:0;d=Ee(p)||p<=0?0:p}return X(X({},n),{},{children:u,name:O(n,a,``),[Er]:d,depth:t,index:r,tooltipIndex:s})},Mr=e=>({x:e.x,y:e.y,width:e.width,height:e.height}),Nr=(e,t)=>{var n=t<0?0:t;return e.map(e=>{var t=e[Er]*n;return X(X({},e),{},{area:Ee(t)||t<=0?0:t})})},Pr=(e,t,n)=>{var r=t*t,i=e.area*e.area,{min:a,max:o}=e.reduce((e,t)=>({min:Math.min(e.min,t.area),max:Math.max(e.max,t.area)}),{min:1/0,max:0});return i?Math.max(r*o*n/i,i/(r*a*n)):1/0},Fr=(e,t,n,r)=>{var i=t?Math.round(e.area/t):0;(r||i>n.height)&&(i=n.height);for(var a=n.x,o,s=0,c=e.length;s<c;s++)o=e[s],o!=null&&(o.x=a,o.y=n.y,o.height=i,o.width=Math.min(i?Math.round(o.area/i):0,n.x+n.width-a),a+=o.width);return o!=null&&(o.width+=n.x+n.width-a),X(X({},n),{},{y:n.y+i,height:n.height-i})},Ir=(e,t,n,r)=>{var i=t?Math.round(e.area/t):0;(r||i>n.width)&&(i=n.width);for(var a=n.y,o,s=0,c=e.length;s<c;s++)o=e[s],o!=null&&(o.x=n.x,o.y=a,o.width=i,o.height=Math.min(i?Math.round(o.area/i):0,n.y+n.height-a),a+=o.height);return o&&(o.height+=n.y+n.height-a),X(X({},n),{},{x:n.x+i,width:n.width-i})},Lr=(e,t,n,r)=>t===n.width?Fr(e,t,n,r):Ir(e,t,n,r),Rr=(e,t)=>{var{children:n}=e;if(n&&n.length){var r=Mr(e),i=[],a=1/0,o,s,c=Math.min(r.width,r.height),l=Nr(n,r.width*r.height/e[Er]),u=l.slice();for(i.area=0;u.length>0;)[o]=u,o!=null&&(i.push(o),i.area+=o.area,s=Pr(i,c,t),s<=a?(u.shift(),a=s):(i.area-=i.pop()?.area??0,r=Lr(i,c,r,!1),c=Math.min(r.width,r.height),i.length=i.area=0,a=1/0));return i.length&&=(r=Lr(i,c,r,!0),i.area=0),X(X({},e),{},{children:l.map(e=>Rr(e,t))})}return e},zr=X({aspectRatio:.5*(1+Math.sqrt(5)),dataKey:`value`,nameKey:`name`,type:`flat`,isAnimationActive:`auto`,isUpdateAnimationActive:`auto`,animationBegin:0,animationDuration:1500,animationEasing:`linear`},$e),Br={isAnimationFinished:!1,formatRoot:null,currentRoot:void 0,nestIndex:[],prevAspectRatio:zr.aspectRatio,prevDataKey:zr.dataKey};function Vr(e){var{content:t,nodeProps:n,type:r,colorPanel:i,onMouseEnter:a,onMouseLeave:o,onClick:s}=e;if(B.isValidElement(t))return B.createElement(N,{onMouseEnter:a,onMouseLeave:o,onClick:s},B.cloneElement(t,n));if(typeof t==`function`)return B.createElement(N,{onMouseEnter:a,onMouseLeave:o,onClick:s},t(n));var{x:c,y:l,width:u,height:d,index:f}=n,p=null;u>10&&d>10&&n.children&&r===`nest`&&(p=B.createElement(dn,{points:[{x:c+2,y:l+d/2},{x:c+6,y:l+d/2+3},{x:c+2,y:l+d/2+6}]}));var m=null,g=Ye(n.name);u>20&&d>20&&g.width<u&&g.height<d&&(m=B.createElement(`text`,{x:c+8,y:l+d/2+7,fontSize:14},n.name));var _=i||h;return B.createElement(`g`,null,B.createElement(je,Y({fill:n.depth<2?_[f%_.length]:`rgba(255,255,255,0)`,stroke:`#fff`},(0,yr.default)(n,[`children`]),{onMouseEnter:a,onMouseLeave:o,onClick:s,"data-recharts-item-index":n.tooltipIndex})),p,m)}function Hr(e){var t=Pe(),n={x:e.nodeProps.x+e.nodeProps.width/2,y:e.nodeProps.y+e.nodeProps.height/2};return B.createElement(Vr,Y({},e,{onMouseEnter:()=>{t(Qe({activeIndex:e.nodeProps.tooltipIndex,activeDataKey:e.dataKey,activeCoordinate:n,activeGraphicalItemId:e.id}))},onMouseLeave:()=>{},onClick:()=>{t(We({activeIndex:e.nodeProps.tooltipIndex,activeDataKey:e.dataKey,activeCoordinate:n,activeGraphicalItemId:e.id}))}}))}var Ur=B.memo(e=>{var{dataKey:t,nameKey:n,stroke:r,fill:i,currentRoot:a,id:o}=e,s={dataDefinedOnItem:a,getPosition:ct,settings:{stroke:r,strokeWidth:void 0,fill:i,dataKey:t,nameKey:n,name:void 0,hide:!1,type:void 0,color:i,unit:``,graphicalItemId:o}};return B.createElement(Fe,{tooltipEntrySettings:s})}),Wr={top:0,right:0,bottom:0,left:0};function Gr(e){var{content:t,nodeProps:n,isLeaf:r,treemapProps:i,onNestClick:a}=e,{id:o,isAnimationActive:s,animationBegin:c,animationDuration:l,animationEasing:u,isUpdateAnimationActive:d,type:f,colorPanel:p,dataKey:m,onAnimationStart:h,onAnimationEnd:g,onMouseEnter:_,onClick:v,onMouseLeave:y}=i,{width:b,height:x,x:S,y:C}=n,w=-S-b,T=0,ee=e=>{(r||f===`nest`)&&typeof _==`function`&&_(n,e)},te=e=>{(r||f===`nest`)&&typeof y==`function`&&y(n,e)},ne=()=>{f===`nest`&&a(n),(r||f===`nest`)&&typeof v==`function`&&v(n)},re=(0,B.useCallback)(()=>{typeof g==`function`&&g()},[g]),E=(0,B.useCallback)(()=>{typeof h==`function`&&h()},[h]);return B.createElement(er,{animationId:`treemap-${n.tooltipIndex}`,from:`translate(${w}px, ${T}px)`,to:`translate(0, 0)`,attributeName:`transform`,begin:c,easing:u,isActive:s,duration:l,onAnimationStart:E,onAnimationEnd:re},e=>B.createElement(N,{onMouseEnter:ee,onMouseLeave:te,onClick:ne,style:X(X({},e),{},{transformOrigin:`${S} ${C}`})},B.createElement(Hr,{id:o,content:t,dataKey:m,nodeProps:X(X({},n),{},{isAnimationActive:s,isUpdateAnimationActive:!d,width:b,height:x,x:S,y:C}),type:f,colorPanel:p})))}var Kr=class extends B.PureComponent{constructor(){super(...arguments),Z(this,`state`,X({},Br)),Z(this,`handleClick`,e=>{var{onClick:t,type:n}=this.props;if(n===`nest`&&e.children){var{width:r,height:i,dataKey:a,nameKey:o,aspectRatio:s}=this.props,c=jr({depth:0,node:X(X({},e),{},{x:0,y:0,width:r,height:i}),index:0,dataKey:a,nameKey:o,nestedActiveTooltipIndex:e.tooltipIndex}),l=Rr(c,s),{nestIndex:u}=this.state;u.push(e),this.setState({formatRoot:l,currentRoot:c,nestIndex:u})}t&&t(e)}),Z(this,`handleTouchMove`,e=>{var t=e.touches[0];if(t!=null){var n=document.elementFromPoint(t.clientX,t.clientY);if(!(!n||!n.getAttribute||this.state.formatRoot==null)){var r=n.getAttribute(`data-recharts-item-index`),i=Or(this.state.formatRoot,r);if(Dr(i)){var{dataKey:a,dispatch:o}=this.props;o(Qe({activeIndex:r,activeDataKey:a,activeCoordinate:{x:i.x+i.width/2,y:i.y+i.height/2},activeGraphicalItemId:this.props.id}))}}}})}static getDerivedStateFromProps(e,t){if(e.data!==t.prevData||e.type!==t.prevType||e.width!==t.prevWidth||e.height!==t.prevHeight||e.dataKey!==t.prevDataKey||e.aspectRatio!==t.prevAspectRatio){var n=jr({depth:0,node:{children:e.data,x:0,y:0,width:e.width,height:e.height},index:0,dataKey:e.dataKey,nameKey:e.nameKey}),r=Rr(n,e.aspectRatio);return X(X({},t),{},{formatRoot:r,currentRoot:n,nestIndex:[n],prevAspectRatio:e.aspectRatio,prevData:e.data,prevWidth:e.width,prevHeight:e.height,prevDataKey:e.dataKey,prevType:e.type})}return null}handleNestIndex(e,t){var{nestIndex:n}=this.state,{width:r,height:i,dataKey:a,nameKey:o,aspectRatio:s}=this.props,c=Rr(jr({depth:0,node:X(X({},e),{},{x:0,y:0,width:r,height:i}),index:0,dataKey:a,nameKey:o,nestedActiveTooltipIndex:e.tooltipIndex}),s);n=n.slice(0,t+1),this.setState({formatRoot:c,currentRoot:e,nestIndex:n})}renderNode(e,t){var{content:n,type:r}=this.props,i=X(X(X({},T(this.props)),t),{},{root:e}),a=!t.children||!t.children.length,{currentRoot:o}=this.state;return!(o?.children||[]).filter(e=>e.depth===t.depth&&e.name===t.name).length&&e.depth&&r===`nest`?null:B.createElement(N,{key:`recharts-treemap-node-${i.x}-${i.y}-${i.name}`,className:`recharts-treemap-depth-${t.depth}`},B.createElement(Gr,{isLeaf:a,content:n,nodeProps:i,treemapProps:this.props,onNestClick:this.handleClick}),t.children&&t.children.length?t.children.map(e=>this.renderNode(t,e)):null)}renderAllNodes(){var{formatRoot:e}=this.state;return e?this.renderNode(e,e):null}renderNestIndex(){var{nameKey:e,nestIndexContent:t}=this.props,{nestIndex:n}=this.state;return B.createElement(`div`,{className:`recharts-treemap-nest-index-wrapper`,style:{marginTop:`8px`,textAlign:`center`}},n.map((n,r)=>{var i=(0,Cn.default)(n,e,`root`),a=typeof i==`string`?i:`root`,o;return B.isValidElement(t)&&(o=B.cloneElement(t,n,r)),o=typeof t==`function`?t(n,r):a,B.createElement(`div`,{onClick:this.handleNestIndex.bind(this,n,r),key:`nest-index-${_e()}`,className:`recharts-treemap-nest-index-box`,style:{cursor:`pointer`,display:`inline-block`,padding:`0 7px`,background:`#000`,color:`#fff`,marginRight:`3px`}},o)}))}render(){var e=this.props,{width:t,height:n,className:r,style:i,children:a,type:o}=e,s=T(xr(e,br));return B.createElement(B.Fragment,null,B.createElement(Ur,{dataKey:this.props.dataKey,nameKey:this.props.nameKey,stroke:this.props.stroke,fill:this.props.fill,currentRoot:this.state.currentRoot,id:this.props.id}),B.createElement(ce,Y({},s,{width:t,height:o===`nest`?n-30:n,onTouchMove:this.handleTouchMove}),this.renderAllNodes(),a),o===`nest`&&this.renderNestIndex())}};Z(Kr,`displayName`,`Treemap`);function qr(e){var t=Pe(),n=se(),r=f();if(!ke(n)||!ke(r))return null;var{id:i}=e;return B.createElement(fe,{id:i,type:`treemap`},i=>B.createElement(Kr,Y({},e,{id:i,width:n,height:r,dispatch:t})))}function Jr(e){var t=j(e,zr),{className:n,style:r,width:i,height:a,throttleDelay:o,throttledEvents:s}=t,[c,l]=(0,B.useState)(null);return B.createElement(Ge,{preloadedState:{options:Ar},reduxStoreName:t.className??`Treemap`},B.createElement(y,{margin:Wr}),B.createElement(Xe,{throttleDelay:o,throttledEvents:s}),B.createElement(Ve,{dispatchTouchEvents:!1,className:n,style:r,width:i,height:a,responsive:!1,ref:e=>{c==null&&e!=null&&l(e)},onMouseEnter:void 0,onMouseLeave:void 0,onClick:void 0,onMouseMove:void 0,onMouseDown:void 0,onMouseUp:void 0,onContextMenu:void 0,onDoubleClick:void 0,onTouchStart:void 0,onTouchMove:void 0,onTouchEnd:void 0},B.createElement(we.Provider,{value:c},B.createElement(qr,t))))}var Q=t();function Yr(e){return`$${e.toFixed(4)}`}function Xr(e){if(e===null)return`—`;let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function Zr(e){return`${(e*100).toFixed(1)}%`}function Qr({delta:e,lowerIsBetter:t=!1,formatter:n}){if(e===null)return null;let r=e>0,i=t?e<0:e>0,a=e===0,o=n?n(Math.abs(e)):e>0?`+${e}`:`${e}`;return(0,Q.jsxs)(`span`,{className:l(`inline-flex items-center gap-0.5 text-[10px] font-medium px-1.5 py-0.5 rounded`,a?`text-muted-foreground bg-muted/40`:i?`text-green-400 bg-green-400/10`:`text-red-400 bg-red-400/10`),children:[a?(0,Q.jsx)(Et,{className:`w-2.5 h-2.5`}):r?(0,Q.jsx)(ft,{className:`w-2.5 h-2.5`}):(0,Q.jsx)(Dt,{className:`w-2.5 h-2.5`}),o]})}function $r({label:e,value:t,badge:n}){return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e}),(0,Q.jsxs)(`div`,{className:`flex items-end justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xl font-semibold tabular-nums`,children:t}),n]})]})}function ei({kpi:e}){return(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:[(0,Q.jsx)($r,{label:`Total Cost`,value:Yr(e.totalCostUsd),badge:(0,Q.jsx)(Qr,{delta:e.costDelta,lowerIsBetter:!0,formatter:e=>`$${e.toFixed(4)}`})}),(0,Q.jsx)($r,{label:`Total Jobs`,value:String(e.totalJobs),badge:(0,Q.jsx)(Qr,{delta:e.jobsDelta,lowerIsBetter:!1,formatter:e=>`+${e}`})}),(0,Q.jsx)($r,{label:`Success Rate`,value:Zr(e.successRate),badge:(0,Q.jsx)(Qr,{delta:e.successRateDelta,lowerIsBetter:!1,formatter:e=>`${(e*100).toFixed(1)}%`})}),(0,Q.jsx)($r,{label:`Avg Duration`,value:Xr(e.avgDurationMs),badge:(0,Q.jsx)(Qr,{delta:e.avgDurationDelta,lowerIsBetter:!0,formatter:e=>Xr(e)})})]})}function ti({active:e,payload:t,label:n}){return!e||!t?.length?null:(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),(0,Q.jsxs)(`p`,{className:`font-medium`,children:[`$`,t[0].value.toFixed(4)]})]})}function ni(e){try{return _t(new Date(e),`MMM d`)}catch{return e}}function ri({data:e}){if(!(e.length>0&&e.some(e=>e.costUsd>0)))return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Cost Over Time`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No cost data for this period`})]});let t=Math.max(1,Math.floor(e.length/7)),n=e.filter((e,n)=>n%t===0).map(e=>e.date);return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Cost Over Time`}),(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsxs)(ht,{data:e,margin:{top:4,right:8,left:0,bottom:0},children:[(0,Q.jsx)(F,{strokeDasharray:`3 3`,stroke:`var(--color-border)`}),(0,Q.jsx)(P,{dataKey:`date`,ticks:n,tickFormatter:ni,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,Q.jsx)(I,{tickFormatter:e=>`$${e.toFixed(2)}`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:55}),(0,Q.jsx)(D,{content:(0,Q.jsx)(ti,{})}),(0,Q.jsx)(R,{type:`monotone`,dataKey:`costUsd`,stroke:z.purple,strokeWidth:2,dot:!1,activeDot:{r:3,fill:z.purple}})]})})]})}function ii({active:e,payload:t}){if(!e||!t?.length)return null;let n=t[0];return(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`capitalize font-medium`,children:n.name}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground`,children:[n.value,` jobs`]})]})}function ai({data:e}){if(e.length===0)return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Jobs by Status`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No jobs in this period`})]});let t=e.reduce((e,t)=>e+t.count,0);return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Jobs by Status`}),(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsxs)(cr,{children:[(0,Q.jsx)(Qn,{data:e,dataKey:`count`,nameKey:`status`,cx:`50%`,cy:`50%`,innerRadius:60,outerRadius:90,paddingAngle:2,children:e.map(e=>(0,Q.jsx)(E,{fill:St[e.status]??`var(--color-muted-foreground)`},e.status))}),(0,Q.jsx)(D,{content:(0,Q.jsx)(ii,{})}),(0,Q.jsx)(W,{formatter:n=>{let r=e.find(e=>e.status===n),i=r?(r.count/t*100).toFixed(0):`0`;return(0,Q.jsxs)(`span`,{className:`text-xs capitalize`,children:[n,` (`,r?.count??0,`, `,i,`%)`]})}})]})})]})}var oi=[`<1m`,`1-3m`,`3-5m`,`5-10m`,`>10m`];function si(e){if(e===null)return`—`;let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function ci({active:e,payload:t,label:n}){return!e||!t?.length?null:(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),(0,Q.jsxs)(`p`,{className:`font-medium`,children:[t[0].value,` jobs`]})]})}function li({data:e,percentiles:t}){let n=oi.map(t=>({bucket:t,count:e.find(e=>e.bucket===t)?.count??0}));return n.some(e=>e.count>0)?(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Duration Distribution`}),(0,Q.jsx)(w,{width:`100%`,height:180,children:(0,Q.jsxs)(mt,{data:n,margin:{top:4,right:8,left:0,bottom:0},children:[(0,Q.jsx)(F,{strokeDasharray:`3 3`,stroke:`var(--color-border)`,vertical:!1}),(0,Q.jsx)(P,{dataKey:`bucket`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,Q.jsx)(I,{allowDecimals:!1,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:30}),(0,Q.jsx)(D,{content:(0,Q.jsx)(ci,{})}),(0,Q.jsx)(L,{dataKey:`count`,fill:z.cyan,radius:[3,3,0,0]})]})}),(0,Q.jsx)(`div`,{className:`flex items-center gap-3 mt-2`,children:[`p50`,`p75`,`p95`].map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground uppercase`,children:[e,`:`]}),(0,Q.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums`,children:si(t[e])})]},e))})]}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Duration Distribution`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No duration data available`})]})}function ui({active:e,payload:t,label:n}){return!e||!t?.length?null:(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground mb-1 font-mono truncate max-w-48`,children:n}),t.map(e=>(0,Q.jsxs)(`p`,{style:{color:e.color},children:[e.name,`: `,e.value.toLocaleString()]},e.name))]})}function di({data:e}){if(e.length===0)return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Token Efficiency`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No token data for this period`})]});let t=e.map(e=>({...e,name:e.command.length>20?`…${e.command.slice(-18)}`:e.command}));return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Token Efficiency`}),(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsxs)(mt,{layout:`vertical`,data:t,margin:{top:4,right:8,left:0,bottom:0},children:[(0,Q.jsx)(F,{strokeDasharray:`3 3`,stroke:`var(--color-border)`,horizontal:!1}),(0,Q.jsx)(P,{type:`number`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,tickFormatter:e=>e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}),(0,Q.jsx)(I,{type:`category`,dataKey:`name`,width:110,tick:{fontSize:9,fill:`var(--color-muted-foreground)`,fontFamily:`monospace`},axisLine:!1,tickLine:!1}),(0,Q.jsx)(D,{content:(0,Q.jsx)(ui,{})}),(0,Q.jsx)(W,{formatter:e=>(0,Q.jsx)(`span`,{className:`text-xs`,children:e})}),(0,Q.jsx)(L,{dataKey:`tokensOut`,name:`Output tokens`,fill:z.purple,stackId:`a`,radius:[0,3,3,0]}),(0,Q.jsx)(L,{dataKey:`tokensCacheRead`,name:`Cached tokens`,fill:z.cyan,stackId:`a`,radius:[0,3,3,0]})]})})]})}function fi(e){return e===null?`—`:`$${e.toFixed(4)}`}function pi(e){if(e===null)return`—`;let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function mi({rate:e}){let t=(e*100).toFixed(0);return(0,Q.jsxs)(`span`,{className:l(`inline-block px-1.5 py-0.5 rounded text-[10px] font-medium`,e>=.8?`bg-green-400/10 text-green-400`:e>=.5?`bg-orange-400/10 text-orange-400`:`bg-red-400/10 text-red-400`),children:[t,`%`]})}function $({label:e,sortKey:t,current:n,dir:r,onSort:i}){return(0,Q.jsx)(`th`,{onClick:()=>i(t),className:`px-3 py-2 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide cursor-pointer select-none hover:text-foreground whitespace-nowrap`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[e,n===t?r===`asc`?(0,Q.jsx)(wt,{className:`w-3 h-3`}):(0,Q.jsx)(vt,{className:`w-3 h-3`}):(0,Q.jsx)(Tt,{className:`w-3 h-3 opacity-40`})]})})}function hi({data:e}){let[t,n]=(0,B.useState)(`totalCostUsd`),[r,i]=(0,B.useState)(`desc`);function a(e){e===t?i(e=>e===`asc`?`desc`:`asc`):(n(e),i(`desc`))}let o=[...e].sort((e,n)=>{let i=e[t]??-1/0,a=n[t]??-1/0,o=typeof i==`string`?i.localeCompare(a):i-a;return r===`asc`?o:-o});return e.length===0?(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Command Performance`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No command data for this period`})]}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Command Performance`}),(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border/30`,children:[(0,Q.jsx)($,{label:`Command`,sortKey:`command`,current:t,dir:r,onSort:a}),(0,Q.jsx)($,{label:`Runs`,sortKey:`totalRuns`,current:t,dir:r,onSort:a}),(0,Q.jsx)($,{label:`Success Rate`,sortKey:`successRate`,current:t,dir:r,onSort:a}),(0,Q.jsx)($,{label:`Avg Cost`,sortKey:`avgCostUsd`,current:t,dir:r,onSort:a}),(0,Q.jsx)($,{label:`Avg Duration`,sortKey:`avgDurationMs`,current:t,dir:r,onSort:a}),(0,Q.jsx)($,{label:`Total Cost`,sortKey:`totalCostUsd`,current:t,dir:r,onSort:a})]})}),(0,Q.jsx)(`tbody`,{children:o.map(e=>(0,Q.jsxs)(`tr`,{className:`border-b border-border/20 hover:bg-accent/20 transition-colors`,children:[(0,Q.jsx)(`td`,{className:`px-3 py-2 font-mono text-[10px] text-foreground`,children:e.command}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums`,children:e.totalRuns}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(mi,{rate:e.successRate})}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums`,children:fi(e.avgCostUsd)}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums`,children:pi(e.avgDurationMs)}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums font-medium`,children:fi(e.totalCostUsd)})]},e.command))})]})})]})}function gi({active:e,payload:t,label:n}){return!e||!t?.length?null:(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),t.map(e=>(0,Q.jsxs)(`p`,{style:{color:e.color},children:[e.name,`: `,e.value]},e.name))]})}function _i(e){try{return _t(new Date(e),`MMM d`)}catch{return e}}function vi({data:e}){if(!(e.length>0&&e.some(e=>e.completed+e.failed+e.canceled>0)))return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Daily Throughput`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No throughput data for this period`})]});let t=Math.max(1,Math.floor(e.length/7)),n=e.filter((e,n)=>n%t===0).map(e=>e.date);return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Daily Throughput`}),(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsxs)(mt,{data:e,margin:{top:4,right:8,left:0,bottom:0},children:[(0,Q.jsx)(F,{strokeDasharray:`3 3`,stroke:`var(--color-border)`,vertical:!1}),(0,Q.jsx)(P,{dataKey:`date`,ticks:n,tickFormatter:_i,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,Q.jsx)(I,{allowDecimals:!1,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:30}),(0,Q.jsx)(D,{content:(0,Q.jsx)(gi,{})}),(0,Q.jsx)(W,{formatter:e=>(0,Q.jsx)(`span`,{className:`text-xs capitalize`,children:e})}),(0,Q.jsx)(L,{dataKey:`completed`,name:`Completed`,stackId:`a`,fill:z.purple}),(0,Q.jsx)(L,{dataKey:`failed`,name:`Failed`,stackId:`a`,fill:z.pink}),(0,Q.jsx)(L,{dataKey:`canceled`,name:`Canceled`,stackId:`a`,fill:z.orange,radius:[3,3,0,0]})]})})]})}function yi({x:e=0,y:t=0,width:n=0,height:r=0,name:i=``,size:a=0,colorIndex:o=0}){let s=Ct[o%Ct.length];return(0,Q.jsxs)(`g`,{children:[(0,Q.jsx)(`rect`,{x:e,y:t,width:n,height:r,style:{fill:s,fillOpacity:.8,stroke:`var(--color-background)`,strokeWidth:2},rx:4}),n>50&&r>30&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`text`,{x:e+6,y:t+16,fill:`var(--color-background)`,fontSize:10,fontFamily:`monospace`,style:{overflow:`hidden`},children:i.length>Math.floor(n/6)?i.slice(0,Math.floor(n/6)-1)+`…`:i}),r>45&&(0,Q.jsxs)(`text`,{x:e+6,y:t+30,fill:`hsl(231 15% 18% / 0.7)`,fontSize:9,children:[`$`,a.toFixed(4)]})]})]})}function bi({active:e,payload:t}){if(!e||!t?.length)return null;let n=t[0].payload;return n?(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,Q.jsx)(`p`,{className:`font-mono font-medium mb-1`,children:n.name}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Cost: $`,n.size.toFixed(4)]}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Jobs: `,n.jobCount]})]}):null}function xi({data:e}){let t=e.filter(e=>e.totalCostUsd>0);if(t.length===0)return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Cost per Command`}),(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No cost data for this period`})]});let n=t.map((e,t)=>({name:e.command,size:e.totalCostUsd,jobCount:e.jobCount,colorIndex:t}));return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:`Cost per Command`}),(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsx)(Jr,{data:n,dataKey:`size`,content:(0,Q.jsx)(yi,{}),children:(0,Q.jsx)(D,{content:(0,Q.jsx)(bi,{})})})})]})}function Si({label:e,value:t}){return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-3 space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide`,children:e}),(0,Q.jsx)(`p`,{className:`text-base font-semibold tabular-nums`,children:t})]})}function Ci({data:e}){let t=e.costPerSuccess===null?`—`:`$${e.costPerSuccess.toFixed(4)}`,n=e.apiEfficiencyPct===null?`—`:`${e.apiEfficiencyPct.toFixed(0)}%`,r=`$${e.failureCostUsd.toFixed(4)}`;return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Bonus Metrics`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,Q.jsx)(Si,{label:`Cost per Success`,value:t}),(0,Q.jsx)(Si,{label:`API Efficiency`,value:n}),(0,Q.jsx)(Si,{label:`Failure Cost`,value:r})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Model Breakdown`}),e.modelBreakdown.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No model data for this period`}):(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border/30`,children:[(0,Q.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide`,children:`Model`}),(0,Q.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide`,children:`Jobs`}),(0,Q.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[10px] font-medium text-muted-foreground uppercase tracking-wide`,children:`Total Cost`})]})}),(0,Q.jsx)(`tbody`,{children:e.modelBreakdown.map(e=>(0,Q.jsxs)(`tr`,{className:`border-b border-border/20`,children:[(0,Q.jsx)(`td`,{className:`px-3 py-1.5 font-mono text-[10px]`,children:e.model}),(0,Q.jsx)(`td`,{className:`px-3 py-1.5 tabular-nums`,children:e.jobCount}),(0,Q.jsxs)(`td`,{className:`px-3 py-1.5 tabular-nums`,children:[`$`,e.totalCostUsd.toFixed(4)]})]},e.model))})]})})]})]})}var wi=[{key:`cost`,label:`Avg Cost ($)`,color:z.purple},{key:`duration`,label:`Avg Duration (min)`,color:z.cyan},{key:`successRate`,label:`Success Rate (%)`,color:z.green}];function Ti({active:e,payload:t,label:n}){return!e||!t?.length?null:(0,Q.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),t.map(e=>(0,Q.jsxs)(`p`,{style:{color:e.color},children:[e.name,`: `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.value})]},e.name))]})}function Ei(e){try{return _t(new Date(e),`MMM d`)}catch{return e}}function Di({points:e}){let[t,n]=(0,B.useState)(new Set([`cost`,`successRate`])),r=e.some(e=>e.jobCount>0),i=e.map(e=>({date:e.date,cost:e.avgCostUsd===null?0:parseFloat(e.avgCostUsd.toFixed(4)),duration:e.avgDurationMs===null?0:parseFloat((e.avgDurationMs/6e4).toFixed(2)),successRate:parseFloat((e.successRate*100).toFixed(1)),jobCount:e.jobCount})),a=Math.max(1,Math.floor(e.length/7)),o=e.filter((e,t)=>t%a===0).map(e=>e.date);function s(e){n(t=>{let n=new Set(t);return n.has(e)?n.size>1&&n.delete(e):n.add(e),n})}return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Performance Trends`}),(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:wi.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>s(e.key),className:`flex items-center gap-1 text-[10px] px-2 py-0.5 rounded transition-colors ${t.has(e.key)?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:[(0,Q.jsx)(`span`,{className:`w-2 h-2 rounded-full inline-block shrink-0`,style:{background:e.color}}),e.label]},e.key))})]}),r?(0,Q.jsx)(w,{width:`100%`,height:220,children:(0,Q.jsxs)(ht,{data:i,margin:{top:4,right:8,left:0,bottom:0},children:[(0,Q.jsx)(F,{strokeDasharray:`3 3`,stroke:`var(--color-border)`}),(0,Q.jsx)(P,{dataKey:`date`,ticks:o,tickFormatter:Ei,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,Q.jsx)(I,{tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:40}),(0,Q.jsx)(D,{content:(0,Q.jsx)(Ti,{})}),(0,Q.jsx)(W,{wrapperStyle:{fontSize:`10px`,paddingTop:`8px`}}),t.has(`cost`)&&(0,Q.jsx)(R,{type:`monotone`,dataKey:`cost`,name:`Avg Cost ($)`,stroke:z.purple,strokeWidth:2,dot:!1,activeDot:{r:3,fill:z.purple}}),t.has(`duration`)&&(0,Q.jsx)(R,{type:`monotone`,dataKey:`duration`,name:`Avg Duration (min)`,stroke:z.cyan,strokeWidth:2,dot:!1,activeDot:{r:3,fill:z.cyan}}),t.has(`successRate`)&&(0,Q.jsx)(R,{type:`monotone`,dataKey:`successRate`,name:`Success Rate (%)`,stroke:z.green,strokeWidth:2,dot:!1,activeDot:{r:3,fill:z.green}})]})}):(0,Q.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-xs text-muted-foreground`,children:`No job data for this period`})]})}function Oi(){return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:Array.from({length:4}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-20 rounded-lg border border-border/40 bg-card/50 animate-pulse`},t))}),(0,Q.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:Array.from({length:4}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-[260px] rounded-lg border border-border/40 bg-card/50 animate-pulse`},t))}),(0,Q.jsx)(`div`,{className:`h-[180px] rounded-lg border border-border/40 bg-card/50 animate-pulse`})]})}function ki({message:e,onRetry:t}){return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-red-400/30 bg-red-400/10 p-4 flex items-center justify-between`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-red-400`,children:e}),(0,Q.jsxs)(`button`,{onClick:t,className:`flex items-center gap-1.5 h-7 px-3 rounded-md text-xs text-red-400 border border-red-400/30 hover:bg-red-400/10 transition-colors`,children:[(0,Q.jsx)(ae,{className:`w-3 h-3`}),`Retry`]})]})}var Ai=[{value:`1d`,label:`1d`},{value:`7d`,label:`7d`},{value:`30d`,label:`30d`}];function ji(){let{activeProjectId:e}=o(),[t,n]=(0,B.useState)(`7d`),[r,i]=(0,B.useState)(``),[a,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!0),[p,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(0),[_,v]=(0,B.useState)(`7d`),[y,b]=(0,B.useState)(null),x=(0,B.useRef)(new Map);(0,B.useEffect)(()=>{if(e){let t=x.current.get(e);t&&(u(t),f(!1))}let n=new AbortController;!l&&!x.current.get(e??``)&&f(!0),m(null);let i=new URLSearchParams({period:t});if(t===`custom`){if(!r||!a){f(!1);return}i.set(`from`,r),i.set(`to`,a)}return fetch(`${s()}/analytics?${i}`,{signal:n.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{u(t),e&&x.current.set(e,t),f(!1)}).catch(e=>{e.name!==`AbortError`&&(m(e.message),f(!1))}),()=>n.abort()},[t,r,a,h,e]),(0,B.useEffect)(()=>{let e=new AbortController;return fetch(`${s()}/trends?period=${_}`,{signal:e.signal}).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(e=>b(e)).catch(e=>{e.name!==`AbortError`&&console.warn(`[analytics] trends fetch failed:`,e.message)}),()=>e.abort()},[_,e]);function S(e,t,r){n(e),i(t??``),c(r??``)}function C(){g(e=>e+1)}return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Analytics`}),l&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l.period.label})]}),(0,Q.jsx)(gt,{period:t,from:r,to:a,onChange:S})]}),d&&(0,Q.jsx)(Oi,{}),!d&&p&&(0,Q.jsx)(ki,{message:`Failed to load analytics: ${p}`,onRetry:C}),!d&&!p&&l&&(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(ei,{kpi:l.kpi}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,Q.jsx)(ri,{data:l.costTimeline}),(0,Q.jsx)(ai,{data:l.statusBreakdown}),(0,Q.jsx)(li,{data:l.durationHistogram,percentiles:l.durationPercentiles}),(0,Q.jsx)(di,{data:l.tokenEfficiency})]}),(0,Q.jsx)(hi,{data:l.commandPerformance}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,Q.jsx)(vi,{data:l.dailyThroughput}),(0,Q.jsx)(xi,{data:l.costPerCommand})]}),(0,Q.jsx)(Ci,{data:l.bonusMetrics}),y&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-medium`,children:`Trends`}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:Ai.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>v(e.value),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${_===e.value?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:e.label},e.value))})]}),(0,Q.jsx)(Di,{points:y.points})]})]})]})}export{ji as default};
|