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