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