import O from"./Icon.RQAIFpgh.js";import{I as w,J as d,h as P,K as g,v as r,U as l,o as $,c as I,M as h,a as s,B as i,t as k,$ as U,N as M,P as c,z as m,y as V,d as J}from"./entry.RGd0w9hd.js";import{u as D}from"./selectMenu.C9lwG85K.js";import{m as E}from"./meter.G0RBEG4z.js";import{_ as K}from"./_plugin-vue_export-helper.x3n3nnut.js";import"./Icon.IbV_ZJvz.js";import"./index.aIcZnwHK.js";const o=w(d.ui.strategy,d.ui.meter,E),R=P({inheritAttrs:!1,slots:Object,props:{value:{type:Number,default:0},min:{type:Number,default:0},max:{type:Number,default:100},indicator:{type:Boolean,default:!1},label:{type:String,default:null},size:{type:String,default:()=>o.default.size,validator(e){return Object.keys(o.meter.size).includes(e)}},color:{type:String,default:()=>o.default.color,validator(e){return[...d.ui.colors,...Object.keys(o.color)].includes(e)}},icon:{type:String,default:null},class:{type:[String,Object,Array],default:()=>""},ui:{type:Object,default:()=>({})}},setup(e){const{ui:a,attrs:v}=D("meter",g(e,"ui"),o,g(e,"class"));function f(C,t,n){if(t==n)return C<t?0:100;t>n&&(n=[t,t=n][0]);const j=(C-t)/(n-t)*100;return Math.max(0,Math.min(100,j))}const b=r(()=>l(a.value.indicator.container)),p=r(()=>l(a.value.indicator.text,a.value.indicator.size[e.size])),u=r(()=>l(a.value.meter.base,a.value.meter.background,a.value.meter.ring,a.value.meter.rounded,a.value.meter.shadow,a.value.color[e.color]??a.value.meter.color.replaceAll("{color}",e.color),a.value.meter.size[e.size])),B=r(()=>l(a.value.meter.appearance.inner,a.value.meter.appearance.meter,a.value.meter.appearance.bar,a.value.meter.appearance.value)),N=r(()=>l(a.value.meter.bar.transition,a.value.meter.bar.ring,a.value.meter.bar.rounded,a.value.meter.bar.size[e.size])),S=r(()=>l(a.value.label.base,a.value.label.text,a.value.color[e.color]??a.value.label.color.replaceAll("{color}",e.color),a.value.label.size[e.size])),y=r(()=>e.min>e.max?e.max:e.min),z=r(()=>e.max<e.min?e.min:e.max),A=r(()=>f(Number(e.value),y.value,z.value));return{ui:a,attrs:v,indicatorContainerClass:b,indicatorClass:p,meterClass:u,meterAppearanceClass:B,meterBarClass:N,labelClass:S,normalizedMin:y,normalizedMax:z,percent:A}}}),T=["value","min","max"];function q(e,a,v,f,b,p){const u=O;return $(),I("div",c({class:e.ui.wrapper},e.attrs),[e.indicator||e.$slots.indicator?h(e.$slots,"indicator",M(c({key:0},{percent:e.percent,value:e.value})),()=>[s("div",{class:i(e.indicatorContainerClass),style:U({width:`${e.percent}%`})},[s("div",{class:i(e.indicatorClass)},k(Math.round(e.percent))+"% ",3)],6)]):m("",!0),s("meter",{value:e.value,min:e.normalizedMin,max:e.normalizedMax,class:i([e.meterClass,e.meterAppearanceClass,e.meterBarClass])},null,10,T),e.label||e.$slots.label?h(e.$slots,"label",M(c({key:1},{percent:e.percent,value:e.value})),()=>[s("div",{class:i(e.labelClass)},[e.icon?($(),V(u,{key:0,name:e.icon},null,8,["name"])):m("",!0),J(" "+k(e.label),1)],2)]):m("",!0)],16)}const Y=K(R,[["render",q]]);export{Y as default};
