@roastcodes/ttdash 6.2.2 → 6.2.3

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.
Files changed (58) hide show
  1. package/dist/assets/AnimatedBarFill-DFAXO-3i.js +1 -0
  2. package/dist/assets/{AnomalyDetection-D06kgR_V.js → AnomalyDetection-DKM--5-J.js} +1 -1
  3. package/dist/assets/{AutoImportModal-CuzbrUVc.js → AutoImportModal-Cqefa6n_.js} +1 -1
  4. package/dist/assets/{CacheROI-fJ1paHaT.js → CacheROI-BLADEjtP.js} +1 -1
  5. package/dist/assets/{ChartCard-CS4Kbe6r.js → ChartCard-DxxB4rGm.js} +2 -2
  6. package/dist/assets/{ChartLegend-Vzg_GmF-.js → ChartLegend-Vpk95i3r.js} +1 -1
  7. package/dist/assets/{CorrelationAnalysis-DX-ZQKVJ.js → CorrelationAnalysis-CI9eGa8R.js} +1 -1
  8. package/dist/assets/{CostByModelOverTime-BRo1PCRo.js → CostByModelOverTime-BDvnsdLO.js} +1 -1
  9. package/dist/assets/{CostByWeekday-BJwEWkmF.js → CostByWeekday-BPU1qW5f.js} +1 -1
  10. package/dist/assets/{CostForecast-BxICbpzM.js → CostForecast-fwd7SRIn.js} +1 -1
  11. package/dist/assets/{CumulativeCost-BdlOTRDX.js → CumulativeCost-CwiklwFD.js} +1 -1
  12. package/dist/assets/{CustomTooltip-CEd8U-a3.js → CustomTooltip-CfoUDPbT.js} +1 -1
  13. package/dist/assets/{DistributionAnalysis-Cw8bRtt9.js → DistributionAnalysis-B8pjQMNj.js} +1 -1
  14. package/dist/assets/DrillDownModal-kczVCwfa.js +1 -0
  15. package/dist/assets/{HelpPanel-Ct4CbfBg.js → HelpPanel-D4zNwrI2.js} +1 -1
  16. package/dist/assets/{InfoButton-CyA48Vlx.js → InfoButton-BGjUQfHz.js} +1 -1
  17. package/dist/assets/InfoHeading-BxLyydv8.js +1 -0
  18. package/dist/assets/{MetricCard-CLFpH1l1.js → MetricCard-r_uhdKDU.js} +1 -1
  19. package/dist/assets/{ModelEfficiency-CO7sQQnT.js → ModelEfficiency-Di3fDAn7.js} +1 -1
  20. package/dist/assets/{ModelMix-C4P2SpQZ.js → ModelMix-BgCzWf9V.js} +1 -1
  21. package/dist/assets/{PeriodComparison-BogfA2IN.js → PeriodComparison-BIoF7n2v.js} +1 -1
  22. package/dist/assets/{ProviderEfficiency-CY4HJ7Fy.js → ProviderEfficiency-BFUYfBkW.js} +1 -1
  23. package/dist/assets/{ProviderLimitsSection-BcCrH2XG.js → ProviderLimitsSection-BxaczEFO.js} +1 -1
  24. package/dist/assets/{RecentDays-K0Uzk7UU.js → RecentDays-Bac6HOtv.js} +1 -1
  25. package/dist/assets/{RequestCacheHitRateByModel-8ip50S7V.js → RequestCacheHitRateByModel-DD2j4dXY.js} +1 -1
  26. package/dist/assets/{RequestQuality-ByYXyzn8.js → RequestQuality-CUy5BQzj.js} +1 -1
  27. package/dist/assets/{RequestsOverTime-B4yB-x_5.js → RequestsOverTime-Bv3riiRF.js} +1 -1
  28. package/dist/assets/SettingsModal-4uENZ87D.js +1 -0
  29. package/dist/assets/{TokenEfficiency-Bhdj4v75.js → TokenEfficiency-6dfn-4_1.js} +1 -1
  30. package/dist/assets/TokenTypes-Dx67irJb.js +1 -0
  31. package/dist/assets/{TokensOverTime-BA7W_OfG.js → TokensOverTime-C1858Oi-.js} +1 -1
  32. package/dist/assets/{app-settings-EFIYxqQU.js → app-settings-BInClAwB.js} +1 -1
  33. package/dist/assets/button-CRvPoJg9.js +1 -0
  34. package/dist/assets/card-B4CVYJDH.js +1 -0
  35. package/dist/assets/{constants-DOCA3QtR.js → constants-BDzjWFuU.js} +1 -1
  36. package/dist/assets/{dialog-D4LfH66U.js → dialog-Djogwk0C.js} +1 -1
  37. package/dist/assets/{formatted-value-DuGw8WPX.js → formatted-value-CpLoDrYF.js} +1 -1
  38. package/dist/assets/{formatters-BzLLk0br.js → formatters-C7EouP6y.js} +1 -1
  39. package/dist/assets/{help-content-Cuf5l3_6.js → help-content-B2N8SHIE.js} +1 -1
  40. package/dist/assets/{i18n-D1WJ4-W9.js → i18n-BS3-GJaA.js} +1 -1
  41. package/dist/assets/{index-D6_2fCBR.js → index-C59tb1_V.js} +3 -3
  42. package/dist/assets/{motion-vendor-BNFhNARW.js → motion-vendor-BNVN-Ktr.js} +1 -1
  43. package/dist/assets/{section-header-KpKzq-Qa.js → section-header-Dz0QIE6e.js} +1 -1
  44. package/dist/assets/{ui-vendor-DOI7LsxH.js → ui-vendor-C_SJC6eX.js} +1 -1
  45. package/dist/assets/useTranslation-0ThAx3Gl.js +1 -0
  46. package/dist/index.html +21 -21
  47. package/package.json +1 -1
  48. package/server.js +7 -0
  49. package/src/locales/de/common.json +9 -0
  50. package/src/locales/en/common.json +9 -0
  51. package/dist/assets/AnimatedBarFill-Da354-1y.js +0 -1
  52. package/dist/assets/DrillDownModal-BT2rFk_U.js +0 -1
  53. package/dist/assets/InfoHeading-CFbl45C9.js +0 -1
  54. package/dist/assets/SettingsModal-Badl8kHp.js +0 -1
  55. package/dist/assets/TokenTypes-CaVA8FXP.js +0 -1
  56. package/dist/assets/button-olcuyddH.js +0 -1
  57. package/dist/assets/card-CskYMXga.js +0 -1
  58. package/dist/assets/useTranslation-JH30oWEP.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{b as t,c as n,f as r,h as i,l as a,m as o,p as s,t as c,v as l,w as u,y as d}from"./charts-vendor-CiBqdKXh.js";import{o as f}from"./motion-vendor-BNFhNARW.js";import{t as p}from"./useTranslation-JH30oWEP.js";import{c as m,n as h,r as g,t as _}from"./formatters-BzLLk0br.js";import{i as v}from"./i18n-D1WJ4-W9.js";import{L as y,a as b,i as x,m as S}from"./icons-vendor-CIvT_-Pb.js";import{a as C}from"./model-utils-BIvGAFGz.js";import{c as w,n as T,t as E}from"./card-CskYMXga.js";import{i as D,t as O}from"./help-content-Cuf5l3_6.js";import{t as k}from"./section-header-KpKzq-Qa.js";import{i as A,n as j,o as M,r as N}from"./chart-theme-BdE8bEiN.js";import{n as P,r as F,t as I}from"./ChartCard-CS4Kbe6r.js";import{t as L}from"./ChartLegend-Vzg_GmF-.js";import{t as R}from"./AnimatedBarFill-Da354-1y.js";import{n as z,r as B}from"./provider-limits-BgKrr7k7.js";var V=e(u()),H=f();function U(e){return e.riskStatus===`limit`?v.t(`limits.statuses.limitExceeded`):e.riskStatus===`warning`?v.t(`limits.statuses.budgetTight`):e.riskStatus===`ok`?v.t(`limits.statuses.budgetStable`):v.t(`limits.statuses.noLimit`)}function W(e){return e.hasSubscription?e.subscriptionStatus===`gain`?v.t(`limits.statuses.subscriptionPaysOff`):v.t(`limits.statuses.belowSubscription`):v.t(`limits.statuses.noSubscription`)}function G(e,t){return e.monthlyLimit>0?v.t(`limits.badge.limit`,{value:e.utilization?.toFixed(0)??`0`}):e.hasSubscription?v.t(`limits.badge.subscription`,{value:Math.min(t,999).toFixed(0)}):v.t(`limits.badge.open`)}function K(e){let t=Number(Array.isArray(e)?e[0]??0:e??0);return Number.isFinite(t)?t:0}function q({data:e,providers:u,limits:f,selectedMonth:v}){let{t:q}=p(),{rows:J,focusMonth:Y,timelineData:X,atLimitCount:Z,nearLimitCount:Q,subscriptionTotal:$,subscriptionGainTotal:ee}=(0,V.useMemo)(()=>{let{months:t,monthMap:n,providerTotals:r}=z(e),i=B(e),a=v??i,o=u.map(e=>{let t=f[e],i=a?n.get(a)?.get(e)??0:0,o=r.get(e)??0,s=t?.monthlyLimit??0,c=!!t?.hasSubscription,l=c?t?.subscriptionPrice??0:0,u=s>0?Math.max(i-s,0):0,d=s>0?Math.max(s-i,0):null,p=s>0?i/s*100:null,m=c?i-l:null,h=m===null?0:Math.max(m,0),g=m===null?0:Math.max(-m,0),_=`none`;return s>0&&i>=s?_=`limit`:s>0&&i>=s*.8?_=`warning`:s>0&&(_=`ok`),{provider:e,cost:i,totalCost:o,monthlyLimit:s,subscriptionPrice:l,hasSubscription:c,remaining:d,overrun:u,utilization:p,subscriptionDelta:m,subscriptionGain:h,subscriptionGap:g,riskStatus:_,subscriptionStatus:c?h>0?`gain`:`gap`:`none`}}).sort((e,t)=>e.riskStatus===`limit`&&t.riskStatus!==`limit`?-1:e.riskStatus!==`limit`&&t.riskStatus===`limit`?1:e.subscriptionStatus===`gain`&&t.subscriptionStatus!==`gain`?-1:e.subscriptionStatus!==`gain`&&t.subscriptionStatus===`gain`?1:t.cost-e.cost);return{rows:o,focusMonth:a,timelineData:t.map(e=>{let t=n.get(e)??new Map,r=u.reduce((e,n)=>e+(t.get(n)??0),0),i=u.reduce((e,t)=>{let n=f[t]?.monthlyLimit??0;return e+(n>0?n:0)},0),a=u.reduce((e,t)=>{let n=f[t];return e+(n?.hasSubscription?n.subscriptionPrice:0)},0),o=u.reduce((e,n)=>{let r=f[n]?.monthlyLimit??0,i=t.get(n)??0;return e+(r>0?Math.max(i-r,0):0)},0),s=u.reduce((e,n)=>{let r=f[n],i=t.get(n)??0,a=r?.hasSubscription?r.subscriptionPrice:0;return e+Math.max(i-a,0)},0),c=u.reduce((e,n)=>{let r=f[n],i=t.get(n)??0,a=r?.hasSubscription?r.subscriptionPrice:0;return e+(r?.hasSubscription?Math.max(a-i,0):0)},0);return{month:e,totalCost:r,totalLimit:i>0?i:null,totalSubscriptions:a>0?a:null,totalOverrun:o,totalSubscriptionGain:s,totalSubscriptionGap:c}}),atLimitCount:o.filter(e=>e.riskStatus===`limit`).length,nearLimitCount:o.filter(e=>e.riskStatus===`warning`).length,subscriptionTotal:o.reduce((e,t)=>e+t.subscriptionPrice,0),subscriptionGainTotal:o.reduce((e,t)=>e+t.subscriptionGain,0)}},[e,f,u,v]);return u.length===0?null:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(k,{title:q(`limits.sectionTitle`),badge:q(`limits.providersBadge`,{count:u.length}),description:q(`limits.sectionDescription`),info:D.limits}),Z>0&&(0,H.jsx)(w,{className:`mb-4 rounded-2xl border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-100`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,H.jsx)(x,{className:`h-4 w-4`}),q(`limits.warningBanner`,{count:Z})]})}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-4`,children:[{label:q(`limits.cards.atLimit`),value:String(Z),hint:Y?m(Y):q(`limits.cards.noMonth`),icon:(0,H.jsx)(x,{className:`h-4 w-4`})},{label:q(`limits.cards.nearLimit`),value:String(Q),hint:q(`limits.cards.nearLimitHint`),icon:(0,H.jsx)(S,{className:`h-4 w-4`})},{label:q(`limits.cards.subscriptionVolume`),value:h($),hint:q(`limits.cards.subscriptionVolumeHint`),icon:(0,H.jsx)(y,{className:`h-4 w-4`})},{label:q(`limits.cards.subscriptionValue`),value:h(ee),hint:q(`limits.cards.subscriptionValueHint`),icon:(0,H.jsx)(b,{className:`h-4 w-4`})}].map((e,t)=>(0,H.jsx)(w,{order:t,children:(0,H.jsx)(E,{className:`h-full`,children:(0,H.jsx)(T,{className:`p-4`,children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:e.label}),(0,H.jsx)(`div`,{className:`mt-1 text-2xl font-semibold tabular-nums`,children:e.value}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.hint})]}),(0,H.jsx)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 p-2 text-muted-foreground`,children:e.icon})]})})})},e.label))}),(0,H.jsx)(`div`,{className:`mt-4 grid grid-cols-1 gap-4 xl:grid-cols-3`,children:J.map((e,t)=>{let n=C(e.provider),r=e.monthlyLimit>0?Math.min(e.cost/e.monthlyLimit*100,100):0,i=e.hasSubscription&&e.subscriptionPrice>0?e.cost/e.subscriptionPrice*100:0,a=Math.min(i,100);return(0,H.jsx)(w,{delayMs:80+t*35,children:(0,H.jsx)(E,{className:e.riskStatus===`limit`?`border-red-500/40 bg-red-500/[0.06]`:e.subscriptionStatus===`gain`?`border-emerald-500/30 bg-emerald-500/[0.05]`:void 0,children:(0,H.jsxs)(T,{className:`p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:e.provider}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:U(e)}),(0,H.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground/80`,children:W(e)})]}),(0,H.jsx)(`div`,{className:`rounded-full border px-2.5 py-1 text-[11px] font-medium`,style:n,children:G(e,i)})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:q(`limits.tracks.usageFocusMonth`)}),(0,H.jsx)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums`,children:h(e.cost)})]}),(0,H.jsxs)(`div`,{className:`text-right`,children:[(0,H.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:q(`limits.tracks.limitSubscription`)}),(0,H.jsxs)(`div`,{className:`mt-1 text-sm font-medium tabular-nums`,children:[e.monthlyLimit>0?h(e.monthlyLimit):q(`limits.statuses.noLimit`),` `,`/ `,e.hasSubscription?h(e.subscriptionPrice):`–`]})]})]}),(0,H.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:q(`limits.tracks.budgetRisk`)}),(0,H.jsx)(`span`,{children:e.monthlyLimit>0?e.overrun>0?`+${h(e.overrun)}`:h(e.remaining??0):q(`limits.statuses.noLimit`)})]}),(0,H.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-muted/30`,children:e.monthlyLimit>0?(0,H.jsx)(R,{className:e.riskStatus===`limit`?`h-full bg-red-400`:e.riskStatus===`warning`?`h-full bg-amber-400`:`h-full`,width:`${r}%`,order:t*2,...e.riskStatus===`limit`||e.riskStatus===`warning`?{}:{style:{backgroundColor:n.color}}}):(0,H.jsx)(`div`,{className:`h-full w-full bg-muted/20`})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:q(`limits.tracks.subscriptionEffect`)}),(0,H.jsx)(`span`,{className:e.subscriptionStatus===`gain`?`text-emerald-300`:e.subscriptionStatus===`gap`?`text-amber-200`:``,children:e.hasSubscription?e.subscriptionStatus===`gain`?`+${h(e.subscriptionGain)}`:h(e.subscriptionGap):q(`limits.statuses.noSubscription`)})]}),(0,H.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-muted/30`,children:e.hasSubscription?(0,H.jsx)(R,{className:e.subscriptionStatus===`gain`?`h-full bg-emerald-400`:`h-full bg-amber-300`,width:`${a}%`,order:t*2+1}):(0,H.jsx)(`div`,{className:`h-full w-full bg-muted/20`})})]})]})]})})},e.provider)})}),(0,H.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 gap-4 xl:grid-cols-2`,children:[(0,H.jsx)(P,{title:q(`limits.tracks.budgetTitle`),subtitle:q(Y?`limits.tracks.budgetSubtitle`:`limits.tracks.budgetNoMonth`),info:O.providerLimitProgress,chartData:J,valueKey:`cost`,valueFormatter:h,children:(0,H.jsx)(`div`,{className:`space-y-3`,children:J.map((e,t)=>{let n=(e.monthlyLimit>0?Math.max(e.monthlyLimit,e.cost,1):Math.max(e.cost,1))*1.15,r=`${e.cost/n*100}%`,i=e.monthlyLimit>0?`${e.monthlyLimit/n*100}%`:`0%`,a=e.monthlyLimit>0?`${Math.min(e.cost,e.monthlyLimit)/n*100}%`:r,o=e.monthlyLimit>0&&e.overrun>0?`${e.overrun/n*100}%`:`0%`;return(0,H.jsxs)(w,{delayMs:90+t*40,className:`rounded-xl border border-border/50 bg-muted/10 p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:e.provider}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.monthlyLimit<=0?q(`limits.statuses.noLimit`):e.overrun>0?q(`limits.tracks.alreadyAboveLimit`,{value:h(e.overrun)}):q(`limits.tracks.stillToLimit`,{value:h(e.remaining??0)})})]}),(0,H.jsxs)(`div`,{className:`text-right text-xs`,children:[(0,H.jsxs)(`div`,{className:`text-muted-foreground`,children:[q(`limits.tracks.usage`),` `,h(e.cost)]}),(0,H.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[q(`limits.tracks.limit`),` `,e.monthlyLimit>0?h(e.monthlyLimit):`–`]})]})]}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsxs)(`div`,{className:`relative h-14`,children:[(0,H.jsx)(`div`,{className:`absolute inset-x-0 top-5 h-4 rounded-full bg-muted/25`}),e.monthlyLimit>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`absolute top-5 left-0 h-4 rounded-l-full bg-sky-400/12`,style:{width:i}}),(0,H.jsx)(`div`,{className:`absolute top-5 h-4 rounded-r-full bg-red-400/12`,style:{left:i,width:`calc(100% - ${i})`}}),(0,H.jsx)(R,{className:e.riskStatus===`warning`?`absolute top-5 left-0 h-4 rounded-full bg-amber-400`:`absolute top-5 left-0 h-4 rounded-full bg-sky-400`,width:a,order:t*2}),e.overrun>0&&(0,H.jsx)(R,{className:`absolute top-5 h-4 rounded-r-full bg-red-400`,style:{left:i},width:o,order:t*2+1}),(0,H.jsx)(`div`,{className:`absolute top-2 h-10 w-px bg-border`,style:{left:i}}),(0,H.jsx)(`div`,{className:`absolute top-0 -translate-x-1/2 rounded-full border border-border/70 bg-background px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,style:{left:i},children:q(`limits.tracks.limit`)})]}):(0,H.jsx)(R,{className:`absolute top-5 left-0 h-4 rounded-full bg-muted-foreground/40`,width:r,order:t*2}),(0,H.jsx)(`div`,{className:`absolute top-11 left-0 text-[10px] text-muted-foreground`,children:`$0`}),(0,H.jsx)(`div`,{className:`absolute top-11 right-0 text-[10px] text-muted-foreground`,children:h(n)})]})}),(0,H.jsxs)(`div`,{className:`mt-2 grid grid-cols-1 gap-2 text-xs md:grid-cols-3`,children:[(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.currentlyUsed`)}),(0,H.jsx)(`div`,{className:`mt-1 font-medium text-foreground`,children:h(e.cost)})]}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.remainingToLimit`)}),(0,H.jsx)(`div`,{className:e.monthlyLimit>0&&e.overrun===0?`mt-1 font-medium text-sky-300`:`mt-1 font-medium text-muted-foreground`,children:e.monthlyLimit>0?e.overrun===0?h(e.remaining??0):`$0.00`:`–`})]}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.alreadyOverLimit`)}),(0,H.jsx)(`div`,{className:e.overrun>0?`mt-1 font-medium text-red-300`:`mt-1 font-medium text-muted-foreground`,children:e.monthlyLimit>0?e.overrun>0?h(e.overrun):`$0.00`:`–`})]})]})]},e.provider)})})}),(0,H.jsx)(P,{title:q(`limits.tracks.subscriptionTitle`),subtitle:q(Y?`limits.tracks.subscriptionSubtitle`:`limits.tracks.subscriptionNoMonth`),info:O.providerSubscriptionMix,chartData:J,valueKey:`cost`,valueFormatter:h,children:(0,H.jsx)(`div`,{className:`space-y-3`,children:J.map((e,t)=>{let n=(e.hasSubscription?Math.max(e.subscriptionPrice,e.cost,1):Math.max(e.cost,1))*1.15,r=`${e.cost/n*100}%`,i=e.hasSubscription?`${e.subscriptionPrice/n*100}%`:`0%`,a=e.hasSubscription?`${Math.min(e.cost,e.subscriptionPrice)/n*100}%`:r,o=e.hasSubscription&&e.subscriptionGain>0?`${e.subscriptionGain/n*100}%`:`0%`;return(0,H.jsxs)(w,{delayMs:90+t*40,className:`rounded-xl border border-border/50 bg-muted/10 p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:e.provider}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.hasSubscription?e.subscriptionStatus===`gain`?q(`limits.tracks.alreadyAboveBreakEvenText`,{value:h(e.subscriptionGain)}):q(`limits.tracks.stillToBreakEven`,{value:h(e.subscriptionGap)}):q(`limits.tracks.noSubscriptionSet`)})]}),(0,H.jsxs)(`div`,{className:`text-right text-xs`,children:[(0,H.jsxs)(`div`,{className:`text-muted-foreground`,children:[q(`limits.tracks.usage`),` `,h(e.cost)]}),(0,H.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[q(`limits.tracks.subscription`),` `,e.hasSubscription?h(e.subscriptionPrice):`–`]})]})]}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsxs)(`div`,{className:`relative h-14`,children:[(0,H.jsx)(`div`,{className:`absolute inset-x-0 top-5 h-4 rounded-full bg-muted/25`}),e.hasSubscription?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`absolute top-5 left-0 h-4 rounded-l-full bg-amber-300/18`,style:{width:i}}),(0,H.jsx)(`div`,{className:`absolute top-5 h-4 rounded-r-full bg-emerald-400/14`,style:{left:i,width:`calc(100% - ${i})`}}),(0,H.jsx)(R,{className:`absolute top-5 left-0 h-4 rounded-full bg-amber-300`,width:a,order:t*2}),e.subscriptionGain>0&&(0,H.jsx)(R,{className:`absolute top-5 h-4 rounded-r-full bg-emerald-400`,style:{left:i},width:o,order:t*2+1}),(0,H.jsx)(`div`,{className:`absolute top-2 h-10 w-px bg-border`,style:{left:i}}),(0,H.jsx)(`div`,{className:`absolute top-0 -translate-x-1/2 rounded-full border border-border/70 bg-background px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,style:{left:i},children:q(`limits.tracks.breakEven`)})]}):(0,H.jsx)(R,{className:`absolute top-5 left-0 h-4 rounded-full bg-muted-foreground/40`,width:r,order:t*2}),(0,H.jsx)(`div`,{className:`absolute top-11 left-0 text-[10px] text-muted-foreground`,children:`$0`}),(0,H.jsx)(`div`,{className:`absolute top-11 right-0 text-[10px] text-muted-foreground`,children:h(n)})]})}),(0,H.jsxs)(`div`,{className:`mt-2 grid grid-cols-1 gap-2 text-xs md:grid-cols-3`,children:[(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.currentlyUsed`)}),(0,H.jsx)(`div`,{className:`mt-1 font-medium text-foreground`,children:h(e.cost)})]}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.remainingToBreakEven`)}),(0,H.jsx)(`div`,{className:e.hasSubscription&&e.subscriptionGap>0?`mt-1 font-medium text-amber-200`:`mt-1 font-medium text-muted-foreground`,children:e.hasSubscription?e.subscriptionGap>0?h(e.subscriptionGap):`$0.00`:`–`})]}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.alreadyAboveBreakEven`)}),(0,H.jsx)(`div`,{className:e.subscriptionGain>0?`mt-1 font-medium text-emerald-300`:`mt-1 font-medium text-muted-foreground`,children:e.hasSubscription?e.subscriptionGain>0?h(e.subscriptionGain):`$0.00`:`–`})]})]})]},e.provider)})})})]}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(P,{title:q(`limits.tracks.portfolioTitle`),subtitle:q(`limits.tracks.portfolioSubtitle`),info:O.providerLimitTimeline,chartData:X,valueKey:`totalCost`,valueFormatter:h,children:(0,H.jsx)(I,{children:e=>(0,H.jsx)(F,{variant:`line`,children:(0,H.jsx)(t,{width:`100%`,height:320,children:(0,H.jsxs)(c,{data:X,margin:N,children:[(0,H.jsxs)(`defs`,{children:[(0,H.jsxs)(`linearGradient`,{id:`limits-risk-area`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,H.jsx)(`stop`,{offset:`0%`,stopColor:`rgb(248 113 113)`,stopOpacity:.28}),(0,H.jsx)(`stop`,{offset:`100%`,stopColor:`rgb(248 113 113)`,stopOpacity:0})]}),(0,H.jsxs)(`linearGradient`,{id:`limits-gain-area`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,H.jsx)(`stop`,{offset:`0%`,stopColor:`rgb(74 222 128)`,stopOpacity:.28}),(0,H.jsx)(`stop`,{offset:`100%`,stopColor:`rgb(74 222 128)`,stopOpacity:0})]})]}),(0,H.jsx)(o,{strokeDasharray:`3 3`,stroke:j.grid,opacity:.25}),(0,H.jsx)(a,{dataKey:`month`,tickFormatter:m,stroke:j.axis,fontSize:11,tickLine:!1}),(0,H.jsx)(n,{tickFormatter:e=>{let t=_(e);return t===null?``:h(Math.abs(t))},stroke:j.axis,fontSize:11,tickLine:!1,axisLine:!1}),(0,H.jsx)(l,{formatter:(e,t)=>[g(Math.abs(K(e))),t??``],labelFormatter:e=>m(String(e)),contentStyle:{borderRadius:12,borderColor:`hsl(var(--border))`,background:`color-mix(in srgb, hsl(var(--popover)) 90%, transparent)`}}),(0,H.jsx)(d,{content:(0,H.jsx)(L,{})}),(0,H.jsx)(i,{y:0,stroke:`hsl(var(--border))`,strokeDasharray:`4 4`}),(0,H.jsx)(r,{type:`monotone`,dataKey:`totalSubscriptionGain`,name:q(`limits.cards.subscriptionValue`),stroke:`rgb(74 222 128)`,fill:`url(#limits-gain-area)`,strokeWidth:2,...A(e)}),(0,H.jsx)(r,{type:`monotone`,dataKey:`totalOverrun`,name:q(`limits.tracks.alreadyOverLimit`),stroke:`rgb(248 113 113)`,fill:`url(#limits-risk-area)`,strokeWidth:2,...A(e,{order:1,role:`stacked`})}),(0,H.jsx)(s,{type:`monotone`,dataKey:`totalCost`,name:`${q(`limits.tracks.usage`)} ${q(`common.costs`).toLowerCase()}`,stroke:j.cost,strokeWidth:2,dot:!1,...M(e,{role:`secondary`})}),(0,H.jsx)(s,{type:`monotone`,dataKey:`totalLimit`,name:q(`limits.tracks.limits`),stroke:`rgb(251 146 60)`,strokeDasharray:`6 3`,strokeWidth:2,dot:!1,connectNulls:!0,...M(e,{order:1,role:`secondary`})}),(0,H.jsx)(s,{type:`monotone`,dataKey:`totalSubscriptions`,name:q(`limits.tracks.subscriptions`),stroke:`rgb(125 211 252)`,strokeDasharray:`3 3`,strokeWidth:2,dot:!1,connectNulls:!0,...M(e,{order:2,role:`secondary`})})]})})})})})})]})}export{q as ProviderLimitsSection};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{b as t,c as n,f as r,h as i,l as a,m as o,p as s,t as c,v as l,w as u,y as d}from"./charts-vendor-CiBqdKXh.js";import{a as f}from"./motion-vendor-BNVN-Ktr.js";import{t as p}from"./useTranslation-0ThAx3Gl.js";import{c as m,n as h,r as g,t as _}from"./formatters-C7EouP6y.js";import{i as v}from"./i18n-BS3-GJaA.js";import{L as y,a as b,i as x,m as S}from"./icons-vendor-CIvT_-Pb.js";import{a as C}from"./model-utils-BIvGAFGz.js";import{c as w,n as T,t as E}from"./card-B4CVYJDH.js";import{i as D,t as O}from"./help-content-B2N8SHIE.js";import{t as k}from"./section-header-Dz0QIE6e.js";import{i as A,n as j,o as M,r as N}from"./chart-theme-BdE8bEiN.js";import{n as P,r as F,t as I}from"./ChartCard-DxxB4rGm.js";import{t as L}from"./ChartLegend-Vpk95i3r.js";import{t as R}from"./AnimatedBarFill-DFAXO-3i.js";import{n as z,r as B}from"./provider-limits-BgKrr7k7.js";var V=e(u()),H=f();function U(e){return e.riskStatus===`limit`?v.t(`limits.statuses.limitExceeded`):e.riskStatus===`warning`?v.t(`limits.statuses.budgetTight`):e.riskStatus===`ok`?v.t(`limits.statuses.budgetStable`):v.t(`limits.statuses.noLimit`)}function W(e){return e.hasSubscription?e.subscriptionStatus===`gain`?v.t(`limits.statuses.subscriptionPaysOff`):v.t(`limits.statuses.belowSubscription`):v.t(`limits.statuses.noSubscription`)}function G(e,t){return e.monthlyLimit>0?v.t(`limits.badge.limit`,{value:e.utilization?.toFixed(0)??`0`}):e.hasSubscription?v.t(`limits.badge.subscription`,{value:Math.min(t,999).toFixed(0)}):v.t(`limits.badge.open`)}function K(e){let t=Number(Array.isArray(e)?e[0]??0:e??0);return Number.isFinite(t)?t:0}function q({data:e,providers:u,limits:f,selectedMonth:v}){let{t:q}=p(),{rows:J,focusMonth:Y,timelineData:X,atLimitCount:Z,nearLimitCount:Q,subscriptionTotal:$,subscriptionGainTotal:ee}=(0,V.useMemo)(()=>{let{months:t,monthMap:n,providerTotals:r}=z(e),i=B(e),a=v??i,o=u.map(e=>{let t=f[e],i=a?n.get(a)?.get(e)??0:0,o=r.get(e)??0,s=t?.monthlyLimit??0,c=!!t?.hasSubscription,l=c?t?.subscriptionPrice??0:0,u=s>0?Math.max(i-s,0):0,d=s>0?Math.max(s-i,0):null,p=s>0?i/s*100:null,m=c?i-l:null,h=m===null?0:Math.max(m,0),g=m===null?0:Math.max(-m,0),_=`none`;return s>0&&i>=s?_=`limit`:s>0&&i>=s*.8?_=`warning`:s>0&&(_=`ok`),{provider:e,cost:i,totalCost:o,monthlyLimit:s,subscriptionPrice:l,hasSubscription:c,remaining:d,overrun:u,utilization:p,subscriptionDelta:m,subscriptionGain:h,subscriptionGap:g,riskStatus:_,subscriptionStatus:c?h>0?`gain`:`gap`:`none`}}).sort((e,t)=>e.riskStatus===`limit`&&t.riskStatus!==`limit`?-1:e.riskStatus!==`limit`&&t.riskStatus===`limit`?1:e.subscriptionStatus===`gain`&&t.subscriptionStatus!==`gain`?-1:e.subscriptionStatus!==`gain`&&t.subscriptionStatus===`gain`?1:t.cost-e.cost);return{rows:o,focusMonth:a,timelineData:t.map(e=>{let t=n.get(e)??new Map,r=u.reduce((e,n)=>e+(t.get(n)??0),0),i=u.reduce((e,t)=>{let n=f[t]?.monthlyLimit??0;return e+(n>0?n:0)},0),a=u.reduce((e,t)=>{let n=f[t];return e+(n?.hasSubscription?n.subscriptionPrice:0)},0),o=u.reduce((e,n)=>{let r=f[n]?.monthlyLimit??0,i=t.get(n)??0;return e+(r>0?Math.max(i-r,0):0)},0),s=u.reduce((e,n)=>{let r=f[n],i=t.get(n)??0,a=r?.hasSubscription?r.subscriptionPrice:0;return e+Math.max(i-a,0)},0),c=u.reduce((e,n)=>{let r=f[n],i=t.get(n)??0,a=r?.hasSubscription?r.subscriptionPrice:0;return e+(r?.hasSubscription?Math.max(a-i,0):0)},0);return{month:e,totalCost:r,totalLimit:i>0?i:null,totalSubscriptions:a>0?a:null,totalOverrun:o,totalSubscriptionGain:s,totalSubscriptionGap:c}}),atLimitCount:o.filter(e=>e.riskStatus===`limit`).length,nearLimitCount:o.filter(e=>e.riskStatus===`warning`).length,subscriptionTotal:o.reduce((e,t)=>e+t.subscriptionPrice,0),subscriptionGainTotal:o.reduce((e,t)=>e+t.subscriptionGain,0)}},[e,f,u,v]);return u.length===0?null:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(k,{title:q(`limits.sectionTitle`),badge:q(`limits.providersBadge`,{count:u.length}),description:q(`limits.sectionDescription`),info:D.limits}),Z>0&&(0,H.jsx)(w,{className:`mb-4 rounded-2xl border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-100`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,H.jsx)(x,{className:`h-4 w-4`}),q(`limits.warningBanner`,{count:Z})]})}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-4`,children:[{label:q(`limits.cards.atLimit`),value:String(Z),hint:Y?m(Y):q(`limits.cards.noMonth`),icon:(0,H.jsx)(x,{className:`h-4 w-4`})},{label:q(`limits.cards.nearLimit`),value:String(Q),hint:q(`limits.cards.nearLimitHint`),icon:(0,H.jsx)(S,{className:`h-4 w-4`})},{label:q(`limits.cards.subscriptionVolume`),value:h($),hint:q(`limits.cards.subscriptionVolumeHint`),icon:(0,H.jsx)(y,{className:`h-4 w-4`})},{label:q(`limits.cards.subscriptionValue`),value:h(ee),hint:q(`limits.cards.subscriptionValueHint`),icon:(0,H.jsx)(b,{className:`h-4 w-4`})}].map((e,t)=>(0,H.jsx)(w,{order:t,children:(0,H.jsx)(E,{className:`h-full`,children:(0,H.jsx)(T,{className:`p-4`,children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:e.label}),(0,H.jsx)(`div`,{className:`mt-1 text-2xl font-semibold tabular-nums`,children:e.value}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.hint})]}),(0,H.jsx)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 p-2 text-muted-foreground`,children:e.icon})]})})})},e.label))}),(0,H.jsx)(`div`,{className:`mt-4 grid grid-cols-1 gap-4 xl:grid-cols-3`,children:J.map((e,t)=>{let n=C(e.provider),r=e.monthlyLimit>0?Math.min(e.cost/e.monthlyLimit*100,100):0,i=e.hasSubscription&&e.subscriptionPrice>0?e.cost/e.subscriptionPrice*100:0,a=Math.min(i,100);return(0,H.jsx)(w,{delayMs:80+t*35,children:(0,H.jsx)(E,{className:e.riskStatus===`limit`?`border-red-500/40 bg-red-500/[0.06]`:e.subscriptionStatus===`gain`?`border-emerald-500/30 bg-emerald-500/[0.05]`:void 0,children:(0,H.jsxs)(T,{className:`p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:e.provider}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:U(e)}),(0,H.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground/80`,children:W(e)})]}),(0,H.jsx)(`div`,{className:`rounded-full border px-2.5 py-1 text-[11px] font-medium`,style:n,children:G(e,i)})]}),(0,H.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:q(`limits.tracks.usageFocusMonth`)}),(0,H.jsx)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums`,children:h(e.cost)})]}),(0,H.jsxs)(`div`,{className:`text-right`,children:[(0,H.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:q(`limits.tracks.limitSubscription`)}),(0,H.jsxs)(`div`,{className:`mt-1 text-sm font-medium tabular-nums`,children:[e.monthlyLimit>0?h(e.monthlyLimit):q(`limits.statuses.noLimit`),` `,`/ `,e.hasSubscription?h(e.subscriptionPrice):`–`]})]})]}),(0,H.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:q(`limits.tracks.budgetRisk`)}),(0,H.jsx)(`span`,{children:e.monthlyLimit>0?e.overrun>0?`+${h(e.overrun)}`:h(e.remaining??0):q(`limits.statuses.noLimit`)})]}),(0,H.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-muted/30`,children:e.monthlyLimit>0?(0,H.jsx)(R,{className:e.riskStatus===`limit`?`h-full bg-red-400`:e.riskStatus===`warning`?`h-full bg-amber-400`:`h-full`,width:`${r}%`,order:t*2,...e.riskStatus===`limit`||e.riskStatus===`warning`?{}:{style:{backgroundColor:n.color}}}):(0,H.jsx)(`div`,{className:`h-full w-full bg-muted/20`})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:q(`limits.tracks.subscriptionEffect`)}),(0,H.jsx)(`span`,{className:e.subscriptionStatus===`gain`?`text-emerald-300`:e.subscriptionStatus===`gap`?`text-amber-200`:``,children:e.hasSubscription?e.subscriptionStatus===`gain`?`+${h(e.subscriptionGain)}`:h(e.subscriptionGap):q(`limits.statuses.noSubscription`)})]}),(0,H.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-muted/30`,children:e.hasSubscription?(0,H.jsx)(R,{className:e.subscriptionStatus===`gain`?`h-full bg-emerald-400`:`h-full bg-amber-300`,width:`${a}%`,order:t*2+1}):(0,H.jsx)(`div`,{className:`h-full w-full bg-muted/20`})})]})]})]})})},e.provider)})}),(0,H.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 gap-4 xl:grid-cols-2`,children:[(0,H.jsx)(P,{title:q(`limits.tracks.budgetTitle`),subtitle:q(Y?`limits.tracks.budgetSubtitle`:`limits.tracks.budgetNoMonth`),info:O.providerLimitProgress,chartData:J,valueKey:`cost`,valueFormatter:h,children:(0,H.jsx)(`div`,{className:`space-y-3`,children:J.map((e,t)=>{let n=(e.monthlyLimit>0?Math.max(e.monthlyLimit,e.cost,1):Math.max(e.cost,1))*1.15,r=`${e.cost/n*100}%`,i=e.monthlyLimit>0?`${e.monthlyLimit/n*100}%`:`0%`,a=e.monthlyLimit>0?`${Math.min(e.cost,e.monthlyLimit)/n*100}%`:r,o=e.monthlyLimit>0&&e.overrun>0?`${e.overrun/n*100}%`:`0%`;return(0,H.jsxs)(w,{delayMs:90+t*40,className:`rounded-xl border border-border/50 bg-muted/10 p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:e.provider}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.monthlyLimit<=0?q(`limits.statuses.noLimit`):e.overrun>0?q(`limits.tracks.alreadyAboveLimit`,{value:h(e.overrun)}):q(`limits.tracks.stillToLimit`,{value:h(e.remaining??0)})})]}),(0,H.jsxs)(`div`,{className:`text-right text-xs`,children:[(0,H.jsxs)(`div`,{className:`text-muted-foreground`,children:[q(`limits.tracks.usage`),` `,h(e.cost)]}),(0,H.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[q(`limits.tracks.limit`),` `,e.monthlyLimit>0?h(e.monthlyLimit):`–`]})]})]}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsxs)(`div`,{className:`relative h-14`,children:[(0,H.jsx)(`div`,{className:`absolute inset-x-0 top-5 h-4 rounded-full bg-muted/25`}),e.monthlyLimit>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`absolute top-5 left-0 h-4 rounded-l-full bg-sky-400/12`,style:{width:i}}),(0,H.jsx)(`div`,{className:`absolute top-5 h-4 rounded-r-full bg-red-400/12`,style:{left:i,width:`calc(100% - ${i})`}}),(0,H.jsx)(R,{className:e.riskStatus===`warning`?`absolute top-5 left-0 h-4 rounded-full bg-amber-400`:`absolute top-5 left-0 h-4 rounded-full bg-sky-400`,width:a,order:t*2}),e.overrun>0&&(0,H.jsx)(R,{className:`absolute top-5 h-4 rounded-r-full bg-red-400`,style:{left:i},width:o,order:t*2+1}),(0,H.jsx)(`div`,{className:`absolute top-2 h-10 w-px bg-border`,style:{left:i}}),(0,H.jsx)(`div`,{className:`absolute top-0 -translate-x-1/2 rounded-full border border-border/70 bg-background px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,style:{left:i},children:q(`limits.tracks.limit`)})]}):(0,H.jsx)(R,{className:`absolute top-5 left-0 h-4 rounded-full bg-muted-foreground/40`,width:r,order:t*2}),(0,H.jsx)(`div`,{className:`absolute top-11 left-0 text-[10px] text-muted-foreground`,children:`$0`}),(0,H.jsx)(`div`,{className:`absolute top-11 right-0 text-[10px] text-muted-foreground`,children:h(n)})]})}),(0,H.jsxs)(`div`,{className:`mt-2 grid grid-cols-1 gap-2 text-xs md:grid-cols-3`,children:[(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.currentlyUsed`)}),(0,H.jsx)(`div`,{className:`mt-1 font-medium text-foreground`,children:h(e.cost)})]}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.remainingToLimit`)}),(0,H.jsx)(`div`,{className:e.monthlyLimit>0&&e.overrun===0?`mt-1 font-medium text-sky-300`:`mt-1 font-medium text-muted-foreground`,children:e.monthlyLimit>0?e.overrun===0?h(e.remaining??0):`$0.00`:`–`})]}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.alreadyOverLimit`)}),(0,H.jsx)(`div`,{className:e.overrun>0?`mt-1 font-medium text-red-300`:`mt-1 font-medium text-muted-foreground`,children:e.monthlyLimit>0?e.overrun>0?h(e.overrun):`$0.00`:`–`})]})]})]},e.provider)})})}),(0,H.jsx)(P,{title:q(`limits.tracks.subscriptionTitle`),subtitle:q(Y?`limits.tracks.subscriptionSubtitle`:`limits.tracks.subscriptionNoMonth`),info:O.providerSubscriptionMix,chartData:J,valueKey:`cost`,valueFormatter:h,children:(0,H.jsx)(`div`,{className:`space-y-3`,children:J.map((e,t)=>{let n=(e.hasSubscription?Math.max(e.subscriptionPrice,e.cost,1):Math.max(e.cost,1))*1.15,r=`${e.cost/n*100}%`,i=e.hasSubscription?`${e.subscriptionPrice/n*100}%`:`0%`,a=e.hasSubscription?`${Math.min(e.cost,e.subscriptionPrice)/n*100}%`:r,o=e.hasSubscription&&e.subscriptionGain>0?`${e.subscriptionGain/n*100}%`:`0%`;return(0,H.jsxs)(w,{delayMs:90+t*40,className:`rounded-xl border border-border/50 bg-muted/10 p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold`,children:e.provider}),(0,H.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.hasSubscription?e.subscriptionStatus===`gain`?q(`limits.tracks.alreadyAboveBreakEvenText`,{value:h(e.subscriptionGain)}):q(`limits.tracks.stillToBreakEven`,{value:h(e.subscriptionGap)}):q(`limits.tracks.noSubscriptionSet`)})]}),(0,H.jsxs)(`div`,{className:`text-right text-xs`,children:[(0,H.jsxs)(`div`,{className:`text-muted-foreground`,children:[q(`limits.tracks.usage`),` `,h(e.cost)]}),(0,H.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[q(`limits.tracks.subscription`),` `,e.hasSubscription?h(e.subscriptionPrice):`–`]})]})]}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsxs)(`div`,{className:`relative h-14`,children:[(0,H.jsx)(`div`,{className:`absolute inset-x-0 top-5 h-4 rounded-full bg-muted/25`}),e.hasSubscription?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`absolute top-5 left-0 h-4 rounded-l-full bg-amber-300/18`,style:{width:i}}),(0,H.jsx)(`div`,{className:`absolute top-5 h-4 rounded-r-full bg-emerald-400/14`,style:{left:i,width:`calc(100% - ${i})`}}),(0,H.jsx)(R,{className:`absolute top-5 left-0 h-4 rounded-full bg-amber-300`,width:a,order:t*2}),e.subscriptionGain>0&&(0,H.jsx)(R,{className:`absolute top-5 h-4 rounded-r-full bg-emerald-400`,style:{left:i},width:o,order:t*2+1}),(0,H.jsx)(`div`,{className:`absolute top-2 h-10 w-px bg-border`,style:{left:i}}),(0,H.jsx)(`div`,{className:`absolute top-0 -translate-x-1/2 rounded-full border border-border/70 bg-background px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,style:{left:i},children:q(`limits.tracks.breakEven`)})]}):(0,H.jsx)(R,{className:`absolute top-5 left-0 h-4 rounded-full bg-muted-foreground/40`,width:r,order:t*2}),(0,H.jsx)(`div`,{className:`absolute top-11 left-0 text-[10px] text-muted-foreground`,children:`$0`}),(0,H.jsx)(`div`,{className:`absolute top-11 right-0 text-[10px] text-muted-foreground`,children:h(n)})]})}),(0,H.jsxs)(`div`,{className:`mt-2 grid grid-cols-1 gap-2 text-xs md:grid-cols-3`,children:[(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.currentlyUsed`)}),(0,H.jsx)(`div`,{className:`mt-1 font-medium text-foreground`,children:h(e.cost)})]}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.remainingToBreakEven`)}),(0,H.jsx)(`div`,{className:e.hasSubscription&&e.subscriptionGap>0?`mt-1 font-medium text-amber-200`:`mt-1 font-medium text-muted-foreground`,children:e.hasSubscription?e.subscriptionGap>0?h(e.subscriptionGap):`$0.00`:`–`})]}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:q(`limits.tracks.alreadyAboveBreakEven`)}),(0,H.jsx)(`div`,{className:e.subscriptionGain>0?`mt-1 font-medium text-emerald-300`:`mt-1 font-medium text-muted-foreground`,children:e.hasSubscription?e.subscriptionGain>0?h(e.subscriptionGain):`$0.00`:`–`})]})]})]},e.provider)})})})]}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(P,{title:q(`limits.tracks.portfolioTitle`),subtitle:q(`limits.tracks.portfolioSubtitle`),info:O.providerLimitTimeline,chartData:X,valueKey:`totalCost`,valueFormatter:h,children:(0,H.jsx)(I,{children:e=>(0,H.jsx)(F,{variant:`line`,children:(0,H.jsx)(t,{width:`100%`,height:320,children:(0,H.jsxs)(c,{data:X,margin:N,children:[(0,H.jsxs)(`defs`,{children:[(0,H.jsxs)(`linearGradient`,{id:`limits-risk-area`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,H.jsx)(`stop`,{offset:`0%`,stopColor:`rgb(248 113 113)`,stopOpacity:.28}),(0,H.jsx)(`stop`,{offset:`100%`,stopColor:`rgb(248 113 113)`,stopOpacity:0})]}),(0,H.jsxs)(`linearGradient`,{id:`limits-gain-area`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,H.jsx)(`stop`,{offset:`0%`,stopColor:`rgb(74 222 128)`,stopOpacity:.28}),(0,H.jsx)(`stop`,{offset:`100%`,stopColor:`rgb(74 222 128)`,stopOpacity:0})]})]}),(0,H.jsx)(o,{strokeDasharray:`3 3`,stroke:j.grid,opacity:.25}),(0,H.jsx)(a,{dataKey:`month`,tickFormatter:m,stroke:j.axis,fontSize:11,tickLine:!1}),(0,H.jsx)(n,{tickFormatter:e=>{let t=_(e);return t===null?``:h(Math.abs(t))},stroke:j.axis,fontSize:11,tickLine:!1,axisLine:!1}),(0,H.jsx)(l,{formatter:(e,t)=>[g(Math.abs(K(e))),t??``],labelFormatter:e=>m(String(e)),contentStyle:{borderRadius:12,borderColor:`hsl(var(--border))`,background:`color-mix(in srgb, hsl(var(--popover)) 90%, transparent)`}}),(0,H.jsx)(d,{content:(0,H.jsx)(L,{})}),(0,H.jsx)(i,{y:0,stroke:`hsl(var(--border))`,strokeDasharray:`4 4`}),(0,H.jsx)(r,{type:`monotone`,dataKey:`totalSubscriptionGain`,name:q(`limits.cards.subscriptionValue`),stroke:`rgb(74 222 128)`,fill:`url(#limits-gain-area)`,strokeWidth:2,...A(e)}),(0,H.jsx)(r,{type:`monotone`,dataKey:`totalOverrun`,name:q(`limits.tracks.alreadyOverLimit`),stroke:`rgb(248 113 113)`,fill:`url(#limits-risk-area)`,strokeWidth:2,...A(e,{order:1,role:`stacked`})}),(0,H.jsx)(s,{type:`monotone`,dataKey:`totalCost`,name:`${q(`limits.tracks.usage`)} ${q(`common.costs`).toLowerCase()}`,stroke:j.cost,strokeWidth:2,dot:!1,...M(e,{role:`secondary`})}),(0,H.jsx)(s,{type:`monotone`,dataKey:`totalLimit`,name:q(`limits.tracks.limits`),stroke:`rgb(251 146 60)`,strokeDasharray:`6 3`,strokeWidth:2,dot:!1,connectNulls:!0,...M(e,{order:1,role:`secondary`})}),(0,H.jsx)(s,{type:`monotone`,dataKey:`totalSubscriptions`,name:q(`limits.tracks.subscriptions`),stroke:`rgb(125 211 252)`,strokeDasharray:`3 3`,strokeWidth:2,dot:!1,connectNulls:!0,...M(e,{order:2,role:`secondary`})})]})})})})})})]})}export{q as ProviderLimitsSection};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{w as t}from"./charts-vendor-CiBqdKXh.js";import{o as n}from"./motion-vendor-BNFhNARW.js";import{a as r,t as i}from"./useTranslation-JH30oWEP.js";import{h as a,i as o,l as s,n as c,u as l}from"./formatters-BzLLk0br.js";import{tt as u}from"./icons-vendor-CIvT_-Pb.js";import{t as d}from"./button-olcuyddH.js";import{c as f,i as p,n as m,r as h,t as g}from"./model-utils-BIvGAFGz.js";import{a as _,i as v,n as y,t as b}from"./card-CskYMXga.js";import{t as x}from"./formatted-value-DuGw8WPX.js";import{n as S}from"./help-content-Cuf5l3_6.js";import{t as C}from"./InfoHeading-CFbl45C9.js";import{t as w}from"./AnimatedBarFill-Da354-1y.js";var T=e(t()),E=n(),D=30,O=120;function k(e){return Math.min(D+O,e)}function A(e,t,n){let r=k(e);if(t(r),r>=e)return null;let i=()=>{t(t=>{if(t>=e)return t;let r=Math.min(t+O,e);return r<e&&n(i),r})};return n(i)}function j(e){return e.modelBreakdowns.map(e=>({name:f(e.modelName),provider:h(e.modelName)})).filter((e,t,n)=>n.findIndex(t=>t.name===e.name&&t.provider===e.provider)===t)}function M(e){let t=new Map,n=0,r=0;for(let i=0;i<e.length;i+=1){let a=e[i];if(!a)continue;if(i>7){let t=e[i-8];t&&(n-=t.totalCost,r-=t.requestCount)}if(i>0){let t=e[i-1];t&&(n+=t.totalCost,r+=t.requestCount)}let o=i>0?e[i-1]:null,s=Math.min(i,7),c=o&&o.totalCost>0?(a.totalCost-o.totalCost)/o.totalCost*100:null;t.set(a.date,{...c===null?{}:{prevCostDelta:c},...s>0?{avgCost7:n/s}:{},...s>0?{avgRequests7:r/s}:{}})}return t}function N(e,t){if(e)return{contentVisibility:`auto`,containIntrinsicSize:t}}function P({data:e,onClickDay:t,viewMode:n=`daily`}){let{t:f}=i(),[h,O]=(0,T.useState)(!1),[k,P]=(0,T.useState)(`date`),[F,I]=(0,T.useState)(!1),[L,R]=(0,T.useState)(D),[,z]=(0,T.useTransition)(),B=(0,T.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{switch(k){case`date`:return F?e.date.localeCompare(t.date):t.date.localeCompare(e.date);case`cost`:return F?e.totalCost-t.totalCost:t.totalCost-e.totalCost;case`tokens`:return F?e.totalTokens-t.totalTokens:t.totalTokens-e.totalTokens;case`costPerM`:{let n=e.totalTokens>0?e.totalCost/(e.totalTokens/1e6):0,r=t.totalTokens>0?t.totalCost/(t.totalTokens/1e6):0;return F?n-r:r-n}}}),t},[e,k,F]);(0,T.useEffect)(()=>{if(!h){R(D);return}if(typeof window>`u`){R(B.length);return}let e=A(B.length,R,window.requestAnimationFrame);return()=>{e!==null&&window.cancelAnimationFrame(e)}},[h,B.length]);let V=(0,T.useMemo)(()=>h?B.slice(0,L):B.slice(0,D),[h,B,L]),H=(0,T.useMemo)(()=>[...e].sort((e,t)=>e.date.localeCompare(t.date)),[e]),U=(0,T.useMemo)(()=>M(H),[H]),W=(0,T.useMemo)(()=>Math.max(...e.map(e=>e.totalCost),0),[e]),G=(0,T.useMemo)(()=>{if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e)t+=o.totalCost,n+=o.totalTokens,r+=o.requestCount,i+=o.cacheReadTokens,(!a||o.totalCost>a.totalCost)&&(a=o);let o=n>0?i/n*100:0;return{totalCost:t,totalTokens:n,totalRequests:r,cacheShare:o,top:a}},[e]),K=(0,T.useMemo)(()=>V.map(e=>({day:e,benchmark:U.get(e.date),costPerM:e.totalTokens>0?e.totalCost/(e.totalTokens/1e6):0,uniqueModels:j(e)})),[U,V]),q=e=>{z(()=>{e===k?I(!F):(P(e),I(!1))})},J=e=>k===e?F?`ascending`:`descending`:`none`,Y=(0,T.useCallback)((e,n)=>{t&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),t(n)))},[t]);return(0,E.jsxs)(b,{children:[(0,E.jsxs)(v,{className:`flex flex-row items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,E.jsx)(C,{info:S.recentDays,children:(0,E.jsx)(_,{className:`text-sm font-medium text-muted-foreground`,children:f(n===`monthly`?`tables.recentDays.monthsDetail`:n===`yearly`?`tables.recentDays.yearsDetail`:`tables.recentDays.daysDetail`)})}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground/70`,children:f(`tables.recentDays.showing`,{shown:V.length,total:B.length,unit:a(n,!0)})})]}),B.length>D&&(0,E.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>z(()=>{O(e=>!e)}),children:f(h?`tables.recentDays.showLess`:`tables.recentDays.showAll`)})]}),(0,E.jsxs)(y,{children:[G&&(0,E.jsxs)(`div`,{className:`mb-3 grid grid-cols-2 gap-2 lg:grid-cols-5`,children:[(0,E.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 px-3 py-2`,children:[(0,E.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:f(`tables.recentDays.totalCost`)}),(0,E.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:(0,E.jsx)(x,{value:G.totalCost,type:`currency`})})]}),(0,E.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 px-3 py-2`,children:[(0,E.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:f(`tables.recentDays.totalTokens`)}),(0,E.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:(0,E.jsx)(x,{value:G.totalTokens,type:`tokens`})})]}),(0,E.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 px-3 py-2`,children:[(0,E.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:f(`tables.recentDays.requests`)}),(0,E.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:(0,E.jsx)(x,{value:G.totalRequests,type:`number`})})]}),(0,E.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 px-3 py-2`,children:[(0,E.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:f(`tables.recentDays.cacheReadShare`)}),(0,E.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:l(G.cacheShare,1)})]}),(0,E.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 px-3 py-2`,children:[(0,E.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:f(`tables.recentDays.peak`)}),(0,E.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:G.top?o(G.top.date):`–`}),(0,E.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:G.top?c(G.top.totalCost):`–`})]})]}),h&&L<B.length&&(0,E.jsx)(`div`,{className:`mb-3 text-xs text-muted-foreground`,children:f(`tables.recentDays.showing`,{shown:L,total:B.length,unit:a(n,!0)})}),(0,E.jsx)(`div`,{className:`grid gap-2 md:hidden`,children:K.map(({day:e,benchmark:i,costPerM:a,uniqueModels:l})=>(0,E.jsxs)(`button`,{onClick:()=>t?.(e.date),className:`rounded-xl border border-border/50 bg-muted/10 p-3 text-left`,style:N(h,`220px`),children:[(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`font-medium`,children:o(e.date,`long`)}),(0,E.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[s(e.requestCount),` `,f(`common.requests`)]})]}),(0,E.jsxs)(`div`,{className:`text-right`,children:[(0,E.jsx)(`div`,{className:`font-mono font-semibold`,children:(0,E.jsx)(x,{value:e.totalCost,type:`currency`,interactive:!1})}),(0,E.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:(0,E.jsx)(x,{value:e.totalTokens,type:`tokens`,interactive:!1})}),n===`daily`&&i?.prevCostDelta!==void 0&&(0,E.jsxs)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[f(`tables.recentDays.previousDay`),` `,i.prevCostDelta>=0?`↑`:`↓`,Math.abs(i.prevCostDelta).toFixed(0),`%`]})]})]}),(0,E.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 gap-2 text-xs`,children:[(0,E.jsxs)(`div`,{className:`rounded-lg bg-muted/20 px-2.5 py-2`,children:[(0,E.jsx)(`div`,{className:`text-muted-foreground`,children:f(`common.input`)}),(0,E.jsx)(`div`,{className:`mt-1 font-mono`,children:(0,E.jsx)(x,{value:e.inputTokens,type:`tokens`,interactive:!1})})]}),(0,E.jsxs)(`div`,{className:`rounded-lg bg-muted/20 px-2.5 py-2`,children:[(0,E.jsx)(`div`,{className:`text-muted-foreground`,children:f(`common.output`)}),(0,E.jsx)(`div`,{className:`mt-1 font-mono`,children:(0,E.jsx)(x,{value:e.outputTokens,type:`tokens`,interactive:!1})})]}),(0,E.jsxs)(`div`,{className:`rounded-lg bg-muted/20 px-2.5 py-2`,children:[(0,E.jsx)(`div`,{className:`text-muted-foreground`,children:`$/1M`}),(0,E.jsx)(`div`,{className:`mt-1 font-mono`,children:(0,E.jsx)(x,{value:a,type:`currency`,interactive:!1})})]})]}),(0,E.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[l.slice(0,4).map(({name:e,provider:t})=>(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] leading-tight font-medium`,style:{backgroundColor:m(e,.16),color:g(e)},children:[(0,E.jsx)(`span`,{children:e}),(0,E.jsx)(`span`,{className:r(`inline-flex items-center rounded-full border px-1 py-0.5 text-[9px] leading-none`,p(t)),children:t})]},`${e}-${t}`)),l.length>4&&(0,E.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-border/50 px-2 py-0.5 text-[10px] text-muted-foreground`,children:f(`tables.modelEfficiency.more`,{count:l.length-4})})]}),n===`daily`&&i?.avgCost7!==void 0&&(0,E.jsxs)(`div`,{className:`mt-3 text-[10px] text-muted-foreground`,children:[f(`tables.recentDays.avg7d`),` `,c(i.avgCost7),` ·`,` `,f(`tables.recentDays.reqAvg`),` `,i.avgRequests7?.toFixed(0)??`–`]})]},e.date))}),(0,E.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,E.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,E.jsx)(`thead`,{className:`sticky top-0 z-10 bg-card`,children:(0,E.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,E.jsx)(`th`,{"aria-sort":J(`date`),className:r(`px-2 py-2 text-left text-xs font-medium`,k===`date`?`text-foreground`:`text-muted-foreground`),children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>q(`date`),className:`inline-flex items-center gap-1 rounded-sm transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,children:[f(`tables.recentDays.date`),` `,(0,E.jsx)(u,{"aria-hidden":`true`,className:r(`h-3 w-3`,k===`date`&&`text-primary`)})]})}),(0,E.jsx)(`th`,{"aria-sort":J(`cost`),className:r(`px-2 py-2 text-right text-xs font-medium`,k===`cost`?`text-foreground`:`text-muted-foreground`),children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>q(`cost`),className:`inline-flex items-center gap-1 rounded-sm transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,children:[f(`tables.recentDays.cost`),` `,(0,E.jsx)(u,{"aria-hidden":`true`,className:r(`h-3 w-3`,k===`cost`&&`text-primary`)})]})}),(0,E.jsx)(`th`,{"aria-sort":J(`tokens`),className:r(`px-2 py-2 text-right text-xs font-medium`,k===`tokens`?`text-foreground`:`text-muted-foreground`),children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>q(`tokens`),className:`inline-flex items-center gap-1 rounded-sm transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,children:[f(`tables.recentDays.tokens`),` `,(0,E.jsx)(u,{"aria-hidden":`true`,className:r(`h-3 w-3`,k===`tokens`&&`text-primary`)})]})}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground md:table-cell`,children:f(`common.input`)}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground md:table-cell`,children:f(`common.output`)}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground lg:table-cell`,children:f(`common.cacheWrite`)}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground lg:table-cell`,children:f(`common.cacheRead`)}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground xl:table-cell`,children:f(`common.thinking`)}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground xl:table-cell`,children:f(`common.requestsShort`)}),(0,E.jsx)(`th`,{"aria-sort":J(`costPerM`),className:r(`px-2 py-2 text-right text-xs font-medium`,k===`costPerM`?`text-foreground`:`text-muted-foreground`),children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>q(`costPerM`),className:`inline-flex items-center gap-1 rounded-sm transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,children:[`$/1M`,` `,(0,E.jsx)(u,{"aria-hidden":`true`,className:r(`h-3 w-3`,k===`costPerM`&&`text-primary`)})]})}),(0,E.jsx)(`th`,{className:`px-2 py-2 text-left text-xs font-medium text-muted-foreground`,children:f(`tables.recentDays.models`)})]})}),(0,E.jsx)(`tbody`,{children:K.map(({day:e,benchmark:i,costPerM:a,uniqueModels:s})=>(0,E.jsxs)(`tr`,{className:`cursor-pointer border-b border-l-[3px] border-border/50 transition-colors hover:bg-muted/10 focus-visible:bg-muted/10 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset active:bg-muted/20`,style:{borderLeftColor:`hsla(215, 70%, 55%, ${.2+(W>0?e.totalCost/W:0)*.8})`,...N(h,`52px`)},onClick:()=>t?.(e.date),onKeyDown:t=>Y(t,e.date),role:t?`button`:void 0,tabIndex:t?0:void 0,children:[(0,E.jsx)(`td`,{className:`px-2 py-2.5 whitespace-nowrap`,children:o(e.date,`long`)}),(0,E.jsxs)(`td`,{className:`relative px-2 py-2.5 text-right font-mono tabular-nums`,children:[(0,E.jsx)(w,{className:`absolute inset-y-1 left-0 rounded-sm bg-primary/8`,width:`${W>0?e.totalCost/W*100:0}%`,delayMs:140,durationMs:520}),(0,E.jsx)(`span`,{className:`relative`,children:(0,E.jsx)(x,{value:e.totalCost,type:`currency`})})]}),(0,E.jsx)(`td`,{className:`px-2 py-2.5 text-right font-mono tabular-nums`,children:(0,E.jsx)(x,{value:e.totalTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums md:table-cell`,children:(0,E.jsx)(x,{value:e.inputTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums md:table-cell`,children:(0,E.jsx)(x,{value:e.outputTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums lg:table-cell`,children:(0,E.jsx)(x,{value:e.cacheCreationTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums lg:table-cell`,children:(0,E.jsx)(x,{value:e.cacheReadTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums xl:table-cell`,children:(0,E.jsx)(x,{value:e.thinkingTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums xl:table-cell`,children:(0,E.jsx)(x,{value:e.requestCount,type:`number`})}),(0,E.jsx)(`td`,{className:`px-2 py-2.5 text-right font-mono tabular-nums`,children:(0,E.jsx)(x,{value:a,type:`currency`})}),(0,E.jsxs)(`td`,{className:`px-2 py-2.5`,children:[(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:s.map(({name:e,provider:t})=>(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] leading-tight font-medium`,style:{backgroundColor:m(e,.16),color:g(e)},children:[(0,E.jsx)(`span`,{children:e}),(0,E.jsx)(`span`,{className:r(`inline-flex items-center rounded-full border px-1 py-0.5 text-[9px] leading-none`,p(t)),children:t})]},`${e}-${t}`))}),n===`daily`&&i?.avgCost7!==void 0&&(0,E.jsxs)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[f(`tables.recentDays.previousDay`),` `,i.prevCostDelta===void 0?`–`:`${i.prevCostDelta>=0?`↑`:`↓`}${Math.abs(i.prevCostDelta).toFixed(0)}%`,` `,`· `,f(`tables.recentDays.avg7d`),` `,c(i.avgCost7)]})]})]},e.date))})]})})]})]})}export{P as RecentDays};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{w as t}from"./charts-vendor-CiBqdKXh.js";import{a as n}from"./motion-vendor-BNVN-Ktr.js";import{o as r,t as i}from"./useTranslation-0ThAx3Gl.js";import{h as a,i as o,l as s,n as c,u as l}from"./formatters-C7EouP6y.js";import{tt as u}from"./icons-vendor-CIvT_-Pb.js";import{t as d}from"./button-CRvPoJg9.js";import{c as f,i as p,n as m,r as h,t as g}from"./model-utils-BIvGAFGz.js";import{a as _,i as v,n as y,t as b}from"./card-B4CVYJDH.js";import{t as x}from"./formatted-value-CpLoDrYF.js";import{n as S}from"./help-content-B2N8SHIE.js";import{t as C}from"./InfoHeading-BxLyydv8.js";import{t as w}from"./AnimatedBarFill-DFAXO-3i.js";var T=e(t()),E=n(),D=30,O=120;function k(e){return Math.min(D+O,e)}function A(e,t,n){let r=k(e);if(t(r),r>=e)return null;let i=()=>{t(t=>{if(t>=e)return t;let r=Math.min(t+O,e);return r<e&&n(i),r})};return n(i)}function j(e){return e.modelBreakdowns.map(e=>({name:f(e.modelName),provider:h(e.modelName)})).filter((e,t,n)=>n.findIndex(t=>t.name===e.name&&t.provider===e.provider)===t)}function M(e){let t=new Map,n=0,r=0;for(let i=0;i<e.length;i+=1){let a=e[i];if(!a)continue;if(i>7){let t=e[i-8];t&&(n-=t.totalCost,r-=t.requestCount)}if(i>0){let t=e[i-1];t&&(n+=t.totalCost,r+=t.requestCount)}let o=i>0?e[i-1]:null,s=Math.min(i,7),c=o&&o.totalCost>0?(a.totalCost-o.totalCost)/o.totalCost*100:null;t.set(a.date,{...c===null?{}:{prevCostDelta:c},...s>0?{avgCost7:n/s}:{},...s>0?{avgRequests7:r/s}:{}})}return t}function N(e,t){if(e)return{contentVisibility:`auto`,containIntrinsicSize:t}}function P({data:e,onClickDay:t,viewMode:n=`daily`}){let{t:f}=i(),[h,O]=(0,T.useState)(!1),[k,P]=(0,T.useState)(`date`),[F,I]=(0,T.useState)(!1),[L,R]=(0,T.useState)(D),[,z]=(0,T.useTransition)(),B=(0,T.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{switch(k){case`date`:return F?e.date.localeCompare(t.date):t.date.localeCompare(e.date);case`cost`:return F?e.totalCost-t.totalCost:t.totalCost-e.totalCost;case`tokens`:return F?e.totalTokens-t.totalTokens:t.totalTokens-e.totalTokens;case`costPerM`:{let n=e.totalTokens>0?e.totalCost/(e.totalTokens/1e6):0,r=t.totalTokens>0?t.totalCost/(t.totalTokens/1e6):0;return F?n-r:r-n}}}),t},[e,k,F]);(0,T.useEffect)(()=>{if(!h){R(D);return}if(typeof window>`u`){R(B.length);return}let e=A(B.length,R,window.requestAnimationFrame);return()=>{e!==null&&window.cancelAnimationFrame(e)}},[h,B.length]);let V=(0,T.useMemo)(()=>h?B.slice(0,L):B.slice(0,D),[h,B,L]),H=(0,T.useMemo)(()=>[...e].sort((e,t)=>e.date.localeCompare(t.date)),[e]),U=(0,T.useMemo)(()=>M(H),[H]),W=(0,T.useMemo)(()=>Math.max(...e.map(e=>e.totalCost),0),[e]),G=(0,T.useMemo)(()=>{if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e)t+=o.totalCost,n+=o.totalTokens,r+=o.requestCount,i+=o.cacheReadTokens,(!a||o.totalCost>a.totalCost)&&(a=o);let o=n>0?i/n*100:0;return{totalCost:t,totalTokens:n,totalRequests:r,cacheShare:o,top:a}},[e]),K=(0,T.useMemo)(()=>V.map(e=>({day:e,benchmark:U.get(e.date),costPerM:e.totalTokens>0?e.totalCost/(e.totalTokens/1e6):0,uniqueModels:j(e)})),[U,V]),q=e=>{z(()=>{e===k?I(!F):(P(e),I(!1))})},J=e=>k===e?F?`ascending`:`descending`:`none`,Y=(0,T.useCallback)((e,n)=>{t&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),t(n)))},[t]);return(0,E.jsxs)(b,{children:[(0,E.jsxs)(v,{className:`flex flex-row items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,E.jsx)(C,{info:S.recentDays,children:(0,E.jsx)(_,{className:`text-sm font-medium text-muted-foreground`,children:f(n===`monthly`?`tables.recentDays.monthsDetail`:n===`yearly`?`tables.recentDays.yearsDetail`:`tables.recentDays.daysDetail`)})}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground/70`,children:f(`tables.recentDays.showing`,{shown:V.length,total:B.length,unit:a(n,!0)})})]}),B.length>D&&(0,E.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>z(()=>{O(e=>!e)}),children:f(h?`tables.recentDays.showLess`:`tables.recentDays.showAll`)})]}),(0,E.jsxs)(y,{children:[G&&(0,E.jsxs)(`div`,{className:`mb-3 grid grid-cols-2 gap-2 lg:grid-cols-5`,children:[(0,E.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 px-3 py-2`,children:[(0,E.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:f(`tables.recentDays.totalCost`)}),(0,E.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:(0,E.jsx)(x,{value:G.totalCost,type:`currency`})})]}),(0,E.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 px-3 py-2`,children:[(0,E.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:f(`tables.recentDays.totalTokens`)}),(0,E.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:(0,E.jsx)(x,{value:G.totalTokens,type:`tokens`})})]}),(0,E.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 px-3 py-2`,children:[(0,E.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:f(`tables.recentDays.requests`)}),(0,E.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:(0,E.jsx)(x,{value:G.totalRequests,type:`number`})})]}),(0,E.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 px-3 py-2`,children:[(0,E.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:f(`tables.recentDays.cacheReadShare`)}),(0,E.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:l(G.cacheShare,1)})]}),(0,E.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/15 px-3 py-2`,children:[(0,E.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:f(`tables.recentDays.peak`)}),(0,E.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:G.top?o(G.top.date):`–`}),(0,E.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:G.top?c(G.top.totalCost):`–`})]})]}),h&&L<B.length&&(0,E.jsx)(`div`,{className:`mb-3 text-xs text-muted-foreground`,children:f(`tables.recentDays.showing`,{shown:L,total:B.length,unit:a(n,!0)})}),(0,E.jsx)(`div`,{className:`grid gap-2 md:hidden`,children:K.map(({day:e,benchmark:i,costPerM:a,uniqueModels:l})=>(0,E.jsxs)(`button`,{onClick:()=>t?.(e.date),className:`rounded-xl border border-border/50 bg-muted/10 p-3 text-left`,style:N(h,`220px`),children:[(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`font-medium`,children:o(e.date,`long`)}),(0,E.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[s(e.requestCount),` `,f(`common.requests`)]})]}),(0,E.jsxs)(`div`,{className:`text-right`,children:[(0,E.jsx)(`div`,{className:`font-mono font-semibold`,children:(0,E.jsx)(x,{value:e.totalCost,type:`currency`,interactive:!1})}),(0,E.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:(0,E.jsx)(x,{value:e.totalTokens,type:`tokens`,interactive:!1})}),n===`daily`&&i?.prevCostDelta!==void 0&&(0,E.jsxs)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[f(`tables.recentDays.previousDay`),` `,i.prevCostDelta>=0?`↑`:`↓`,Math.abs(i.prevCostDelta).toFixed(0),`%`]})]})]}),(0,E.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 gap-2 text-xs`,children:[(0,E.jsxs)(`div`,{className:`rounded-lg bg-muted/20 px-2.5 py-2`,children:[(0,E.jsx)(`div`,{className:`text-muted-foreground`,children:f(`common.input`)}),(0,E.jsx)(`div`,{className:`mt-1 font-mono`,children:(0,E.jsx)(x,{value:e.inputTokens,type:`tokens`,interactive:!1})})]}),(0,E.jsxs)(`div`,{className:`rounded-lg bg-muted/20 px-2.5 py-2`,children:[(0,E.jsx)(`div`,{className:`text-muted-foreground`,children:f(`common.output`)}),(0,E.jsx)(`div`,{className:`mt-1 font-mono`,children:(0,E.jsx)(x,{value:e.outputTokens,type:`tokens`,interactive:!1})})]}),(0,E.jsxs)(`div`,{className:`rounded-lg bg-muted/20 px-2.5 py-2`,children:[(0,E.jsx)(`div`,{className:`text-muted-foreground`,children:`$/1M`}),(0,E.jsx)(`div`,{className:`mt-1 font-mono`,children:(0,E.jsx)(x,{value:a,type:`currency`,interactive:!1})})]})]}),(0,E.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[l.slice(0,4).map(({name:e,provider:t})=>(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] leading-tight font-medium`,style:{backgroundColor:m(e,.16),color:g(e)},children:[(0,E.jsx)(`span`,{children:e}),(0,E.jsx)(`span`,{className:r(`inline-flex items-center rounded-full border px-1 py-0.5 text-[9px] leading-none`,p(t)),children:t})]},`${e}-${t}`)),l.length>4&&(0,E.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-border/50 px-2 py-0.5 text-[10px] text-muted-foreground`,children:f(`tables.modelEfficiency.more`,{count:l.length-4})})]}),n===`daily`&&i?.avgCost7!==void 0&&(0,E.jsxs)(`div`,{className:`mt-3 text-[10px] text-muted-foreground`,children:[f(`tables.recentDays.avg7d`),` `,c(i.avgCost7),` ·`,` `,f(`tables.recentDays.reqAvg`),` `,i.avgRequests7?.toFixed(0)??`–`]})]},e.date))}),(0,E.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,E.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,E.jsx)(`thead`,{className:`sticky top-0 z-10 bg-card`,children:(0,E.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,E.jsx)(`th`,{"aria-sort":J(`date`),className:r(`px-2 py-2 text-left text-xs font-medium`,k===`date`?`text-foreground`:`text-muted-foreground`),children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>q(`date`),className:`inline-flex items-center gap-1 rounded-sm transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,children:[f(`tables.recentDays.date`),` `,(0,E.jsx)(u,{"aria-hidden":`true`,className:r(`h-3 w-3`,k===`date`&&`text-primary`)})]})}),(0,E.jsx)(`th`,{"aria-sort":J(`cost`),className:r(`px-2 py-2 text-right text-xs font-medium`,k===`cost`?`text-foreground`:`text-muted-foreground`),children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>q(`cost`),className:`inline-flex items-center gap-1 rounded-sm transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,children:[f(`tables.recentDays.cost`),` `,(0,E.jsx)(u,{"aria-hidden":`true`,className:r(`h-3 w-3`,k===`cost`&&`text-primary`)})]})}),(0,E.jsx)(`th`,{"aria-sort":J(`tokens`),className:r(`px-2 py-2 text-right text-xs font-medium`,k===`tokens`?`text-foreground`:`text-muted-foreground`),children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>q(`tokens`),className:`inline-flex items-center gap-1 rounded-sm transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,children:[f(`tables.recentDays.tokens`),` `,(0,E.jsx)(u,{"aria-hidden":`true`,className:r(`h-3 w-3`,k===`tokens`&&`text-primary`)})]})}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground md:table-cell`,children:f(`common.input`)}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground md:table-cell`,children:f(`common.output`)}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground lg:table-cell`,children:f(`common.cacheWrite`)}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground lg:table-cell`,children:f(`common.cacheRead`)}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground xl:table-cell`,children:f(`common.thinking`)}),(0,E.jsx)(`th`,{className:`hidden px-2 py-2 text-right text-xs font-medium text-muted-foreground xl:table-cell`,children:f(`common.requestsShort`)}),(0,E.jsx)(`th`,{"aria-sort":J(`costPerM`),className:r(`px-2 py-2 text-right text-xs font-medium`,k===`costPerM`?`text-foreground`:`text-muted-foreground`),children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>q(`costPerM`),className:`inline-flex items-center gap-1 rounded-sm transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,children:[`$/1M`,` `,(0,E.jsx)(u,{"aria-hidden":`true`,className:r(`h-3 w-3`,k===`costPerM`&&`text-primary`)})]})}),(0,E.jsx)(`th`,{className:`px-2 py-2 text-left text-xs font-medium text-muted-foreground`,children:f(`tables.recentDays.models`)})]})}),(0,E.jsx)(`tbody`,{children:K.map(({day:e,benchmark:i,costPerM:a,uniqueModels:s})=>(0,E.jsxs)(`tr`,{className:`cursor-pointer border-b border-l-[3px] border-border/50 transition-colors hover:bg-muted/10 focus-visible:bg-muted/10 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset active:bg-muted/20`,style:{borderLeftColor:`hsla(215, 70%, 55%, ${.2+(W>0?e.totalCost/W:0)*.8})`,...N(h,`52px`)},onClick:()=>t?.(e.date),onKeyDown:t=>Y(t,e.date),role:t?`button`:void 0,tabIndex:t?0:void 0,children:[(0,E.jsx)(`td`,{className:`px-2 py-2.5 whitespace-nowrap`,children:o(e.date,`long`)}),(0,E.jsxs)(`td`,{className:`relative px-2 py-2.5 text-right font-mono tabular-nums`,children:[(0,E.jsx)(w,{className:`absolute inset-y-1 left-0 rounded-sm bg-primary/8`,width:`${W>0?e.totalCost/W*100:0}%`,delayMs:140,durationMs:520}),(0,E.jsx)(`span`,{className:`relative`,children:(0,E.jsx)(x,{value:e.totalCost,type:`currency`})})]}),(0,E.jsx)(`td`,{className:`px-2 py-2.5 text-right font-mono tabular-nums`,children:(0,E.jsx)(x,{value:e.totalTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums md:table-cell`,children:(0,E.jsx)(x,{value:e.inputTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums md:table-cell`,children:(0,E.jsx)(x,{value:e.outputTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums lg:table-cell`,children:(0,E.jsx)(x,{value:e.cacheCreationTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums lg:table-cell`,children:(0,E.jsx)(x,{value:e.cacheReadTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums xl:table-cell`,children:(0,E.jsx)(x,{value:e.thinkingTokens,type:`tokens`})}),(0,E.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right font-mono tabular-nums xl:table-cell`,children:(0,E.jsx)(x,{value:e.requestCount,type:`number`})}),(0,E.jsx)(`td`,{className:`px-2 py-2.5 text-right font-mono tabular-nums`,children:(0,E.jsx)(x,{value:a,type:`currency`})}),(0,E.jsxs)(`td`,{className:`px-2 py-2.5`,children:[(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:s.map(({name:e,provider:t})=>(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] leading-tight font-medium`,style:{backgroundColor:m(e,.16),color:g(e)},children:[(0,E.jsx)(`span`,{children:e}),(0,E.jsx)(`span`,{className:r(`inline-flex items-center rounded-full border px-1 py-0.5 text-[9px] leading-none`,p(t)),children:t})]},`${e}-${t}`))}),n===`daily`&&i?.avgCost7!==void 0&&(0,E.jsxs)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[f(`tables.recentDays.previousDay`),` `,i.prevCostDelta===void 0?`–`:`${i.prevCostDelta>=0?`↑`:`↓`}${Math.abs(i.prevCostDelta).toFixed(0)}%`,` `,`· `,f(`tables.recentDays.avg7d`),` `,c(i.avgCost7)]})]})]},e.date))})]})})]})]})}export{P as RecentDays};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{_ as t,a as n,b as r,c as i,d as a,f as o,l as s,m as c,p as l,t as u,v as d,w as f,y as p}from"./charts-vendor-CiBqdKXh.js";import{o as m}from"./motion-vendor-BNFhNARW.js";import{t as h}from"./useTranslation-JH30oWEP.js";import{a as g,g as _,u as v}from"./formatters-BzLLk0br.js";import{c as y,t as b}from"./model-utils-BIvGAFGz.js";import{t as x}from"./help-content-Cuf5l3_6.js";import{a as S,i as C,n as w,o as T,r as E}from"./chart-theme-BdE8bEiN.js";import{n as D,r as O,t as k}from"./ChartCard-CS4Kbe6r.js";import{t as A}from"./ChartLegend-Vzg_GmF-.js";import{t as j}from"./CustomTooltip-CEd8U-a3.js";import{n as M,o as N}from"./calculations-BJw_4KdI.js";var P=e(f()),F=m();function I(e){return v(e,1)}function L(e,t,n,r,i){let a=e+t+n+r+i;return a>0?r/a*100:0}function R({timelineData:e,summaryData:f,viewMode:m}){let{t:v}=h(),R=(0,P.useId)().replace(/:/g,``),z=v(`charts.requestCacheHitRate.total`),B=`trailing7Rate`,V=v(m===`daily`?`charts.requestCacheHitRate.trailing7Rate`:`charts.requestCacheHitRate.trendRate`),H=(0,P.useMemo)(()=>M(f).map(e=>({...e,model:e.model===`Total`?z:e.model})),[f,z]),U=(0,P.useMemo)(()=>{if(H.length===0)return null;let e=H[0];return e?{total:e,topModel:H.slice(1).sort((e,t)=>t.totalRate-e.totalRate)[0]??null,dominantModel:H.slice(1).sort((e,t)=>t.totalBaseTokens-e.totalBaseTokens)[0]??null,models:Math.max(H.length-1,0)}:null},[H]),W=(0,P.useMemo)(()=>{if(e.length===0)return[];let t=H.slice(1).map(e=>e.model),n=[...e].sort((e,t)=>e.date.localeCompare(t.date)),r=n.map(e=>L(e.inputTokens,e.outputTokens,e.cacheCreationTokens,e.cacheReadTokens,e.thinkingTokens)),i=N(r,Math.min(7,n.length)),a={};for(let e of t)a[e]=[];for(let e of n){let n=new Map;for(let r of e.modelBreakdowns){let e=y(r.modelName);if(!t.includes(e))continue;let i=n.get(e)??{input:0,output:0,cacheCreate:0,cacheRead:0,thinking:0};i.input+=r.inputTokens,i.output+=r.outputTokens,i.cacheCreate+=r.cacheCreationTokens,i.cacheRead+=r.cacheReadTokens,i.thinking+=r.thinkingTokens,n.set(e,i)}for(let e of t){let t=n.get(e),r=a[e];r&&r.push(t?L(t.input,t.output,t.cacheCreate,t.cacheRead,t.thinking):0)}}return n.map((e,n)=>{let o={date:e.date,totalRate:r[n],totalRate_ma7:i[n]};for(let e of t)o[e]=a[e]?.[n]??0;return o})},[e,H]);if(!U||W.length===0)return null;let G=Math.max(220,Math.min(310,H.length*28+48)),K=Math.max(280,Math.min(420,H.length*34+56)),q=m===`daily`?280:250,J=m===`daily`?360:320,Y=Object.keys(W[0]??{}).filter(e=>e!==`date`&&e!==`totalRate`&&e!==`totalRate_ma7`),X=(0,F.jsx)(`div`,{className:`mt-6 grid grid-cols-1 gap-4 xl:grid-cols-3`,children:H.slice(0,6).map(e=>(0,F.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/10 p-3`,children:[(0,F.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.model}),(0,F.jsxs)(`div`,{className:`mt-2 flex items-end gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[10px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.totalRate`)}),(0,F.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:I(e.totalRate)})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[10px] tracking-wider text-muted-foreground uppercase`,children:V}),(0,F.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:I(e[B])})]})]})]},e.model))});return(0,F.jsx)(D,{title:v(`charts.requestCacheHitRate.title`),subtitle:v(`charts.requestCacheHitRate.subtitle`,{total:I(U.total.totalRate),trailing:I(U.total[B])}),info:x.requestCacheHitRate,chartData:H,valueKey:`totalRate`,valueFormatter:I,expandedExtra:X,children:e=>{let f=e?8:6;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`mb-3 grid grid-cols-2 gap-2 text-center md:grid-cols-4`,children:[(0,F.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,F.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.totalRate`)}),(0,F.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:I(U.total.totalRate)})]}),(0,F.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,F.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:V}),(0,F.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:I(U.total[B])})]}),(0,F.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,F.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.topModel`)}),(0,F.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:U.topModel?.model??`–`})]}),(0,F.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,F.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.models`)}),(0,F.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:U.models})]})]}),(0,F.jsxs)(`div`,{className:`grid gap-4 ${e?`grid-cols-1 xl:grid-cols-[2fr_1fr]`:`grid-cols-1 lg:grid-cols-[2fr_1fr]`}`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`mb-2 text-[10px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.timelineHeading`,{unit:_(m)})}),(0,F.jsx)(k,{children:t=>(0,F.jsx)(O,{variant:`line`,children:(0,F.jsx)(r,{width:`100%`,height:e?J:q,children:(0,F.jsxs)(u,{data:W,margin:E,children:[(0,F.jsx)(`defs`,{children:(0,F.jsxs)(`linearGradient`,{id:`${R}-total-rate`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,F.jsx)(`stop`,{offset:`0%`,stopColor:w.cost,stopOpacity:.24}),(0,F.jsx)(`stop`,{offset:`100%`,stopColor:w.cost,stopOpacity:0})]})}),(0,F.jsx)(c,{strokeDasharray:`3 3`,stroke:w.grid,opacity:.3}),(0,F.jsx)(s,{dataKey:`date`,tickFormatter:g,stroke:w.axis,fontSize:11,tickLine:!1}),(0,F.jsx)(i,{type:`number`,domain:[0,100],tickFormatter:I,stroke:w.axis,fontSize:11,tickLine:!1,axisLine:!1}),(0,F.jsx)(d,{content:(0,F.jsx)(j,{formatter:e=>I(e),pinnedEntryNames:[v(`charts.requestCacheHitRate.totalRate`)],showComputedTotal:!1,hideZeroValues:!0}),cursor:{fill:`hsl(var(--muted))`,opacity:.12}}),(0,F.jsx)(p,{content:(0,F.jsx)(A,{})}),(0,F.jsx)(o,{type:`monotone`,dataKey:`totalRate`,stroke:w.cost,fill:`url(#${R}-total-rate)`,name:v(`charts.requestCacheHitRate.totalRate`),strokeWidth:2,dot:!1,activeDot:{r:5,strokeWidth:2,stroke:w.cost,fill:`hsl(var(--background))`},...C(t)}),(0,F.jsx)(l,{type:`monotone`,dataKey:`totalRate_ma7`,stroke:w.ma7,name:V,dot:!1,strokeWidth:2,strokeDasharray:`5 5`,connectNulls:!0,...T(t,{role:`secondary`})}),Y.map((e,n)=>(0,F.jsx)(l,{type:`monotone`,dataKey:e,stroke:b(e),name:e,dot:!1,strokeWidth:1.8,connectNulls:!0,...T(t,{order:n+2,role:`secondary`})},e))]})})})})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`mb-2 text-[10px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.modelBreakdownHeading`)}),(0,F.jsx)(k,{children:o=>(0,F.jsx)(O,{variant:`line`,children:(0,F.jsx)(r,{width:`100%`,height:e?K:G,children:(0,F.jsxs)(n,{data:H,layout:`vertical`,margin:{...E,left:e?30:20,right:8},barCategoryGap:e?14:10,barSize:f,maxBarSize:f,children:[(0,F.jsx)(c,{strokeDasharray:`3 3`,stroke:w.grid,opacity:.22,horizontal:!1}),(0,F.jsx)(s,{type:`number`,domain:[0,100],tickFormatter:I,stroke:w.axis,fontSize:10,tickLine:!1,axisLine:!1}),(0,F.jsx)(i,{type:`category`,dataKey:`model`,stroke:w.axis,fontSize:10,tickLine:!1,axisLine:!1,width:e?126:108}),(0,F.jsx)(d,{content:(0,F.jsx)(j,{formatter:e=>I(e),pinnedEntryNames:[v(`charts.requestCacheHitRate.totalRate`),V],showComputedTotal:!1}),cursor:{fill:`hsl(var(--muted))`,opacity:.12}}),(0,F.jsx)(p,{content:(0,F.jsx)(A,{})}),(0,F.jsx)(a,{dataKey:`totalRate`,name:v(`charts.requestCacheHitRate.totalRate`),radius:[0,4,4,0],fill:w.cacheRead,...S(o),children:H.map(e=>(0,F.jsx)(t,{fill:e.model===z?w.cost:w.cacheRead,fillOpacity:e.model===z?.95:.82},`${e.model}-total`))}),(0,F.jsx)(a,{dataKey:B,name:V,radius:[0,4,4,0],fill:w.ma7,...S(o,1),children:H.map(e=>(0,F.jsx)(t,{fill:e.model===z?w.cumulative:w.ma7,fillOpacity:e.model===z?.95:.8},`${e.model}-recent`))})]})})})})]})]})]})}})}export{R as RequestCacheHitRateByModel};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{_ as t,a as n,b as r,c as i,d as a,f as o,l as s,m as c,p as l,t as u,v as d,w as f,y as p}from"./charts-vendor-CiBqdKXh.js";import{a as m}from"./motion-vendor-BNVN-Ktr.js";import{t as h}from"./useTranslation-0ThAx3Gl.js";import{a as g,g as _,u as v}from"./formatters-C7EouP6y.js";import{c as y,t as b}from"./model-utils-BIvGAFGz.js";import{t as x}from"./help-content-B2N8SHIE.js";import{a as S,i as C,n as w,o as T,r as E}from"./chart-theme-BdE8bEiN.js";import{n as D,r as O,t as k}from"./ChartCard-DxxB4rGm.js";import{t as A}from"./ChartLegend-Vpk95i3r.js";import{t as j}from"./CustomTooltip-CfoUDPbT.js";import{n as M,o as N}from"./calculations-BJw_4KdI.js";var P=e(f()),F=m();function I(e){return v(e,1)}function L(e,t,n,r,i){let a=e+t+n+r+i;return a>0?r/a*100:0}function R({timelineData:e,summaryData:f,viewMode:m}){let{t:v}=h(),R=(0,P.useId)().replace(/:/g,``),z=v(`charts.requestCacheHitRate.total`),B=`trailing7Rate`,V=v(m===`daily`?`charts.requestCacheHitRate.trailing7Rate`:`charts.requestCacheHitRate.trendRate`),H=(0,P.useMemo)(()=>M(f).map(e=>({...e,model:e.model===`Total`?z:e.model})),[f,z]),U=(0,P.useMemo)(()=>{if(H.length===0)return null;let e=H[0];return e?{total:e,topModel:H.slice(1).sort((e,t)=>t.totalRate-e.totalRate)[0]??null,dominantModel:H.slice(1).sort((e,t)=>t.totalBaseTokens-e.totalBaseTokens)[0]??null,models:Math.max(H.length-1,0)}:null},[H]),W=(0,P.useMemo)(()=>{if(e.length===0)return[];let t=H.slice(1).map(e=>e.model),n=[...e].sort((e,t)=>e.date.localeCompare(t.date)),r=n.map(e=>L(e.inputTokens,e.outputTokens,e.cacheCreationTokens,e.cacheReadTokens,e.thinkingTokens)),i=N(r,Math.min(7,n.length)),a={};for(let e of t)a[e]=[];for(let e of n){let n=new Map;for(let r of e.modelBreakdowns){let e=y(r.modelName);if(!t.includes(e))continue;let i=n.get(e)??{input:0,output:0,cacheCreate:0,cacheRead:0,thinking:0};i.input+=r.inputTokens,i.output+=r.outputTokens,i.cacheCreate+=r.cacheCreationTokens,i.cacheRead+=r.cacheReadTokens,i.thinking+=r.thinkingTokens,n.set(e,i)}for(let e of t){let t=n.get(e),r=a[e];r&&r.push(t?L(t.input,t.output,t.cacheCreate,t.cacheRead,t.thinking):0)}}return n.map((e,n)=>{let o={date:e.date,totalRate:r[n],totalRate_ma7:i[n]};for(let e of t)o[e]=a[e]?.[n]??0;return o})},[e,H]);if(!U||W.length===0)return null;let G=Math.max(220,Math.min(310,H.length*28+48)),K=Math.max(280,Math.min(420,H.length*34+56)),q=m===`daily`?280:250,J=m===`daily`?360:320,Y=Object.keys(W[0]??{}).filter(e=>e!==`date`&&e!==`totalRate`&&e!==`totalRate_ma7`),X=(0,F.jsx)(`div`,{className:`mt-6 grid grid-cols-1 gap-4 xl:grid-cols-3`,children:H.slice(0,6).map(e=>(0,F.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/10 p-3`,children:[(0,F.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.model}),(0,F.jsxs)(`div`,{className:`mt-2 flex items-end gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[10px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.totalRate`)}),(0,F.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:I(e.totalRate)})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[10px] tracking-wider text-muted-foreground uppercase`,children:V}),(0,F.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:I(e[B])})]})]})]},e.model))});return(0,F.jsx)(D,{title:v(`charts.requestCacheHitRate.title`),subtitle:v(`charts.requestCacheHitRate.subtitle`,{total:I(U.total.totalRate),trailing:I(U.total[B])}),info:x.requestCacheHitRate,chartData:H,valueKey:`totalRate`,valueFormatter:I,expandedExtra:X,children:e=>{let f=e?8:6;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`mb-3 grid grid-cols-2 gap-2 text-center md:grid-cols-4`,children:[(0,F.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,F.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.totalRate`)}),(0,F.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:I(U.total.totalRate)})]}),(0,F.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,F.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:V}),(0,F.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:I(U.total[B])})]}),(0,F.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,F.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.topModel`)}),(0,F.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:U.topModel?.model??`–`})]}),(0,F.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,F.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.models`)}),(0,F.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:U.models})]})]}),(0,F.jsxs)(`div`,{className:`grid gap-4 ${e?`grid-cols-1 xl:grid-cols-[2fr_1fr]`:`grid-cols-1 lg:grid-cols-[2fr_1fr]`}`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`mb-2 text-[10px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.timelineHeading`,{unit:_(m)})}),(0,F.jsx)(k,{children:t=>(0,F.jsx)(O,{variant:`line`,children:(0,F.jsx)(r,{width:`100%`,height:e?J:q,children:(0,F.jsxs)(u,{data:W,margin:E,children:[(0,F.jsx)(`defs`,{children:(0,F.jsxs)(`linearGradient`,{id:`${R}-total-rate`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,F.jsx)(`stop`,{offset:`0%`,stopColor:w.cost,stopOpacity:.24}),(0,F.jsx)(`stop`,{offset:`100%`,stopColor:w.cost,stopOpacity:0})]})}),(0,F.jsx)(c,{strokeDasharray:`3 3`,stroke:w.grid,opacity:.3}),(0,F.jsx)(s,{dataKey:`date`,tickFormatter:g,stroke:w.axis,fontSize:11,tickLine:!1}),(0,F.jsx)(i,{type:`number`,domain:[0,100],tickFormatter:I,stroke:w.axis,fontSize:11,tickLine:!1,axisLine:!1}),(0,F.jsx)(d,{content:(0,F.jsx)(j,{formatter:e=>I(e),pinnedEntryNames:[v(`charts.requestCacheHitRate.totalRate`)],showComputedTotal:!1,hideZeroValues:!0}),cursor:{fill:`hsl(var(--muted))`,opacity:.12}}),(0,F.jsx)(p,{content:(0,F.jsx)(A,{})}),(0,F.jsx)(o,{type:`monotone`,dataKey:`totalRate`,stroke:w.cost,fill:`url(#${R}-total-rate)`,name:v(`charts.requestCacheHitRate.totalRate`),strokeWidth:2,dot:!1,activeDot:{r:5,strokeWidth:2,stroke:w.cost,fill:`hsl(var(--background))`},...C(t)}),(0,F.jsx)(l,{type:`monotone`,dataKey:`totalRate_ma7`,stroke:w.ma7,name:V,dot:!1,strokeWidth:2,strokeDasharray:`5 5`,connectNulls:!0,...T(t,{role:`secondary`})}),Y.map((e,n)=>(0,F.jsx)(l,{type:`monotone`,dataKey:e,stroke:b(e),name:e,dot:!1,strokeWidth:1.8,connectNulls:!0,...T(t,{order:n+2,role:`secondary`})},e))]})})})})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`mb-2 text-[10px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestCacheHitRate.modelBreakdownHeading`)}),(0,F.jsx)(k,{children:o=>(0,F.jsx)(O,{variant:`line`,children:(0,F.jsx)(r,{width:`100%`,height:e?K:G,children:(0,F.jsxs)(n,{data:H,layout:`vertical`,margin:{...E,left:e?30:20,right:8},barCategoryGap:e?14:10,barSize:f,maxBarSize:f,children:[(0,F.jsx)(c,{strokeDasharray:`3 3`,stroke:w.grid,opacity:.22,horizontal:!1}),(0,F.jsx)(s,{type:`number`,domain:[0,100],tickFormatter:I,stroke:w.axis,fontSize:10,tickLine:!1,axisLine:!1}),(0,F.jsx)(i,{type:`category`,dataKey:`model`,stroke:w.axis,fontSize:10,tickLine:!1,axisLine:!1,width:e?126:108}),(0,F.jsx)(d,{content:(0,F.jsx)(j,{formatter:e=>I(e),pinnedEntryNames:[v(`charts.requestCacheHitRate.totalRate`),V],showComputedTotal:!1}),cursor:{fill:`hsl(var(--muted))`,opacity:.12}}),(0,F.jsx)(p,{content:(0,F.jsx)(A,{})}),(0,F.jsx)(a,{dataKey:`totalRate`,name:v(`charts.requestCacheHitRate.totalRate`),radius:[0,4,4,0],fill:w.cacheRead,...S(o),children:H.map(e=>(0,F.jsx)(t,{fill:e.model===z?w.cost:w.cacheRead,fillOpacity:e.model===z?.95:.82},`${e.model}-total`))}),(0,F.jsx)(a,{dataKey:B,name:V,radius:[0,4,4,0],fill:w.ma7,...S(o,1),children:H.map(e=>(0,F.jsx)(t,{fill:e.model===z?w.cumulative:w.ma7,fillOpacity:e.model===z?.95:.8},`${e.model}-recent`))})]})})})})]})]})]})}})}export{R as RequestCacheHitRateByModel};
@@ -1 +1 @@
1
- import{o as e}from"./motion-vendor-BNFhNARW.js";import{t}from"./useTranslation-JH30oWEP.js";import{d as n,l as r,n as i,u as a}from"./formatters-BzLLk0br.js";import{a as o,i as s,n as c,t as l}from"./card-CskYMXga.js";import{n as u}from"./help-content-Cuf5l3_6.js";import{t as d}from"./InfoHeading-CFbl45C9.js";import{t as f}from"./AnimatedBarFill-Da354-1y.js";var p=e();function m({metrics:e,viewMode:m}){let{t:h}=t(),g=e.totalRequests>0?e.totalCacheRead/e.totalRequests:0,_=e.totalRequests>0?e.totalThinking/e.totalRequests:0,v=e.totalOutput>0?e.totalInput/e.totalOutput:0,y=e.activeDays>0?e.totalRequests/e.activeDays:0,b=[{label:h(`requestQuality.tokensPerRequest`),value:e.hasRequestData?n(e.avgTokensPerRequest):h(`common.notAvailable`),accent:`var(--chart-2)`,hint:h(`requestQuality.tokensHint`),progress:Math.min(e.avgTokensPerRequest/2e5,1)},{label:h(`requestQuality.costPerRequest`),value:e.hasRequestData?i(e.avgCostPerRequest):h(`common.notAvailable`),accent:`var(--chart-4)`,hint:h(`requestQuality.costHint`),progress:Math.min(e.avgCostPerRequest/.25,1)},{label:h(`requestQuality.cachePerRequest`),value:e.hasRequestData?n(g):h(`common.notAvailable`),accent:`var(--chart-1)`,hint:h(`requestQuality.cacheHint`),progress:Math.min(g/2e5,1)},{label:h(`requestQuality.thinkingPerRequest`),value:e.hasRequestData?n(_):h(`common.notAvailable`),accent:`var(--chart-5)`,hint:h(`requestQuality.thinkingHint`),progress:Math.min(_/1e4,1)}];return(0,p.jsxs)(l,{className:`overflow-visible`,children:[(0,p.jsx)(s,{children:(0,p.jsx)(d,{info:u.requestQuality,children:(0,p.jsx)(o,{className:`text-sm font-medium text-muted-foreground`,children:h(`requestQuality.title`)})})}),(0,p.jsxs)(c,{className:`space-y-4`,children:[(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 xl:grid-cols-4`,children:b.map((t,n)=>(0,p.jsxs)(`div`,{className:`rounded-xl border border-border/50 bg-muted/15 p-3`,children:[(0,p.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:t.label}),(0,p.jsx)(`div`,{className:`mt-1 text-lg font-semibold tabular-nums`,children:t.value}),(0,p.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:t.hint}),(0,p.jsx)(`div`,{className:`mt-3 h-1.5 overflow-hidden rounded-full bg-muted/40`,children:(0,p.jsx)(f,{className:`h-full rounded-full`,order:n,style:{backgroundColor:`hsl(${t.accent})`},width:e.hasRequestData&&t.progress>0?`${Math.max(t.progress*100,6)}%`:`0%`})})]},t.label))}),(0,p.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-4`,children:[(0,p.jsxs)(`div`,{className:`rounded-xl border border-border/50 bg-gradient-to-br from-primary/[0.12] via-transparent to-transparent p-4`,children:[(0,p.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:h(`requestQuality.requestDensity`)}),(0,p.jsx)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums`,children:r(Math.round(y))}),(0,p.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:h(`requestQuality.averagePerActiveUnit`,{unit:h(m===`yearly`?`periods.year`:m===`monthly`?`periods.month`:`periods.day`)})})]}),(0,p.jsxs)(`div`,{className:`rounded-xl border border-border/50 bg-gradient-to-br from-chart-3/[0.12] via-transparent to-transparent p-4`,children:[(0,p.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:h(`requestQuality.cacheHitRate`)}),(0,p.jsx)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums`,children:a(e.cacheHitRate,1)}),(0,p.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:h(`requestQuality.cacheHitHint`)})]}),(0,p.jsxs)(`div`,{className:`rounded-xl border border-border/50 bg-gradient-to-br from-chart-4/[0.12] via-transparent to-transparent p-4`,children:[(0,p.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:h(`requestQuality.inputOutput`)}),(0,p.jsxs)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums`,children:[v.toFixed(2),`:1`]}),(0,p.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:h(`requestQuality.inputOutputHint`)})]}),(0,p.jsxs)(`div`,{className:`rounded-xl border border-border/50 bg-gradient-to-br from-chart-5/[0.12] via-transparent to-transparent p-4`,children:[(0,p.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:h(`requestQuality.topRequestModel`)}),(0,p.jsx)(`div`,{className:`mt-1 truncate text-lg font-semibold`,children:e.topRequestModel?.name??`–`}),(0,p.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.topRequestModel?`${r(e.topRequestModel.requests)} ${h(`common.requests`)}`:h(`requestQuality.noRequestLeader`)})]})]})]})]})}export{m as RequestQuality};
1
+ import{a as e}from"./motion-vendor-BNVN-Ktr.js";import{t}from"./useTranslation-0ThAx3Gl.js";import{d as n,l as r,n as i,u as a}from"./formatters-C7EouP6y.js";import{a as o,i as s,n as c,t as l}from"./card-B4CVYJDH.js";import{n as u}from"./help-content-B2N8SHIE.js";import{t as d}from"./InfoHeading-BxLyydv8.js";import{t as f}from"./AnimatedBarFill-DFAXO-3i.js";var p=e();function m({metrics:e,viewMode:m}){let{t:h}=t(),g=e.totalRequests>0?e.totalCacheRead/e.totalRequests:0,_=e.totalRequests>0?e.totalThinking/e.totalRequests:0,v=e.totalOutput>0?e.totalInput/e.totalOutput:0,y=e.activeDays>0?e.totalRequests/e.activeDays:0,b=[{label:h(`requestQuality.tokensPerRequest`),value:e.hasRequestData?n(e.avgTokensPerRequest):h(`common.notAvailable`),accent:`var(--chart-2)`,hint:h(`requestQuality.tokensHint`),progress:Math.min(e.avgTokensPerRequest/2e5,1)},{label:h(`requestQuality.costPerRequest`),value:e.hasRequestData?i(e.avgCostPerRequest):h(`common.notAvailable`),accent:`var(--chart-4)`,hint:h(`requestQuality.costHint`),progress:Math.min(e.avgCostPerRequest/.25,1)},{label:h(`requestQuality.cachePerRequest`),value:e.hasRequestData?n(g):h(`common.notAvailable`),accent:`var(--chart-1)`,hint:h(`requestQuality.cacheHint`),progress:Math.min(g/2e5,1)},{label:h(`requestQuality.thinkingPerRequest`),value:e.hasRequestData?n(_):h(`common.notAvailable`),accent:`var(--chart-5)`,hint:h(`requestQuality.thinkingHint`),progress:Math.min(_/1e4,1)}];return(0,p.jsxs)(l,{className:`overflow-visible`,children:[(0,p.jsx)(s,{children:(0,p.jsx)(d,{info:u.requestQuality,children:(0,p.jsx)(o,{className:`text-sm font-medium text-muted-foreground`,children:h(`requestQuality.title`)})})}),(0,p.jsxs)(c,{className:`space-y-4`,children:[(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 xl:grid-cols-4`,children:b.map((t,n)=>(0,p.jsxs)(`div`,{className:`rounded-xl border border-border/50 bg-muted/15 p-3`,children:[(0,p.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:t.label}),(0,p.jsx)(`div`,{className:`mt-1 text-lg font-semibold tabular-nums`,children:t.value}),(0,p.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:t.hint}),(0,p.jsx)(`div`,{className:`mt-3 h-1.5 overflow-hidden rounded-full bg-muted/40`,children:(0,p.jsx)(f,{className:`h-full rounded-full`,order:n,style:{backgroundColor:`hsl(${t.accent})`},width:e.hasRequestData&&t.progress>0?`${Math.max(t.progress*100,6)}%`:`0%`})})]},t.label))}),(0,p.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-4`,children:[(0,p.jsxs)(`div`,{className:`rounded-xl border border-border/50 bg-gradient-to-br from-primary/[0.12] via-transparent to-transparent p-4`,children:[(0,p.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:h(`requestQuality.requestDensity`)}),(0,p.jsx)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums`,children:r(Math.round(y))}),(0,p.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:h(`requestQuality.averagePerActiveUnit`,{unit:h(m===`yearly`?`periods.year`:m===`monthly`?`periods.month`:`periods.day`)})})]}),(0,p.jsxs)(`div`,{className:`rounded-xl border border-border/50 bg-gradient-to-br from-chart-3/[0.12] via-transparent to-transparent p-4`,children:[(0,p.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:h(`requestQuality.cacheHitRate`)}),(0,p.jsx)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums`,children:a(e.cacheHitRate,1)}),(0,p.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:h(`requestQuality.cacheHitHint`)})]}),(0,p.jsxs)(`div`,{className:`rounded-xl border border-border/50 bg-gradient-to-br from-chart-4/[0.12] via-transparent to-transparent p-4`,children:[(0,p.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:h(`requestQuality.inputOutput`)}),(0,p.jsxs)(`div`,{className:`mt-1 text-xl font-semibold tabular-nums`,children:[v.toFixed(2),`:1`]}),(0,p.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:h(`requestQuality.inputOutputHint`)})]}),(0,p.jsxs)(`div`,{className:`rounded-xl border border-border/50 bg-gradient-to-br from-chart-5/[0.12] via-transparent to-transparent p-4`,children:[(0,p.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:h(`requestQuality.topRequestModel`)}),(0,p.jsx)(`div`,{className:`mt-1 truncate text-lg font-semibold`,children:e.topRequestModel?.name??`–`}),(0,p.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.topRequestModel?`${r(e.topRequestModel.requests)} ${h(`common.requests`)}`:h(`requestQuality.noRequestLeader`)})]})]})]})]})}export{m as RequestQuality};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{_ as t,b as n,c as r,f as i,g as a,i as o,l as s,m as c,p as l,t as u,v as d,w as f,y as p}from"./charts-vendor-CiBqdKXh.js";import{o as m}from"./motion-vendor-BNFhNARW.js";import{t as h}from"./useTranslation-JH30oWEP.js";import{a as g,g as _}from"./formatters-BzLLk0br.js";import{r as v}from"./i18n-D1WJ4-W9.js";import{t as y}from"./model-utils-BIvGAFGz.js";import{t as b}from"./formatted-value-DuGw8WPX.js";import{t as x}from"./help-content-Cuf5l3_6.js";import{i as S,n as C,o as w,r as T,s as E}from"./chart-theme-BdE8bEiN.js";import{n as D,r as O,t as k}from"./ChartCard-CS4Kbe6r.js";import{t as A}from"./ChartLegend-Vzg_GmF-.js";import{t as j}from"./CustomTooltip-CEd8U-a3.js";var M=e(f()),N=m();function P(e){return new Intl.NumberFormat(v(),{notation:e>=1e4?`compact`:`standard`,maximumFractionDigits:+(e>=1e4)}).format(e)}function F({viewBox:e,total:t}){let{t:n}=h();if(!e)return null;let{cx:r,cy:i}=e;return(0,N.jsxs)(`g`,{children:[(0,N.jsx)(`text`,{x:r,y:i-6,textAnchor:`middle`,className:`fill-muted-foreground`,fontSize:11,children:n(`charts.requestsOverTime.total`)}),(0,N.jsx)(`text`,{x:r,y:i+14,textAnchor:`middle`,className:`fill-foreground`,fontSize:16,fontWeight:600,children:t})]})}function I({data:e,viewMode:f=`daily`,onClickDay:m}){let{t:v}=h(),I=(0,M.useId)().replace(/:/g,``),L=v(`charts.requestsOverTime.averagePerUnit`,{unit:_(f)}),R=v(f===`daily`?`charts.requestsOverTime.movingAverage`:`charts.requestsOverTime.trend`),z=v(f===`daily`?`charts.requestsOverTime.movingAverageHeading`:`charts.requestsOverTime.trendHeading`),B=(0,M.useMemo)(()=>{if(e.length===0)return null;let t=new Map;for(let n of e)for(let[e,r]of Object.entries(n))e===`date`||e===`totalRequests`||e===`totalRequestsMA7`||e===`totalRequestsPrev`||e.endsWith(`_ma7`)||e.endsWith(`Prev`)||typeof r==`number`&&t.set(e,(t.get(e)??0)+r);let n=Array.from(t.entries()).sort((e,t)=>t[1]-e[1]),r=e.reduce((e,t)=>e+t.totalRequests,0),i=[...e].sort((e,t)=>t.totalRequests-e.totalRequests)[0];return i?{totalRequests:r,peak:i,topModels:n}:null},[e]),V=(0,M.useMemo)(()=>(B?.topModels??[]).slice(0,5).map(([e])=>e),[B]),H=(0,M.useMemo)(()=>(B?.topModels??[]).map(([e,t])=>({name:e,value:t})),[B]),U=e=>{let t=e;t?.activePayload?.[0]?.payload?.date&&m&&m(t.activePayload[0].payload.date)},W=(0,N.jsx)(k,{children:t=>(0,N.jsxs)(`div`,{className:`mt-6 space-y-5`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`mb-2 text-[10px] tracking-wider text-muted-foreground uppercase`,children:z}),(0,N.jsx)(O,{variant:`line`,children:(0,N.jsx)(n,{width:`100%`,height:360,children:(0,N.jsxs)(u,{data:e,margin:T,children:[(0,N.jsx)(c,{strokeDasharray:`3 3`,stroke:C.grid,opacity:.3}),(0,N.jsx)(s,{dataKey:`date`,tickFormatter:g,stroke:C.axis,fontSize:11,tickLine:!1}),(0,N.jsx)(r,{tickFormatter:P,stroke:C.axis,fontSize:11,tickLine:!1,axisLine:!1}),(0,N.jsx)(d,{content:(0,N.jsx)(j,{formatter:e=>P(e)}),cursor:{stroke:`hsl(var(--muted))`,strokeWidth:1}}),(0,N.jsx)(p,{content:(0,N.jsx)(A,{})}),(0,N.jsx)(l,{type:`monotone`,dataKey:`totalRequestsMA7`,stroke:C.ma7,name:v(`charts.requestsOverTime.totalMovingAverage`,{label:R}),dot:!1,strokeWidth:2.5,strokeDasharray:`6 4`,connectNulls:!0,...w(t,{role:`secondary`})}),(B?.topModels??[]).map(([e],n)=>(0,N.jsx)(l,{type:`monotone`,dataKey:`${e}_ma7`,stroke:y(e),name:`${e} ${R}`,dot:!1,strokeWidth:2,strokeDasharray:`5 4`,connectNulls:!0,...w(t,{order:n%6,role:`secondary`})},`${e}_ma7`))]})})})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`mb-2 text-[10px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestsOverTime.requestsByModelTotal`)}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:(B?.topModels??[]).map(([e,t])=>{let n=B&&B.totalRequests>0?t/B.totalRequests*100:0;return(0,N.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/10 p-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`h-2.5 w-2.5 shrink-0 rounded-full`,style:{backgroundColor:y(e)}}),(0,N.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e})]}),(0,N.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[n.toFixed(1),`%`]})]}),(0,N.jsx)(`div`,{className:`mt-2 text-lg font-semibold tabular-nums`,children:P(t)}),(0,N.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:v(`charts.requestsOverTime.requestsInRange`)})]},e)})})]})]})});return(0,N.jsx)(D,{title:v(`charts.requestsOverTime.title`),subtitle:B?v(`charts.requestsOverTime.summary`,{total:P(B.totalRequests),peak:P(B.peak.totalRequests),date:g(B.peak.date)}):v(`charts.requestsOverTime.subtitle`),info:x.requestsOverTime,summary:B?(0,N.jsx)(b,{value:B.totalRequests,type:`number`}):void 0,chartData:e,valueKey:`totalRequests`,valueFormatter:P,expandedExtra:W,children:f=>{let m=f?420:320,h=f?440:340,_=f?70:54,b=f?112:82,x=f?`48%`:`46%`;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`mb-3 grid grid-cols-2 gap-2 text-center md:grid-cols-4`,children:[(0,N.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,N.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestsOverTime.total`)}),(0,N.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:B?P(B.totalRequests):`0`})]}),(0,N.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,N.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:L}),(0,N.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:B&&e.length>0?P(B.totalRequests/e.length):`0`})]}),(0,N.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,N.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestsOverTime.topModel`)}),(0,N.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:B?.topModels[0]?.[0]??`–`})]}),(0,N.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,N.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestsOverTime.topShare`)}),(0,N.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:B&&B.totalRequests>0&&B.topModels[0]?`${(B.topModels[0][1]/B.totalRequests*100).toFixed(1)}%`:`–`})]})]}),(0,N.jsxs)(`div`,{className:`grid gap-4 ${f?`grid-cols-1 xl:grid-cols-3`:`grid-cols-1 lg:grid-cols-3`}`,children:[(0,N.jsx)(`div`,{className:f?`xl:col-span-2`:`lg:col-span-2`,children:(0,N.jsx)(k,{children:t=>(0,N.jsx)(O,{variant:`line`,children:(0,N.jsx)(n,{width:`100%`,height:m,children:(0,N.jsxs)(u,{data:e,margin:T,onClick:U,children:[(0,N.jsx)(`defs`,{children:(0,N.jsxs)(`linearGradient`,{id:`${I}-requests`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,N.jsx)(`stop`,{offset:`0%`,stopColor:C.cumulative,stopOpacity:.28}),(0,N.jsx)(`stop`,{offset:`100%`,stopColor:C.cumulative,stopOpacity:0})]})}),(0,N.jsx)(c,{strokeDasharray:`3 3`,stroke:C.grid,opacity:.3}),(0,N.jsx)(s,{dataKey:`date`,tickFormatter:g,stroke:C.axis,fontSize:11,tickLine:!1}),(0,N.jsx)(r,{tickFormatter:P,stroke:C.axis,fontSize:11,tickLine:!1,axisLine:!1}),(0,N.jsx)(d,{content:(0,N.jsx)(j,{formatter:e=>P(e),pinnedEntryNames:[v(`charts.requestsOverTime.totalRequestsSeries`)],showComputedTotal:!1}),cursor:{fill:`hsl(var(--muted))`,opacity:.12}}),(0,N.jsx)(p,{content:(0,N.jsx)(A,{})}),(0,N.jsx)(i,{type:`monotone`,dataKey:`totalRequests`,stroke:C.cumulative,fill:`url(#${I}-requests)`,name:v(`charts.requestsOverTime.totalRequestsSeries`),strokeWidth:1.8,dot:!1,activeDot:{r:5,strokeWidth:2,stroke:C.cumulative,fill:`hsl(var(--background))`},...S(t)}),(0,N.jsx)(l,{type:`monotone`,dataKey:`totalRequestsMA7`,stroke:C.ma7,name:R,dot:!1,strokeWidth:2.2,strokeDasharray:`5 5`,connectNulls:!0,...w(t,{role:`secondary`})}),V.map((e,n)=>(0,N.jsx)(l,{type:`monotone`,dataKey:e,stroke:y(e),name:e,dot:!1,strokeWidth:1.6,...w(t,{order:n%5+1})},e))]})})})})}),(0,N.jsx)(`div`,{className:`min-w-0 pt-1`,children:(0,N.jsx)(k,{children:e=>(0,N.jsx)(O,{variant:`radial`,children:(0,N.jsx)(n,{width:`100%`,height:h,children:(0,N.jsxs)(o,{children:[(0,N.jsxs)(a,{data:H,cx:`50%`,cy:x,innerRadius:_,outerRadius:b,paddingAngle:2,dataKey:`value`,nameKey:`name`,...E(e),children:[H.map(e=>(0,N.jsx)(t,{fill:y(e.name)},e.name)),(0,N.jsx)(F,{total:B?P(B.totalRequests):`0`})]}),(0,N.jsx)(d,{content:(0,N.jsx)(j,{formatter:e=>P(e)})}),(0,N.jsx)(p,{content:(0,N.jsx)(A,{className:f?`pt-[18px]`:`pt-2`,renderLabel:e=>{let t=String(e.value??``),n=H.find(e=>e.name===t);return`${t} (${n?P(n.value):``})`}})})]})})})})})]})]})}})}export{I as RequestsOverTime};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{_ as t,b as n,c as r,f as i,g as a,i as o,l as s,m as c,p as l,t as u,v as d,w as f,y as p}from"./charts-vendor-CiBqdKXh.js";import{a as m}from"./motion-vendor-BNVN-Ktr.js";import{t as h}from"./useTranslation-0ThAx3Gl.js";import{a as g,g as _}from"./formatters-C7EouP6y.js";import{r as v}from"./i18n-BS3-GJaA.js";import{t as y}from"./model-utils-BIvGAFGz.js";import{t as b}from"./formatted-value-CpLoDrYF.js";import{t as x}from"./help-content-B2N8SHIE.js";import{i as S,n as C,o as w,r as T,s as E}from"./chart-theme-BdE8bEiN.js";import{n as D,r as O,t as k}from"./ChartCard-DxxB4rGm.js";import{t as A}from"./ChartLegend-Vpk95i3r.js";import{t as j}from"./CustomTooltip-CfoUDPbT.js";var M=e(f()),N=m();function P(e){return new Intl.NumberFormat(v(),{notation:e>=1e4?`compact`:`standard`,maximumFractionDigits:+(e>=1e4)}).format(e)}function F({viewBox:e,total:t}){let{t:n}=h();if(!e)return null;let{cx:r,cy:i}=e;return(0,N.jsxs)(`g`,{children:[(0,N.jsx)(`text`,{x:r,y:i-6,textAnchor:`middle`,className:`fill-muted-foreground`,fontSize:11,children:n(`charts.requestsOverTime.total`)}),(0,N.jsx)(`text`,{x:r,y:i+14,textAnchor:`middle`,className:`fill-foreground`,fontSize:16,fontWeight:600,children:t})]})}function I({data:e,viewMode:f=`daily`,onClickDay:m}){let{t:v}=h(),I=(0,M.useId)().replace(/:/g,``),L=v(`charts.requestsOverTime.averagePerUnit`,{unit:_(f)}),R=v(f===`daily`?`charts.requestsOverTime.movingAverage`:`charts.requestsOverTime.trend`),z=v(f===`daily`?`charts.requestsOverTime.movingAverageHeading`:`charts.requestsOverTime.trendHeading`),B=(0,M.useMemo)(()=>{if(e.length===0)return null;let t=new Map;for(let n of e)for(let[e,r]of Object.entries(n))e===`date`||e===`totalRequests`||e===`totalRequestsMA7`||e===`totalRequestsPrev`||e.endsWith(`_ma7`)||e.endsWith(`Prev`)||typeof r==`number`&&t.set(e,(t.get(e)??0)+r);let n=Array.from(t.entries()).sort((e,t)=>t[1]-e[1]),r=e.reduce((e,t)=>e+t.totalRequests,0),i=[...e].sort((e,t)=>t.totalRequests-e.totalRequests)[0];return i?{totalRequests:r,peak:i,topModels:n}:null},[e]),V=(0,M.useMemo)(()=>(B?.topModels??[]).slice(0,5).map(([e])=>e),[B]),H=(0,M.useMemo)(()=>(B?.topModels??[]).map(([e,t])=>({name:e,value:t})),[B]),U=e=>{let t=e;t?.activePayload?.[0]?.payload?.date&&m&&m(t.activePayload[0].payload.date)},W=(0,N.jsx)(k,{children:t=>(0,N.jsxs)(`div`,{className:`mt-6 space-y-5`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`mb-2 text-[10px] tracking-wider text-muted-foreground uppercase`,children:z}),(0,N.jsx)(O,{variant:`line`,children:(0,N.jsx)(n,{width:`100%`,height:360,children:(0,N.jsxs)(u,{data:e,margin:T,children:[(0,N.jsx)(c,{strokeDasharray:`3 3`,stroke:C.grid,opacity:.3}),(0,N.jsx)(s,{dataKey:`date`,tickFormatter:g,stroke:C.axis,fontSize:11,tickLine:!1}),(0,N.jsx)(r,{tickFormatter:P,stroke:C.axis,fontSize:11,tickLine:!1,axisLine:!1}),(0,N.jsx)(d,{content:(0,N.jsx)(j,{formatter:e=>P(e)}),cursor:{stroke:`hsl(var(--muted))`,strokeWidth:1}}),(0,N.jsx)(p,{content:(0,N.jsx)(A,{})}),(0,N.jsx)(l,{type:`monotone`,dataKey:`totalRequestsMA7`,stroke:C.ma7,name:v(`charts.requestsOverTime.totalMovingAverage`,{label:R}),dot:!1,strokeWidth:2.5,strokeDasharray:`6 4`,connectNulls:!0,...w(t,{role:`secondary`})}),(B?.topModels??[]).map(([e],n)=>(0,N.jsx)(l,{type:`monotone`,dataKey:`${e}_ma7`,stroke:y(e),name:`${e} ${R}`,dot:!1,strokeWidth:2,strokeDasharray:`5 4`,connectNulls:!0,...w(t,{order:n%6,role:`secondary`})},`${e}_ma7`))]})})})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`mb-2 text-[10px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestsOverTime.requestsByModelTotal`)}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:(B?.topModels??[]).map(([e,t])=>{let n=B&&B.totalRequests>0?t/B.totalRequests*100:0;return(0,N.jsxs)(`div`,{className:`rounded-lg border border-border/50 bg-muted/10 p-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`h-2.5 w-2.5 shrink-0 rounded-full`,style:{backgroundColor:y(e)}}),(0,N.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e})]}),(0,N.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[n.toFixed(1),`%`]})]}),(0,N.jsx)(`div`,{className:`mt-2 text-lg font-semibold tabular-nums`,children:P(t)}),(0,N.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:v(`charts.requestsOverTime.requestsInRange`)})]},e)})})]})]})});return(0,N.jsx)(D,{title:v(`charts.requestsOverTime.title`),subtitle:B?v(`charts.requestsOverTime.summary`,{total:P(B.totalRequests),peak:P(B.peak.totalRequests),date:g(B.peak.date)}):v(`charts.requestsOverTime.subtitle`),info:x.requestsOverTime,summary:B?(0,N.jsx)(b,{value:B.totalRequests,type:`number`}):void 0,chartData:e,valueKey:`totalRequests`,valueFormatter:P,expandedExtra:W,children:f=>{let m=f?420:320,h=f?440:340,_=f?70:54,b=f?112:82,x=f?`48%`:`46%`;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`mb-3 grid grid-cols-2 gap-2 text-center md:grid-cols-4`,children:[(0,N.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,N.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestsOverTime.total`)}),(0,N.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:B?P(B.totalRequests):`0`})]}),(0,N.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,N.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:L}),(0,N.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:B&&e.length>0?P(B.totalRequests/e.length):`0`})]}),(0,N.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,N.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestsOverTime.topModel`)}),(0,N.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:B?.topModels[0]?.[0]??`–`})]}),(0,N.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-2`,children:[(0,N.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:v(`charts.requestsOverTime.topShare`)}),(0,N.jsx)(`div`,{className:`text-sm font-semibold tabular-nums`,children:B&&B.totalRequests>0&&B.topModels[0]?`${(B.topModels[0][1]/B.totalRequests*100).toFixed(1)}%`:`–`})]})]}),(0,N.jsxs)(`div`,{className:`grid gap-4 ${f?`grid-cols-1 xl:grid-cols-3`:`grid-cols-1 lg:grid-cols-3`}`,children:[(0,N.jsx)(`div`,{className:f?`xl:col-span-2`:`lg:col-span-2`,children:(0,N.jsx)(k,{children:t=>(0,N.jsx)(O,{variant:`line`,children:(0,N.jsx)(n,{width:`100%`,height:m,children:(0,N.jsxs)(u,{data:e,margin:T,onClick:U,children:[(0,N.jsx)(`defs`,{children:(0,N.jsxs)(`linearGradient`,{id:`${I}-requests`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,N.jsx)(`stop`,{offset:`0%`,stopColor:C.cumulative,stopOpacity:.28}),(0,N.jsx)(`stop`,{offset:`100%`,stopColor:C.cumulative,stopOpacity:0})]})}),(0,N.jsx)(c,{strokeDasharray:`3 3`,stroke:C.grid,opacity:.3}),(0,N.jsx)(s,{dataKey:`date`,tickFormatter:g,stroke:C.axis,fontSize:11,tickLine:!1}),(0,N.jsx)(r,{tickFormatter:P,stroke:C.axis,fontSize:11,tickLine:!1,axisLine:!1}),(0,N.jsx)(d,{content:(0,N.jsx)(j,{formatter:e=>P(e),pinnedEntryNames:[v(`charts.requestsOverTime.totalRequestsSeries`)],showComputedTotal:!1}),cursor:{fill:`hsl(var(--muted))`,opacity:.12}}),(0,N.jsx)(p,{content:(0,N.jsx)(A,{})}),(0,N.jsx)(i,{type:`monotone`,dataKey:`totalRequests`,stroke:C.cumulative,fill:`url(#${I}-requests)`,name:v(`charts.requestsOverTime.totalRequestsSeries`),strokeWidth:1.8,dot:!1,activeDot:{r:5,strokeWidth:2,stroke:C.cumulative,fill:`hsl(var(--background))`},...S(t)}),(0,N.jsx)(l,{type:`monotone`,dataKey:`totalRequestsMA7`,stroke:C.ma7,name:R,dot:!1,strokeWidth:2.2,strokeDasharray:`5 5`,connectNulls:!0,...w(t,{role:`secondary`})}),V.map((e,n)=>(0,N.jsx)(l,{type:`monotone`,dataKey:e,stroke:y(e),name:e,dot:!1,strokeWidth:1.6,...w(t,{order:n%5+1})},e))]})})})})}),(0,N.jsx)(`div`,{className:`min-w-0 pt-1`,children:(0,N.jsx)(k,{children:e=>(0,N.jsx)(O,{variant:`radial`,children:(0,N.jsx)(n,{width:`100%`,height:h,children:(0,N.jsxs)(o,{children:[(0,N.jsxs)(a,{data:H,cx:`50%`,cy:x,innerRadius:_,outerRadius:b,paddingAngle:2,dataKey:`value`,nameKey:`name`,...E(e),children:[H.map(e=>(0,N.jsx)(t,{fill:y(e.name)},e.name)),(0,N.jsx)(F,{total:B?P(B.totalRequests):`0`})]}),(0,N.jsx)(d,{content:(0,N.jsx)(j,{formatter:e=>P(e)})}),(0,N.jsx)(p,{content:(0,N.jsx)(A,{className:f?`pt-[18px]`:`pt-2`,renderLabel:e=>{let t=String(e.value??``),n=H.find(e=>e.name===t);return`${t} (${n?P(n.value):``})`}})})]})})})})})]})]})}})}export{I as RequestsOverTime};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{w as t}from"./charts-vendor-CiBqdKXh.js";import{a as n}from"./motion-vendor-BNVN-Ktr.js";import{o as r,t as i}from"./useTranslation-0ThAx3Gl.js";import{s as a}from"./formatters-C7EouP6y.js";import{t as o}from"./i18n-BS3-GJaA.js";import{I as s,N as ee,O as te,P as c,S as ne,et as re,h as l,k as ie,r as u,rt as ae,w as oe}from"./icons-vendor-CIvT_-Pb.js";import{t as d}from"./button-CRvPoJg9.js";import{i as f}from"./model-utils-BIvGAFGz.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./dialog-Djogwk0C.js";import{a as fe,c as p,i as pe,l as m,o as me,s as h,t as g}from"./app-settings-BInClAwB.js";import{n as he}from"./help-content-B2N8SHIE.js";import{t as ge}from"./InfoHeading-BxLyydv8.js";import{a as _,t as v}from"./provider-limits-BgKrr7k7.js";var y=e(t()),b=n();function x(e){let t=e.replace(`,`,`.`).trim();if(!t)return 0;let n=Number.parseFloat(t);return Number.isFinite(n)?Math.max(0,Number(n.toFixed(2))):0}function S(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function C(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))].sort((e,t)=>e.localeCompare(t))}function _e(e,t){let n={};for(let r of e)n[r]=t[r]??{...v};return n}function w(e,t,n){let r=e.indexOf(t),i=r+n;if(r<0||i<0||i>=e.length)return e;let a=[...e],[o]=a.splice(r,1);return o?(a.splice(i,0,o),a):e}function ve(e,t,n){if(t===n)return e;let r=e.indexOf(t),i=e.indexOf(n);if(r<0||i<0)return e;let a=[...e],[o]=a.splice(r,1);if(!o)return e;let s=r<i?i-1:i;return a.splice(s,0,o),a}function T({open:e,onOpenChange:t,language:n,reducedMotionPreference:T,limitProviders:E,filterProviders:ye,models:be,limits:D,defaultFilters:O,sectionVisibility:k,sectionOrder:A,lastLoadedAt:j,lastLoadSource:M,cliAutoLoadActive:xe=!1,hasData:Se,onSaveSettings:Ce,onExportSettings:we,onImportSettings:Te,onExportData:Ee,onImportData:De,settingsBusy:N=!1,dataBusy:P=!1}){let{t:F}=i(),[I,L]=(0,y.useState)(n),[R,z]=(0,y.useState)(T),[B,V]=(0,y.useState)(()=>_(E,D)),[H,U]=(0,y.useState)(O),[W,G]=(0,y.useState)(k),[K,q]=(0,y.useState)(A),[J,Y]=(0,y.useState)(null),[X,Z]=(0,y.useState)(null),Oe=(0,y.useRef)(null);(0,y.useEffect)(()=>{e&&(L(n),z(T),V(_(E,D)),U(O),G(k),q(A),Y(null),Z(null))},[e,n,T,E,D,O,k,A]);let ke=(0,y.useMemo)(()=>C([...ye,...H.providers]),[ye,H.providers]),Ae=(0,y.useMemo)(()=>C([...be,...H.models]),[be,H.models]),Q=(e,t)=>{V(n=>({...n,[e]:{...n[e]??v,...t}}))},je=async()=>{await Ce({language:I,reducedMotionPreference:R,providerLimits:_e(E,B),defaultFilters:{...H,providers:C(H.providers),models:C(H.models)},sectionVisibility:W,sectionOrder:K}),t(!1)},Me=()=>{L(g.language),z(g.reducedMotionPreference),V(_(E,{})),U(h),G(m()),q(p()),Y(null),Z(null)},Ne=()=>{U(h)},Pe=()=>{G(m()),q(p())},Fe=()=>{V(_(E,{}))},Ie=F(M?`settings.modal.sources.${M}`:`settings.modal.sources.unknown`),$=(0,y.useMemo)(()=>K.map(e=>fe[e]).filter(e=>e!==void 0),[K]);return(0,b.jsx)(de,{open:e,onOpenChange:t,children:(0,b.jsxs)(le,{className:`max-h-[88vh] max-w-5xl overflow-x-visible overflow-y-auto`,onOpenAutoFocus:e=>{e.preventDefault(),Oe.current?.focus()},children:[(0,b.jsxs)(ce,{className:`overflow-visible`,children:[(0,b.jsx)(ge,{info:he.providerLimits,children:(0,b.jsx)(se,{ref:Oe,tabIndex:-1,className:`focus:outline-none`,children:F(`settings.modal.title`)})}),(0,b.jsx)(ue,{children:F(`settings.modal.description`)})]}),(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border/50 bg-muted/20 px-4 py-3`,children:[(0,b.jsx)(`div`,{className:`text-[11px] font-medium tracking-[0.14em] text-muted-foreground uppercase`,children:F(`settings.modal.dataStatus`)}),(0,b.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-[11px] tracking-[0.12em] text-muted-foreground uppercase`,children:F(`settings.modal.lastLoaded`)}),(0,b.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:j?a(j):F(`common.notAvailable`)})]}),(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-[11px] tracking-[0.12em] text-muted-foreground uppercase`,children:F(`settings.modal.loadedVia`)}),(0,b.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:Ie})]}),(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-[11px] tracking-[0.12em] text-muted-foreground uppercase`,children:F(`settings.modal.cliAutoLoad`)}),(0,b.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:F(xe?`common.enabled`:`common.disabled`)})]})]})]}),(0,b.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border/50 bg-card/60 p-4 backdrop-blur-xl`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`span`,{className:`mt-0.5 inline-flex h-9 w-9 items-center justify-center rounded-xl border border-border/60 bg-muted/20 text-muted-foreground`,children:(0,b.jsx)(oe,{className:`h-4 w-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:F(`settings.modal.languageTitle`)}),(0,b.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:F(`settings.modal.languageDescription`)})]})]}),(0,b.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:o.map(e=>(0,b.jsx)(d,{type:`button`,"data-testid":`settings-language-${e}`,"aria-pressed":I===e,variant:I===e?`default`:`outline`,onClick:()=>L(e),children:F(`app.languages.${e}`)},e))})]}),(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border/50 bg-card/60 p-4 backdrop-blur-xl`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`span`,{className:`mt-0.5 inline-flex h-9 w-9 items-center justify-center rounded-xl border border-border/60 bg-muted/20 text-muted-foreground`,children:(0,b.jsx)(ie,{className:`h-4 w-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:F(`settings.modal.defaultFiltersTitle`)}),(0,b.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:F(`settings.modal.defaultFiltersDescription`)})]})]}),(0,b.jsx)(d,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`reset-default-filters`,onClick:Ne,disabled:N,children:F(`common.reset`)})]}),(0,b.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsx)(`div`,{className:`text-[11px] font-medium tracking-[0.14em] text-muted-foreground uppercase`,children:F(`settings.modal.defaultViewMode`)}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:me.map(e=>(0,b.jsx)(d,{type:`button`,"aria-pressed":H.viewMode===e,variant:H.viewMode===e?`default`:`outline`,onClick:()=>U(t=>({...t,viewMode:e})),children:F(`settings.modal.viewModes.${e}`)},e))})]}),(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsx)(`div`,{className:`text-[11px] font-medium tracking-[0.14em] text-muted-foreground uppercase`,children:F(`settings.modal.defaultDateRange`)}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:pe.map(e=>(0,b.jsx)(d,{type:`button`,"aria-pressed":H.datePreset===e,variant:H.datePreset===e?`default`:`outline`,onClick:()=>U(t=>({...t,datePreset:e})),children:F(`settings.modal.datePresets.${e}`)},e))})]}),(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsx)(`div`,{className:`text-[11px] font-medium tracking-[0.14em] text-muted-foreground uppercase`,children:F(`settings.modal.filterProviders`)}),ke.length===0?(0,b.jsx)(`div`,{className:`rounded-xl border border-dashed border-border/60 bg-muted/10 px-3 py-4 text-sm text-muted-foreground`,children:F(`settings.modal.noProviders`)}):(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ke.map(e=>{let t=H.providers.includes(e);return(0,b.jsx)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>U(t=>({...t,providers:S(t.providers,e)})),className:r(`inline-flex items-center rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,t?`border-primary/30 bg-primary text-primary-foreground`:f(e)),children:e},e)})})]}),(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsx)(`div`,{className:`text-[11px] font-medium tracking-[0.14em] text-muted-foreground uppercase`,children:F(`settings.modal.filterModels`)}),Ae.length===0?(0,b.jsx)(`div`,{className:`rounded-xl border border-dashed border-border/60 bg-muted/10 px-3 py-4 text-sm text-muted-foreground`,children:F(`settings.modal.noModels`)}):(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ae.map(e=>{let t=H.models.includes(e);return(0,b.jsx)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>U(t=>({...t,models:S(t.models,e)})),className:r(`inline-flex items-center rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,t?`border-primary/30 bg-primary text-primary-foreground`:`border-border bg-muted/20 text-muted-foreground hover:bg-accent hover:text-foreground`),children:e},e)})})]})]})]}),(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border/50 bg-card/60 p-4 backdrop-blur-xl`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`span`,{className:`mt-0.5 inline-flex h-9 w-9 items-center justify-center rounded-xl border border-border/60 bg-muted/20 text-muted-foreground`,children:(0,b.jsx)(ee,{className:`h-4 w-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:F(`settings.modal.sectionVisibilityTitle`)}),(0,b.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:F(`settings.modal.sectionVisibilityDescription`)})]})]}),(0,b.jsx)(d,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`reset-section-visibility`,onClick:Pe,disabled:N,children:F(`common.reset`)})]}),(0,b.jsx)(`div`,{className:`mt-3 text-xs text-muted-foreground`,children:F(`settings.modal.sectionOrderHint`)}),(0,b.jsx)(`div`,{className:`mt-4 space-y-2`,children:$.map((e,t)=>{let n=W[e.id];return(0,b.jsxs)(`div`,{"data-section-id":e.id,draggable:!0,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.id),Y(e.id),Z(e.id)},onDragOver:t=>{t.preventDefault(),X!==e.id&&Z(e.id)},onDragLeave:()=>{X===e.id&&Z(null)},onDrop:t=>{t.preventDefault();let n=t.dataTransfer.getData(`text/plain`)||J;n&&(q(t=>ve(t,n,e.id)),Y(null),Z(null))},onDragEnd:()=>{Y(null),Z(null)},className:r(`flex items-center gap-2 rounded-xl border px-3 py-2 text-sm transition-colors`,X===e.id?`border-primary/40 bg-primary/10`:`border-border/70 bg-muted/10`,J===e.id&&`opacity-70`),children:[(0,b.jsx)(`span`,{className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border/60 bg-background/40 text-muted-foreground`,children:(0,b.jsx)(te,{className:`h-4 w-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:F(e.labelKey)}),(0,b.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:F(`settings.modal.positionLabel`,{position:t+1,total:$.length})})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,b.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,"data-testid":`move-section-up-${e.id}`,onClick:()=>q(t=>w(t,e.id,-1)),disabled:t===0,"aria-label":F(`settings.modal.moveSectionUp`,{section:F(e.labelKey)}),children:(0,b.jsx)(re,{className:`h-4 w-4`})}),(0,b.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,"data-testid":`move-section-down-${e.id}`,onClick:()=>q(t=>w(t,e.id,1)),disabled:t===$.length-1,"aria-label":F(`settings.modal.moveSectionDown`,{section:F(e.labelKey)}),children:(0,b.jsx)(ae,{className:`h-4 w-4`})}),(0,b.jsx)(`button`,{type:`button`,"data-testid":`toggle-section-visibility-${e.id}`,"aria-pressed":n,onClick:()=>G(t=>({...t,[e.id]:!t[e.id]})),className:r(`inline-flex min-w-[88px] items-center justify-center rounded-full border px-3 py-1.5 text-xs font-medium tracking-[0.12em] uppercase transition-colors`,n?`border-emerald-500/30 bg-emerald-500/10 text-foreground`:`border-border bg-muted/20 text-muted-foreground hover:bg-accent hover:text-foreground`),children:F(n?`common.visible`:`common.hidden`)})]})]},e.id)})})]}),(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border/50 bg-card/60 p-4 backdrop-blur-xl`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`span`,{className:`mt-0.5 inline-flex h-9 w-9 items-center justify-center rounded-xl border border-border/60 bg-muted/20 text-muted-foreground`,children:(0,b.jsx)(l,{className:`h-4 w-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:F(`settings.modal.dashboardSettingsTitle`)}),(0,b.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:F(`settings.modal.dashboardSettingsDescription`)})]})]}),(0,b.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,b.jsx)(`div`,{className:`text-[11px] font-medium tracking-[0.14em] text-muted-foreground uppercase`,children:F(`settings.modal.reducedMotionTitle`)}),(0,b.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:F(`settings.modal.reducedMotionDescription`)}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[[`system`,`settings.modal.reducedMotionOptions.system`],[`always`,`settings.modal.reducedMotionOptions.always`],[`never`,`settings.modal.reducedMotionOptions.never`]].map(([e,t])=>(0,b.jsx)(d,{type:`button`,"data-testid":`settings-reduced-motion-${e}`,"aria-pressed":R===e,variant:R===e?`default`:`outline`,onClick:()=>z(e),children:F(t)},e))})]})]})]}),(0,b.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border/50 bg-card/60 p-4 backdrop-blur-xl`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`span`,{className:`mt-0.5 inline-flex h-9 w-9 items-center justify-center rounded-xl border border-border/60 bg-muted/20 text-muted-foreground`,children:(0,b.jsx)(l,{className:`h-4 w-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:F(`settings.modal.settingsBackupTitle`)}),(0,b.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:F(`settings.modal.settingsBackupDescription`)})]})]}),(0,b.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,b.jsxs)(d,{variant:`outline`,onClick:we,disabled:N,className:`gap-2`,children:[(0,b.jsx)(c,{className:`h-4 w-4`}),F(`settings.modal.exportSettings`)]}),(0,b.jsxs)(d,{variant:`outline`,onClick:Te,disabled:N,className:`gap-2`,children:[(0,b.jsx)(u,{className:`h-4 w-4`}),F(`settings.modal.importSettings`)]})]})]}),(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border/50 bg-card/60 p-4 backdrop-blur-xl`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`span`,{className:`mt-0.5 inline-flex h-9 w-9 items-center justify-center rounded-xl border border-border/60 bg-muted/20 text-muted-foreground`,children:(0,b.jsx)(s,{className:`h-4 w-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:F(`settings.modal.dataBackupTitle`)}),(0,b.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:F(`settings.modal.dataBackupDescription`)})]})]}),(0,b.jsx)(`p`,{className:`mt-3 rounded-xl border border-amber-500/20 bg-amber-500/8 px-3 py-2 text-xs leading-relaxed text-amber-200/90`,children:F(`settings.modal.dataImportPolicy`)}),(0,b.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-muted-foreground`,children:F(`settings.modal.dataImportReplaceHint`)}),(0,b.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,b.jsxs)(d,{variant:`outline`,onClick:Ee,disabled:!Se||P,className:`gap-2`,children:[(0,b.jsx)(c,{className:`h-4 w-4`}),F(`settings.modal.exportData`)]}),(0,b.jsxs)(d,{variant:`outline`,onClick:De,disabled:P,className:`gap-2`,children:[(0,b.jsx)(u,{className:`h-4 w-4`}),F(`settings.modal.importData`)]})]})]})]}),(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border/50 bg-card/60 p-4 backdrop-blur-xl`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`span`,{className:`mt-0.5 inline-flex h-9 w-9 items-center justify-center rounded-xl border border-border/60 bg-muted/20 text-muted-foreground`,children:(0,b.jsx)(ne,{className:`h-4 w-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:F(`settings.modal.providerLimitsTitle`)}),(0,b.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:F(`settings.modal.providerLimitsDescription`)})]})]}),(0,b.jsx)(d,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`reset-provider-limits`,onClick:Fe,disabled:N,children:F(`common.reset`)})]}),(0,b.jsx)(`div`,{className:`mt-4`,children:E.length===0?(0,b.jsx)(`div`,{className:`rounded-xl border border-dashed border-border/60 bg-muted/10 px-4 py-8 text-center text-sm text-muted-foreground`,children:F(`settings.modal.noProviders`)}):(0,b.jsx)(`div`,{className:`space-y-3`,children:E.map(e=>{let t=B[e]??v;return(0,b.jsx)(`div`,{"data-provider-id":e,className:`rounded-2xl border border-border/50 bg-background/40 p-4`,children:(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,b.jsx)(`div`,{className:`min-w-0`,children:(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`span`,{className:r(`inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-medium`,f(e)),children:e}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>Q(e,{hasSubscription:!t.hasSubscription}),className:r(`inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,t.hasSubscription?`border-emerald-500/30 bg-emerald-500/10 text-emerald-300`:`border-border bg-muted/20 text-muted-foreground hover:bg-accent`),children:t.hasSubscription?F(`common.enabled`):F(`limits.statuses.noSubscription`)})]})}),(0,b.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:w-[420px]`,children:[(0,b.jsxs)(`label`,{className:`space-y-1.5`,children:[(0,b.jsx)(`span`,{className:`text-[11px] font-medium tracking-[0.14em] text-muted-foreground uppercase`,children:F(`limits.modal.subscriptionPerMonth`)}),(0,b.jsx)(`input`,{type:`number`,min:`0`,step:`0.01`,value:t.subscriptionPrice,disabled:!t.hasSubscription,onChange:t=>Q(e,{subscriptionPrice:x(t.target.value)}),className:`h-10 w-full rounded-md border border-border bg-background px-3 text-sm disabled:cursor-not-allowed disabled:opacity-50`})]}),(0,b.jsxs)(`label`,{className:`space-y-1.5`,children:[(0,b.jsx)(`span`,{className:`text-[11px] font-medium tracking-[0.14em] text-muted-foreground uppercase`,children:F(`limits.modal.monthlyLimit`)}),(0,b.jsx)(`input`,{type:`number`,min:`0`,step:`0.01`,value:t.monthlyLimit,onChange:t=>Q(e,{monthlyLimit:x(t.target.value)}),className:`h-10 w-full rounded-md border border-border bg-background px-3 text-sm`})]})]})]})},e)})})})]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border/50 pt-4`,children:[(0,b.jsx)(d,{variant:`ghost`,onClick:Me,disabled:N,"data-testid":`reset-all-settings-drafts`,children:F(`common.reset`)}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(d,{variant:`ghost`,onClick:()=>t(!1),disabled:N,children:F(`settings.modal.close`)}),(0,b.jsx)(d,{onClick:()=>void je(),disabled:N,children:F(`settings.modal.save`)})]})]})]})})}export{T as SettingsModal};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{b as t,c as n,f as r,h as i,l as a,m as o,p as s,t as c,v as l,w as u}from"./charts-vendor-CiBqdKXh.js";import{o as d}from"./motion-vendor-BNFhNARW.js";import{t as f}from"./useTranslation-JH30oWEP.js";import{a as p,n as m,t as h}from"./formatters-BzLLk0br.js";import{t as g}from"./help-content-Cuf5l3_6.js";import{i as _,n as v,o as y,r as b}from"./chart-theme-BdE8bEiN.js";import{n as x,r as S,t as C}from"./ChartCard-CS4Kbe6r.js";import{t as w}from"./CustomTooltip-CEd8U-a3.js";import{o as T}from"./calculations-BJw_4KdI.js";var E=e(u()),D=d();function O({data:e}){let{t:u}=f(),d=(0,E.useId)().replace(/:/g,``),{chartData:O,avg:k}=(0,E.useMemo)(()=>{let t=[...e].sort((e,t)=>e.date.localeCompare(t.date)),n=t.map(e=>e.totalTokens>0?e.totalCost/(e.totalTokens/1e6):0),r=T(n),i=n.length>0?n.reduce((e,t)=>e+t,0)/n.length:0;return{chartData:t.map((e,t)=>({date:e.date,efficiency:n[t],effMA7:r[t]})),avg:i}},[e]);return O.length<3?null:(0,D.jsx)(x,{title:u(`charts.tokenEfficiency.title`),subtitle:u(`charts.tokenEfficiency.subtitle`,{value:m(k)}),info:g.tokenEfficiency,chartData:O,valueKey:`efficiency`,valueFormatter:m,children:(0,D.jsx)(C,{children:e=>(0,D.jsx)(S,{variant:`line`,children:(0,D.jsx)(t,{width:`100%`,height:250,children:(0,D.jsxs)(c,{data:O,margin:b,children:[(0,D.jsx)(`defs`,{children:(0,D.jsxs)(`linearGradient`,{id:`${d}-effGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:v.input,stopOpacity:.2}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:v.input,stopOpacity:0})]})}),(0,D.jsx)(o,{strokeDasharray:`3 3`,stroke:v.grid,opacity:.3}),(0,D.jsx)(a,{dataKey:`date`,tickFormatter:p,stroke:v.axis,fontSize:11,tickLine:!1}),(0,D.jsx)(n,{tickFormatter:e=>{let t=h(e);return t===null?``:m(t)},stroke:v.axis,fontSize:11,tickLine:!1,axisLine:!1}),(0,D.jsx)(l,{content:(0,D.jsx)(w,{formatter:e=>m(e)}),cursor:{fill:`hsl(var(--muted))`,opacity:.15}}),(0,D.jsx)(i,{y:k,stroke:v.axis,strokeDasharray:`3 3`,strokeOpacity:.5}),(0,D.jsx)(r,{type:`monotone`,dataKey:`efficiency`,stroke:v.input,fill:`url(#${d}-effGrad)`,strokeWidth:1.5,name:u(`charts.tokenEfficiency.series`),dot:!1,..._(e)}),(0,D.jsx)(s,{type:`monotone`,dataKey:`effMA7`,stroke:v.ma7,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:u(`charts.tokenEfficiency.movingAverage`),...y(e,{role:`secondary`})})]})})})})})}export{O as TokenEfficiency};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{b as t,c as n,f as r,h as i,l as a,m as o,p as s,t as c,v as l,w as u}from"./charts-vendor-CiBqdKXh.js";import{a as d}from"./motion-vendor-BNVN-Ktr.js";import{t as f}from"./useTranslation-0ThAx3Gl.js";import{a as p,n as m,t as h}from"./formatters-C7EouP6y.js";import{t as g}from"./help-content-B2N8SHIE.js";import{i as _,n as v,o as y,r as b}from"./chart-theme-BdE8bEiN.js";import{n as x,r as S,t as C}from"./ChartCard-DxxB4rGm.js";import{t as w}from"./CustomTooltip-CfoUDPbT.js";import{o as T}from"./calculations-BJw_4KdI.js";var E=e(u()),D=d();function O({data:e}){let{t:u}=f(),d=(0,E.useId)().replace(/:/g,``),{chartData:O,avg:k}=(0,E.useMemo)(()=>{let t=[...e].sort((e,t)=>e.date.localeCompare(t.date)),n=t.map(e=>e.totalTokens>0?e.totalCost/(e.totalTokens/1e6):0),r=T(n),i=n.length>0?n.reduce((e,t)=>e+t,0)/n.length:0;return{chartData:t.map((e,t)=>({date:e.date,efficiency:n[t],effMA7:r[t]})),avg:i}},[e]);return O.length<3?null:(0,D.jsx)(x,{title:u(`charts.tokenEfficiency.title`),subtitle:u(`charts.tokenEfficiency.subtitle`,{value:m(k)}),info:g.tokenEfficiency,chartData:O,valueKey:`efficiency`,valueFormatter:m,children:(0,D.jsx)(C,{children:e=>(0,D.jsx)(S,{variant:`line`,children:(0,D.jsx)(t,{width:`100%`,height:250,children:(0,D.jsxs)(c,{data:O,margin:b,children:[(0,D.jsx)(`defs`,{children:(0,D.jsxs)(`linearGradient`,{id:`${d}-effGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,D.jsx)(`stop`,{offset:`0%`,stopColor:v.input,stopOpacity:.2}),(0,D.jsx)(`stop`,{offset:`100%`,stopColor:v.input,stopOpacity:0})]})}),(0,D.jsx)(o,{strokeDasharray:`3 3`,stroke:v.grid,opacity:.3}),(0,D.jsx)(a,{dataKey:`date`,tickFormatter:p,stroke:v.axis,fontSize:11,tickLine:!1}),(0,D.jsx)(n,{tickFormatter:e=>{let t=h(e);return t===null?``:m(t)},stroke:v.axis,fontSize:11,tickLine:!1,axisLine:!1}),(0,D.jsx)(l,{content:(0,D.jsx)(w,{formatter:e=>m(e)}),cursor:{fill:`hsl(var(--muted))`,opacity:.15}}),(0,D.jsx)(i,{y:k,stroke:v.axis,strokeDasharray:`3 3`,strokeOpacity:.5}),(0,D.jsx)(r,{type:`monotone`,dataKey:`efficiency`,stroke:v.input,fill:`url(#${d}-effGrad)`,strokeWidth:1.5,name:u(`charts.tokenEfficiency.series`),dot:!1,..._(e)}),(0,D.jsx)(s,{type:`monotone`,dataKey:`effMA7`,stroke:v.ma7,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:u(`charts.tokenEfficiency.movingAverage`),...y(e,{role:`secondary`})})]})})})})})}export{O as TokenEfficiency};
@@ -0,0 +1 @@
1
+ import{_ as e,b as t,g as n,i as r,v as i,y as a}from"./charts-vendor-CiBqdKXh.js";import{a as o}from"./motion-vendor-BNVN-Ktr.js";import{t as s}from"./useTranslation-0ThAx3Gl.js";import{d as c}from"./formatters-C7EouP6y.js";import{t as l}from"./help-content-B2N8SHIE.js";import{n as u,s as d}from"./chart-theme-BdE8bEiN.js";import{n as f,r as p,t as m}from"./ChartCard-DxxB4rGm.js";import{t as h}from"./ChartLegend-Vpk95i3r.js";import{t as g}from"./CustomTooltip-CfoUDPbT.js";var _=o(),v={Input:u.input,Output:u.output,"Cache Write":u.cacheWrite,"Cache Read":u.cacheRead,Thinking:u.cost};function y({viewBox:e,total:t}){let{t:n}=s();if(!e)return null;let{cx:r,cy:i}=e;return(0,_.jsxs)(`g`,{children:[(0,_.jsx)(`text`,{x:r,y:i-6,textAnchor:`middle`,className:`fill-muted-foreground`,fontSize:11,children:n(`charts.tokenTypes.total`)}),(0,_.jsx)(`text`,{x:r,y:i+14,textAnchor:`middle`,className:`fill-foreground`,fontSize:16,fontWeight:600,children:t})]})}function b({data:o}){let{t:b}=s(),x=o.reduce((e,t)=>e+t.value,0);return(0,_.jsx)(f,{title:b(`charts.tokenTypes.title`),subtitle:b(`charts.tokenTypes.subtitle`),info:l.tokenTypes,chartData:o,valueKey:`value`,valueFormatter:c,children:s=>{let l=s?560:320,f=s?`66%`:`57%`,b=s?84:58,S=s?134:92;return(0,_.jsx)(m,{children:m=>(0,_.jsx)(p,{variant:`radial`,children:(0,_.jsx)(t,{width:`100%`,height:l,children:(0,_.jsxs)(r,{children:[(0,_.jsxs)(n,{data:o,cx:`50%`,cy:f,innerRadius:b,outerRadius:S,paddingAngle:2,dataKey:`value`,nameKey:`name`,...d(m),children:[o.map(t=>(0,_.jsx)(e,{fill:v[t.name]??u.cost},t.name)),(0,_.jsx)(y,{total:c(x)})]}),(0,_.jsx)(i,{content:(0,_.jsx)(g,{formatter:e=>c(e)})}),(0,_.jsx)(a,{content:(0,_.jsx)(h,{className:s?`pt-[22px]`:`pt-2`,renderLabel:e=>{let t=String(e.value??``),n=o.find(e=>e.name===t);return`${t} (${n?c(n.value):``})`}})})]})})})})}})}export{b as TokenTypes};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{b as t,c as n,f as r,l as i,m as a,p as o,t as s,v as c,w as l}from"./charts-vendor-CiBqdKXh.js";import{o as u}from"./motion-vendor-BNFhNARW.js";import{t as d}from"./useTranslation-JH30oWEP.js";import{a as f,d as p}from"./formatters-BzLLk0br.js";import{t as m}from"./formatted-value-DuGw8WPX.js";import{t as h}from"./help-content-Cuf5l3_6.js";import{i as g,n as _,o as v,r as y}from"./chart-theme-BdE8bEiN.js";import{n as b,r as x,t as S}from"./ChartCard-CS4Kbe6r.js";import{t as C}from"./CustomTooltip-CEd8U-a3.js";var w=e(l()),T=u();function E({data:e,onClickDay:l}){let{t:u}=d(),E=(0,w.useId)(),D=e=>`${E}-${e}`.replace(/:/g,``),O=(0,w.useMemo)(()=>{let t=0,n=0,r=0,i=0,a=0;for(let o of e)t+=o[`Cache Read`],n+=o[`Cache Write`],r+=o.Input,i+=o.Output,a+=o.Thinking;return{cacheRead:t,cacheWrite:n,input:r,output:i,thinking:a,total:t+n+r+i+a}},[e]),k=(0,w.useMemo)(()=>e.map((t,n)=>({date:t.date,total:t.Input+t.Output+t[`Cache Write`]+t[`Cache Read`]+t.Thinking,totalPrev:(()=>{let t=n>0?e[n-1]:void 0;return t?t.Input+t.Output+t[`Cache Write`]+t[`Cache Read`]+t.Thinking:void 0})(),tokenMA7:t.tokenMA7})),[e]),A=e=>{let t=e;t?.activePayload?.[0]?.payload?.date&&l&&l(t.activePayload[0].payload.date)},j=(0,T.jsx)(S,{children:e=>(0,T.jsxs)(`div`,{className:`mt-4`,children:[(0,T.jsx)(`div`,{className:`mb-1 text-[10px] tracking-wider text-muted-foreground uppercase`,children:u(`charts.tokensOverTime.allTypes`)}),(0,T.jsx)(x,{variant:`line`,children:(0,T.jsx)(t,{width:`100%`,height:180,children:(0,T.jsxs)(s,{data:k,margin:y,children:[(0,T.jsx)(`defs`,{children:(0,T.jsxs)(`linearGradient`,{id:D(`total`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.cost,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.cost,stopOpacity:0})]})}),(0,T.jsx)(a,{strokeDasharray:`3 3`,stroke:_.grid,opacity:.3}),(0,T.jsx)(i,{dataKey:`date`,tickFormatter:f,stroke:_.axis,fontSize:10,tickLine:!1}),(0,T.jsx)(n,{tickFormatter:p,stroke:_.axis,fontSize:10,tickLine:!1,axisLine:!1,width:55}),(0,T.jsx)(c,{content:(0,T.jsx)(C,{formatter:p}),cursor:{fill:`hsl(var(--muted))`,opacity:.15}}),(0,T.jsx)(r,{type:`monotone`,dataKey:`total`,stroke:_.cost,fill:`url(#${D(`total`)})`,strokeWidth:1.5,name:u(`charts.tokensOverTime.totalTokens`),...g(e)}),(0,T.jsx)(o,{type:`monotone`,dataKey:`tokenMA7`,stroke:_.ma7,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:u(`charts.tokensOverTime.movingAverage`),...v(e,{role:`secondary`})})]})})})]})});return(0,T.jsxs)(b,{title:u(`charts.tokensOverTime.title`),subtitle:u(`charts.tokensOverTime.subtitle`),info:h.tokensOverTime,summary:(0,T.jsx)(m,{value:O.total,type:`tokens`}),className:`lg:col-span-2`,chartData:e,valueKey:`Cache Read`,valueFormatter:p,expandedExtra:j,children:[(0,T.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-2 text-center md:grid-cols-5`,children:[{label:`Cache Read`,value:O.cacheRead,color:_.cacheRead},{label:`Cache Write`,value:O.cacheWrite,color:_.cacheWrite},{label:`Output`,value:O.output,color:_.output},{label:`Input`,value:O.input,color:_.input},{label:`Thinking`,value:O.thinking,color:_.cost}].map(e=>(0,T.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-1.5`,children:[(0,T.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:e.label}),(0,T.jsx)(`div`,{className:`font-mono text-xs font-semibold`,style:{color:e.color},children:p(e.value)}),(0,T.jsx)(`div`,{className:`font-mono text-[9px] text-muted-foreground/60`,children:O.total>0?`${(e.value/O.total*100).toFixed(1)}%`:`–`})]},e.label))}),(0,T.jsxs)(`div`,{className:`mb-2`,children:[(0,T.jsx)(`div`,{className:`mb-1 text-[10px] tracking-wider text-muted-foreground uppercase`,children:u(`charts.tokensOverTime.cacheTokens`)}),(0,T.jsx)(S,{children:l=>(0,T.jsx)(x,{variant:`line`,children:(0,T.jsx)(t,{width:`100%`,height:150,children:(0,T.jsxs)(s,{data:e,margin:{...y,bottom:0},onClick:A,children:[(0,T.jsxs)(`defs`,{children:[(0,T.jsxs)(`linearGradient`,{id:D(`cacheRead`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.cacheRead,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.cacheRead,stopOpacity:0})]}),(0,T.jsxs)(`linearGradient`,{id:D(`cacheWrite`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.cacheWrite,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.cacheWrite,stopOpacity:0})]})]}),(0,T.jsx)(a,{strokeDasharray:`3 3`,stroke:_.grid,opacity:.3}),(0,T.jsx)(i,{dataKey:`date`,tickFormatter:f,stroke:_.axis,fontSize:10,tickLine:!1,hide:!0}),(0,T.jsx)(n,{tickFormatter:p,stroke:_.axis,fontSize:10,tickLine:!1,axisLine:!1,width:55}),(0,T.jsx)(c,{content:(0,T.jsx)(C,{formatter:p}),cursor:{fill:`hsl(var(--muted))`,opacity:.15}}),(0,T.jsx)(r,{type:`monotone`,dataKey:`Cache Read`,stroke:_.cacheRead,fill:`url(#${D(`cacheRead`)})`,strokeWidth:1.5,name:`Cache Read`,...g(l)}),(0,T.jsx)(r,{type:`monotone`,dataKey:`Cache Write`,stroke:_.cacheWrite,fill:`url(#${D(`cacheWrite`)})`,strokeWidth:1.5,name:`Cache Write`,...g(l,{order:1,role:`stacked`})}),(0,T.jsx)(o,{type:`monotone`,dataKey:`cacheReadMA7`,stroke:_.cacheRead,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:`Cache Read ${u(`charts.tokensOverTime.averageSuffix`)}`,...v(l,{role:`secondary`})}),(0,T.jsx)(o,{type:`monotone`,dataKey:`cacheWriteMA7`,stroke:_.cacheWrite,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:`Cache Write ${u(`charts.tokensOverTime.averageSuffix`)}`,...v(l,{order:1,role:`secondary`})})]})})})})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 text-[10px] tracking-wider text-muted-foreground uppercase`,children:u(`charts.tokensOverTime.inputOutputTokens`)}),(0,T.jsx)(S,{children:l=>(0,T.jsx)(x,{variant:`line`,children:(0,T.jsx)(t,{width:`100%`,height:150,children:(0,T.jsxs)(s,{data:e,margin:y,onClick:A,children:[(0,T.jsxs)(`defs`,{children:[(0,T.jsxs)(`linearGradient`,{id:D(`output`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.output,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.output,stopOpacity:0})]}),(0,T.jsxs)(`linearGradient`,{id:D(`input`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.input,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.input,stopOpacity:0})]})]}),(0,T.jsx)(a,{strokeDasharray:`3 3`,stroke:_.grid,opacity:.3}),(0,T.jsx)(i,{dataKey:`date`,tickFormatter:f,stroke:_.axis,fontSize:10,tickLine:!1}),(0,T.jsx)(n,{tickFormatter:p,stroke:_.axis,fontSize:10,tickLine:!1,axisLine:!1,width:55}),(0,T.jsx)(c,{content:(0,T.jsx)(C,{formatter:p}),cursor:{fill:`hsl(var(--muted))`,opacity:.15}}),(0,T.jsx)(r,{type:`monotone`,dataKey:`Output`,stroke:_.output,fill:`url(#${D(`output`)})`,strokeWidth:1.5,name:`Output`,...g(l)}),(0,T.jsx)(r,{type:`monotone`,dataKey:`Input`,stroke:_.input,fill:`url(#${D(`input`)})`,strokeWidth:1.5,name:`Input`,...g(l,{order:1,role:`stacked`})}),(0,T.jsx)(o,{type:`monotone`,dataKey:`outputMA7`,stroke:_.output,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:`Output ${u(`charts.tokensOverTime.averageSuffix`)}`,...v(l,{role:`secondary`})}),(0,T.jsx)(o,{type:`monotone`,dataKey:`inputMA7`,stroke:_.input,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:`Input ${u(`charts.tokensOverTime.averageSuffix`)}`,...v(l,{order:1,role:`secondary`})})]})})})})]}),(0,T.jsxs)(`div`,{className:`mt-3`,children:[(0,T.jsx)(`div`,{className:`mb-1 text-[10px] tracking-wider text-muted-foreground uppercase`,children:u(`charts.tokensOverTime.thinkingTokens`)}),(0,T.jsx)(S,{children:l=>(0,T.jsx)(x,{variant:`line`,children:(0,T.jsx)(t,{width:`100%`,height:110,children:(0,T.jsxs)(s,{data:e,margin:y,onClick:A,children:[(0,T.jsx)(`defs`,{children:(0,T.jsxs)(`linearGradient`,{id:D(`thinking`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.cost,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.cost,stopOpacity:0})]})}),(0,T.jsx)(a,{strokeDasharray:`3 3`,stroke:_.grid,opacity:.3}),(0,T.jsx)(i,{dataKey:`date`,tickFormatter:f,stroke:_.axis,fontSize:10,tickLine:!1,hide:!0}),(0,T.jsx)(n,{tickFormatter:p,stroke:_.axis,fontSize:10,tickLine:!1,axisLine:!1,width:55}),(0,T.jsx)(c,{content:(0,T.jsx)(C,{formatter:p}),cursor:{fill:`hsl(var(--muted))`,opacity:.15}}),(0,T.jsx)(r,{type:`monotone`,dataKey:`Thinking`,stroke:_.cost,fill:`url(#${D(`thinking`)})`,strokeWidth:1.5,name:`Thinking`,...g(l)}),(0,T.jsx)(o,{type:`monotone`,dataKey:`thinkingMA7`,stroke:_.cost,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:`Thinking ${u(`charts.tokensOverTime.averageSuffix`)}`,...v(l,{role:`secondary`})})]})})})})]})]})}export{E as TokensOverTime};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{b as t,c as n,f as r,l as i,m as a,p as o,t as s,v as c,w as l}from"./charts-vendor-CiBqdKXh.js";import{a as u}from"./motion-vendor-BNVN-Ktr.js";import{t as d}from"./useTranslation-0ThAx3Gl.js";import{a as f,d as p}from"./formatters-C7EouP6y.js";import{t as m}from"./formatted-value-CpLoDrYF.js";import{t as h}from"./help-content-B2N8SHIE.js";import{i as g,n as _,o as v,r as y}from"./chart-theme-BdE8bEiN.js";import{n as b,r as x,t as S}from"./ChartCard-DxxB4rGm.js";import{t as C}from"./CustomTooltip-CfoUDPbT.js";var w=e(l()),T=u();function E({data:e,onClickDay:l}){let{t:u}=d(),E=(0,w.useId)(),D=e=>`${E}-${e}`.replace(/:/g,``),O=(0,w.useMemo)(()=>{let t=0,n=0,r=0,i=0,a=0;for(let o of e)t+=o[`Cache Read`],n+=o[`Cache Write`],r+=o.Input,i+=o.Output,a+=o.Thinking;return{cacheRead:t,cacheWrite:n,input:r,output:i,thinking:a,total:t+n+r+i+a}},[e]),k=(0,w.useMemo)(()=>e.map((t,n)=>({date:t.date,total:t.Input+t.Output+t[`Cache Write`]+t[`Cache Read`]+t.Thinking,totalPrev:(()=>{let t=n>0?e[n-1]:void 0;return t?t.Input+t.Output+t[`Cache Write`]+t[`Cache Read`]+t.Thinking:void 0})(),tokenMA7:t.tokenMA7})),[e]),A=e=>{let t=e;t?.activePayload?.[0]?.payload?.date&&l&&l(t.activePayload[0].payload.date)},j=(0,T.jsx)(S,{children:e=>(0,T.jsxs)(`div`,{className:`mt-4`,children:[(0,T.jsx)(`div`,{className:`mb-1 text-[10px] tracking-wider text-muted-foreground uppercase`,children:u(`charts.tokensOverTime.allTypes`)}),(0,T.jsx)(x,{variant:`line`,children:(0,T.jsx)(t,{width:`100%`,height:180,children:(0,T.jsxs)(s,{data:k,margin:y,children:[(0,T.jsx)(`defs`,{children:(0,T.jsxs)(`linearGradient`,{id:D(`total`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.cost,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.cost,stopOpacity:0})]})}),(0,T.jsx)(a,{strokeDasharray:`3 3`,stroke:_.grid,opacity:.3}),(0,T.jsx)(i,{dataKey:`date`,tickFormatter:f,stroke:_.axis,fontSize:10,tickLine:!1}),(0,T.jsx)(n,{tickFormatter:p,stroke:_.axis,fontSize:10,tickLine:!1,axisLine:!1,width:55}),(0,T.jsx)(c,{content:(0,T.jsx)(C,{formatter:p}),cursor:{fill:`hsl(var(--muted))`,opacity:.15}}),(0,T.jsx)(r,{type:`monotone`,dataKey:`total`,stroke:_.cost,fill:`url(#${D(`total`)})`,strokeWidth:1.5,name:u(`charts.tokensOverTime.totalTokens`),...g(e)}),(0,T.jsx)(o,{type:`monotone`,dataKey:`tokenMA7`,stroke:_.ma7,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:u(`charts.tokensOverTime.movingAverage`),...v(e,{role:`secondary`})})]})})})]})});return(0,T.jsxs)(b,{title:u(`charts.tokensOverTime.title`),subtitle:u(`charts.tokensOverTime.subtitle`),info:h.tokensOverTime,summary:(0,T.jsx)(m,{value:O.total,type:`tokens`}),className:`lg:col-span-2`,chartData:e,valueKey:`Cache Read`,valueFormatter:p,expandedExtra:j,children:[(0,T.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-2 text-center md:grid-cols-5`,children:[{label:`Cache Read`,value:O.cacheRead,color:_.cacheRead},{label:`Cache Write`,value:O.cacheWrite,color:_.cacheWrite},{label:`Output`,value:O.output,color:_.output},{label:`Input`,value:O.input,color:_.input},{label:`Thinking`,value:O.thinking,color:_.cost}].map(e=>(0,T.jsxs)(`div`,{className:`rounded-lg bg-muted/20 p-1.5`,children:[(0,T.jsx)(`div`,{className:`text-[9px] tracking-wider text-muted-foreground uppercase`,children:e.label}),(0,T.jsx)(`div`,{className:`font-mono text-xs font-semibold`,style:{color:e.color},children:p(e.value)}),(0,T.jsx)(`div`,{className:`font-mono text-[9px] text-muted-foreground/60`,children:O.total>0?`${(e.value/O.total*100).toFixed(1)}%`:`–`})]},e.label))}),(0,T.jsxs)(`div`,{className:`mb-2`,children:[(0,T.jsx)(`div`,{className:`mb-1 text-[10px] tracking-wider text-muted-foreground uppercase`,children:u(`charts.tokensOverTime.cacheTokens`)}),(0,T.jsx)(S,{children:l=>(0,T.jsx)(x,{variant:`line`,children:(0,T.jsx)(t,{width:`100%`,height:150,children:(0,T.jsxs)(s,{data:e,margin:{...y,bottom:0},onClick:A,children:[(0,T.jsxs)(`defs`,{children:[(0,T.jsxs)(`linearGradient`,{id:D(`cacheRead`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.cacheRead,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.cacheRead,stopOpacity:0})]}),(0,T.jsxs)(`linearGradient`,{id:D(`cacheWrite`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.cacheWrite,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.cacheWrite,stopOpacity:0})]})]}),(0,T.jsx)(a,{strokeDasharray:`3 3`,stroke:_.grid,opacity:.3}),(0,T.jsx)(i,{dataKey:`date`,tickFormatter:f,stroke:_.axis,fontSize:10,tickLine:!1,hide:!0}),(0,T.jsx)(n,{tickFormatter:p,stroke:_.axis,fontSize:10,tickLine:!1,axisLine:!1,width:55}),(0,T.jsx)(c,{content:(0,T.jsx)(C,{formatter:p}),cursor:{fill:`hsl(var(--muted))`,opacity:.15}}),(0,T.jsx)(r,{type:`monotone`,dataKey:`Cache Read`,stroke:_.cacheRead,fill:`url(#${D(`cacheRead`)})`,strokeWidth:1.5,name:`Cache Read`,...g(l)}),(0,T.jsx)(r,{type:`monotone`,dataKey:`Cache Write`,stroke:_.cacheWrite,fill:`url(#${D(`cacheWrite`)})`,strokeWidth:1.5,name:`Cache Write`,...g(l,{order:1,role:`stacked`})}),(0,T.jsx)(o,{type:`monotone`,dataKey:`cacheReadMA7`,stroke:_.cacheRead,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:`Cache Read ${u(`charts.tokensOverTime.averageSuffix`)}`,...v(l,{role:`secondary`})}),(0,T.jsx)(o,{type:`monotone`,dataKey:`cacheWriteMA7`,stroke:_.cacheWrite,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:`Cache Write ${u(`charts.tokensOverTime.averageSuffix`)}`,...v(l,{order:1,role:`secondary`})})]})})})})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 text-[10px] tracking-wider text-muted-foreground uppercase`,children:u(`charts.tokensOverTime.inputOutputTokens`)}),(0,T.jsx)(S,{children:l=>(0,T.jsx)(x,{variant:`line`,children:(0,T.jsx)(t,{width:`100%`,height:150,children:(0,T.jsxs)(s,{data:e,margin:y,onClick:A,children:[(0,T.jsxs)(`defs`,{children:[(0,T.jsxs)(`linearGradient`,{id:D(`output`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.output,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.output,stopOpacity:0})]}),(0,T.jsxs)(`linearGradient`,{id:D(`input`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.input,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.input,stopOpacity:0})]})]}),(0,T.jsx)(a,{strokeDasharray:`3 3`,stroke:_.grid,opacity:.3}),(0,T.jsx)(i,{dataKey:`date`,tickFormatter:f,stroke:_.axis,fontSize:10,tickLine:!1}),(0,T.jsx)(n,{tickFormatter:p,stroke:_.axis,fontSize:10,tickLine:!1,axisLine:!1,width:55}),(0,T.jsx)(c,{content:(0,T.jsx)(C,{formatter:p}),cursor:{fill:`hsl(var(--muted))`,opacity:.15}}),(0,T.jsx)(r,{type:`monotone`,dataKey:`Output`,stroke:_.output,fill:`url(#${D(`output`)})`,strokeWidth:1.5,name:`Output`,...g(l)}),(0,T.jsx)(r,{type:`monotone`,dataKey:`Input`,stroke:_.input,fill:`url(#${D(`input`)})`,strokeWidth:1.5,name:`Input`,...g(l,{order:1,role:`stacked`})}),(0,T.jsx)(o,{type:`monotone`,dataKey:`outputMA7`,stroke:_.output,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:`Output ${u(`charts.tokensOverTime.averageSuffix`)}`,...v(l,{role:`secondary`})}),(0,T.jsx)(o,{type:`monotone`,dataKey:`inputMA7`,stroke:_.input,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:`Input ${u(`charts.tokensOverTime.averageSuffix`)}`,...v(l,{order:1,role:`secondary`})})]})})})})]}),(0,T.jsxs)(`div`,{className:`mt-3`,children:[(0,T.jsx)(`div`,{className:`mb-1 text-[10px] tracking-wider text-muted-foreground uppercase`,children:u(`charts.tokensOverTime.thinkingTokens`)}),(0,T.jsx)(S,{children:l=>(0,T.jsx)(x,{variant:`line`,children:(0,T.jsx)(t,{width:`100%`,height:110,children:(0,T.jsxs)(s,{data:e,margin:y,onClick:A,children:[(0,T.jsx)(`defs`,{children:(0,T.jsxs)(`linearGradient`,{id:D(`thinking`),x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,T.jsx)(`stop`,{offset:`0%`,stopColor:_.cost,stopOpacity:.25}),(0,T.jsx)(`stop`,{offset:`100%`,stopColor:_.cost,stopOpacity:0})]})}),(0,T.jsx)(a,{strokeDasharray:`3 3`,stroke:_.grid,opacity:.3}),(0,T.jsx)(i,{dataKey:`date`,tickFormatter:f,stroke:_.axis,fontSize:10,tickLine:!1,hide:!0}),(0,T.jsx)(n,{tickFormatter:p,stroke:_.axis,fontSize:10,tickLine:!1,axisLine:!1,width:55}),(0,T.jsx)(c,{content:(0,T.jsx)(C,{formatter:p}),cursor:{fill:`hsl(var(--muted))`,opacity:.15}}),(0,T.jsx)(r,{type:`monotone`,dataKey:`Thinking`,stroke:_.cost,fill:`url(#${D(`thinking`)})`,strokeWidth:1.5,name:`Thinking`,...g(l)}),(0,T.jsx)(o,{type:`monotone`,dataKey:`thinkingMA7`,stroke:_.cost,strokeWidth:2,strokeDasharray:`5 5`,dot:!1,connectNulls:!0,name:`Thinking ${u(`charts.tokensOverTime.averageSuffix`)}`,...v(l,{role:`secondary`})})]})})})})]})]})}export{E as TokensOverTime};
@@ -1 +1 @@
1
- import{i as e}from"./provider-limits-BgKrr7k7.js";var t={datePresets:[`all`,`7d`,`30d`,`month`,`year`],viewModes:[`daily`,`monthly`,`yearly`],sectionDefinitions:[{id:`insights`,domId:`insights`,labelKey:`helpPanel.sectionLabels.insights`},{id:`metrics`,domId:`metrics`,labelKey:`helpPanel.sectionLabels.metrics`},{id:`today`,domId:`today`,labelKey:`helpPanel.sectionLabels.today`},{id:`currentMonth`,domId:`current-month`,labelKey:`helpPanel.sectionLabels.currentMonth`},{id:`activity`,domId:`activity`,labelKey:`helpPanel.sectionLabels.activity`},{id:`forecastCache`,domId:`forecast-cache`,labelKey:`helpPanel.sectionLabels.forecastCache`},{id:`limits`,domId:`limits`,labelKey:`helpPanel.sectionLabels.limits`},{id:`costAnalysis`,domId:`charts`,labelKey:`helpPanel.sectionLabels.costAnalysis`},{id:`tokenAnalysis`,domId:`token-analysis`,labelKey:`helpPanel.sectionLabels.tokenAnalysis`},{id:`requestAnalysis`,domId:`request-analysis`,labelKey:`helpPanel.sectionLabels.requestAnalysis`},{id:`advancedAnalysis`,domId:`advanced-analysis`,labelKey:`helpPanel.sectionLabels.advancedAnalysis`},{id:`comparisons`,domId:`comparisons`,labelKey:`helpPanel.sectionLabels.comparisons`},{id:`tables`,domId:`tables`,labelKey:`helpPanel.sectionLabels.tables`}]},n=[`all`,`7d`,`30d`,`month`,`year`],r=[`daily`,`monthly`,`yearly`],i=[`insights`,`metrics`,`today`,`currentMonth`,`activity`,`forecastCache`,`limits`,`costAnalysis`,`tokenAnalysis`,`requestAnalysis`,`advancedAnalysis`,`comparisons`,`tables`];function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function o(e,t,n){if(!Array.isArray(e))throw Error(`Invalid dashboard preferences: "${n}" must be an array.`);let r=e;if(r.find(e=>typeof e!=`string`||!t.includes(e))!==void 0)throw Error(`Invalid dashboard preferences: "${n}" contains unsupported values.`);return r.map(e=>e)}function s(e){if(!Array.isArray(e))throw Error(`Invalid dashboard preferences: "sectionDefinitions" must be an array.`);return e.map(e=>{if(!a(e))throw Error(`Invalid dashboard preferences: each "sectionDefinitions" entry must be an object.`);let{id:t,domId:n,labelKey:r}=e;if(typeof t!=`string`||!i.includes(t))throw Error(`Invalid dashboard preferences: sectionDefinitions contain an unknown id.`);if(typeof n!=`string`||!n.trim())throw Error(`Invalid dashboard preferences: sectionDefinitions require a domId.`);if(typeof r!=`string`||!r.trim())throw Error(`Invalid dashboard preferences: sectionDefinitions require a labelKey.`);return{id:t,domId:n,labelKey:r}})}function c(e){if(!a(e))throw Error(`Invalid dashboard preferences: expected an object.`);return{datePresets:o(e.datePresets,n,`datePresets`),viewModes:o(e.viewModes,r,`viewModes`),sectionDefinitions:s(e.sectionDefinitions)}}var l=c(t),u=l.datePresets,d=l.viewModes,f=l.sectionDefinitions,p=Object.fromEntries(f.map(e=>[e.id,e])),m={viewMode:`daily`,datePreset:`all`,providers:[],models:[]};function h(){return f.reduce((e,t)=>({...e,[t.id]:!0}),{})}function g(){return f.map(e=>e.id)}function _(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean))]:[]}function v(e){return u.includes(e)?e:`all`}function y(e){return d.includes(e)?e:`daily`}function b(e){let t=e&&typeof e==`object`?e:{};return{viewMode:y(t.viewMode),datePreset:v(t.datePreset),providers:_(t.providers),models:_(t.models)}}function x(e){let t=e&&typeof e==`object`?e:{},n=h();return f.reduce((e,r)=>({...e,[r.id]:typeof t[r.id]==`boolean`?!!t[r.id]:n[r.id]}),{})}function S(e){let t=g();if(!Array.isArray(e))return t;let n=e.filter(e=>typeof e==`string`&&t.includes(e)),r=[...new Set(n)],i=t.filter(e=>!r.includes(e));return[...r,...i]}var C={language:`de`,theme:`dark`,providerLimits:{},defaultFilters:m,sectionVisibility:h(),sectionOrder:g(),lastLoadedAt:null,lastLoadSource:null,cliAutoLoadActive:!1};function w(e){return e===`en`?`en`:`de`}function T(e){return e===`light`?`light`:`dark`}function E(t){if(!t||typeof t!=`object`)return{};let n={};for(let[r,i]of Object.entries(t))n[r]=e(i);return n}function D(e){return e===`file`||e===`auto-import`||e===`cli-auto-load`?e:null}function O(e){if(typeof e!=`string`)return null;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():null}function k(e){let t=e&&typeof e==`object`?e:{};return{language:w(t.language),theme:T(t.theme),providerLimits:E(t.providerLimits),defaultFilters:b(t.defaultFilters),sectionVisibility:x(t.sectionVisibility),sectionOrder:S(t.sectionOrder),lastLoadedAt:O(t.lastLoadedAt),lastLoadSource:D(t.lastLoadSource),cliAutoLoadActive:!!t.cliAutoLoadActive}}function A(e){typeof document>`u`||document.documentElement.classList.toggle(`dark`,e===`dark`)}export{p as a,g as c,u as i,h as l,A as n,d as o,k as r,m as s,C as t};
1
+ import{i as e}from"./provider-limits-BgKrr7k7.js";var t={datePresets:[`all`,`7d`,`30d`,`month`,`year`],viewModes:[`daily`,`monthly`,`yearly`],sectionDefinitions:[{id:`insights`,domId:`insights`,labelKey:`helpPanel.sectionLabels.insights`},{id:`metrics`,domId:`metrics`,labelKey:`helpPanel.sectionLabels.metrics`},{id:`today`,domId:`today`,labelKey:`helpPanel.sectionLabels.today`},{id:`currentMonth`,domId:`current-month`,labelKey:`helpPanel.sectionLabels.currentMonth`},{id:`activity`,domId:`activity`,labelKey:`helpPanel.sectionLabels.activity`},{id:`forecastCache`,domId:`forecast-cache`,labelKey:`helpPanel.sectionLabels.forecastCache`},{id:`limits`,domId:`limits`,labelKey:`helpPanel.sectionLabels.limits`},{id:`costAnalysis`,domId:`charts`,labelKey:`helpPanel.sectionLabels.costAnalysis`},{id:`tokenAnalysis`,domId:`token-analysis`,labelKey:`helpPanel.sectionLabels.tokenAnalysis`},{id:`requestAnalysis`,domId:`request-analysis`,labelKey:`helpPanel.sectionLabels.requestAnalysis`},{id:`advancedAnalysis`,domId:`advanced-analysis`,labelKey:`helpPanel.sectionLabels.advancedAnalysis`},{id:`comparisons`,domId:`comparisons`,labelKey:`helpPanel.sectionLabels.comparisons`},{id:`tables`,domId:`tables`,labelKey:`helpPanel.sectionLabels.tables`}]},n=[`all`,`7d`,`30d`,`month`,`year`],r=[`daily`,`monthly`,`yearly`],i=[`insights`,`metrics`,`today`,`currentMonth`,`activity`,`forecastCache`,`limits`,`costAnalysis`,`tokenAnalysis`,`requestAnalysis`,`advancedAnalysis`,`comparisons`,`tables`];function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function o(e,t,n){if(!Array.isArray(e))throw Error(`Invalid dashboard preferences: "${n}" must be an array.`);let r=e;if(r.find(e=>typeof e!=`string`||!t.includes(e))!==void 0)throw Error(`Invalid dashboard preferences: "${n}" contains unsupported values.`);return r.map(e=>e)}function s(e){if(!Array.isArray(e))throw Error(`Invalid dashboard preferences: "sectionDefinitions" must be an array.`);return e.map(e=>{if(!a(e))throw Error(`Invalid dashboard preferences: each "sectionDefinitions" entry must be an object.`);let{id:t,domId:n,labelKey:r}=e;if(typeof t!=`string`||!i.includes(t))throw Error(`Invalid dashboard preferences: sectionDefinitions contain an unknown id.`);if(typeof n!=`string`||!n.trim())throw Error(`Invalid dashboard preferences: sectionDefinitions require a domId.`);if(typeof r!=`string`||!r.trim())throw Error(`Invalid dashboard preferences: sectionDefinitions require a labelKey.`);return{id:t,domId:n,labelKey:r}})}function c(e){if(!a(e))throw Error(`Invalid dashboard preferences: expected an object.`);return{datePresets:o(e.datePresets,n,`datePresets`),viewModes:o(e.viewModes,r,`viewModes`),sectionDefinitions:s(e.sectionDefinitions)}}var l=c(t),u=l.datePresets,d=l.viewModes,f=l.sectionDefinitions,p=Object.fromEntries(f.map(e=>[e.id,e])),m={viewMode:`daily`,datePreset:`all`,providers:[],models:[]};function h(){return f.reduce((e,t)=>({...e,[t.id]:!0}),{})}function g(){return f.map(e=>e.id)}function _(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean))]:[]}function v(e){return u.includes(e)?e:`all`}function y(e){return d.includes(e)?e:`daily`}function b(e){let t=e&&typeof e==`object`?e:{};return{viewMode:y(t.viewMode),datePreset:v(t.datePreset),providers:_(t.providers),models:_(t.models)}}function x(e){let t=e&&typeof e==`object`?e:{},n=h();return f.reduce((e,r)=>({...e,[r.id]:typeof t[r.id]==`boolean`?!!t[r.id]:n[r.id]}),{})}function S(e){let t=g();if(!Array.isArray(e))return t;let n=e.filter(e=>typeof e==`string`&&t.includes(e)),r=[...new Set(n)],i=t.filter(e=>!r.includes(e));return[...r,...i]}var C={language:`de`,theme:`dark`,reducedMotionPreference:`system`,providerLimits:{},defaultFilters:m,sectionVisibility:h(),sectionOrder:g(),lastLoadedAt:null,lastLoadSource:null,cliAutoLoadActive:!1};function w(e){return e===`en`?`en`:`de`}function T(e){return e===`light`?`light`:`dark`}function E(e){return e===`always`||e===`never`?e:`system`}function D(t){if(!t||typeof t!=`object`)return{};let n={};for(let[r,i]of Object.entries(t))n[r]=e(i);return n}function O(e){return e===`file`||e===`auto-import`||e===`cli-auto-load`?e:null}function k(e){if(typeof e!=`string`)return null;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():null}function A(e){let t=e&&typeof e==`object`?e:{};return{language:w(t.language),theme:T(t.theme),reducedMotionPreference:E(t.reducedMotionPreference),providerLimits:D(t.providerLimits),defaultFilters:b(t.defaultFilters),sectionVisibility:x(t.sectionVisibility),sectionOrder:S(t.sectionOrder),lastLoadedAt:k(t.lastLoadedAt),lastLoadSource:O(t.lastLoadSource),cliAutoLoadActive:!!t.cliAutoLoadActive}}function j(e){typeof document>`u`||document.documentElement.classList.toggle(`dark`,e===`dark`)}export{p as a,g as c,u as i,h as l,j as n,d as o,A as r,m as s,C as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{S as t,w as n}from"./charts-vendor-CiBqdKXh.js";import{a as r}from"./motion-vendor-BNVN-Ktr.js";import{y as i}from"./ui-vendor-C_SJC6eX.js";import{o as a}from"./useTranslation-0ThAx3Gl.js";var o=e(n()),s=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,c=t,l=(e,t)=>n=>{if(t?.variants==null)return c(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=s(t)||s(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return c(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},u=r(),d=l(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 cursor-pointer`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-border bg-transparent hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),f=o.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>(0,u.jsx)(r?i:`button`,{className:a(d({variant:t,size:n,className:e})),ref:s,...o}));f.displayName=`Button`;export{f as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{w as t}from"./charts-vendor-CiBqdKXh.js";import{a as n,i as r,n as i}from"./motion-vendor-BNVN-Ktr.js";import{a,o}from"./useTranslation-0ThAx3Gl.js";var s=e(t()),c=n(),l={sectionPreloadMargin:`0px 0px 45% 0px`,sectionRevealAmount:.14,sectionRevealOffset:12,sectionRevealDuration:.6,sectionRevealEase:[.22,1,.36,1],placeholderFadeDuration:.34,itemRevealAmount:.24,itemRevealOffset:8,itemRevealDuration:.42,itemStaggerMs:105,chartStartDelayMs:285,meterStartDelayMs:375,meterDurationMs:960},u=(0,s.createContext)(null);function d(){return(0,s.useContext)(u)}function f(e,t){let[n,r]=(0,s.useState)(typeof IntersectionObserver>`u`);return(0,s.useEffect)(()=>{if(typeof IntersectionObserver>`u`){r(!0);return}if(n)return;let i=e.current;if(!i)return;let a=new IntersectionObserver(e=>{e[0]?.isIntersecting&&(r(!0),a.disconnect())},{threshold:t});return a.observe(i),()=>{a.disconnect()}},[t,n,e]),n}function p(e,{amount:t=l.itemRevealAmount,kind:n=`item`,order:r=0,delayMs:i}={}){let o=d(),c=a(),u=typeof IntersectionObserver>`u`,p=f(e,t),m=(o?.sectionVisible??!0)&&(u?!0:p),[h,g]=(0,s.useState)(0),_=(0,s.useRef)(!1);(0,s.useEffect)(()=>{m&&!_.current&&g(e=>e+1),_.current=m},[m]);let v=i??(n===`meter`?o?.meterStartDelayMs??l.meterStartDelayMs:o?.chartStartDelayMs??l.chartStartDelayMs);return{active:c?!0:m,runKey:h,delayMs:v+r*l.itemStaggerMs,shouldReduceMotion:c}}function m({children:e,className:t,order:n=0,delayMs:r,amount:a,"data-testid":o}){let u=(0,s.useRef)(null),d=p(u,{kind:`item`,order:n,...r===void 0?{}:{delayMs:r},...a===void 0?{}:{amount:a}});return(0,s.useEffect)(()=>{let e=u.current;e&&e.querySelectorAll(`a[href], button, input, select, textarea, [tabindex]`).forEach(e=>{if(!d.active){e.hasAttribute(`data-dashboard-motion-tabindex`)||e.setAttribute(`data-dashboard-motion-tabindex`,e.getAttribute(`tabindex`)??``),e.tabIndex=-1;return}if(!e.hasAttribute(`data-dashboard-motion-tabindex`))return;let t=e.getAttribute(`data-dashboard-motion-tabindex`);t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`),e.removeAttribute(`data-dashboard-motion-tabindex`)})},[d.active]),d.shouldReduceMotion?(0,c.jsx)(`div`,{ref:u,className:t,"data-testid":o,children:e}):(0,c.jsx)(i.div,{ref:u,className:t,"data-testid":o,"aria-hidden":!d.active,...d.active?{}:{style:{pointerEvents:`none`}},initial:!1,animate:d.active?{opacity:1,y:0}:{opacity:0,y:l.itemRevealOffset},transition:{duration:l.itemRevealDuration,delay:d.active?d.delayMs/1e3:0,ease:l.sectionRevealEase},children:e})}function h({id:e,children:t,className:n,contentClassName:d,placeholderClassName:f,eager:p=!1,onPreload:m}){let h=(0,s.useRef)(null),g=(0,s.useRef)(!1),_=(0,s.useRef)(null),v=(0,s.useRef)(!0),y=a(),[b,x]=(0,s.useState)(p),[S,C]=(0,s.useState)(p);(0,s.useEffect)(()=>()=>{v.current=!1},[]);let w=(0,s.useCallback)(()=>{if(g.current)return _.current;if(g.current=!0,!m){x(!0);let e=Promise.resolve();return _.current=e,e}let e=Promise.resolve().then(()=>m()).catch(()=>void 0).finally(()=>{v.current&&x(!0)});return _.current=e,e},[m]);(0,s.useEffect)(()=>{if(p){w(),C(!0);return}let e=h.current;if(!e||typeof IntersectionObserver>`u`){w(),C(!0);return}let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&(w(),t.disconnect())},{rootMargin:l.sectionPreloadMargin,threshold:0}),n=new IntersectionObserver(e=>{e[0]?.isIntersecting&&(w(),C(!0),n.disconnect())},{threshold:l.sectionRevealAmount});return t.observe(e),n.observe(e),()=>{t.disconnect(),n.disconnect()}},[p,w]);let T=p||b,E=!S,D={opacity:0,pointerEvents:`none`},O={pointerEvents:`none`},k=(0,s.useMemo)(()=>({sectionVisible:S,chartStartDelayMs:l.chartStartDelayMs,meterStartDelayMs:l.meterStartDelayMs,shouldReduceMotion:y}),[S,y]);return(0,c.jsx)(`section`,{id:e,ref:h,className:o(`relative`,n),"data-section-mounted":T?`true`:`false`,"data-section-visible":S?`true`:`false`,children:T?(0,c.jsx)(u.Provider,{value:k,children:(0,c.jsxs)(`div`,{className:`relative`,children:[y?(0,c.jsx)(`div`,{...S?{}:{inert:!0},className:d,style:S?void 0:D,children:t}):(0,c.jsx)(i.div,{...S?{}:{inert:!0},...S?{}:{style:O},initial:{opacity:0,y:l.sectionRevealOffset},animate:S?{opacity:1,y:0}:{opacity:0,y:l.sectionRevealOffset},transition:{duration:l.sectionRevealDuration,ease:l.sectionRevealEase},className:d,children:t}),(0,c.jsx)(r,{initial:!1,children:E&&(y?(0,c.jsx)(`div`,{"aria-hidden":`true`,className:o(`pointer-events-none absolute inset-0 rounded-2xl border border-border/40 bg-card/50 backdrop-blur-xl`,f??`min-h-[320px]`)}):(0,c.jsx)(i.div,{"aria-hidden":`true`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:{duration:l.placeholderFadeDuration},className:o(`pointer-events-none absolute inset-0 rounded-2xl border border-border/40 bg-card/50 backdrop-blur-xl`,f??`min-h-[320px]`)},`section-placeholder`))})]})}):(0,c.jsx)(`div`,{"aria-hidden":`true`,className:o(`rounded-2xl border border-border/40 bg-card/50 backdrop-blur-xl`,f??`min-h-[320px]`)})})}var g=s.forwardRef(({className:e,...t},n)=>{let r=a(),s=d(),l=r||s?{initial:!1,animate:{opacity:1,y:0},transition:{duration:0}}:{initial:{opacity:0,y:14},whileInView:{opacity:1,y:0},viewport:{once:!0,amount:.15},transition:{duration:.35,ease:`easeOut`}};return(0,c.jsx)(i.div,{ref:n,...t,...l,className:o(`relative rounded-xl border border-border/50 bg-card/80 text-card-foreground shadow-[var(--shadow-card)] backdrop-blur-xl transition-all duration-300 hover:border-border/80 hover:shadow-[var(--shadow-card-hover)] motion-reduce:transition-none`,e)})});g.displayName=`Card`;var _=s.forwardRef(({className:e,...t},n)=>(0,c.jsx)(`div`,{ref:n,className:o(`flex flex-col space-y-1.5 p-4`,e),...t}));_.displayName=`CardHeader`;var v=s.forwardRef(({children:e,className:t,...n},r)=>(0,c.jsx)(`h3`,{ref:r,className:o(`leading-none font-semibold tracking-tight`,t),...n,children:e}));v.displayName=`CardTitle`;var y=s.forwardRef(({className:e,...t},n)=>(0,c.jsx)(`div`,{ref:n,className:o(`p-4 pt-0`,e),...t}));y.displayName=`CardContent`;var b=s.forwardRef(({className:e,...t},n)=>(0,c.jsx)(`p`,{ref:n,className:o(`text-xs text-muted-foreground`,e),...t}));b.displayName=`CardDescription`;export{v as a,m as c,_ as i,p as l,y as n,h as o,b as r,l as s,g as t,d as u};
@@ -1 +1 @@
1
- var e=`6.2.2`,t=`https://github.com/roastcodes/ttdash`,n=`https://github.com/roastcodes/ttdash/issues`,r=`https://www.npmjs.com/package/@roastcodes/ttdash/v/${e}`,i={"Opus 4.6":{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},"Opus 4.5":{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},"Sonnet 4.6":{input:3,output:15,cacheRead:.3,cacheWrite:3.75},"Sonnet 4.5":{input:3,output:15,cacheRead:.3,cacheWrite:3.75},"Haiku 4.5":{input:.8,output:4,cacheRead:.08,cacheWrite:1},"GPT-5.4":{input:0,output:0,cacheRead:0,cacheWrite:0},"GPT-5":{input:0,output:0,cacheRead:0,cacheWrite:0},"Gemini 3 Flash Preview":{input:0,output:0,cacheRead:0,cacheWrite:0},Gemini:{input:0,output:0,cacheRead:0,cacheWrite:0},OpenCode:{input:0,output:0,cacheRead:0,cacheWrite:0}};export{e as a,r as i,t as n,i as r,n as t};
1
+ var e=`6.2.3`,t=`https://github.com/roastcodes/ttdash`,n=`https://github.com/roastcodes/ttdash/issues`,r=`https://www.npmjs.com/package/@roastcodes/ttdash/v/${e}`,i={"Opus 4.6":{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},"Opus 4.5":{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},"Sonnet 4.6":{input:3,output:15,cacheRead:.3,cacheWrite:3.75},"Sonnet 4.5":{input:3,output:15,cacheRead:.3,cacheWrite:3.75},"Haiku 4.5":{input:.8,output:4,cacheRead:.08,cacheWrite:1},"GPT-5.4":{input:0,output:0,cacheRead:0,cacheWrite:0},"GPT-5":{input:0,output:0,cacheRead:0,cacheWrite:0},"Gemini 3 Flash Preview":{input:0,output:0,cacheRead:0,cacheWrite:0},Gemini:{input:0,output:0,cacheRead:0,cacheWrite:0},OpenCode:{input:0,output:0,cacheRead:0,cacheWrite:0}};export{e as a,r as i,t as n,i as r,n as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{w as t}from"./charts-vendor-CiBqdKXh.js";import{o as n}from"./motion-vendor-BNFhNARW.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l}from"./ui-vendor-DOI7LsxH.js";import{a as u,i as d,r as f,t as p}from"./useTranslation-JH30oWEP.js";import{n as m}from"./icons-vendor-CIvT_-Pb.js";var h=e(t()),g=n(),_=l,v=h.forwardRef(({className:e,...t},n)=>{let i=d();return(0,g.jsx)(r,{ref:n,className:u(`fixed inset-0 z-50 bg-black/60 backdrop-blur-sm`,f(i,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`),e),...t})});v.displayName=`DialogOverlay`;var y=h.forwardRef(({className:e,children:t,...n},r)=>{let{t:i}=p(),a=d();return(0,g.jsxs)(s,{children:[(0,g.jsx)(v,{}),(0,g.jsxs)(c,{ref:r,className:u(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border border-border bg-card p-6 shadow-lg duration-200`,f(a,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`),e),...n,children:[t,(0,g.jsx)(o,{"aria-label":i(`common.close`),title:i(`common.close`),className:`absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:outline-none`,children:(0,g.jsx)(m,{className:`h-4 w-4`})})]})]})});y.displayName=`DialogContent`;var b=({className:e,...t})=>(0,g.jsx)(`div`,{className:u(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t}),x=h.forwardRef(({className:e,...t},n)=>(0,g.jsx)(i,{ref:n,className:u(`text-lg leading-none font-semibold tracking-tight`,e),...t}));x.displayName=`DialogTitle`;var S=h.forwardRef(({className:e,...t},n)=>(0,g.jsx)(a,{ref:n,className:u(`text-sm text-muted-foreground`,e),...t}));S.displayName=`DialogDescription`;export{x as a,b as i,y as n,S as r,_ as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{w as t}from"./charts-vendor-CiBqdKXh.js";import{a as n}from"./motion-vendor-BNVN-Ktr.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l}from"./ui-vendor-C_SJC6eX.js";import{a as u,i as d,o as f,t as p}from"./useTranslation-0ThAx3Gl.js";import{n as m}from"./icons-vendor-CIvT_-Pb.js";var h=e(t()),g=n(),_=l,v=h.forwardRef(({className:e,...t},n)=>{let i=u();return(0,g.jsx)(r,{ref:n,className:f(`fixed inset-0 z-50 bg-black/60 backdrop-blur-sm`,d(i,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`),e),...t})});v.displayName=`DialogOverlay`;var y=h.forwardRef(({className:e,children:t,...n},r)=>{let{t:i}=p(),a=u();return(0,g.jsxs)(s,{children:[(0,g.jsx)(v,{}),(0,g.jsxs)(c,{ref:r,className:f(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border border-border bg-card p-6 shadow-lg duration-200`,d(a,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`),e),...n,children:[t,(0,g.jsx)(o,{"aria-label":i(`common.close`),title:i(`common.close`),className:`absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:outline-none`,children:(0,g.jsx)(m,{className:`h-4 w-4`})})]})]})});y.displayName=`DialogContent`;var b=({className:e,...t})=>(0,g.jsx)(`div`,{className:f(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t}),x=h.forwardRef(({className:e,...t},n)=>(0,g.jsx)(i,{ref:n,className:f(`text-lg leading-none font-semibold tracking-tight`,e),...t}));x.displayName=`DialogTitle`;var S=h.forwardRef(({className:e,...t},n)=>(0,g.jsx)(a,{ref:n,className:f(`text-sm text-muted-foreground`,e),...t}));S.displayName=`DialogDescription`;export{x as a,b as i,y as n,S as r,_ as t};
@@ -1 +1 @@
1
- import{o as e}from"./motion-vendor-BNFhNARW.js";import{a as t}from"./useTranslation-JH30oWEP.js";import{d as n,f as r,l as i,n as a,r as o,u as s,v as c,x as l,y as u}from"./formatters-BzLLk0br.js";var d=e(),f={currency:e=>a(e),tokens:e=>n(e),number:e=>i(e),percent:(e,t)=>s(e,t)},p={currency:e=>o(e),tokens:e=>r(e),number:e=>i(e),percent:e=>s(e,4)};function m({value:e,type:n,className:r,decimals:i,label:a,insight:o,interactive:s=!0}){let m=f[n](e,i),h=p[n](e);if(m===h)return(0,d.jsx)(`span`,{className:r,children:m});let g=a?`${a}: ${h}`:h;return s?(0,d.jsxs)(c,{children:[(0,d.jsx)(l,{asChild:!0,children:(0,d.jsx)(`button`,{type:`button`,"aria-label":g,className:t(`inline cursor-help rounded-sm border-0 bg-transparent p-0 text-inherit underline decoration-muted-foreground/40 decoration-dotted underline-offset-4 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none`,r),children:m})}),(0,d.jsx)(u,{className:`max-w-[260px]`,children:(0,d.jsxs)(`div`,{className:`space-y-1`,children:[a&&(0,d.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:a}),(0,d.jsx)(`div`,{className:`font-mono text-xs`,children:h}),o&&(0,d.jsx)(`div`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:o})]})})]}):(0,d.jsxs)(`span`,{className:t(`cursor-help underline decoration-muted-foreground/40 decoration-dotted underline-offset-4`,r),title:o?`${h} — ${o}`:h,children:[(0,d.jsx)(`span`,{"aria-hidden":`true`,children:m}),(0,d.jsxs)(`span`,{className:`sr-only`,children:[g,o?`. ${o}`:``]})]})}export{m as t};
1
+ import{a as e}from"./motion-vendor-BNVN-Ktr.js";import{o as t}from"./useTranslation-0ThAx3Gl.js";import{d as n,f as r,l as i,n as a,r as o,u as s,v as c,x as l,y as u}from"./formatters-C7EouP6y.js";var d=e(),f={currency:e=>a(e),tokens:e=>n(e),number:e=>i(e),percent:(e,t)=>s(e,t)},p={currency:e=>o(e),tokens:e=>r(e),number:e=>i(e),percent:e=>s(e,4)};function m({value:e,type:n,className:r,decimals:i,label:a,insight:o,interactive:s=!0}){let m=f[n](e,i),h=p[n](e);if(m===h)return(0,d.jsx)(`span`,{className:r,children:m});let g=a?`${a}: ${h}`:h;return s?(0,d.jsxs)(c,{children:[(0,d.jsx)(l,{asChild:!0,children:(0,d.jsx)(`button`,{type:`button`,"aria-label":g,className:t(`inline cursor-help rounded-sm border-0 bg-transparent p-0 text-inherit underline decoration-muted-foreground/40 decoration-dotted underline-offset-4 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none`,r),children:m})}),(0,d.jsx)(u,{className:`max-w-[260px]`,children:(0,d.jsxs)(`div`,{className:`space-y-1`,children:[a&&(0,d.jsx)(`div`,{className:`text-[10px] tracking-[0.14em] text-muted-foreground uppercase`,children:a}),(0,d.jsx)(`div`,{className:`font-mono text-xs`,children:h}),o&&(0,d.jsx)(`div`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:o})]})})]}):(0,d.jsxs)(`span`,{className:t(`cursor-help underline decoration-muted-foreground/40 decoration-dotted underline-offset-4`,r),title:o?`${h} — ${o}`:h,children:[(0,d.jsx)(`span`,{"aria-hidden":`true`,children:m}),(0,d.jsxs)(`span`,{className:`sr-only`,children:[g,o?`. ${o}`:``]})]})}export{m as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{w as t}from"./charts-vendor-CiBqdKXh.js";import{o as n}from"./motion-vendor-BNFhNARW.js";import{C as r,S as i,b as a,x as o}from"./ui-vendor-DOI7LsxH.js";import{a as s,i as c,r as l}from"./useTranslation-JH30oWEP.js";import{i as u,r as d}from"./i18n-D1WJ4-W9.js";var f=e(t()),p=n(),m=o,h=i,g=r,_=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>{let i=c();return(0,p.jsx)(a,{ref:r,sideOffset:t,className:s(`z-50 overflow-hidden rounded-lg border border-border/50 bg-popover/90 px-3 py-1.5 text-xs text-popover-foreground shadow-lg shadow-black/10 backdrop-blur-xl duration-200`,l(i,`animate-in fade-in-0 zoom-in-95`),e),...n})});_.displayName=`TooltipContent`;function v(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function y(){return v(new Date)}function b(){return y().slice(0,7)}function x(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`){let t=Number(e);return Number.isFinite(t)?t:null}return null}function S(e){return e>=1e3?`$${(e/1e3).toFixed(1)}k`:e>=100?`$${Math.round(e)}`:e>=10?`$${e.toFixed(1)}`:`$${e.toFixed(2)}`}function C(e){return`$${e.toLocaleString(d(),{minimumFractionDigits:2,maximumFractionDigits:2})}`}function w(e){return Number.isFinite(e)?e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e>=100?e.toFixed(0):e>=10?e.toFixed(1):e>=1?e.toFixed(2):e===0?`0`:e.toFixed(3):`0`}function T(e){return e.toLocaleString(d())}function E(e){return`${e.toLocaleString(d())} ${u.t(`common.tokens`)}`}function D(e,t=1){return`${e.toFixed(t)}%`}function O(e,t=`short`){if(/^\d{4}$/.test(e))return e;if(/^\d{4}-\d{2}$/.test(e)){let[n=`0`,r=`1`]=e.split(`-`),i=new Date(parseInt(n,10),parseInt(r,10)-1);return t===`short`?i.toLocaleDateString(d(),{month:`short`,year:`2-digit`}):i.toLocaleDateString(d(),{month:`long`,year:`numeric`})}let n=new Date(e+`T00:00:00`);return t===`long`?n.toLocaleDateString(d(),{weekday:`short`,day:`2-digit`,month:`2-digit`,year:`numeric`}):t===`weekday`?n.toLocaleDateString(d(),{weekday:`short`}):n.toLocaleDateString(d(),{day:`2-digit`,month:`2-digit`})}function k(e){if(/^\d{4}$/.test(e))return e;if(/^\d{4}-\d{2}$/.test(e)){let[t=`0`,n=`1`]=e.split(`-`);return new Date(parseInt(t,10),parseInt(n,10)-1).toLocaleDateString(d(),{month:`short`,year:`2-digit`})}return new Date(e+`T00:00:00`).toLocaleDateString(d(),{day:`2-digit`,month:`2-digit`})}function A(e,t=!1){return e===`monthly`?u.t(t?`periods.months`:`periods.month`):e===`yearly`?u.t(t?`periods.years`:`periods.year`):u.t(t?`periods.days`:`periods.day`)}function j(e){return e===`monthly`?u.t(`periods.unitMonth`):e===`yearly`?u.t(`periods.unitYear`):u.t(`periods.unitDay`)}function M(e){if(!/^\d{4}-\d{2}$/.test(e))return``;let[t=``,n=``]=e.split(`-`),r=Number.parseInt(t,10),i=Number.parseInt(n,10);return!Number.isInteger(r)||!Number.isInteger(i)||i<1||i>12?``:new Date(r,i-1).toLocaleDateString(d(),{month:`long`,year:`numeric`})}function N(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString(d(),{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function P(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString(d(),{day:`2-digit`,month:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})}export{v as _,k as a,m as b,M as c,w as d,E as f,j as g,A as h,O as i,T as l,y as m,S as n,N as o,b as p,C as r,P as s,x as t,D as u,h as v,g as x,_ as y};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{w as t}from"./charts-vendor-CiBqdKXh.js";import{a as n}from"./motion-vendor-BNVN-Ktr.js";import{C as r,S as i,b as a,x as o}from"./ui-vendor-C_SJC6eX.js";import{a as s,i as c,o as l}from"./useTranslation-0ThAx3Gl.js";import{i as u,r as d}from"./i18n-BS3-GJaA.js";var f=e(t()),p=n(),m=o,h=i,g=r,_=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>{let i=s();return(0,p.jsx)(a,{ref:r,sideOffset:t,className:l(`z-50 overflow-hidden rounded-lg border border-border/50 bg-popover/90 px-3 py-1.5 text-xs text-popover-foreground shadow-lg shadow-black/10 backdrop-blur-xl duration-200`,c(i,`animate-in fade-in-0 zoom-in-95`),e),...n})});_.displayName=`TooltipContent`;function v(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function y(){return v(new Date)}function b(){return y().slice(0,7)}function x(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`){let t=Number(e);return Number.isFinite(t)?t:null}return null}function S(e){return e>=1e3?`$${(e/1e3).toFixed(1)}k`:e>=100?`$${Math.round(e)}`:e>=10?`$${e.toFixed(1)}`:`$${e.toFixed(2)}`}function C(e){return`$${e.toLocaleString(d(),{minimumFractionDigits:2,maximumFractionDigits:2})}`}function w(e){return Number.isFinite(e)?e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e>=100?e.toFixed(0):e>=10?e.toFixed(1):e>=1?e.toFixed(2):e===0?`0`:e.toFixed(3):`0`}function T(e){return e.toLocaleString(d())}function E(e){return`${e.toLocaleString(d())} ${u.t(`common.tokens`)}`}function D(e,t=1){return`${e.toFixed(t)}%`}function O(e,t=`short`){if(/^\d{4}$/.test(e))return e;if(/^\d{4}-\d{2}$/.test(e)){let[n=`0`,r=`1`]=e.split(`-`),i=new Date(parseInt(n,10),parseInt(r,10)-1);return t===`short`?i.toLocaleDateString(d(),{month:`short`,year:`2-digit`}):i.toLocaleDateString(d(),{month:`long`,year:`numeric`})}let n=new Date(e+`T00:00:00`);return t===`long`?n.toLocaleDateString(d(),{weekday:`short`,day:`2-digit`,month:`2-digit`,year:`numeric`}):t===`weekday`?n.toLocaleDateString(d(),{weekday:`short`}):n.toLocaleDateString(d(),{day:`2-digit`,month:`2-digit`})}function k(e){if(/^\d{4}$/.test(e))return e;if(/^\d{4}-\d{2}$/.test(e)){let[t=`0`,n=`1`]=e.split(`-`);return new Date(parseInt(t,10),parseInt(n,10)-1).toLocaleDateString(d(),{month:`short`,year:`2-digit`})}return new Date(e+`T00:00:00`).toLocaleDateString(d(),{day:`2-digit`,month:`2-digit`})}function A(e,t=!1){return e===`monthly`?u.t(t?`periods.months`:`periods.month`):e===`yearly`?u.t(t?`periods.years`:`periods.year`):u.t(t?`periods.days`:`periods.day`)}function j(e){return e===`monthly`?u.t(`periods.unitMonth`):e===`yearly`?u.t(`periods.unitYear`):u.t(`periods.unitDay`)}function M(e){if(!/^\d{4}-\d{2}$/.test(e))return``;let[t=``,n=``]=e.split(`-`),r=Number.parseInt(t,10),i=Number.parseInt(n,10);return!Number.isInteger(r)||!Number.isInteger(i)||i<1||i>12?``:new Date(r,i-1).toLocaleDateString(d(),{month:`long`,year:`numeric`})}function N(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString(d(),{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function P(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString(d(),{day:`2-digit`,month:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})}export{v as _,k as a,m as b,M as c,w as d,E as f,j as g,A as h,O as i,T as l,y as m,S as n,N as o,b as p,C as r,P as s,x as t,D as u,h as v,g as x,_ as y};