import{i as S,c as I}from"./app-Ba7ZqSpq.js";import{e as q}from"./app-DUeSaIYz.js";import{C as R}from"./app-qhR41k1m.js";import{W as B}from"./app-B9xxzP2y.js";import{_ as v}from"./app-CbQf18RD.js";import{C}from"./app-BjiVQlSS.js";import{C as p}from"./app-Bt2pXSov.js";import{C as L}from"./app-4ZdxSI8r.js";import{o as x,c as k,w as n,u as h,g as b,b as c,f,a as m,h as _}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";import"./app-CL60OiIv.js";import"./app-D9TrJBlL.js";import"./app-_Ovp2dOH.js";import"./app-BjSCO7rC.js";import"./app-Dhl-Bw0H.js";import"./app-B2C_dtYI.js";import"./app-COidJXl1.js";function w(){const{utils:t}=S(this);t.setEcharts(q),this.$delay(function(){let e=this;this.reloadRequestsChart("daily-requests-chart","请求数统计",this.dailyStats,function(a){if(a.seriesIndex==0)return e.dailyStats[a.dataIndex].day+"<br/>请求数："+t.formatNumber(e.dailyStats[a.dataIndex].countRequests);if(a.seriesIndex==1){let r=0;return e.dailyStats[a.dataIndex].countRequests>0&&(r=Math.round(e.dailyStats[a.dataIndex].countCachedRequests*1e4/e.dailyStats[a.dataIndex].countRequests)/100),e.dailyStats[a.dataIndex].day+"<br/>缓存请求数："+t.formatNumber(e.dailyStats[a.dataIndex].countCachedRequests)+"<br/>缓存命中率："+r+"%"}return""}),this.reloadTrafficChart("daily-traffic-chart","流量统计",this.dailyStats,function(a){if(a.seriesIndex==0)return e.dailyStats[a.dataIndex].day+"<br/>流量："+t.formatBytes(e.dailyStats[a.dataIndex].bytes);if(a.seriesIndex==1){let r=0;return e.dailyStats[a.dataIndex].bytes>0&&(r=Math.round(e.dailyStats[a.dataIndex].cachedBytes*1e4/e.dailyStats[a.dataIndex].bytes)/100),e.dailyStats[a.dataIndex].day+"<br/>缓存流量："+t.formatBytes(e.dailyStats[a.dataIndex].cachedBytes)+"<br/>缓存命中率："+r+"%"}return""})}),this.reloadRequestsChart=function(e,a,r,y){let u=document.getElementById(e);if(u==null)return;let l=t.countAxis(r,function(s){return Math.max(s.countRequests,s.countCachedRequests)});r.$any(function(s,i){return i.countCachedRequests>0}),t.initChart(u,void 0,s=>{let i={xAxis:{data:r.map(function(o){return o.day.substr(5)}),axisLabel:{color:t.chartLabelColor}},yAxis:{axisLabel:{formatter:function(o){return o+l.unit},color:t.chartLabelColor}},tooltip:{show:!0,trigger:"item",formatter:y},grid:{left:50,top:40,right:20,bottom:20},series:[{name:"请求数",type:"line",data:r.map(function(o){return o.countRequests/l.divider}),itemStyle:{color:t.DefaultChartColor},areaStyle:{color:t.DefaultChartColor},smooth:!0},{name:"缓存请求数",type:"line",data:r.map(function(o){return o.countCachedRequests?o.countCachedRequests/l.divider:null}),itemStyle:{color:t.CacheChartColor},areaStyle:{color:t.CacheChartColor},smooth:!0}],legend:{data:["请求数","缓存请求数"],textStyle:{color:t.chartLabelColor()}},animation:!0};s.setOption(i),s.resize()})},this.reloadTrafficChart=function(e,a,r,y){let u=document.getElementById(e);if(u==null)return;let l=t.bytesAxis(r,function(i){return Math.max(i.bytes,i.cachedBytes)});const s=r.$any(function(i,o){return o.cachedBytes>0});t.initChart(u,void 0,i=>{let o={xAxis:{data:r.map(function(d){return d.day.substr(5)}),axisLabel:{color:t.chartLabelColor}},yAxis:{axisLabel:{formatter:function(d){return d+l.unit},color:t.chartLabelColor}},tooltip:{show:!0,trigger:"item",formatter:y},grid:{left:50,top:40,right:20,bottom:20},series:[{name:"流量",type:"line",data:r.map(function(d){return d.bytes/l.divider}),itemStyle:{color:t.DefaultChartColor},areaStyle:{color:t.DefaultChartColor},smooth:!0},{name:"缓存流量",type:"line",data:r.map(function(d){return s?d.cachedBytes/l.divider:null}),itemStyle:{color:t.CacheChartColor},areaStyle:{color:t.CacheChartColor},smooth:!0}],legend:{data:["流量","缓存流量"],textStyle:{color:t.chartLabelColor()}},animation:!0};i.setOption(o),i.resize()})}}const A={key:0},N=["href"],D={key:1},M=m("span",{class:"text-base gray"},"（按天）",-1),V=m("div",{class:"chart-box",id:"daily-requests-chart"},null,-1),E=m("span",{class:"text-base gray"},"（按天）",-1),O=m("div",{class:"chart-box",id:"daily-traffic-chart"},null,-1),st={__name:"dailyRequests",setup(t){const e=I(new w);return(a,r)=>(x(),k(R,{ctx:h(e),"has-tab":!0},{default:n(()=>[h(e).statIsOn?_("",!0):(x(),b("div",A,[c(B,null,{default:n(()=>[f(" 要想查看统计数据，需要先开启统计功能，"),m("a",{href:"/servers/server/settings/stat?serverId="+h(e).serverId},"[点击这里]",8,N),f("修改配置。 ")]),_:1})])),h(e).statIsOn?(x(),b("div",D,[c(v,{ctx:h(e),"active-tab":"daily"},null,8,["ctx"]),c(L,null,{default:n(()=>[c(C,{cols:"1"},{header:n(()=>[f("请求数统计"),M]),default:n(()=>[c(p,null,{value:n(()=>[V]),_:1})]),_:1}),c(C,{cols:"1"},{header:n(()=>[f("流量统计"),E]),default:n(()=>[c(p,null,{value:n(()=>[O]),_:1})]),_:1})]),_:1})])):_("",!0)]),_:1},8,["ctx"]))}};export{st as default};
