import{i as B,c as S}from"./app-Ba7ZqSpq.js";import{e as g}from"./app-DUeSaIYz.js";import{C as z}from"./app-qhR41k1m.js";import{W as E}from"./app-B9xxzP2y.js";import{C as L}from"./app-4ZdxSI8r.js";import{C as b}from"./app-BjiVQlSS.js";import{C as w}from"./app-Bt2pXSov.js";import{o as f,c as k,w as s,u as c,g as y,b as n,f as l,a as p,h as v}from"./app-SC54XQDl.js";import"./app-CS3AUTAk.js";import"./app-CCkWSX4Q.js";import"./app-C28obFWS.js";import"./app-CkINxBL9.js";import"./app-PPG0ZS4d.js";import"./app--Lj8zATS.js";import"./app-Ch8j4za4.js";import"./app-C2mBgI5Z.js";function N(){const{utils:o}=B(this);o.setEcharts(g),this.$delay(function(){let t=this,a=this.processMaxUnit(this.systemStats);this.reloadChart("system-chart","操作系统",this.systemStats,function(e){return e.system.name},function(e){return t.systemStats[e.dataIndex].system.name+": "+o.formatNumber(t.systemStats[e.dataIndex].rawCount)},a),window.addEventListener("resize",function(){t.resizeChart("system-chart")});let r=this.processMaxUnit(this.browserStats);this.reloadChart("browser-chart","浏览器",this.browserStats,function(e){return e.browser.name},function(e){return t.browserStats[e.dataIndex].browser.name+": "+o.formatNumber(t.browserStats[e.dataIndex].rawCount)},r),window.addEventListener("resize",function(){t.resizeChart("system-chart"),t.resizeChart("browser-chart")})}),this.reloadChart=function(t,a,r,e,i,u){let x=document.getElementById(t);x!=null&&o.initChart(x,void 0,m=>{let C=20,_=0;const d=o.xRotation(m,r.map(e));d!=null&&(C=d[0],_=d[1]);let I={xAxis:{data:r.map(e),axisLabel:{interval:0,color:o.chartLabelColor,rotate:_}},yAxis:{axisLabel:{formatter:function(h){return h+u},color:o.chartLabelColor}},tooltip:{show:!0,trigger:"item",formatter:i},grid:{left:40,top:10,right:20,bottom:C},series:[{name:a,type:"bar",data:r.map(function(h){return h.count}),itemStyle:{color:o.DefaultChartColor},barWidth:"10em"}],animation:!0};m.setOption(I),m.resize()})},this.resizeChart=function(t){let a=document.getElementById(t);a!=null&&o.initChart(a,void 0,r=>{r.resize()})},this.processMaxUnit=function(t){let a=t.$map(function(i,u){return u.count}).$max(),r=0,e="";return a>=1e3*1e3*1e3?(e="B",r=1e3*1e3*1e3):a>=1e3*1e3?(e="M",r=1e3*1e3):a>=1e3&&(e="K",r=1e3),t.forEach(function(i){i.rawCount=i.count,r>0&&(i.count/=r)}),e}}const M={key:0},U=["href"],V={key:1},O=p("div",{class:"chart-box",id:"system-chart"},null,-1),R=p("div",{class:"chart-box",id:"browser-chart"},null,-1),F={__name:"clients",setup(o){const t=S(new N);return(a,r)=>(f(),k(z,{ctx:c(t),"has-tab":!0},{default:s(()=>[c(t).statIsOn?v("",!0):(f(),y("div",M,[n(E,null,{default:s(()=>[l(" 要想查看统计数据，需要先开启统计功能，"),p("a",{href:"/servers/server/settings/stat?serverId="+c(t).serverId},"[点击这里]",8,U),l("修改配置。 ")]),_:1})])),c(t).statIsOn?(f(),y("div",V,[n(L,null,{default:s(()=>[n(b,{cols:"1"},{header:s(()=>[l("操作系统排行")]),default:s(()=>[n(w,null,{value:s(()=>[O]),_:1})]),_:1}),n(b,{cols:"1"},{header:s(()=>[l("浏览器排行")]),default:s(()=>[n(w,null,{value:s(()=>[R]),_:1})]),_:1})]),_:1})])):v("",!0)]),_:1},8,["ctx"]))}};export{F as default};
