import{At as e,Ct as t,Dt as n,Et as r,Ft as i,It as a,Mt as o,Nt as s,Pt as c,St as l,Tt as u,jt as d,kt as f,wt as p}from"./index-DAN9Q3vY.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(t,n,r,i,a,o,s){var l=t-r,u=n-i,d=(s?o:-o)/c(l*l+u*u),f=d*u,p=-d*l,m=t+f,h=n+p,g=r+f,_=i+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=a-o,w=m*_-g*h,T=(x<0?-1:1)*c(e(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(a/C-1),y11:D*(a/C-1)}}function x(){var e=m,x=h,S=a(0),C=null,w=g,T=_,E=v,D=null,O=l(k);function k(){var a,l,m=+e.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-f,_=T.apply(this,arguments)-f,v=t(_-g),k=_>g;if(D||=a=O(),h<m&&(l=h,h=m,m=l),!(h>1e-12))D.moveTo(0,0);else if(v>i-1e-12)D.moveTo(h*n(g),h*s(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*n(_),m*s(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):c(m*m+h*h)),R=d(t(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=u(L/m*s(I)),W=u(L/h*s(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*n(A),K=h*s(A),q=m*n(N),J=m*s(N);if(R>1e-12){var Y=h*n(j),X=h*s(j),Z=m*n(M),Q=m*s(M),$;if(v<o)if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/s(p((ee*ne+te*re)/(c(ee*ee+te*te)*c(ne*ne+re*re)))/2),ae=c($[0]*$[0]+$[1]*$[1]);z=d(R,(m-ae)/(ie-1)),B=d(R,(h-ae)/(ie+1))}else z=B=0}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,r(V.y01,V.x01),r(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,r(V.y01,V.x01),r(V.y11,V.x11),!k),D.arc(0,0,h,r(V.cy+V.y11,V.cx+V.x11),r(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,r(H.y11,H.x11),r(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,r(V.y01,V.x01),r(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,r(V.y01,V.x01),r(V.y11,V.x11),!k),D.arc(0,0,m,r(V.cy+V.y11,V.cx+V.x11),r(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,r(H.y11,H.x11),r(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),a)return D=null,a+``||null}return k.centroid=function(){var t=(+e.apply(this,arguments)+ +x.apply(this,arguments))/2,r=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-o/2;return[n(r)*t,s(r)*t]},k.innerRadius=function(t){return arguments.length?(e=typeof t==`function`?t:a(+t),k):e},k.outerRadius=function(e){return arguments.length?(x=typeof e==`function`?e:a(+e),k):x},k.cornerRadius=function(e){return arguments.length?(S=typeof e==`function`?e:a(+e),k):S},k.padRadius=function(e){return arguments.length?(C=e==null?null:typeof e==`function`?e:a(+e),k):C},k.startAngle=function(e){return arguments.length?(w=typeof e==`function`?e:a(+e),k):w},k.endAngle=function(e){return arguments.length?(T=typeof e==`function`?e:a(+e),k):T},k.padAngle=function(e){return arguments.length?(E=typeof e==`function`?e:a(+e),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};