import{b as k,C as _,d as C,P as y,c as D,e as v,f as $,p as L,i as S,L as F}from"./vendor-chart-DaYBPsQM.js";import{L as B}from"./LoadingSpinner-DyY-Iblo.js";import{u as R}from"./vendor-i18n-DnQQ95F5.js";import{r as E,j as n,g as I,Y as g,a1 as l,p as h,e as r,M as s}from"./vendor-vue-gvI8EVHg.js";const T={class:"card p-4"},j={class:"mb-4 text-sm font-semibold text-gray-900 dark:text-white"},z={key:0,class:"flex h-48 items-center justify-center"},A={key:1,class:"h-48"},M={key:2,class:"flex h-48 items-center justify-center text-sm text-gray-500 dark:text-gray-400"},O=E({__name:"TokenUsageTrend",props:{trendData:{},loading:{type:Boolean}},setup(i){k.register(_,C,y,D,v,$,L,S);const{t:d}=R(),o=i,c=r(()=>document.documentElement.classList.contains("dark")),a=r(()=>({text:c.value?"#e5e7eb":"#374151",grid:c.value?"#374151":"#e5e7eb",input:"#3b82f6",output:"#10b981",cacheCreation:"#f59e0b",cacheRead:"#06b6d4"})),u=r(()=>{var e;return(e=o.trendData)!=null&&e.length?{labels:o.trendData.map(t=>t.date),datasets:[{label:"Input",data:o.trendData.map(t=>t.input_tokens),borderColor:a.value.input,backgroundColor:`${a.value.input}20`,fill:!0,tension:.3},{label:"Output",data:o.trendData.map(t=>t.output_tokens),borderColor:a.value.output,backgroundColor:`${a.value.output}20`,fill:!0,tension:.3},{label:"Cache Creation",data:o.trendData.map(t=>t.cache_creation_tokens),borderColor:a.value.cacheCreation,backgroundColor:`${a.value.cacheCreation}20`,fill:!0,tension:.3},{label:"Cache Read",data:o.trendData.map(t=>t.cache_read_tokens),borderColor:a.value.cacheRead,backgroundColor:`${a.value.cacheRead}20`,fill:!0,tension:.3}]}:null}),x=r(()=>({responsive:!0,maintainAspectRatio:!1,interaction:{intersect:!1,mode:"index"},plugins:{legend:{position:"top",labels:{color:a.value.text,usePointStyle:!0,pointStyle:"circle",padding:15,font:{size:11}}},tooltip:{callbacks:{label:e=>`${e.dataset.label}: ${p(e.raw)}`,footer:e=>{var f;const t=(f=e[0])==null?void 0:f.dataIndex;if(t!==void 0&&o.trendData[t]){const b=o.trendData[t];return`Actual: $${m(b.actual_cost)} | Standard: $${m(b.cost)}`}return""}}}},scales:{x:{grid:{color:a.value.grid},ticks:{color:a.value.text,font:{size:10}}},y:{grid:{color:a.value.grid},ticks:{color:a.value.text,font:{size:10},callback:e=>p(Number(e))}}}})),p=e=>e>=1e9?`${(e/1e9).toFixed(2)}B`:e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(2)}K`:e.toLocaleString(),m=e=>e>=1e3?(e/1e3).toFixed(2)+"K":e>=1?e.toFixed(2):e>=.01?e.toFixed(3):e.toFixed(4);return(e,t)=>(s(),n("div",T,[I("h3",j,g(l(d)("admin.dashboard.tokenUsageTrend")),1),i.loading?(s(),n("div",z,[h(B)])):i.trendData.length>0&&u.value?(s(),n("div",A,[h(l(F),{data:u.value,options:x.value},null,8,["data","options"])])):(s(),n("div",M,g(l(d)("admin.dashboard.noDataAvailable")),1))]))}});export{O as _};
