import { t } from './array-2ff2c7a6.esm.js';
import { q, P as P$1 } from './path-428ebac9.esm.js';
import { D as Df } from './index.esm2.js';

function w(t) {
    return t[0];
}
function b(t) {
    return t[1];
}
function P(t$1, u) {
    var s = P$1(true), i = null, l = Df, r = null, m = q(e);
    t$1 = typeof t$1 == "function" ? t$1 : t$1 === void 0 ? w : P$1(t$1), u = typeof u == "function" ? u : u === void 0 ? b : P$1(u);
    function e(n) {
        var f, g = (n = t(n)).length, p, c = false, a;
        for(i == null && (r = l(a = m())), f = 0; f <= g; ++f)!(f < g && s(p = n[f], f, n)) === c && ((c = !c) ? r.lineStart() : r.lineEnd()), c && r.point(+t$1(p, f, n), +u(p, f, n));
        if (a) return r = null, a + "" || null;
    }
    return e.x = function(n) {
        return arguments.length ? (t$1 = typeof n == "function" ? n : P$1(+n), e) : t$1;
    }, e.y = function(n) {
        return arguments.length ? (u = typeof n == "function" ? n : P$1(+n), e) : u;
    }, e.defined = function(n) {
        return arguments.length ? (s = typeof n == "function" ? n : P$1(!!n), e) : s;
    }, e.curve = function(n) {
        return arguments.length ? (l = n, i != null && (r = l(i)), e) : l;
    }, e.context = function(n) {
        return arguments.length ? (n == null ? i = r = null : r = l(i = n), e) : i;
    }, e;
}

export { P };
