import { __name as T } from "./chunk-AGHRB4JF.js";
var c = {
  aggregation: 17.25,
  extension: 17.25,
  composition: 17.25,
  dependency: 6,
  lollipop: 13.5,
  arrow_point: 4
  //arrow_cross: 24,
}, b = {
  arrow_point: 9,
  arrow_cross: 12.5,
  arrow_circle: 12.5
};
function w(t, o) {
  if (t === void 0 || o === void 0)
    return { angle: 0, deltaX: 0, deltaY: 0 };
  t = n(t), o = n(o);
  const [f, e] = [t.x, t.y], [s, h] = [o.x, o.y], l = s - f, g = h - e;
  return { angle: Math.atan(g / l), deltaX: l, deltaY: g };
}
T(w, "calculateDeltaAndAngle");
var n = /* @__PURE__ */ T((t) => Array.isArray(t) ? { x: t[0], y: t[1] } : t, "pointTransformer"), m = /* @__PURE__ */ T((t) => ({
  x: /* @__PURE__ */ T(function(o, f, e) {
    let s = 0;
    const h = n(e[0]).x < n(e[e.length - 1]).x ? "left" : "right";
    if (f === 0 && Object.hasOwn(c, t.arrowTypeStart)) {
      const { angle: r, deltaX: x } = w(e[0], e[1]);
      s = c[t.arrowTypeStart] * Math.cos(r) * (x >= 0 ? 1 : -1);
    } else if (f === e.length - 1 && Object.hasOwn(c, t.arrowTypeEnd)) {
      const { angle: r, deltaX: x } = w(
        e[e.length - 1],
        e[e.length - 2]
      );
      s = c[t.arrowTypeEnd] * Math.cos(r) * (x >= 0 ? 1 : -1);
    }
    const l = Math.abs(
      n(o).x - n(e[e.length - 1]).x
    ), g = Math.abs(
      n(o).y - n(e[e.length - 1]).y
    ), i = Math.abs(n(o).x - n(e[0]).x), M = Math.abs(n(o).y - n(e[0]).y), a = c[t.arrowTypeStart], y = c[t.arrowTypeEnd], u = 1;
    if (l < y && l > 0 && g < y) {
      let r = y + u - l;
      r *= h === "right" ? -1 : 1, s -= r;
    }
    if (i < a && i > 0 && M < a) {
      let r = a + u - i;
      r *= h === "right" ? -1 : 1, s += r;
    }
    return n(o).x + s;
  }, "x"),
  y: /* @__PURE__ */ T(function(o, f, e) {
    let s = 0;
    const h = n(e[0]).y < n(e[e.length - 1]).y ? "down" : "up";
    if (f === 0 && Object.hasOwn(c, t.arrowTypeStart)) {
      const { angle: r, deltaY: x } = w(e[0], e[1]);
      s = c[t.arrowTypeStart] * Math.abs(Math.sin(r)) * (x >= 0 ? 1 : -1);
    } else if (f === e.length - 1 && Object.hasOwn(c, t.arrowTypeEnd)) {
      const { angle: r, deltaY: x } = w(
        e[e.length - 1],
        e[e.length - 2]
      );
      s = c[t.arrowTypeEnd] * Math.abs(Math.sin(r)) * (x >= 0 ? 1 : -1);
    }
    const l = Math.abs(
      n(o).y - n(e[e.length - 1]).y
    ), g = Math.abs(
      n(o).x - n(e[e.length - 1]).x
    ), i = Math.abs(n(o).y - n(e[0]).y), M = Math.abs(n(o).x - n(e[0]).x), a = c[t.arrowTypeStart], y = c[t.arrowTypeEnd], u = 1;
    if (l < y && l > 0 && g < y) {
      let r = y + u - l;
      r *= h === "up" ? -1 : 1, s -= r;
    }
    if (i < a && i > 0 && M < a) {
      let r = a + u - i;
      r *= h === "up" ? -1 : 1, s += r;
    }
    return n(o).y + s;
  }, "y")
}), "getLineFunctionsWithOffset");
export {
  m as getLineFunctionsWithOffset,
  c as markerOffsets,
  b as markerOffsets2
};
