import{i as S,c as I}from"./app-a6cKceqE.js";import{e as q}from"./app-DUeSaIYz.js";import{C as B}from"./app-CLawzVMq.js";import{W as R}from"./app-D7QVa3_6.js";import{C as v}from"./app-s9q29Mor.js";import{_ as L}from"./app-5kap3d7V.js";import{C}from"./app-Biqm6MNM.js";import{C as p}from"./app-C14NbwKQ.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-BYcXwl4U.js";import"./app-BeFNDz9n.js";import"./app-BDgR0DSb.js";import"./app-CO4sV-Ic.js";import"./app-yt37eDzA.js";import"./app-BG60hdvp.js";import"./app-BQ5ggxk2.js";import"./app-SxAW7vhf.js";import"./app-D3zbrzdO.js";import"./app-DCd54JMo.js";import"./app-MrAtUXr3.js";import"./app-BWSI2Z1R.js";import"./app-DPDEogA0.js";import"./app-DxjODhok.js";import"./app-CabATHnR.js";import"./app-BhzV4gWo.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};
