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