import{anyType as e,stringType as t}from"../_util/type.mjs";import{presetPrimaryColors as n}from"../node_modules/.pnpm/@ant-design_colors@7.2.1/node_modules/@ant-design/colors/es/presets.mjs";import"../node_modules/.pnpm/@ant-design_colors@7.2.1/node_modules/@ant-design/colors/es/index.mjs";import{progressProps as r}from"./props.mjs";import{getSize as i,getSuccessPercent as a,validProgress as o}from"./utils.mjs";import{Fragment as s,computed as c,createVNode as l,defineComponent as u}from"vue";var d=()=>({...r(),strokeColor:e(),direction:t()}),f=e=>{let t=[];return Object.keys(e).forEach(n=>{let r=Number.parseFloat(n.replace(/%/g,``));isNaN(r)||t.push({key:r,value:e[n]})}),t=t.sort((e,t)=>e.key-t.key),t.map(({key:e,value:t})=>`${t} ${e}%`).join(`, `)},p=(e,t)=>{let{from:r=n.blue,to:i=n.blue,direction:a=t===`rtl`?`to left`:`to right`,...o}=e;return Object.keys(o).length===0?{backgroundImage:`linear-gradient(${a}, ${r}, ${i})`}:{backgroundImage:`linear-gradient(${a}, ${f(o)})`}},m=u({compatConfig:{MODE:3},name:`ProgressLine`,inheritAttrs:!1,props:d(),setup(e,{slots:t,attrs:n}){let r=c(()=>{let{strokeColor:t,direction:n}=e;return t&&typeof t!=`string`?p(t,n):{backgroundColor:t}}),u=c(()=>e.strokeLinecap===`square`||e.strokeLinecap===`butt`?0:void 0),d=c(()=>e.trailColor?{backgroundColor:e.trailColor}:void 0),f=c(()=>e.size??[-1,e.strokeWidth||(e.size===`small`?6:8)]),m=c(()=>i(f.value,`line`,{strokeWidth:e.strokeWidth})),h=c(()=>{let{percent:t}=e;return{width:`${o(t)}%`,height:`${m.value.height}px`,borderRadius:u.value,...r.value}}),g=c(()=>a(e)),_=c(()=>{let{success:t}=e;return{width:`${o(g.value)}%`,height:`${m.value.height}px`,borderRadius:u.value,backgroundColor:t?.strokeColor}}),v={width:m.value.width<0?`100%`:m.value.width,height:`${m.value.height}px`};return()=>l(s,null,[l(`div`,{...n,class:[`${e.prefixCls}-outer`,n.class],style:[n.style,v]},[l(`div`,{class:`${e.prefixCls}-inner`,style:d.value},[l(`div`,{class:`${e.prefixCls}-bg`,style:h.value},null),g.value===void 0?null:l(`div`,{class:`${e.prefixCls}-success-bg`,style:_.value},null)])]),t.default?.()])}});export{m as default,p as handleGradient,d as lineProps,f as sortGradient};