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