import{B as V,L as k,o as n,c as o,M as P,N as z,m as u,j as p,H as b,a as i,t as f,f as O,h as m,n as d,p as M,k as $,y,P as w,z as G,Q as L}from"./index-BUn66i27.js";var N=function(t){var r=t.dt;return`
.p-metergroup {
    display: flex;
    gap: `.concat(r("metergroup.gap"),`;
}

.p-metergroup-meters {
    display: flex;
    background: `).concat(r("metergroup.meters.background"),`;
    border-radius: `).concat(r("metergroup.border.radius"),`;
}

.p-metergroup-label-list {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style-type: none;
}

.p-metergroup-label {
    display: inline-flex;
    align-items: center;
    gap: `).concat(r("metergroup.label.gap"),`;
}

.p-metergroup-label-marker {
    display: inline-flex;
    width: `).concat(r("metergroup.label.marker.size"),`;
    height: `).concat(r("metergroup.label.marker.size"),`;
    border-radius: 100%;
}

.p-metergroup-label-icon {
    font-size: `).concat(r("metergroup.label.icon.size"),`;
    width: `).concat(r("metergroup.label.icon.size"),`;
    height: `).concat(r("metergroup.label.icon.size"),`;
}

.p-metergroup-horizontal {
    flex-direction: column;
}

.p-metergroup-label-list-horizontal {
    gap: `).concat(r("metergroup.label.list.horizontal.gap"),`;
}

.p-metergroup-horizontal .p-metergroup-meters {
    height: `).concat(r("metergroup.meters.size"),`;
}

.p-metergroup-horizontal .p-metergroup-meter:first-of-type {
    border-start-start-radius: `).concat(r("metergroup.border.radius"),`;
    border-end-start-radius: `).concat(r("metergroup.border.radius"),`;
}

.p-metergroup-horizontal .p-metergroup-meter:last-of-type {
    border-start-end-radius: `).concat(r("metergroup.border.radius"),`;
    border-end-end-radius: `).concat(r("metergroup.border.radius"),`;
}

.p-metergroup-vertical {
    flex-direction: row;
}

.p-metergroup-label-list-vertical {
    flex-direction: column;
    gap: `).concat(r("metergroup.label.list.vertical.gap"),`;
}

.p-metergroup-vertical .p-metergroup-meters {
    flex-direction: column;
    width: `).concat(r("metergroup.meters.size"),`;
    height: 100%;
}

.p-metergroup-vertical .p-metergroup-label-list {
    align-items: flex-start;
}

.p-metergroup-vertical .p-metergroup-meter:first-of-type {
    border-start-start-radius: `).concat(r("metergroup.border.radius"),`;
    border-start-end-radius: `).concat(r("metergroup.border.radius"),`;
}

.p-metergroup-vertical .p-metergroup-meter:last-of-type {
    border-end-start-radius: `).concat(r("metergroup.border.radius"),`;
    border-end-end-radius: `).concat(r("metergroup.border.radius"),`;
}
`)},x={root:function(t){var r=t.props;return["p-metergroup p-component",{"p-metergroup-horizontal":r.orientation==="horizontal","p-metergroup-vertical":r.orientation==="vertical"}]},meters:"p-metergroup-meters",meter:"p-metergroup-meter",labelList:function(t){var r=t.props;return["p-metergroup-label-list",{"p-metergroup-label-list-vertical":r.labelOrientation==="vertical","p-metergroup-label-list-horizontal":r.labelOrientation==="horizontal"}]},label:"p-metergroup-label",labelIcon:"p-metergroup-label-icon",labelMarker:"p-metergroup-label-marker",labelText:"p-metergroup-label-text"},B=V.extend({name:"metergroup",theme:N,classes:x}),I={name:"MeterGroup",extends:k,props:{value:{type:Array,default:null},min:{type:Number,default:0},max:{type:Number,default:100},orientation:{type:String,default:"horizontal"},labelPosition:{type:String,default:"end"},labelOrientation:{type:String,default:"horizontal"}},style:B,provide:function(){return{$pcMeterGroup:this,$parentInstance:this}}},S={name:"MeterGroupLabel",hostName:"MeterGroup",extends:k,inheritAttrs:!1,props:{value:{type:Array,default:null},labelPosition:{type:String,default:"end"},labelOrientation:{type:String,default:"horizontal"}}};function q(e,t,r,s,v,a){return n(),o("ol",u({class:e.cx("labelList")},e.ptm("labelList")),[(n(!0),o(P,null,z(r.value,function(l,c){return n(),o("li",u({key:c+"_label",class:e.cx("label"),ref_for:!0},e.ptm("label")),[p(e.$slots,"icon",{value:l,class:b(e.cx("labelIcon"))},function(){return[l.icon?(n(),o("i",u({key:0,class:[l.icon,e.cx("labelIcon")],style:{color:l.color},ref_for:!0},e.ptm("labelIcon")),null,16)):(n(),o("span",u({key:1,class:e.cx("labelMarker"),style:{backgroundColor:l.color},ref_for:!0},e.ptm("labelMarker")),null,16))]}),i("span",u({class:e.cx("labelText"),ref_for:!0},e.ptm("labelText")),f(l.label)+" ("+f(e.$parentInstance.percentValue(l.value))+")",17)],16)}),128))],16)}S.render=q;var C={name:"MeterGroup",extends:I,inheritAttrs:!1,methods:{getPTOptions:function(t,r,s){return this.ptm(t,{context:{value:r,index:s}})},percent:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=(t-this.min)/(this.max-this.min)*100;return Math.round(Math.max(0,Math.min(100,r)))},percentValue:function(t){return this.percent(t)+"%"},meterCalculatedStyles:function(t){return{backgroundColor:t.color,width:this.orientation==="horizontal"&&this.percentValue(t.value),height:this.orientation==="vertical"&&this.percentValue(t.value)}}},computed:{totalPercent:function(){return this.percent(this.value.reduce(function(t,r){return t+r.value},0))},percentages:function(){var t=0,r=[];return this.value.forEach(function(s){t+=s.value,r.push(t)}),r}},components:{MeterGroupLabel:S}},A=["aria-valuemin","aria-valuemax","aria-valuenow"];function T(e,t,r,s,v,a){var l=O("MeterGroupLabel");return n(),o("div",u({class:e.cx("root"),role:"meter","aria-valuemin":e.min,"aria-valuemax":e.max,"aria-valuenow":a.totalPercent},e.ptmi("root")),[e.labelPosition==="start"?p(e.$slots,"label",{key:0,value:e.value,totalPercent:a.totalPercent,percentages:a.percentages},function(){return[m(l,{value:e.value,labelPosition:e.labelPosition,labelOrientation:e.labelOrientation,unstyled:e.unstyled,pt:e.pt},null,8,["value","labelPosition","labelOrientation","unstyled","pt"])]}):d("",!0),p(e.$slots,"start",{value:e.value,totalPercent:a.totalPercent,percentages:a.percentages}),i("div",u({class:e.cx("meters")},e.ptm("meters")),[(n(!0),o(P,null,z(e.value,function(c,h){return p(e.$slots,"meter",{key:h,value:c,index:h,class:b(e.cx("meter")),orientation:e.orientation,size:a.percentValue(c.value),totalPercent:a.totalPercent},function(){return[a.percent(c.value)?(n(),o("span",u({key:0,class:e.cx("meter"),style:a.meterCalculatedStyles(c),ref_for:!0},a.getPTOptions("meter",c,h)),null,16)):d("",!0)]})}),128))],16),p(e.$slots,"end",{value:e.value,totalPercent:a.totalPercent,percentages:a.percentages}),e.labelPosition==="end"?p(e.$slots,"label",{key:1,value:e.value,totalPercent:a.totalPercent,percentages:a.percentages},function(){return[m(l,{value:e.value,labelPosition:e.labelPosition,labelOrientation:e.labelOrientation,unstyled:e.unstyled,pt:e.pt},null,8,["value","labelPosition","labelOrientation","unstyled","pt"])]}):d("",!0)],16,A)}C.render=T;const D={class:"col-span-12 lg:col-span-6 xl:col-span-3"},E={class:"card mb-0"},j={class:"flex justify-between mb-4"},H={class:"block text-muted-color font-medium mb-4"},U={key:0,class:"mt-10 text-wrap"},g=M({__name:"MeterCard",props:{measureName:{type:String,required:!0},measureDescription:{type:String,required:!1},measureValue:{type:Array,required:!1},icon:{type:String,required:!1},iconColor:{type:String,required:!1},iconBgColor:{type:String,required:!1},maxValue:{type:Number,required:!1,default:100}},setup(e){return(t,r)=>{const s=C;return n(),o("div",D,[i("div",E,[i("div",j,[i("div",null,[i("span",H,f(e.measureName),1),e.measureDescription?(n(),o("div",U,f(e.measureDescription),1)):d("",!0),e.measureValue?(n(),$(s,{key:1,value:e.measureValue,max:e.maxValue},null,8,["value","max"])):d("",!0)]),i("div",{class:b(["flex items-center justify-center rounded-border",[e.iconBgColor]]),style:{width:"2.5rem",height:"2.5rem"}},[i("i",{class:b(["pi !text-xl",[e.icon,e.iconColor]])},null,2)],2)])])])}}}),F={class:"grid grid-cols-12 gap-8"},J=M({__name:"HomeDashboard",setup(e){const t=y(),{t:r}=w(),s=y([{label:r("system.cpu.usage"),value:t,color:"var(--p-primary-color)",icon:""}]);async function v(){const a=await L.cpuV1ExpCpuPost();t.value=a.data}return G(()=>{v()}),(a,l)=>(n(),o("div",F,[m(g,{"measure-name":"Sensor configurations","measure-description":"Active/Total: 3/12","icon-bg-color":"bg-blue-100 dark:bg-blue-400/10",icon:"pi-file","icon-color":"text-blue-500"}),m(g,{"measure-name":a.$t("system.cpu.label"),"measure-value":s.value,"icon-bg-color":"bg-slate-100 dark:bg-slate-400/10",icon:"pi-microchip","icon-color":"text-slate-500"},null,8,["measure-name","measure-value"]),m(g,{"measure-name":a.$t("system.ram.label"),"measure-value":[{label:a.$t("system.ram.usage"),value:24,color:"var(--p-primary-color)",icon:""}],"icon-bg-color":"bg-slate-100 dark:bg-slate-400/10",icon:"pi-microchip","icon-color":"text-slate-500"},null,8,["measure-name","measure-value"]),m(g,{"measure-name":a.$t("system.disk.label"),"measure-value":[{label:a.$t("system.disk.usage"),value:46,color:"var(--p-primary-color)",icon:""}],"icon-bg-color":"bg-slate-100 dark:bg-slate-400/10",icon:"pi-microchip","icon-color":"text-slate-500"},null,8,["measure-name","measure-value"])]))}});export{J as default};
