import{Q as ln,J as an,k as z,L as D,i as Q,v as un,t as y,P as tn,M as F,E as _,a as rn,e as o,D as on,d as sn,b as fn}from"./step-D_f8mI9d.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,E,v,A,S,a){var J=I-l,i=E-h,n=S-v,d=a-A,u=d*J-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*J,h+u*i]}function V(l,h,I,E,v,A,S){var a=l-I,J=h-E,i=(S?A:-A)/F(a*a+J*J),n=i*J,d=-i*a,u=l+n,s=h+d,f=I+n,c=E+d,j=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,L=(g<0?-1:1)*F(on(0,T*T*R-P*P)),M=(P*g-m*L)/R,O=(-P*m-g*L)/R,w=(P*g+m*L)/R,p=(-P*m+g*L)/R,x=M-j,e=O-t,r=w-j,k=p-t;return x*x+e*e>r*r+k*k&&(M=w,O=p),{cx:M,cy:O,x01:-n,y01:-d,x11:M*(v/T-1),y11:O*(v/T-1)}}function hn(){var l=cn,h=yn,I=Q(0),E=null,v=gn,A=dn,S=mn,a=null,J=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,j=rn(c-f),t=c>f;if(a||(a=n=J()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(j>tn-y)a.moveTo(s*z(f),s*D(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*z(c),u*D(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=j,L=j,M=S.apply(this,arguments)/2,O=M>y&&(E?+E.apply(this,arguments):F(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(O>y){var k=sn(O/u*D(M)),G=sn(O/s*D(M));(P-=k*2)>y?(k*=t?1:-1,R+=k,T-=k):(P=0,R=T=(f+c)/2),(L-=G*2)>y?(G*=t?1:-1,m+=G,g-=G):(L=0,m=g=(f+c)/2)}var B=s*z(m),C=s*D(m),H=u*z(T),K=u*D(T);if(w>y){var N=s*z(g),U=s*D(g),W=u*z(R),X=u*D(R),q;if(j<an)if(q=pn(B,C,W,X,N,U,H,K)){var Y=B-q[0],Z=C-q[1],$=N-q[0],b=U-q[1],nn=1/D(fn((Y*$+Z*b)/(F(Y*Y+Z*Z)*F($*$+b*b)))/2),en=F(q[0]*q[0]+q[1]*q[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}L>y?x>y?(e=V(W,X,B,C,s,x,t),r=V(N,U,H,K,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(B,C),a.arc(0,0,s,m,g,!t)):a.moveTo(B,C),!(u>y)||!(P>y)?a.lineTo(H,K):p>y?(e=V(H,K,N,U,u,-p,t),r=V(B,C,W,X,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[z(d)*n,D(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:Q(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:Q(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:Q(+n),i):I},i.padRadius=function(n){return arguments.length?(E=n==null?null:typeof n=="function"?n:Q(+n),i):E},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:Q(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:Q(+n),i):A},i.padAngle=function(n){return arguments.length?(S=typeof n=="function"?n:Q(+n),i):S},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
