import{o as e}from"./chunk-jRWAZmH_.js";import{n as t}from"./jsx-runtime-CEixWuwE.js";import{$n as n,Bt as r,E as i,G as a,In as o,Jt as s,On as c,St as l,Ut as u,V as d,Vt as f,Wt as p,er as m,kn as h,qt as g,xt as _}from"./axios-BAZB3l2q.js";import{n as v,t as y}from"./slicedToArray-BQ1tPSGY.js";import{n as b,t as x}from"./typeof-BUNGcdwP.js";import{i as S,r as C}from"./asyncToGenerator-DHhZBkop.js";import{l as w,u as T}from"./button-BwrlrBF7.js";import{i as E}from"./select-7EsN1BXB.js";S();var D=e(o());w(),u();var O=e(t()),k={percent:0,prefixCls:`rc-progress`,strokeColor:`#2db7f5`,strokeLinecap:`round`,strokeWidth:1,trailColor:`#D9D9D9`,trailWidth:1,gapPosition:`bottom`},A=function(){var e=(0,O.useRef)([]),t=(0,O.useRef)(null);return(0,O.useEffect)(function(){var n=Date.now(),r=!1;e.current.forEach(function(e){if(e){r=!0;var i=e.style;i.transitionDuration=`.3s, .3s, .3s, .06s`,t.current&&n-t.current<100&&(i.transitionDuration=`0s, 0s`)}}),r&&(t.current=Date.now())}),e.current};b(),v(),f();var j=0,M=r();function N(){var e;return M?(e=j,j+=1):e=`TEST_OR_SSR`,e}var P=(function(e){var t=y(O.useState(),2),n=t[0],r=t[1];return O.useEffect(function(){r(`rc_progress_${N()}`)},[]),e||n});m(),h(),s();var F=[`id`,`prefixCls`,`steps`,`strokeWidth`,`trailWidth`,`gapDegree`,`gapPosition`,`trailColor`,`strokeLinecap`,`style`,`className`,`strokeColor`,`percent`];function I(e){return+e.replace(`%`,``)}function L(e){var t=e??[];return Array.isArray(t)?t:[t]}var R=100,z=function(e,t,n,r,i,a,o,s,c,l){var u=arguments.length>10&&arguments[10]!==void 0?arguments[10]:0,d=n/100*360*((360-a)/360),f=a===0?0:{bottom:0,top:180,left:90,right:-90}[o],p=(100-r)/100*t;return c===`round`&&r!==100&&(p+=l/2,p>=t&&(p=t-.01)),{stroke:typeof s==`string`?s:void 0,strokeDasharray:`${t}px ${e}`,strokeDashoffset:p+u,transform:`rotate(${i+d+f}deg)`,transformOrigin:`0 0`,transition:`stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s`,fillOpacity:0}},B=function(e){var t=c(c({},k),e),r=t.id,i=t.prefixCls,a=t.steps,o=t.strokeWidth,s=t.trailWidth,l=t.gapDegree,u=l===void 0?0:l,d=t.gapPosition,f=t.trailColor,p=t.strokeLinecap,m=t.style,h=t.className,_=t.strokeColor,v=t.percent,y=g(t,F),b=`${P(r)}-gradient`,S=R/2-o/2,C=Math.PI*2*S,w=u>0?90+u/2:-90,T=C*((360-u)/360),E=x(a)===`object`?a:{count:a,space:2},j=E.count,M=E.space,N=z(C,T,0,100,w,u,d,f,p,o),B=L(v),V=L(_),H=V.find(function(e){return e&&x(e)===`object`}),U=A();return O.createElement(`svg`,n({className:(0,D.default)(`${i}-circle`,h),viewBox:`${-R/2} ${-R/2} ${R} ${R}`,style:m,id:r,role:`presentation`},y),H&&O.createElement(`defs`,null,O.createElement(`linearGradient`,{id:b,x1:`100%`,y1:`0%`,x2:`0%`,y2:`0%`},Object.keys(H).sort(function(e,t){return I(e)-I(t)}).map(function(e,t){return O.createElement(`stop`,{key:t,offset:e,stopColor:H[e]})}))),!j&&O.createElement(`circle`,{className:`${i}-circle-trail`,r:S,cx:0,cy:0,stroke:f,strokeLinecap:p,strokeWidth:s||o,style:N}),j?function(){var e=Math.round(j*(B[0]/100)),t=100/j,n=0;return Array(j).fill(null).map(function(r,a){var s=a<=e-1?V[0]:f,c=s&&x(s)===`object`?`url(#${b})`:void 0,l=z(C,T,n,t,w,u,d,s,`butt`,o,M);return n+=(T-l.strokeDashoffset+M)*100/T,O.createElement(`circle`,{key:a,className:`${i}-circle-path`,r:S,cx:0,cy:0,stroke:c,strokeWidth:o,opacity:1,style:l,ref:function(e){U[a]=e}})})}():function(){var e=0;return B.map(function(t,n){var r=V[n]||V[V.length-1],a=r&&x(r)===`object`?`url(#${b})`:void 0,s=z(C,T,e,t,w,u,d,r,p,o);return e+=t,O.createElement(`circle`,{key:n,className:`${i}-circle-path`,r:S,cx:0,cy:0,stroke:a,strokeLinecap:p,strokeWidth:o,opacity:t===0?0:1,style:s,ref:function(e){U[n]=e}})}).reverse()}())};function V(e){return!e||e<0?0:e>100?100:e}function H(e){var t=e.success,n=e.successPercent;return t&&`progress`in t&&(n=t.progress),t&&`percent`in t&&(n=t.percent),n}function U(e){var t=e.percent,n=e.success,r=e.successPercent,i=V(H({success:n,successPercent:r}));return[i,V(V(t)-i)]}function W(e){var t=e.success,n=t===void 0?{}:t,r=e.strokeColor;return[n.strokeColor||p.green,r||null]}var G=function(e){var t=e.prefixCls,n=e.width,r=e.strokeWidth,i=e.trailColor,a=i===void 0?null:i,o=e.strokeLinecap,s=o===void 0?`round`:o,c=e.gapPosition,l=e.gapDegree,u=e.type,d=e.children,f=e.success,p=n||120,m={width:p,height:p,fontSize:p*.15+6},h=r||6,g=c||u===`dashboard`&&`bottom`||void 0,_=function(){if(l||l===0)return l;if(u===`dashboard`)return 75},v=Object.prototype.toString.call(e.strokeColor)===`[object Object]`,y=W({success:f,strokeColor:e.strokeColor}),b=(0,D.default)(`${t}-inner`,C({},`${t}-circle-gradient`,v));return O.createElement(`div`,{className:b,style:m},O.createElement(B,{percent:U(e),strokeWidth:h,trailWidth:h,strokeColor:y,strokeLinecap:s,trailColor:a,prefixCls:t,gapDegree:_(),gapPosition:g}),d)};m(),u();var K=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i=100?`success`:t||`normal`}function x(t,n){var r=e.format,i=H(e);if(!m)return null;var o,s=r||function(e){return`${e}%`},u=g===`line`;return r||n!==`exception`&&n!==`success`?o=s(V(c),V(i)):n===`exception`?o=u?O.createElement(_,null):O.createElement(a,null):n===`success`&&(o=u?O.createElement(l,null):O.createElement(E,null)),O.createElement(`span`,{className:`${t}-text`,title:typeof o==`string`?o:void 0},o)}var S=O.useContext(d),w=S.getPrefixCls,k=S.direction,A=w(`progress`,t),j=b(),M=x(A,j),N=Array.isArray(o)?o[0]:o,P=typeof o==`string`||Array.isArray(o)?o:void 0,F;g===`line`?F=i?O.createElement(X,n({},e,{strokeColor:P,prefixCls:A,steps:i}),M):O.createElement(Y,n({},e,{strokeColor:N,prefixCls:A,direction:k}),M):(g===`circle`||g===`dashboard`)&&(F=O.createElement(G,n({},e,{strokeColor:N,prefixCls:A,progressStatus:j}),M));var I=(0,D.default)(A,C(C(C(C(C({},`${A}-${g===`dashboard`&&`circle`||i&&`steps`||g}`,!0),`${A}-status-${j}`,!0),`${A}-show-info`,m),`${A}-${f}`,f),`${A}-rtl`,k===`rtl`),r);return O.createElement(`div`,n({},T(v,[`status`,`format`,`trailColor`,`strokeWidth`,`width`,`gapDegree`,`gapPosition`,`strokeLinecap`,`success`,`successPercent`]),{className:I,role:`progressbar`}),F)};export{$ as t};