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