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