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