import d from "./array.js";
import o from "./constant.js";
import a from "./curve/linear.js";
import { withPath as v } from "./path.js";
import { x as b, y as w } from "./point.js";
function j(e, r) {
  var m = o(!0), i = null, l = a, u = null, s = v(t);
  e = typeof e == "function" ? e : e === void 0 ? b : o(e), r = typeof r == "function" ? r : r === void 0 ? w : o(r);
  function t(n) {
    var f, h = (n = d(n)).length, p, c = !1, g;
    for (i == null && (u = l(g = s())), f = 0; f <= h; ++f)
      !(f < h && m(p = n[f], f, n)) === c && ((c = !c) ? u.lineStart() : u.lineEnd()), c && u.point(+e(p, f, n), +r(p, f, n));
    if (g) return u = null, g + "" || null;
  }
  return t.x = function(n) {
    return arguments.length ? (e = typeof n == "function" ? n : o(+n), t) : e;
  }, t.y = function(n) {
    return arguments.length ? (r = typeof n == "function" ? n : o(+n), t) : r;
  }, t.defined = function(n) {
    return arguments.length ? (m = typeof n == "function" ? n : o(!!n), t) : m;
  }, t.curve = function(n) {
    return arguments.length ? (l = n, i != null && (u = l(i)), t) : l;
  }, t.context = function(n) {
    return arguments.length ? (n == null ? i = u = null : u = l(i = n), t) : i;
  }, t;
}
export {
  j as default
};
