import{r as e}from"./rolldown-runtime-BM3Ffeng.js";import{a as t}from"./element-plus-vendor-BF9PNysW.js";import{A as n,D as r,E as i,I as a,N as o,Pt as s,Xt as c,Yt as l,at as u,et as d,gt as f,nt as p,qt as m,x as h}from"./vue-vendor-DMUmTARL.js";import{i as g,t as _}from"./scopeMeta-CzBMS2X0.js";import{t as v}from"./formatNumber-CSIIcI3k.js";var y={class:`rounded-zf-lg border border-border-light bg-surface p-5 sm:p-6`},b={class:`flex flex-col gap-6 xl:flex-row xl:items-end xl:justify-between`},x={class:`min-w-0`},S={class:`mt-2 flex flex-wrap items-end gap-x-5 gap-y-2`},C={class:`text-4xl font-semibold tabular-nums leading-none tracking-tight text-primary sm:text-5xl`},w={class:`flex flex-wrap items-center gap-x-4 gap-y-2 pb-0.5 text-xs`},T={class:`text-secondary`},E={class:`text-secondary`},D={class:`ml-1 font-semibold text-primary`},O={class:`text-secondary`},k={class:`ml-1 font-semibold text-primary`},A={class:`grid grid-cols-2 gap-3 sm:grid-cols-4 sm:gap-6`},j={class:`truncate text-xs text-secondary`},M={class:`mt-1 truncate text-xl font-semibold tabular-nums text-primary sm:text-2xl`},N={class:`mt-6 border-t border-border-light pt-5`},P={class:`grid grid-cols-2 gap-x-5 gap-y-3 lg:grid-cols-4`},F={class:`flex items-center justify-between gap-2 text-xs`},I={class:`flex min-w-0 items-center gap-1.5 text-secondary`},L={class:`truncate`},R={class:`shrink-0 font-medium tabular-nums text-primary`},z={class:`ml-1 font-normal text-placeholder`},B={class:`mt-3 flex h-2 overflow-hidden rounded-full bg-page`},V=[`title`],H=a({__name:`DownloadStatsOverview`,props:{data:{},loading:{type:Boolean},avgPerIp:{},momText:{},momTrend:{},peakText:{}},setup(e){let a=e,H=i(()=>[{label:`实际文件`,value:a.data.actualFileCount||0},{label:`独立 IP`,value:a.data.uniqueIpCount||0},{label:`独立文件`,value:a.data.uniqueFileCount||0},{label:`独立来源`,value:a.data.uniqueRefererCount||0}]),U=i(()=>{let e=a.data.downloadCount||0,t=t=>e>0?Number((t/e*100).toFixed(1)):0;return _.map(e=>{let n=a.data[e.overviewField]||0;return{key:e.key,label:e.label,value:n,percent:t(n),color:g(e)}})}),W=i(()=>a.momTrend===`up`?`text-success`:a.momTrend===`down`?`text-danger`:`text-regular`);return(i,a)=>{let g=u(`count`),_=t;return f((d(),n(`section`,y,[r(`div`,b,[r(`div`,x,[a[4]||=r(`p`,{class:`text-xs font-medium text-secondary`},`总下载量`,-1),r(`div`,S,[f(r(`div`,C,null,512),[[g,e.data.downloadCount||0]]),r(`div`,w,[r(`span`,T,[a[0]||=o(` 环比 `,-1),r(`strong`,{class:m([`ml-1 font-semibold`,s(W)])},c(e.momText),3)]),r(`span`,E,[a[1]||=o(` 峰值 `,-1),r(`strong`,D,c(e.peakText),1)]),r(`span`,O,[a[2]||=o(` 人均 `,-1),r(`strong`,k,c(e.avgPerIp.toFixed(1)),1),a[3]||=o(` 次/IP `,-1)])])])]),r(`div`,A,[(d(!0),n(h,null,p(s(H),e=>(d(),n(`div`,{key:e.label,class:`min-w-0`},[r(`p`,j,c(e.label),1),r(`p`,M,c(s(v)(e.value)),1)]))),128))])]),r(`div`,N,[r(`div`,P,[(d(!0),n(h,null,p(s(U),e=>(d(),n(`div`,{key:e.key,class:`min-w-0`},[r(`div`,F,[r(`span`,I,[r(`span`,{class:`h-2 w-2 shrink-0 rounded-full`,style:l({backgroundColor:e.color})},null,4),r(`span`,L,c(e.label),1)]),r(`span`,R,[o(c(s(v)(e.value))+` `,1),r(`span`,z,c(e.percent)+`%`,1)])])]))),128))]),r(`div`,B,[(d(!0),n(h,null,p(s(U),e=>(d(),n(`div`,{key:e.key,class:`h-full transition-all duration-300 ease-in-out`,style:l({width:`${e.percent}%`,backgroundColor:e.color}),title:`${e.label} ${e.percent}%`},null,12,V))),128))])])])),[[_,e.loading]])}}}),U=e({default:()=>W}),W=H;export{U as n,W as t};