smart-chat-asp
Version:
smartChat component
87 lines (86 loc) • 4.94 kB
JavaScript
import { w as ln, c as O } from "./path-428ebac9.mjs";
import { bs as an, bt as G, bu as P, bv as rn, bw as y, aD as tn, bx as K, by as _, bz as un, bA as o, bB as sn, bC as on, bD as fn } from "./lib-85d3a8f7.mjs";
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, z, D, v, A, S, a) {
var B = z - l, i = D - h, n = S - v, m = a - A, r = m * B - n * i;
if (!(r * r < y))
return r = (n * (h - A) - m * (l - v)) / r, [l + r * B, h + r * i];
}
function V(l, h, z, D, v, A, S) {
var a = l - z, B = h - D, i = (S ? A : -A) / K(a * a + B * B), n = i * B, m = -i * a, r = l + n, s = h + m, f = z + n, c = D + m, j = (r + f) / 2, t = (s + c) / 2, p = f - r, g = c - s, R = p * p + g * g, b = v - A, T = r * c - f * s, C = (g < 0 ? -1 : 1) * K(fn(0, b * b * R - T * T)), E = (T * g - p * C) / R, I = (-T * p - g * C) / R, w = (T * g + p * C) / R, x = (-T * p + g * C) / R, d = E - j, e = I - t, u = w - j, F = x - t;
return d * d + e * e > u * u + F * F && (E = w, I = x), {
cx: E,
cy: I,
x01: -n,
y01: -m,
x11: E * (v / b - 1),
y11: I * (v / b - 1)
};
}
function vn() {
var l = cn, h = yn, z = O(0), D = null, v = gn, A = mn, S = pn, a = null, B = 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 = B()), 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 * P(f)), a.arc(0, 0, s, f, c, !t), r > y && (a.moveTo(r * G(c), r * P(c)), a.arc(0, 0, r, c, f, t));
else {
var p = f, g = c, R = f, b = c, T = j, C = j, E = S.apply(this, arguments) / 2, I = E > y && (D ? +D.apply(this, arguments) : K(r * r + s * s)), w = _(un(s - r) / 2, +z.apply(this, arguments)), x = w, d = w, e, u;
if (I > y) {
var F = sn(I / r * P(E)), L = sn(I / s * P(E));
(T -= F * 2) > y ? (F *= t ? 1 : -1, R += F, b -= F) : (T = 0, R = b = (f + c) / 2), (C -= L * 2) > y ? (L *= t ? 1 : -1, p += L, g -= L) : (C = 0, p = g = (f + c) / 2);
}
var H = s * G(p), J = s * P(p), M = r * G(b), N = r * P(b);
if (w > y) {
var Q = s * G(g), U = s * P(g), W = r * G(R), X = r * P(R), q;
if (j < an)
if (q = xn(H, J, W, X, Q, U, M, N)) {
var Y = H - q[0], Z = J - q[1], $ = Q - q[0], k = U - q[1], nn = 1 / P(on((Y * $ + Z * k) / (K(Y * Y + Z * Z) * K($ * $ + k * k))) / 2), en = K(q[0] * q[0] + q[1] * q[1]);
x = _(w, (r - en) / (nn - 1)), d = _(w, (s - en) / (nn + 1));
} else
x = d = 0;
}
C > y ? d > y ? (e = V(W, X, H, J, s, d, t), u = V(Q, U, M, N, s, d, t), a.moveTo(e.cx + e.x01, e.cy + e.y01), d < w ? 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) || !(T > y) ? a.lineTo(M, N) : x > y ? (e = V(M, N, Q, U, r, -x, t), u = V(H, J, W, X, r, -x, t), a.lineTo(e.cx + e.x01, e.cy + e.y01), x < w ? 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, b, 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, P(m) * n];
}, i.innerRadius = function(n) {
return arguments.length ? (l = typeof n == "function" ? n : O(+n), i) : l;
}, i.outerRadius = function(n) {
return arguments.length ? (h = typeof n == "function" ? n : O(+n), i) : h;
}, i.cornerRadius = function(n) {
return arguments.length ? (z = typeof n == "function" ? n : O(+n), i) : z;
}, i.padRadius = function(n) {
return arguments.length ? (D = n == null ? null : typeof n == "function" ? n : O(+n), i) : D;
}, i.startAngle = function(n) {
return arguments.length ? (v = typeof n == "function" ? n : O(+n), i) : v;
}, i.endAngle = function(n) {
return arguments.length ? (A = typeof n == "function" ? n : O(+n), i) : A;
}, i.padAngle = function(n) {
return arguments.length ? (S = typeof n == "function" ? n : O(+n), i) : S;
}, i.context = function(n) {
return arguments.length ? (a = n ?? null, i) : a;
}, i;
}
export {
vn as a
};