import{i as S,c as I}from"./app-a6cKceqE.js";import{e as q}from"./app-DUeSaIYz.js";import{C as R}from"./app-CLawzVMq.js";import{W as B}from"./app-D7QVa3_6.js";import{_ as v}from"./app-5kap3d7V.js";import{C}from"./app-Biqm6MNM.js";import{C as p}from"./app-C14NbwKQ.js";import{C as L}from"./app-s9q29Mor.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-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: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};
