import e from"../_util/props-util/initDefaultProps.mjs";import t from"../config-provider/hooks/useConfigInject.mjs";import{progressProps as n,progressStatuses as r}from"./props.mjs";import{getSize as i,getSuccessPercent as a,validProgress as o}from"./utils.mjs";import s from"./Circle.mjs";import c from"./Line.mjs";import l from"./Steps.mjs";import u from"./style/index.mjs";import{computed as d,createVNode as f,defineComponent as p}from"vue";import{CheckCircleFilled as m,CheckOutlined as h,CloseCircleFilled as g,CloseOutlined as _}from"@antsoo-lib/icons";var v=p({compatConfig:{MODE:3},name:`AProgress`,inheritAttrs:!1,props:e(n(),{type:`line`,percent:0,showInfo:!0,trailColor:null,size:`default`,strokeLinecap:`round`}),slots:Object,setup(e,{slots:n,attrs:p}){let{prefixCls:v,direction:y}=t(`progress`,e),[b,x]=u(v),S=d(()=>Array.isArray(e.strokeColor)?e.strokeColor[0]:e.strokeColor),C=d(()=>{let{percent:t=0}=e,n=a(e);return Number.parseInt(n===void 0?t.toString():n.toString(),10)}),w=d(()=>{let{status:t}=e;return!r.includes(t)&&C.value>=100?`success`:t||`normal`}),T=d(()=>{let{type:t,showInfo:n,size:r}=e,a=v.value;return{[a]:!0,[`${a}-inline-circle`]:t===`circle`&&i(r,`circle`).width<=20,[`${a}-${t===`dashboard`&&`circle`||t}`]:!0,[`${a}-status-${w.value}`]:!0,[`${a}-show-info`]:n,[`${a}-${r}`]:r,[`${a}-rtl`]:y.value===`rtl`,[x.value]:!0}}),E=d(()=>typeof e.strokeColor==`string`||Array.isArray(e.strokeColor)?e.strokeColor:void 0),D=()=>{let{showInfo:t,format:r,type:i,percent:s,title:c}=e,l=a(e);if(!t)return null;let u,d=r||n?.format||(e=>`${e}%`),p=i===`line`;return r||n?.format||w.value!==`exception`&&w.value!==`success`?u=d(o(s),o(l)):w.value===`exception`?u=f(p?g:_,null,null):w.value===`success`&&(u=f(p?m:h,null,null)),f(`span`,{class:`${v.value}-text`,title:c===void 0&&typeof u==`string`?u:void 0},[u])};return()=>{let{type:t,steps:n,title:r}=e,{class:i,...a}=p,o=D(),u;return t===`line`?u=n?f(l,{...e,strokeColor:E.value,prefixCls:v.value,steps:n},{default:()=>[o]}):f(c,{...e,strokeColor:S.value,prefixCls:v.value,direction:y.value},{default:()=>[o]}):(t===`circle`||t===`dashboard`)&&(u=f(s,{...e,prefixCls:v.value,strokeColor:S.value,progressStatus:w.value},{default:()=>[o]})),b(f(`div`,{role:`progressbar`,...a,class:[T.value,i],title:r},[u]))}}});export{v as default};