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