Distance from the point T to the circle-arc in the plane

Input: point T ∈ (ℝ^2), center C ∈ (ℝ^2), radius r, angles (Subscript[α, 1]),(Subscript[α, 2]); 
Output: distance;
Submodules: none needed

darc[t_,s_,r_,a1_,a2_]:=Module[{kut,kut1,kut2,vec1,vec2,phi,dd},
vec1={r Cos[a1],r Sin[a1]};vec2={r Cos[a2],r Sin[a2]};
kut1=If[Norm[t-s]≠ 0,ArcCos[vec1.(t-s)/(Norm[vec1] Norm[t-s])],0]//N;
kut2=If[Norm[t-s]≠ 0,ArcCos[vec2.(t-s)/(Norm[vec2] Norm[t-s])],0]//N;
kut=ArcCos[vec1.vec2/(Norm[vec1] Norm[vec2])]//N;
phi=If[t[[1]]-s[[1]]≠ 0,Arg[(t[[1]]-s[[1]])+I(t[[2]]-s[[2]])],If[t[[2]]-s[[2]]>0,Pi/2,3Pi/2]];
If[Round[kut1+kut2-kut,10^(-7)]==0,dd=Abs[Norm[s-t]-r],
dd=Min[Norm[t-s-vec1],Norm[t-s-vec2]]
     ];
dd]