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{t as g}from"./_plugin-vue_export-helper-CWyGVBf-.js";import{t as _}from"./formatNumber-CSIIcI3k.js";var v={class:`rounded-zf-lg border border-border-light bg-surface p-5 sm:p-6`},y={class:`flex flex-col gap-6 xl:flex-row xl:items-end xl:justify-between`},b={class:`min-w-0`},x={class:`mt-2 flex flex-wrap items-end gap-x-5 gap-y-2`},S={class:`text-4xl font-semibold leading-none tracking-tight text-primary sm:text-5xl`},C={class:`flex flex-wrap items-center gap-x-4 gap-y-2 pb-0.5 text-xs`},w={class:`text-secondary`},T={class:`text-secondary`},E={class:`ml-1 font-semibold text-primary`},D={class:`text-secondary`},O={class:`ml-1 font-semibold text-primary`},k={class:`grid grid-cols-2 gap-3 sm:grid-cols-4 sm:gap-6`},A={class:`truncate text-xs text-secondary`},j={class:`mt-1 truncate text-xl font-semibold tabular-nums text-primary sm:text-2xl`},M={class:`mt-6 border-t border-border-light pt-5`},N={class:`grid grid-cols-2 gap-x-5 gap-y-3 lg:grid-cols-4`},P={class:`flex items-center justify-between gap-2 text-xs`},F={class:`flex min-w-0 items-center gap-1.5 text-secondary`},I={class:`truncate`},L={class:`shrink-0 font-medium tabular-nums text-primary`},R={class:`ml-1 font-normal text-placeholder`},z={class:`mt-3 flex h-2 overflow-hidden rounded-full bg-page`},B=[`title`],V=a({__name:`DownloadStatsOverview`,props:{data:{},loading:{type:Boolean},avgPerIp:{},momText:{},momTrend:{},peakText:{}},setup(e){let a=e,g=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}]),V=i(()=>{let e=a.data.downloadCount||0,t=t=>e>0?Number((t/e*100).toFixed(1)):0;return[{key:`directLink`,label:`直链`,value:a.data.directLinkCount||0,percent:t(a.data.directLinkCount||0),colorClass:`bg-zp`},{key:`shortLink`,label:`短链`,value:a.data.shortLinkCount||0,percent:t(a.data.shortLinkCount||0),colorClass:`zf-download-stats-success-bg`},{key:`frontend`,label:`直接下载`,value:a.data.frontendDownloadCount||0,percent:t(a.data.frontendDownloadCount||0),colorClass:`zf-download-stats-warning-bg`},{key:`preview`,label:`预览`,value:a.data.previewCount||0,percent:t(a.data.previewCount||0),colorClass:`zf-download-stats-info-bg`}]}),H=i(()=>a.momTrend===`up`?`text-success`:a.momTrend===`down`?`text-danger`:`text-regular`);return(i,a)=>{let U=u(`count`),W=t;return f((d(),n(`section`,v,[r(`div`,y,[r(`div`,b,[a[4]||=r(`p`,{class:`text-xs font-medium text-secondary`},`总下载量`,-1),r(`div`,x,[f(r(`div`,S,null,512),[[U,e.data.downloadCount||0]]),r(`div`,C,[r(`span`,w,[a[0]||=o(` 环比 `,-1),r(`strong`,{class:m([`ml-1 font-semibold`,s(H)])},c(e.momText),3)]),r(`span`,T,[a[1]||=o(` 峰值 `,-1),r(`strong`,E,c(e.peakText),1)]),r(`span`,D,[a[2]||=o(` 人均 `,-1),r(`strong`,O,c(e.avgPerIp.toFixed(1)),1),a[3]||=o(` 次/IP `,-1)])])])]),r(`div`,k,[(d(!0),n(h,null,p(s(g),e=>(d(),n(`div`,{key:e.label,class:`min-w-0`},[r(`p`,A,c(e.label),1),r(`p`,j,c(s(_)(e.value)),1)]))),128))])]),r(`div`,M,[r(`div`,N,[(d(!0),n(h,null,p(s(V),e=>(d(),n(`div`,{key:e.key,class:`min-w-0`},[r(`div`,P,[r(`span`,F,[r(`span`,{class:m([`h-2 w-2 shrink-0 rounded-full`,e.colorClass])},null,2),r(`span`,I,c(e.label),1)]),r(`span`,L,[o(c(s(_)(e.value))+` `,1),r(`span`,R,c(e.percent)+`%`,1)])])]))),128))]),r(`div`,z,[(d(!0),n(h,null,p(s(V),e=>(d(),n(`div`,{key:e.key,class:m([`h-full transition-all duration-300 ease-in-out`,e.colorClass]),style:l({width:`${e.percent}%`}),title:`${e.label} ${e.percent}%`},null,14,B))),128))])])])),[[W,e.loading]])}}}),H=e({default:()=>U}),U=g(V,[[`__scopeId`,`data-v-46b7c2f8`]]);export{H as n,U as t};