import{V,X as k,f as A,Z as M,c as u,o as i,u as N,n as c,N as s,a as v,G as h,q as o,ae as B,t as C,h as P,w as O,au as R,a5 as Z,b5 as j,aR as q,b6 as G,aS as U,aa as X,aZ as H,ab as D,aj as J}from"./index-Dyf_FKwG.js";const K=V({type:{type:String,default:"line",values:["line","circle","dashboard"]},percentage:{type:Number,default:0,validator:e=>e>=0&&e<=100},status:{type:String,default:"",values:["","success","exception","warning"]},indeterminate:Boolean,duration:{type:Number,default:3},strokeWidth:{type:Number,default:6},strokeLinecap:{type:k(String),default:"round"},textInside:Boolean,width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:k([String,Array,Function]),default:""},striped:Boolean,stripedFlow:Boolean,format:{type:k(Function),default:e=>`${e}%`}}),Q=["aria-valuenow"],Y={viewBox:"0 0 100 100"},_=["d","stroke","stroke-linecap","stroke-width"],ee=["d","stroke","opacity","stroke-linecap","stroke-width"],te={key:0};var ae=A({name:"ElProgress",__name:"progress",props:K,setup(e){const m={success:"#13ce66",exception:"#ff4949",warning:"#e6a23c",default:"#20a0ff"},a=e,r=M("progress"),I=o(()=>{const t={width:`${a.percentage}%`,animationDuration:`${a.duration}s`},n=S(a.percentage);return n.includes("gradient")?t.background=n:t.backgroundColor=n,t}),y=o(()=>(a.strokeWidth/a.width*100).toFixed(1)),b=o(()=>["circle","dashboard"].includes(a.type)?Number.parseInt(`${50-Number.parseFloat(y.value)/2}`,10):0),w=o(()=>{const t=b.value,n=a.type==="dashboard";return`
          M 50 50
          m 0 ${n?"":"-"}${t}
          a ${t} ${t} 0 1 1 0 ${n?"-":""}${t*2}
          a ${t} ${t} 0 1 1 0 ${n?"":"-"}${t*2}
          `}),p=o(()=>2*Math.PI*b.value),g=o(()=>a.type==="dashboard"?.75:1),$=o(()=>`${-1*p.value*(1-g.value)/2}px`),T=o(()=>({strokeDasharray:`${p.value*g.value}px, ${p.value}px`,strokeDashoffset:$.value})),F=o(()=>({strokeDasharray:`${p.value*g.value*(a.percentage/100)}px, ${p.value}px`,strokeDashoffset:$.value,transition:"stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"})),E=o(()=>{let t;return a.color?t=S(a.percentage):t=m[a.status]||m.default,t}),W=o(()=>a.status==="warning"?j:a.type==="line"?a.status==="success"?q:G:a.status==="success"?U:X),z=o(()=>a.type==="line"?12+a.strokeWidth*.4:a.width*.111111+2),x=o(()=>a.format(a.percentage));function L(t){const n=100/t.length;return t.map((l,f)=>D(l)?{color:l,percentage:(f+1)*n}:l).sort((l,f)=>l.percentage-f.percentage)}const S=t=>{var n;const{color:d}=a;if(H(d))return d(t);if(D(d))return d;{const l=L(d);for(const f of l)if(f.percentage>t)return f.color;return(n=l[l.length-1])==null?void 0:n.color}};return(t,n)=>(i(),u("div",{class:c([s(r).b(),s(r).m(e.type),s(r).is(e.status),{[s(r).m("without-text")]:!e.showText,[s(r).m("text-inside")]:e.textInside}]),role:"progressbar","aria-valuenow":e.percentage,"aria-valuemin":"0","aria-valuemax":"100"},[e.type==="line"?(i(),u("div",{key:0,class:c(s(r).b("bar"))},[v("div",{class:c(s(r).be("bar","outer")),style:h({height:`${e.strokeWidth}px`})},[v("div",{class:c([s(r).be("bar","inner"),{[s(r).bem("bar","inner","indeterminate")]:e.indeterminate},{[s(r).bem("bar","inner","striped")]:e.striped},{[s(r).bem("bar","inner","striped-flow")]:e.stripedFlow}]),style:h(I.value)},[(e.showText||t.$slots.default)&&e.textInside?(i(),u("div",{key:0,class:c(s(r).be("bar","innerText"))},[B(t.$slots,"default",{percentage:e.percentage},()=>[v("span",null,C(x.value),1)])],2)):N("v-if",!0)],6)],6)],2)):(i(),u("div",{key:1,class:c(s(r).b("circle")),style:h({height:`${e.width}px`,width:`${e.width}px`})},[(i(),u("svg",Y,[v("path",{class:c(s(r).be("circle","track")),d:w.value,stroke:`var(${s(r).cssVarName("fill-color-light")}, #e5e9f2)`,"stroke-linecap":e.strokeLinecap,"stroke-width":y.value,fill:"none",style:h(T.value)},null,14,_),v("path",{class:c(s(r).be("circle","path")),d:w.value,stroke:E.value,fill:"none",opacity:e.percentage?1:0,"stroke-linecap":e.strokeLinecap,"stroke-width":y.value,style:h(F.value)},null,14,ee)]))],6)),(e.showText||t.$slots.default)&&!e.textInside?(i(),u("div",{key:2,class:c(s(r).e("text")),style:h({fontSize:`${z.value}px`})},[B(t.$slots,"default",{percentage:e.percentage},()=>[e.status?(i(),P(s(Z),{key:1},{default:O(()=>[(i(),P(R(W.value)))]),_:1})):(i(),u("span",te,C(x.value),1))])],6)):N("v-if",!0)],10,Q))}});const re=J(ae);export{re as E};
