pkg_index.js

let wasm;

const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );

if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };

let cachedUint8ArrayMemory0 = null;

function getUint8ArrayMemory0() {
    if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
        cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
    }
    return cachedUint8ArrayMemory0;
}

function getStringFromWasm0(ptr, len) {
    ptr = ptr >>> 0;
    return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}

function debugString(val) {
    // primitive types
    const type = typeof val;
    if (type == 'number' || type == 'boolean' || val == null) {
        return  `${val}`;
    }
    if (type == 'string') {
        return `"${val}"`;
    }
    if (type == 'symbol') {
        const description = val.description;
        if (description == null) {
            return 'Symbol';
        } else {
            return `Symbol(${description})`;
        }
    }
    if (type == 'function') {
        const name = val.name;
        if (typeof name == 'string' && name.length > 0) {
            return `Function(${name})`;
        } else {
            return 'Function';
        }
    }
    // objects
    if (Array.isArray(val)) {
        const length = val.length;
        let debug = '[';
        if (length > 0) {
            debug += debugString(val[0]);
        }
        for(let i = 1; i < length; i++) {
            debug += ', ' + debugString(val[i]);
        }
        debug += ']';
        return debug;
    }
    // Test for built-in
    const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
    let className;
    if (builtInMatches && builtInMatches.length > 1) {
        className = builtInMatches[1];
    } else {
        // Failed to match the standard '[object ClassName]'
        return toString.call(val);
    }
    if (className == 'Object') {
        // we're a user defined class or Object
        // JSON.stringify avoids problems with cycles, and is generally much
        // easier than looping through ownProperties of `val`.
        try {
            return 'Object(' + JSON.stringify(val) + ')';
        } catch (_) {
            return 'Object';
        }
    }
    // errors
    if (val instanceof Error) {
        return `${val.name}: ${val.message}\n${val.stack}`;
    }
    // TODO we could test for more things here, like `Set`s and `Map`s.
    return className;
}

let WASM_VECTOR_LEN = 0;

const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );

const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
    ? function (arg, view) {
    return cachedTextEncoder.encodeInto(arg, view);
}
    : function (arg, view) {
    const buf = cachedTextEncoder.encode(arg);
    view.set(buf);
    return {
        read: arg.length,
        written: buf.length
    };
});

function passStringToWasm0(arg, malloc, realloc) {

    if (realloc === undefined) {
        const buf = cachedTextEncoder.encode(arg);
        const ptr = malloc(buf.length, 1) >>> 0;
        getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
        WASM_VECTOR_LEN = buf.length;
        return ptr;
    }

    let len = arg.length;
    let ptr = malloc(len, 1) >>> 0;

    const mem = getUint8ArrayMemory0();

    let offset = 0;

    for (; offset < len; offset++) {
        const code = arg.charCodeAt(offset);
        if (code > 0x7F) break;
        mem[ptr + offset] = code;
    }

    if (offset !== len) {
        if (offset !== 0) {
            arg = arg.slice(offset);
        }
        ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
        const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
        const ret = encodeString(arg, view);

        offset += ret.written;
        ptr = realloc(ptr, len, offset, 1) >>> 0;
    }

    WASM_VECTOR_LEN = offset;
    return ptr;
}

let cachedDataViewMemory0 = null;

function getDataViewMemory0() {
    if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
        cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
    }
    return cachedDataViewMemory0;
}

function isLikeNone(x) {
    return x === undefined || x === null;
}

function _assertClass(instance, klass) {
    if (!(instance instanceof klass)) {
        throw new Error(`expected instance of ${klass.name}`);
    }
}

function addToExternrefTable0(obj) {
    const idx = wasm.__externref_table_alloc();
    wasm.__wbindgen_export_2.set(idx, obj);
    return idx;
}

function passArrayJsValueToWasm0(array, malloc) {
    const ptr = malloc(array.length * 4, 4) >>> 0;
    for (let i = 0; i < array.length; i++) {
        const add = addToExternrefTable0(array[i]);
        getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
    }
    WASM_VECTOR_LEN = array.length;
    return ptr;
}

function getArrayJsValueFromWasm0(ptr, len) {
    ptr = ptr >>> 0;
    const mem = getDataViewMemory0();
    const result = [];
    for (let i = ptr; i < ptr + 4 * len; i += 4) {
        result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
    }
    wasm.__externref_drop_slice(ptr, len);
    return result;
}

function takeFromExternrefTable0(idx) {
    const value = wasm.__wbindgen_export_2.get(idx);
    wasm.__externref_table_dealloc(idx);
    return value;
}

function passArray8ToWasm0(arg, malloc) {
    const ptr = malloc(arg.length * 1, 1) >>> 0;
    getUint8ArrayMemory0().set(arg, ptr / 1);
    WASM_VECTOR_LEN = arg.length;
    return ptr;
}

function getArrayU8FromWasm0(ptr, len) {
    ptr = ptr >>> 0;
    return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}

let cachedFloat32ArrayMemory0 = null;

function getFloat32ArrayMemory0() {
    if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
        cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
    }
    return cachedFloat32ArrayMemory0;
}

function passArrayF32ToWasm0(arg, malloc) {
    const ptr = malloc(arg.length * 4, 4) >>> 0;
    getFloat32ArrayMemory0().set(arg, ptr / 4);
    WASM_VECTOR_LEN = arg.length;
    return ptr;
}

let cachedUint32ArrayMemory0 = null;

function getUint32ArrayMemory0() {
    if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
        cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
    }
    return cachedUint32ArrayMemory0;
}

function passArray32ToWasm0(arg, malloc) {
    const ptr = malloc(arg.length * 4, 4) >>> 0;
    getUint32ArrayMemory0().set(arg, ptr / 4);
    WASM_VECTOR_LEN = arg.length;
    return ptr;
}

function getArrayF32FromWasm0(ptr, len) {
    ptr = ptr >>> 0;
    return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
 * Linearly interpolates between two values given a progress value.
 * @param {number} a - The start value.
 * @param {number} b - The end value.
 * @param {number} t - The progress value.
 * @returns {number} The interpolated value.
 */
export function lerp(a, b, t) {
    const ret = wasm.lerp(a, b, t);
    return ret;
}

/**
 * Returns the progress value between two numbers given an interpolated value.
 * @param {number} a - The start value.
 * @param {number} b - The end value.
 * @param {number} value - The value to find the progress of.
 * @returns {number} The progress value.
 */
export function inverse_lerp(a, b, value) {
    const ret = wasm.inverse_lerp(a, b, value);
    return ret;
}

/**
 * Multiplies two matrices together.
 * @param {number[]} a - The first matrix to multiply as a flat array.
 * @param {number[]} b - The second matrix to multiply as a flat array.
 * @param {number} a_rows - The number of rows in the first matrix.
 * @param {number} a_columns - The number of columns in the first matrix.
 * @param {number} b_columns - The number of columns in the second matrix.
 * @returns {number[]} The product of the two matrices.
 */
export function matrix_product(a, b, a_rows, a_columns, b_columns) {
    const ptr0 = passArrayF32ToWasm0(a, wasm.__wbindgen_malloc);
    const len0 = WASM_VECTOR_LEN;
    const ptr1 = passArrayF32ToWasm0(b, wasm.__wbindgen_malloc);
    const len1 = WASM_VECTOR_LEN;
    const ret = wasm.matrix_product(ptr0, len0, ptr1, len1, a_rows, a_columns, b_columns);
    var v3 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
    wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
    return v3;
}

/**
 * Multiplies a matrix by a path of 2D points, returning a new path.
 * @param {number[]} matrix - The matrix to multiply as a flat array.
 * @param {Path2D} path - The path to multiply.
 * @param {number} a_rows - The number of rows in the first matrix.
 * @param {number} a_columns - The number of columns in the first matrix.
 * @param {number} b_columns - The number of columns in the second matrix.
 * @returns {Path2D} The product of the matrix and the path.
 */
export function matrix_product_path(matrix, path, a_rows, a_columns, b_columns) {
    const ptr0 = passArrayF32ToWasm0(matrix, wasm.__wbindgen_malloc);
    const len0 = WASM_VECTOR_LEN;
    _assertClass(path, Path2D);
    const ret = wasm.matrix_product_path(ptr0, len0, path.__wbg_ptr, a_rows, a_columns, b_columns);
    return Path2D.__wrap(ret);
}

const AnchorsAndHandlesFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_anchorsandhandles_free(ptr >>> 0, 1));
/**
 * Start anchors, first control points, second control points, and end anchors of a path.
 */
export class AnchorsAndHandles {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(AnchorsAndHandles.prototype);
        obj.__wbg_ptr = ptr;
        AnchorsAndHandlesFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        AnchorsAndHandlesFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_anchorsandhandles_free(ptr, 0);
    }
    /**
     * Creates a new AnchorsAndHandles object.
     * @param {Point2D[]} start_anchors - The start anchors of the path.
     * @param {Point2D[]} first_controls - The first control points of the path.
     * @param {Point2D[]} second_controls - The second control points of the path.
     * @param {Point2D[]} end_anchors - The end anchors of the path.
     */
    constructor(start_anchors, first_controls, second_controls, end_anchors) {
        const ptr0 = passArrayJsValueToWasm0(start_anchors, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ptr1 = passArrayJsValueToWasm0(first_controls, wasm.__wbindgen_malloc);
        const len1 = WASM_VECTOR_LEN;
        const ptr2 = passArrayJsValueToWasm0(second_controls, wasm.__wbindgen_malloc);
        const len2 = WASM_VECTOR_LEN;
        const ptr3 = passArrayJsValueToWasm0(end_anchors, wasm.__wbindgen_malloc);
        const len3 = WASM_VECTOR_LEN;
        const ret = wasm.anchorsandhandles_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        this.__wbg_ptr = ret[0] >>> 0;
        AnchorsAndHandlesFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Creates a AnchorsAndHandles object from a Path2D object.
     * @param {Path2D} path - The path to extract the anchors and handles from.
     * @returns {AnchorsAndHandles} An object containing the start anchors, first control points, second control points, and end anchors of a path.
     */
    static from_path(path) {
        _assertClass(path, Path2D);
        var ptr0 = path.__destroy_into_raw();
        const ret = wasm.anchorsandhandles_from_path(ptr0);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        return AnchorsAndHandles.__wrap(ret[0]);
    }
    /**
     * Returns the start anchors of the path.
     * @returns {Point2D[]} The start anchors of the path.
     */
    get start_anchors() {
        const ret = wasm.anchorsandhandles_start_anchors(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Returns the first control points of the path.
     * @returns {Point2D[]} The first control points of the path.
     */
    get first_controls() {
        const ret = wasm.anchorsandhandles_first_controls(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Returns the second control points of the path.
     * @returns {Point2D[]} The second control points of the path.
     */
    get second_controls() {
        const ret = wasm.anchorsandhandles_second_controls(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Returns the end anchors of the path.
     * @returns {Point2D[]} The end anchors of the path.
     */
    get end_anchors() {
        const ret = wasm.anchorsandhandles_end_anchors(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Returns the number of cubic bezier curves in the path.
     * @returns {number} The number of cubic bezier curves in the path.
     */
    get len() {
        const ret = wasm.anchorsandhandles_len(this.__wbg_ptr);
        return ret >>> 0;
    }
    /**
     * Clones the AnchorsAndHandles object.
     * @returns {AnchorsAndHandles}
     */
    clone() {
        const ret = wasm.anchorsandhandles_clone(this.__wbg_ptr);
        return AnchorsAndHandles.__wrap(ret);
    }
}

const ArcFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_arc_free(ptr >>> 0, 1));
/**
 * An Arc is a portion of the circumference of a circle.
 */
export class Arc {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Arc.prototype);
        obj.__wbg_ptr = ptr;
        ArcFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        ArcFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_arc_free(ptr, 0);
    }
    /**
     * Creates a new Arc object from a center point, radius, start angle, and end angle.
     * @param {Point2D} center - The center point of the arc as a Point2D.
     * @param {number} radius - The radius of the arc.
     * @param {number} start_angle - The start angle of the arc in radians.
     * @param {number} end_angle - The end angle of the arc in radians.
     */
    constructor(center, radius, start_angle, end_angle) {
        _assertClass(center, Point2D);
        var ptr0 = center.__destroy_into_raw();
        const ret = wasm.arc_new(ptr0, radius, start_angle, end_angle);
        this.__wbg_ptr = ret >>> 0;
        ArcFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Creates a new vector object builder with the arc's points.
     * @param {number | null} [samples]
     * @returns {VectorObjectBuilder} A VectorObjectBuilder representing the arc.
     */
    vector_object_builder(samples) {
        const ret = wasm.arc_vector_object_builder(this.__wbg_ptr, isLikeNone(samples) ? 0x100000001 : (samples) >>> 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the center point of the arc.
     * @returns {Point2D} The center point of the arc as a Point2D.
     */
    get center() {
        const ret = wasm.arc_center(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the radius of the arc.
     * @returns {number} The radius of the arc.
     */
    get radius() {
        const ret = wasm.arc_radius(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the start angle of the arc in radians.
     * @returns {number} The start angle of the arc in radians.
     */
    get start_angle() {
        const ret = wasm.arc_start_angle(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the end angle of the arc in radians.
     * @returns {number} The end angle of the arc in radians.
     */
    get end_angle() {
        const ret = wasm.arc_end_angle(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns a VectorObjectBuilder representing the arc and a tip at the start of the arc.
     * @param {VectorObjectBuilder} tip_shape - The tip shape as a VectorObjectBuilder to add to the start of the arc. It must be pointing to the right and centered at (0, 0). This function will rotate and move it to the correct angle.
     * @param {number | null} [samples] - The number of samples to use to create the arc, by default 15.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder representing the arc and a tip at the start of the arc.
     */
    start_tip_vector_object_builder(tip_shape, samples) {
        _assertClass(tip_shape, VectorObjectBuilder);
        var ptr0 = tip_shape.__destroy_into_raw();
        const ret = wasm.arc_start_tip_vector_object_builder(this.__wbg_ptr, ptr0, isLikeNone(samples) ? 0x100000001 : (samples) >>> 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns a VectorObjectBuilder representing the arc and a tip at the end of the arc.
     * @param {VectorObjectBuilder} tip_shape - The tip shape as a VectorObjectBuilder to add to the end of the arc. It must be pointing to the right and centered at (0, 0). This function will rotate and move it to the correct angle.
     * @param {number | null} [samples] - The number of samples to use to create the arc.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder representing the arc and a tip at the end of the arc.
     */
    end_tip_vector_object_builder(tip_shape, samples) {
        _assertClass(tip_shape, VectorObjectBuilder);
        var ptr0 = tip_shape.__destroy_into_raw();
        const ret = wasm.arc_end_tip_vector_object_builder(this.__wbg_ptr, ptr0, isLikeNone(samples) ? 0x100000001 : (samples) >>> 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns a VectorObjectBuilder representing the arc and tips at both ends of the arc.
     * @param {VectorObjectBuilder} tip_shape - The tip shape as a VectorObjectBuilder to add to the start of the arc. It must be pointing to the right and centered at (0, 0). This function will rotate and move it to the correct angle.
     * @param {number | null} [samples] - The number of samples to use to create the arc.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder representing the arc and tips at both ends of the arc.
     */
    both_tips_vector_object_builder(tip_shape, samples) {
        _assertClass(tip_shape, VectorObjectBuilder);
        var ptr0 = tip_shape.__destroy_into_raw();
        const ret = wasm.arc_both_tips_vector_object_builder(this.__wbg_ptr, ptr0, isLikeNone(samples) ? 0x100000001 : (samples) >>> 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the point on the arc at a given t progress value.
     * @param {number} t - The t value to evaluate the polynomial at. A number between 0 and 1.
     * @returns {Point2D} The Point2D on the arc at the given t value.
     */
    point_at(t) {
        const ret = wasm.arc_point_at(this.__wbg_ptr, t);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the length of the arc.
     * @returns {number} The length of the arc.
     */
    length() {
        const ret = wasm.arc_length(this.__wbg_ptr);
        return ret;
    }
}

const AxisFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_axis_free(ptr >>> 0, 1));
/**
 * An Axis for plotting data.
 */
export class Axis {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Axis.prototype);
        obj.__wbg_ptr = ptr;
        AxisFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        AxisFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_axis_free(ptr, 0);
    }
    /**
     * Creates a new Axis with the given range and label.
     * @param {ClosedInterval} range - The range of the axis.
     * @param {Point2D} render_start - The minimum coordinates of the axis when rendered.
     * @param {Point2D} render_end - The maximum coordinates of the axis when rendered.
     * @param {VectorObjectBuilder | null} [label] - The label of the axis.
     * @param {Tick[] | null} [ticks] - The ticks of the axis.
     * @param {Style | null} [style] - The style of the axis.
     * @param {number | null} [stroke_width] - The stroke width of the axis.
     */
    constructor(range, render_start, render_end, label, ticks, style, stroke_width) {
        _assertClass(range, ClosedInterval);
        var ptr0 = range.__destroy_into_raw();
        _assertClass(render_start, Point2D);
        var ptr1 = render_start.__destroy_into_raw();
        _assertClass(render_end, Point2D);
        var ptr2 = render_end.__destroy_into_raw();
        let ptr3 = 0;
        if (!isLikeNone(label)) {
            _assertClass(label, VectorObjectBuilder);
            ptr3 = label.__destroy_into_raw();
        }
        var ptr4 = isLikeNone(ticks) ? 0 : passArrayJsValueToWasm0(ticks, wasm.__wbindgen_malloc);
        var len4 = WASM_VECTOR_LEN;
        let ptr5 = 0;
        if (!isLikeNone(style)) {
            _assertClass(style, Style);
            ptr5 = style.__destroy_into_raw();
        }
        const ret = wasm.axis_new(ptr0, ptr1, ptr2, ptr3, ptr4, len4, ptr5, isLikeNone(stroke_width) ? 0x100000001 : Math.fround(stroke_width));
        this.__wbg_ptr = ret >>> 0;
        AxisFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the range of the axis.
     * @returns {ClosedInterval} The range of the axis.
     */
    get range() {
        const ret = wasm.axis_range(this.__wbg_ptr);
        return ClosedInterval.__wrap(ret);
    }
    /**
     * Returns the minimum x-coordinate of the axis when rendered.
     * @returns {Point2D} The minimum x-coordinate of the axis when rendered.
     */
    get render_start() {
        const ret = wasm.axis_render_start(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the maximum x-coordinate of the axis when rendered.
     * @returns {Point2D} The maximum x-coordinate of the axis when rendered.
     */
    get render_end() {
        const ret = wasm.axis_render_end(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the label of the axis.
     * @returns {VectorObjectBuilder | undefined} The label of the axis.
     */
    get label() {
        const ret = wasm.axis_label(this.__wbg_ptr);
        return ret === 0 ? undefined : VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the ticks of the axis.
     * @returns {Tick[]} The ticks of the axis.
     */
    get ticks() {
        const ret = wasm.axis_ticks(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Returns the style of the axis.
     * @returns {Style} The style of the axis.
     */
    get style() {
        const ret = wasm.axis_style(this.__wbg_ptr);
        return Style.__wrap(ret);
    }
    /**
     * Returns the number of ticks on the axis.
     * @returns {number} The number of ticks on the axis.
     */
    get num_ticks() {
        const ret = wasm.axis_num_ticks(this.__wbg_ptr);
        return ret >>> 0;
    }
    /**
     * Returns the tick at the given number.
     * @param {number} num - The number coo
     * @returns {Tick | undefined} The tick at the given number.
     */
    tick(num) {
        const ret = wasm.axis_tick(this.__wbg_ptr, num);
        return ret === 0 ? undefined : Tick.__wrap(ret);
    }
    /**
     * Gets the coordinates of a point in the axis.
     * @param {number} num
     * @returns {Point2D} The coordinates of the point in the axis.
     */
    coord_to_point(num) {
        const ret = wasm.axis_coord_to_point(this.__wbg_ptr, num);
        return Point2D.__wrap(ret);
    }
    /**
     * Gets the value of a point in the axis.
     * @param {Point2D} point
     * @returns {number} The value of the point in the axis.
     */
    point_to_coord(point) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        const ret = wasm.axis_point_to_coord(this.__wbg_ptr, ptr0);
        return ret;
    }
    /**
     * Gets the VectorObjectBuilder such that when built and rendered, the axis is drawn.
     * @param {Point2D | null} [label_direction] - The direction of the label. The default is (1, 0).
     * @param {number | null} [label_offset] - The offset of the label. The default is 20.0.
     * @param {Point2D | null} [tick_label_direction] - The direction of the tick label. The default is (0, 1).
     * @param {number | null} [tick_label_offset] - The offset of the tick label. The default is 10.0.
     * @param {boolean | null} [add_label] - Whether to add the axis label. The default is true.
     * @returns {VectorObjectBuilder} A vector object builder with the axis.
     */
    vector_object_builder(label_direction, label_offset, tick_label_direction, tick_label_offset, add_label) {
        let ptr0 = 0;
        if (!isLikeNone(label_direction)) {
            _assertClass(label_direction, Point2D);
            ptr0 = label_direction.__destroy_into_raw();
        }
        let ptr1 = 0;
        if (!isLikeNone(tick_label_direction)) {
            _assertClass(tick_label_direction, Point2D);
            ptr1 = tick_label_direction.__destroy_into_raw();
        }
        const ret = wasm.axis_vector_object_builder(this.__wbg_ptr, ptr0, isLikeNone(label_offset) ? 0x100000001 : Math.fround(label_offset), ptr1, isLikeNone(tick_label_offset) ? 0x100000001 : Math.fround(tick_label_offset), isLikeNone(add_label) ? 0xFFFFFF : add_label ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the VectorObjectBuilder with the axis and tip at the end.
     * @param {VectorObjectBuilder} tip_shape - The shape of the tip. The shape must be pointing to the right and centered to (0, 0), this function will rotate and move it to the correct angle.
     * @param {Point2D | null} [label_direction] - The direction of the label. The default is (1, 0).
     * @param {number | null} [label_offset] - The offset of the label. The default is 20.0.
     * @param {Point2D | null} [tick_label_direction] - The direction of the tick label. The default is (0, 1).
     * @param {number | null} [tick_label_offset] - The offset of the tick label. The default is 10.0.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder with the axis and tip at the end.
     */
    with_tip_at_the_end(tip_shape, label_direction, label_offset, tick_label_direction, tick_label_offset) {
        _assertClass(tip_shape, VectorObjectBuilder);
        var ptr0 = tip_shape.__destroy_into_raw();
        let ptr1 = 0;
        if (!isLikeNone(label_direction)) {
            _assertClass(label_direction, Point2D);
            ptr1 = label_direction.__destroy_into_raw();
        }
        let ptr2 = 0;
        if (!isLikeNone(tick_label_direction)) {
            _assertClass(tick_label_direction, Point2D);
            ptr2 = tick_label_direction.__destroy_into_raw();
        }
        const ret = wasm.axis_with_tip_at_the_end(this.__wbg_ptr, ptr0, ptr1, isLikeNone(label_offset) ? 0x100000001 : Math.fround(label_offset), ptr2, isLikeNone(tick_label_offset) ? 0x100000001 : Math.fround(tick_label_offset));
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the VectorObjectBuilder with the axis and tips at both ends.
     * @param {VectorObjectBuilder} tip_shape - The shape of the tip. The shape must be pointing to the right, this function will rotate and move it to the correct angle.
     * @param {Point2D | null} [label_direction] - The direction of the label. The default is (1, 0).
     * @param {number | null} [label_offset] - The offset of the label. The default is 20.0.
     * @param {Point2D | null} [tick_label_direction] - The direction of the tick label. The default is (0, 1).
     * @param {number | null} [tick_label_offset] - The offset of the tick label. The default is 10.0.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder with the axis and tips at both ends.
     */
    with_tips_at_both_ends(tip_shape, label_direction, label_offset, tick_label_direction, tick_label_offset) {
        _assertClass(tip_shape, VectorObjectBuilder);
        var ptr0 = tip_shape.__destroy_into_raw();
        let ptr1 = 0;
        if (!isLikeNone(label_direction)) {
            _assertClass(label_direction, Point2D);
            ptr1 = label_direction.__destroy_into_raw();
        }
        let ptr2 = 0;
        if (!isLikeNone(tick_label_direction)) {
            _assertClass(tick_label_direction, Point2D);
            ptr2 = tick_label_direction.__destroy_into_raw();
        }
        const ret = wasm.axis_with_tips_at_both_ends(this.__wbg_ptr, ptr0, ptr1, isLikeNone(label_offset) ? 0x100000001 : Math.fround(label_offset), ptr2, isLikeNone(tick_label_offset) ? 0x100000001 : Math.fround(tick_label_offset));
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Clones the axis.
     * @returns {Axis}
     */
    clone() {
        const ret = wasm.axis_clone(this.__wbg_ptr);
        return Axis.__wrap(ret);
    }
}

const BoundingBoxFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_boundingbox_free(ptr >>> 0, 1));
/**
 * A bounding box is a rectangle that contains a set of points.
 */
export class BoundingBox {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(BoundingBox.prototype);
        obj.__wbg_ptr = ptr;
        BoundingBoxFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        BoundingBoxFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_boundingbox_free(ptr, 0);
    }
    /**
     * Creates a new bounding box from a minimum x-coordinate, minimum y-coordinate, width, and height.
     * @param {number} min_x - The minimum x-coordinate of the bounding box.
     * @param {number} min_y - The minimum y-coordinate of the bounding box.
     * @param {number} width - The width of the bounding box.
     * @param {number} height - The height of the bounding box.
     */
    constructor(min_x, min_y, width, height) {
        const ret = wasm.boundingbox_new(min_x, min_y, width, height);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        this.__wbg_ptr = ret[0] >>> 0;
        BoundingBoxFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Clones the bounding box.
     * @returns {BoundingBox}
     */
    clone() {
        const ret = wasm.boundingbox_clone(this.__wbg_ptr);
        return BoundingBox.__wrap(ret);
    }
    /**
     * Creates the instance of a path's bounding box.
     * @param {Path2D} path - The path to calculate the bounding box of.
     * @returns {BoundingBox | undefined} The bounding box of the path.
     */
    static from_path(path) {
        _assertClass(path, Path2D);
        const ret = wasm.boundingbox_from_path(path.__wbg_ptr);
        return ret === 0 ? undefined : BoundingBox.__wrap(ret);
    }
    /**
     * Gets the minimum x-coordinate of the bounding box.
     * @returns {number} The minimum x-coordinate of the bounding box.
     */
    get min_x() {
        const ret = wasm.boundingbox_min_x(this.__wbg_ptr);
        return ret;
    }
    /**
     * Gets the minimum y-coordinate of the bounding box.
     * @returns {number} The minimum y-coordinate of the bounding box.
     */
    get min_y() {
        const ret = wasm.boundingbox_min_y(this.__wbg_ptr);
        return ret;
    }
    /**
     * Gets the width of the bounding box.
     * @returns {number} The width of the bounding box.
     */
    get width() {
        const ret = wasm.boundingbox_width(this.__wbg_ptr);
        return ret;
    }
    /**
     * Gets the height of the bounding box.
     * @returns {number} The height of the bounding box.
     */
    get height() {
        const ret = wasm.boundingbox_height(this.__wbg_ptr);
        return ret;
    }
    /**
     * Checks if a point is contained within the bounding box.
     * @param {Point2D} point - The point to check if it is contained within the bounding box.
     * @returns {boolean} A boolean indicating if the point is contained within the bounding box.
     */
    contains(point) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        const ret = wasm.boundingbox_contains(this.__wbg_ptr, ptr0);
        return ret !== 0;
    }
    /**
     * Checks if the bounding box overlaps with another bounding box.
     * @param {BoundingBox} other - The other bounding box to check for intersection.
     * @returns {boolean} A boolean indicating if the bounding box overlaps with the other bounding box.
     */
    intersects(other) {
        _assertClass(other, BoundingBox);
        const ret = wasm.boundingbox_intersects(this.__wbg_ptr, other.__wbg_ptr);
        return ret !== 0;
    }
    /**
     * Returns the intersection of the bounding box with another bounding box, it means the area that is common to both bounding boxes.
     * @param {BoundingBox | null} [_this] - The bounding box to intersect with.
     * @param {BoundingBox | null} [other] - The other bounding box to intersect with.
     * @returns {BoundingBox | undefined} The intersection of the bounding box with the other bounding box.
     */
    static intersection(_this, other) {
        let ptr0 = 0;
        if (!isLikeNone(_this)) {
            _assertClass(_this, BoundingBox);
            ptr0 = _this.__destroy_into_raw();
        }
        let ptr1 = 0;
        if (!isLikeNone(other)) {
            _assertClass(other, BoundingBox);
            ptr1 = other.__destroy_into_raw();
        }
        const ret = wasm.boundingbox_intersection(ptr0, ptr1);
        return ret === 0 ? undefined : BoundingBox.__wrap(ret);
    }
    /**
     * Returns the union of the bounding box with another bounding box, it means the smallest bounding box that contains both bounding boxes.
     * @param {BoundingBox | null} [_this] - The bounding box to union with.
     * @param {BoundingBox | null} [other] - The other bounding box to union with.
     * @returns {BoundingBox | undefined} The union of the bounding box with the other bounding box.
     */
    static union(_this, other) {
        let ptr0 = 0;
        if (!isLikeNone(_this)) {
            _assertClass(_this, BoundingBox);
            ptr0 = _this.__destroy_into_raw();
        }
        let ptr1 = 0;
        if (!isLikeNone(other)) {
            _assertClass(other, BoundingBox);
            ptr1 = other.__destroy_into_raw();
        }
        const ret = wasm.boundingbox_union(ptr0, ptr1);
        return ret === 0 ? undefined : BoundingBox.__wrap(ret);
    }
    /**
     * Returns the center point of the bounding box.
     * @returns {Point2D} The center of the bounding box.
     */
    get center() {
        const ret = wasm.boundingbox_center(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
}

const CartesianAxesFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_cartesianaxes_free(ptr >>> 0, 1));
/**
 * A CartesianAxes represents the axes of a Cartesian plot.
 */
export class CartesianAxes {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(CartesianAxes.prototype);
        obj.__wbg_ptr = ptr;
        CartesianAxesFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        CartesianAxesFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_cartesianaxes_free(ptr, 0);
    }
    /**
     * Creates a new CartesianAxes with the given x and y axes.
     * @param {ClosedInterval} x_range - The x-range of the Cartesian axes.
     * @param {ClosedInterval} y_range - The y-range of the Cartesian axes.
     * @param {Point2D} render_start - The minimum coordinates of the Cartesian axes when rendered.
     * @param {Point2D} render_end - The maximum coordinates of the Cartesian axes when rendered.
     * @param {Style | null} [style] - The style of each axis.
     * @param {number | null} [stroke_width] - The stroke width of each axis.
     * @param {VectorObjectBuilder | null} [x_label] - The x-axis label.
     * @param {VectorObjectBuilder | null} [y_label] - The y-axis label.
     * @param {Tick[] | null} [x_ticks] - The x-axis ticks.
     * @param {Tick[] | null} [y_ticks] - The y-axis ticks.
     */
    constructor(x_range, y_range, render_start, render_end, style, stroke_width, x_label, y_label, x_ticks, y_ticks) {
        _assertClass(x_range, ClosedInterval);
        var ptr0 = x_range.__destroy_into_raw();
        _assertClass(y_range, ClosedInterval);
        var ptr1 = y_range.__destroy_into_raw();
        _assertClass(render_start, Point2D);
        var ptr2 = render_start.__destroy_into_raw();
        _assertClass(render_end, Point2D);
        var ptr3 = render_end.__destroy_into_raw();
        let ptr4 = 0;
        if (!isLikeNone(style)) {
            _assertClass(style, Style);
            ptr4 = style.__destroy_into_raw();
        }
        let ptr5 = 0;
        if (!isLikeNone(x_label)) {
            _assertClass(x_label, VectorObjectBuilder);
            ptr5 = x_label.__destroy_into_raw();
        }
        let ptr6 = 0;
        if (!isLikeNone(y_label)) {
            _assertClass(y_label, VectorObjectBuilder);
            ptr6 = y_label.__destroy_into_raw();
        }
        var ptr7 = isLikeNone(x_ticks) ? 0 : passArrayJsValueToWasm0(x_ticks, wasm.__wbindgen_malloc);
        var len7 = WASM_VECTOR_LEN;
        var ptr8 = isLikeNone(y_ticks) ? 0 : passArrayJsValueToWasm0(y_ticks, wasm.__wbindgen_malloc);
        var len8 = WASM_VECTOR_LEN;
        const ret = wasm.cartesianaxes_new(ptr0, ptr1, ptr2, ptr3, ptr4, isLikeNone(stroke_width) ? 0x100000001 : Math.fround(stroke_width), ptr5, ptr6, ptr7, len7, ptr8, len8);
        this.__wbg_ptr = ret >>> 0;
        CartesianAxesFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the x-axis of the Cartesian axes.
     * @returns {Axis} The x-axis of the Cartesian axes.
     */
    get x_axis() {
        const ret = wasm.cartesianaxes_x_axis(this.__wbg_ptr);
        return Axis.__wrap(ret);
    }
    /**
     * Returns the y-axis of the Cartesian axes.
     * @returns {Axis} The y-axis of the Cartesian axes.
     */
    get y_axis() {
        const ret = wasm.cartesianaxes_y_axis(this.__wbg_ptr);
        return Axis.__wrap(ret);
    }
    /**
     * Gets the VectorObjectBuilder such that when built and rendered, the Cartesian axes are drawn.
     * @param {Point2D | null} [x_label_direction] - The direction of the x-label. The default is (1, 0).
     * @param {number | null} [x_label_offset] - The offset of the x-label. The default is 20.0.
     * @param {Point2D | null} [x_tick_label_direction] - The direction of the x-tick label. The default is (0, 1).
     * @param {number | null} [x_tick_label_offset] - The offset of the x-tick label. The default is 10.0.
     * @param {Point2D | null} [y_label_direction] - The direction of the y-label. The default is (1, 0).
     * @param {number | null} [y_label_offset] - The offset of the y-label. The default is 20.0.
     * @param {Point2D | null} [y_tick_label_direction] - The direction of the y-tick label. The default is (0, 1).
     * @param {number | null} [y_tick_label_offset] - The offset of the y-tick label. The default is 10.0.
     * @returns {VectorObjectBuilder} A vector object builder with the Cartesian axes.
     */
    vector_object_builder(x_label_direction, x_label_offset, x_tick_label_direction, x_tick_label_offset, y_label_direction, y_label_offset, y_tick_label_direction, y_tick_label_offset) {
        let ptr0 = 0;
        if (!isLikeNone(x_label_direction)) {
            _assertClass(x_label_direction, Point2D);
            ptr0 = x_label_direction.__destroy_into_raw();
        }
        let ptr1 = 0;
        if (!isLikeNone(x_tick_label_direction)) {
            _assertClass(x_tick_label_direction, Point2D);
            ptr1 = x_tick_label_direction.__destroy_into_raw();
        }
        let ptr2 = 0;
        if (!isLikeNone(y_label_direction)) {
            _assertClass(y_label_direction, Point2D);
            ptr2 = y_label_direction.__destroy_into_raw();
        }
        let ptr3 = 0;
        if (!isLikeNone(y_tick_label_direction)) {
            _assertClass(y_tick_label_direction, Point2D);
            ptr3 = y_tick_label_direction.__destroy_into_raw();
        }
        const ret = wasm.cartesianaxes_vector_object_builder(this.__wbg_ptr, ptr0, isLikeNone(x_label_offset) ? 0x100000001 : Math.fround(x_label_offset), ptr1, isLikeNone(x_tick_label_offset) ? 0x100000001 : Math.fround(x_tick_label_offset), ptr2, isLikeNone(y_label_offset) ? 0x100000001 : Math.fround(y_label_offset), ptr3, isLikeNone(y_tick_label_offset) ? 0x100000001 : Math.fround(y_tick_label_offset));
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the VectorObjectBuilder with the Cartesian axes and tip at the end of both axes.
     * @param {VectorObjectBuilder} tip_shape - The shape of the tip. The shape must be pointing to the right, this function will rotate and move it to the correct angle.
     * @param {Point2D | null} [x_label_direction] - The direction of the x-label. The default is (1, 0).
     * @param {number | null} [x_label_offset] - The offset of the x-label. The default is 20.0.
     * @param {Point2D | null} [x_tick_label_direction] - The direction of the x-tick label. The default is (0, 1).
     * @param {number | null} [x_tick_label_offset] - The offset of the x-tick label. The default is 10.0.
     * @param {Point2D | null} [y_label_direction] - The direction of the y-label. The default is (1, 0).
     * @param {number | null} [y_label_offset] - The offset of the y-label. The default is 20.0.
     * @param {Point2D | null} [y_tick_label_direction] - The direction of the y-tick label. The default is (0, 1).
     * @param {number | null} [y_tick_label_offset] - The offset of the y-tick label. The default is 10.0.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder with the Cartesian axes and tip at the end of both axes.
     */
    with_tips_at_ends(tip_shape, x_label_direction, x_label_offset, x_tick_label_direction, x_tick_label_offset, y_label_direction, y_label_offset, y_tick_label_direction, y_tick_label_offset) {
        _assertClass(tip_shape, VectorObjectBuilder);
        var ptr0 = tip_shape.__destroy_into_raw();
        let ptr1 = 0;
        if (!isLikeNone(x_label_direction)) {
            _assertClass(x_label_direction, Point2D);
            ptr1 = x_label_direction.__destroy_into_raw();
        }
        let ptr2 = 0;
        if (!isLikeNone(x_tick_label_direction)) {
            _assertClass(x_tick_label_direction, Point2D);
            ptr2 = x_tick_label_direction.__destroy_into_raw();
        }
        let ptr3 = 0;
        if (!isLikeNone(y_label_direction)) {
            _assertClass(y_label_direction, Point2D);
            ptr3 = y_label_direction.__destroy_into_raw();
        }
        let ptr4 = 0;
        if (!isLikeNone(y_tick_label_direction)) {
            _assertClass(y_tick_label_direction, Point2D);
            ptr4 = y_tick_label_direction.__destroy_into_raw();
        }
        const ret = wasm.cartesianaxes_with_tips_at_ends(this.__wbg_ptr, ptr0, ptr1, isLikeNone(x_label_offset) ? 0x100000001 : Math.fround(x_label_offset), ptr2, isLikeNone(x_tick_label_offset) ? 0x100000001 : Math.fround(x_tick_label_offset), ptr3, isLikeNone(y_label_offset) ? 0x100000001 : Math.fround(y_label_offset), ptr4, isLikeNone(y_tick_label_offset) ? 0x100000001 : Math.fround(y_tick_label_offset));
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the VectorObjectBuilder with the Cartesian axes and tips at both ends of both axes.
     * @param {VectorObjectBuilder} tip_shape - The shape of the tip. The shape must be pointing to the right, this function will rotate and move it to the correct angle.
     * @param {Point2D | null} [x_label_direction] - The direction of the x-label. The default is (1, 0).
     * @param {number | null} [x_label_offset] - The offset of the x-label. The default is 20.0.
     * @param {Point2D | null} [x_tick_label_direction] - The direction of the x-tick label. The default is (0, 1).
     * @param {number | null} [x_tick_label_offset] - The offset of the x-tick label. The default is 10.0.
     * @param {Point2D | null} [y_label_direction] - The direction of the y-label. The default is (1, 0).
     * @param {number | null} [y_label_offset] - The offset of the y-label. The default is 20.0.
     * @param {Point2D | null} [y_tick_label_direction] - The direction of the y-tick label. The default is (0, 1).
     * @param {number | null} [y_tick_label_offset] - The offset of the y-tick label. The default is 10.0.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder with the Cartesian axes and tips at both ends of both axes.
     */
    with_tips_at_both_ends(tip_shape, x_label_direction, x_label_offset, x_tick_label_direction, x_tick_label_offset, y_label_direction, y_label_offset, y_tick_label_direction, y_tick_label_offset) {
        _assertClass(tip_shape, VectorObjectBuilder);
        var ptr0 = tip_shape.__destroy_into_raw();
        let ptr1 = 0;
        if (!isLikeNone(x_label_direction)) {
            _assertClass(x_label_direction, Point2D);
            ptr1 = x_label_direction.__destroy_into_raw();
        }
        let ptr2 = 0;
        if (!isLikeNone(x_tick_label_direction)) {
            _assertClass(x_tick_label_direction, Point2D);
            ptr2 = x_tick_label_direction.__destroy_into_raw();
        }
        let ptr3 = 0;
        if (!isLikeNone(y_label_direction)) {
            _assertClass(y_label_direction, Point2D);
            ptr3 = y_label_direction.__destroy_into_raw();
        }
        let ptr4 = 0;
        if (!isLikeNone(y_tick_label_direction)) {
            _assertClass(y_tick_label_direction, Point2D);
            ptr4 = y_tick_label_direction.__destroy_into_raw();
        }
        const ret = wasm.cartesianaxes_with_tips_at_both_ends(this.__wbg_ptr, ptr0, ptr1, isLikeNone(x_label_offset) ? 0x100000001 : Math.fround(x_label_offset), ptr2, isLikeNone(x_tick_label_offset) ? 0x100000001 : Math.fround(x_tick_label_offset), ptr3, isLikeNone(y_label_offset) ? 0x100000001 : Math.fround(y_label_offset), ptr4, isLikeNone(y_tick_label_offset) ? 0x100000001 : Math.fround(y_tick_label_offset));
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the associated point of the given coordinates in the Cartesian axes.
     * @param {Point2D} p
     * @returns {Point2D} The associated point of the given coordinates in the Cartesian axes.
     */
    coord_to_point(p) {
        _assertClass(p, Point2D);
        var ptr0 = p.__destroy_into_raw();
        const ret = wasm.cartesianaxes_coord_to_point(this.__wbg_ptr, ptr0);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the associated coordinates of the given point in the Cartesian axes.
     * @param {Point2D} point
     * @returns {Point2D} The associated coordinates of the given point in the Cartesian axes.
     */
    point_to_coord(point) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        const ret = wasm.cartesianaxes_point_to_coord(this.__wbg_ptr, ptr0);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the ParametricFunctionPlot object with the given function, relative to the Cartesian axes' coordinates.
     * @param {string} expression_x - The x function to plot.
     * @param {string} expression_y - The y function to plot.
     * @param {ClosedInterval} domain - The domain of the parametric function.
     * @param {ClosedInterval} x_range - The x-range of the plot.
     * @param {ClosedInterval} y_range - The y-range of the plot.
     * @param {number[]} discontinuities - The discontinuities of the plot.
     * @param {number | null} [min_depth] - The minimum depth of the plot.
     * @param {number | null} [max_depth] - The maximum depth of the plot.
     * @param {number | null} [threshold] - The threshold of the plot.
     * @returns {ParametricFunctionPlot} The ParametricFunctionPlot object with the given function.
     */
    plot_function(expression_x, expression_y, domain, x_range, y_range, discontinuities, min_depth, max_depth, threshold) {
        const ptr0 = passStringToWasm0(expression_x, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ptr1 = passStringToWasm0(expression_y, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len1 = WASM_VECTOR_LEN;
        _assertClass(domain, ClosedInterval);
        var ptr2 = domain.__destroy_into_raw();
        _assertClass(x_range, ClosedInterval);
        var ptr3 = x_range.__destroy_into_raw();
        _assertClass(y_range, ClosedInterval);
        var ptr4 = y_range.__destroy_into_raw();
        var ptr5 = isLikeNone(discontinuities) ? 0 : passArrayF32ToWasm0(discontinuities, wasm.__wbindgen_malloc);
        var len5 = WASM_VECTOR_LEN;
        const ret = wasm.cartesianaxes_plot_function(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, ptr3, ptr4, ptr5, len5, isLikeNone(min_depth) ? 0x100000001 : (min_depth) >>> 0, isLikeNone(max_depth) ? 0x100000001 : (max_depth) >>> 0, isLikeNone(threshold) ? 0x100000001 : Math.fround(threshold));
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        return ParametricFunctionPlot.__wrap(ret[0]);
    }
    /**
     * Clones the Cartesian axes.
     * @returns {CartesianAxes}
     */
    clone() {
        const ret = wasm.cartesianaxes_clone(this.__wbg_ptr);
        return CartesianAxes.__wrap(ret);
    }
}

const CircleFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_circle_free(ptr >>> 0, 1));
/**
 * A Circle is a set of all points in a plane that are at a given distance from a given point, the center.
 */
export class Circle {

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        CircleFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_circle_free(ptr, 0);
    }
    /**
     * Creates a new Circle from a center Point2D and a radius.
     * @param {Point2D} center - The center point of the circle as a Point2D.
     * @param {number} radius - The radius of the circle.
     */
    constructor(center, radius) {
        _assertClass(center, Point2D);
        var ptr0 = center.__destroy_into_raw();
        const ret = wasm.circle_new(ptr0, radius);
        this.__wbg_ptr = ret >>> 0;
        CircleFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Creates an Arc from the circle.
     * @returns {Arc} An Arc representing the circle.
     */
    get arc() {
        const ret = wasm.circle_arc(this.__wbg_ptr);
        return Arc.__wrap(ret);
    }
    /**
     * Creates a new VectorObjectBuilder from the circle.
     * @param {number | null} [samples] - The number of samples to use to create the circle, by default 15.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder representing the circle.
     */
    vector_object_builder(samples) {
        const ret = wasm.circle_vector_object_builder(this.__wbg_ptr, isLikeNone(samples) ? 0x100000001 : (samples) >>> 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the center point of the circle as a Point2D.
     * @returns {Point2D} The center point of the circle.
     */
    get center() {
        const ret = wasm.arc_center(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the radius of the circle.
     * @returns {number} The radius of the circle.
     */
    get radius() {
        const ret = wasm.arc_radius(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the circumference of the circle.
     * @returns {number} The circumference of the circle.
     */
    circumference() {
        const ret = wasm.circle_circumference(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the area of the circle.
     * @returns {number} The area of the circle.
     */
    area() {
        const ret = wasm.circle_area(this.__wbg_ptr);
        return ret;
    }
}

const ClosedIntervalFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_closedinterval_free(ptr >>> 0, 1));
/**
 * A ClosedInterval represents a closed interval [start, end].
 */
export class ClosedInterval {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(ClosedInterval.prototype);
        obj.__wbg_ptr = ptr;
        ClosedIntervalFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        ClosedIntervalFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_closedinterval_free(ptr, 0);
    }
    /**
     * Creates a new Interval from a start and end value.
     * @param {number} start - The start of the interval.
     * @param {number} end - The end of the interval.
     */
    constructor(start, end) {
        const ret = wasm.closedinterval_new(start, end);
        this.__wbg_ptr = ret >>> 0;
        ClosedIntervalFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the start of the interval.
     * @returns {number} The start of the interval.
     */
    get start() {
        const ret = wasm.closedinterval_start(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the end of the interval.
     * @returns {number} The end of the interval.
     */
    get end() {
        const ret = wasm.closedinterval_end(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the length of the interval.
     * @returns {number} The length of the interval.
     */
    get length() {
        const ret = wasm.closedinterval_length(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the midpoint of the interval.
     * @returns {number} The midpoint of the interval.
     */
    midpoint() {
        const ret = wasm.closedinterval_midpoint(this.__wbg_ptr);
        return ret;
    }
    /**
     * Samples the interval at a given number of points.
     * @param {number} num_points - The number of points to sample.
     * @returns {Float32Array} The sampled points of the interval.
     */
    sample(num_points) {
        const ret = wasm.closedinterval_sample(this.__wbg_ptr, num_points);
        var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Checks if a number is contained within the interval.
     * @param {number} number - The number to check if it is contained.
     * @returns {boolean} Whether the number is contained within the interval.
     */
    contains(number) {
        const ret = wasm.closedinterval_contains(this.__wbg_ptr, number);
        return ret !== 0;
    }
}

const ColorFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_color_free(ptr >>> 0, 1));
/**
 * A color with red, green, blue, and alpha components.
 */
export class Color {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Color.prototype);
        obj.__wbg_ptr = ptr;
        ColorFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        ColorFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_color_free(ptr, 0);
    }
    /**
     * The red component of the color.
     * @returns {number}
     */
    get red() {
        const ret = wasm.__wbg_get_color_red(this.__wbg_ptr);
        return ret;
    }
    /**
     * The red component of the color.
     * @param {number} arg0
     */
    set red(arg0) {
        wasm.__wbg_set_color_red(this.__wbg_ptr, arg0);
    }
    /**
     * The green component of the color.
     * @returns {number}
     */
    get green() {
        const ret = wasm.__wbg_get_color_green(this.__wbg_ptr);
        return ret;
    }
    /**
     * The green component of the color.
     * @param {number} arg0
     */
    set green(arg0) {
        wasm.__wbg_set_color_green(this.__wbg_ptr, arg0);
    }
    /**
     * The blue component of the color.
     * @returns {number}
     */
    get blue() {
        const ret = wasm.__wbg_get_color_blue(this.__wbg_ptr);
        return ret;
    }
    /**
     * The blue component of the color.
     * @param {number} arg0
     */
    set blue(arg0) {
        wasm.__wbg_set_color_blue(this.__wbg_ptr, arg0);
    }
    /**
     * The alpha component of the color.
     * @returns {number}
     */
    get alpha() {
        const ret = wasm.__wbg_get_color_alpha(this.__wbg_ptr);
        return ret;
    }
    /**
     * The alpha component of the color.
     * @param {number} arg0
     */
    set alpha(arg0) {
        wasm.__wbg_set_color_alpha(this.__wbg_ptr, arg0);
    }
    /**
     * Creates a new Color with the given red, green, blue, and alpha components.
     * @param {number} red - The red component of the color.
     * @param {number} green - The green component of the color.
     * @param {number} blue - The blue component of the color.
     * @param {number} alpha - The alpha component of the color.
     */
    constructor(red, green, blue, alpha) {
        const ret = wasm.color_new(red, green, blue, alpha);
        this.__wbg_ptr = ret >>> 0;
        ColorFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the default color, which is a fully transparent black.
     * @returns {Color} The default color.
     */
    static default_color() {
        const ret = wasm.color_default_color();
        return Color.__wrap(ret);
    }
    /**
     * Linearly interpolates between two Colors given a progress value.
     * @param {Color} color1 - The start color.
     * @param {Color} color2 - The end color.
     * @param {number} t - The progress value.
     * @returns {Color}
     */
    static lerp(color1, color2, t) {
        _assertClass(color1, Color);
        _assertClass(color2, Color);
        const ret = wasm.color_lerp(color1.__wbg_ptr, color2.__wbg_ptr, t);
        return Color.__wrap(ret);
    }
}

const ColorStopFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_colorstop_free(ptr >>> 0, 1));
/**
 * A color stop for a gradient with a color and a position.
 */
export class ColorStop {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(ColorStop.prototype);
        obj.__wbg_ptr = ptr;
        ColorStopFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    static __unwrap(jsValue) {
        if (!(jsValue instanceof ColorStop)) {
            return 0;
        }
        return jsValue.__destroy_into_raw();
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        ColorStopFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_colorstop_free(ptr, 0);
    }
    /**
     * The color of the stop.
     * @returns {Color}
     */
    get color() {
        const ret = wasm.__wbg_get_colorstop_color(this.__wbg_ptr);
        return Color.__wrap(ret);
    }
    /**
     * The color of the stop.
     * @param {Color} arg0
     */
    set color(arg0) {
        _assertClass(arg0, Color);
        var ptr0 = arg0.__destroy_into_raw();
        wasm.__wbg_set_colorstop_color(this.__wbg_ptr, ptr0);
    }
    /**
     * The position of the stop.
     * @returns {number}
     */
    get position() {
        const ret = wasm.__wbg_get_colorstop_position(this.__wbg_ptr);
        return ret;
    }
    /**
     * The position of the stop.
     * @param {number} arg0
     */
    set position(arg0) {
        wasm.__wbg_set_colorstop_position(this.__wbg_ptr, arg0);
    }
    /**
     * Creates a new ColorStop with the given color and position.
     * @param {Color} color - The color of the stop.
     * @param {number} position - The position of the stop.
     */
    constructor(color, position) {
        _assertClass(color, Color);
        var ptr0 = color.__destroy_into_raw();
        const ret = wasm.colorstop_new(ptr0, position);
        this.__wbg_ptr = ret >>> 0;
        ColorStopFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
}

const CubicBezierTupleFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_cubicbeziertuple_free(ptr >>> 0, 1));
/**
 * A cubic bezier curve represented by four points: a start anchor, a first control point, a second control point, and an end anchor.
 */
export class CubicBezierTuple {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(CubicBezierTuple.prototype);
        obj.__wbg_ptr = ptr;
        CubicBezierTupleFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        CubicBezierTupleFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_cubicbeziertuple_free(ptr, 0);
    }
    /**
     * Creates a new cubic bezier curve.
     * @param {Point2D} start_anchor - The start anchor of the cubic bezier.
     * @param {Point2D} first_control - The first control point of the cubic bezier.
     * @param {Point2D} second_control - The second control point of the cubic bezier.
     * @param {Point2D} end_anchor - The end anchor of the cubic bezier.
     */
    constructor(start_anchor, first_control, second_control, end_anchor) {
        _assertClass(start_anchor, Point2D);
        var ptr0 = start_anchor.__destroy_into_raw();
        _assertClass(first_control, Point2D);
        var ptr1 = first_control.__destroy_into_raw();
        _assertClass(second_control, Point2D);
        var ptr2 = second_control.__destroy_into_raw();
        _assertClass(end_anchor, Point2D);
        var ptr3 = end_anchor.__destroy_into_raw();
        const ret = wasm.cubicbeziertuple_new(ptr0, ptr1, ptr2, ptr3);
        this.__wbg_ptr = ret >>> 0;
        CubicBezierTupleFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Creates a new cubic bezier curve from a line.
     * @param {Point2D} p1 - The start point of the line.
     * @param {Point2D} p2 - The end point of the line.
     * @returns {CubicBezierTuple} The cubic bezier curve representing the line.
     */
    static from_line(p1, p2) {
        _assertClass(p1, Point2D);
        var ptr0 = p1.__destroy_into_raw();
        _assertClass(p2, Point2D);
        var ptr1 = p2.__destroy_into_raw();
        const ret = wasm.cubicbeziertuple_from_line(ptr0, ptr1);
        return CubicBezierTuple.__wrap(ret);
    }
    /**
     * Creates a new cubic bezier curve from a quadratic bezier.
     * @param {Point2D} p1 - The first anchor point of the quadratic bezier.
     * @param {Point2D} p2 - The control point of the quadratic bezier.
     * @param {Point2D} p3 - The second anchor point of the quadratic bezier.
     * @returns {CubicBezierTuple} The cubic bezier curve representing the quadratic bezier.
     */
    static from_quadratic(p1, p2, p3) {
        _assertClass(p1, Point2D);
        var ptr0 = p1.__destroy_into_raw();
        _assertClass(p2, Point2D);
        var ptr1 = p2.__destroy_into_raw();
        _assertClass(p3, Point2D);
        var ptr2 = p3.__destroy_into_raw();
        const ret = wasm.cubicbeziertuple_from_quadratic(ptr0, ptr1, ptr2);
        return CubicBezierTuple.__wrap(ret);
    }
    /**
     * Returns the start anchor of the cubic bezier.
     * @returns {Point2D} The start anchor of the cubic bezier.
     */
    get start_anchor() {
        const ret = wasm.cubicbeziertuple_start_anchor(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the first control point of the cubic bezier.
     * @returns {Point2D} The first control point of the cubic bezier.
     */
    get first_control() {
        const ret = wasm.cubicbeziertuple_first_control(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the second control point of the cubic bezier.
     * @returns {Point2D} The second control point of the cubic bezier.
     */
    get second_control() {
        const ret = wasm.cubicbeziertuple_second_control(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the end anchor of the cubic bezier.
     * @returns {Point2D} The end anchor of the cubic bezier.
     */
    get end_anchor() {
        const ret = wasm.cubicbeziertuple_end_anchor(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the point on the cubic bezier curve at a given t value.
     * @param {number} t - The t value to evaluate the polynomial at. A number between 0 and 1.
     * @returns {Point2D} The point on the cubic bezier curve when the polynomial is evaluated at the given t value.
     */
    point_at(t) {
        const ret = wasm.cubicbeziertuple_point_at(this.__wbg_ptr, t);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns an approximation of the length of the cubic bezier curve, based on sampling points along the curve and an optional extra length to add.
     * @param {number | null} [samples] - The number of samples to take along the curve.
     * @param {number | null} [extra_length] - An optional extra length to add to the approximation.
     * @returns {number}
     */
    length(samples, extra_length) {
        const ret = wasm.cubicbeziertuple_length(this.__wbg_ptr, isLikeNone(samples) ? 0x100000001 : (samples) >>> 0, isLikeNone(extra_length) ? 0x100000001 : Math.fround(extra_length));
        return ret;
    }
    /**
     * Clones the CubicBezierTuple object.
     * @returns {CubicBezierTuple}
     */
    clone() {
        const ret = wasm.cubicbeziertuple_clone(this.__wbg_ptr);
        return CubicBezierTuple.__wrap(ret);
    }
}

const EquilateralTriangleFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_equilateraltriangle_free(ptr >>> 0, 1));
/**
 * An EquilateralTriangle is a triangle in which all three sides are equal in length.
 */
export class EquilateralTriangle {

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        EquilateralTriangleFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_equilateraltriangle_free(ptr, 0);
    }
    /**
     * Creates a new EquilateralTriangle from a center point and side length.
     * @param {Point2D} center - The center Point2D of the equilateral triangle.
     * @param {number} side_length - The side length of the equilateral triangle.
     * @param {number | null} [rotation] - The rotation of the equilateral triangle, if any.
     */
    constructor(center, side_length, rotation) {
        _assertClass(center, Point2D);
        var ptr0 = center.__destroy_into_raw();
        const ret = wasm.equilateraltriangle_new(ptr0, side_length, isLikeNone(rotation) ? 0x100000001 : Math.fround(rotation));
        this.__wbg_ptr = ret >>> 0;
        EquilateralTriangleFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Creates a Triangle from the equilateral triangle.
     * @returns {Triangle} A triangle with the equilateral triangle's vertices.
     */
    get triangle() {
        const ret = wasm.equilateraltriangle_triangle(this.__wbg_ptr);
        return Triangle.__wrap(ret);
    }
    /**
     * Creates a VectorObjectBuilder from the equilateral triangle.
     * @returns {VectorObjectBuilder} A vector object builder with the equilateral triangle's points.
     */
    get vector_object_builder() {
        const ret = wasm.equilateraltriangle_vector_object_builder(this.__wbg_ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the center Point2D of the equilateral triangle.
     * @returns {Point2D} The center point of the equilateral triangle.
     */
    get center() {
        const ret = wasm.equilateraltriangle_center(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the side length of the equilateral triangle.
     * @returns {number} The side length of the equilateral triangle.
     */
    get side_length() {
        const ret = wasm.equilateraltriangle_side_length(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the area of the equilateral triangle.
     * @returns {number} The area of the equilateral triangle.
     */
    get area() {
        const ret = wasm.equilateraltriangle_area(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the perimeter of the equilateral triangle.
     * @returns {number} The perimeter of the equilateral triangle.
     */
    get perimeter() {
        const ret = wasm.equilateraltriangle_perimeter(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the height of the equilateral triangle.
     * @returns {number} The height of the equilateral triangle.
     */
    get height() {
        const ret = wasm.equilateraltriangle_height(this.__wbg_ptr);
        return ret;
    }
}

const FontFaceFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_fontface_free(ptr >>> 0, 1));
/**
 * A FontFace represents a font that can be used for rendering text.
 */
export class FontFace {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(FontFace.prototype);
        obj.__wbg_ptr = ptr;
        FontFaceFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    static __unwrap(jsValue) {
        if (!(jsValue instanceof FontFace)) {
            return 0;
        }
        return jsValue.__destroy_into_raw();
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        FontFaceFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_fontface_free(ptr, 0);
    }
    /**
     * Creates a new FontFace from font data.
     * @param {Uint8Array} data - The data of the font face.
     */
    constructor(data) {
        const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.fontface_new(ptr0, len0);
        this.__wbg_ptr = ret >>> 0;
        FontFaceFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the data of the font face.
     * @returns {Uint8Array} The data of the font face.
     */
    get data() {
        const ret = wasm.fontface_data(this.__wbg_ptr);
        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
        return v1;
    }
    /**
     * Clones the font face.
     * @returns {FontFace}
     */
    clone() {
        const ret = wasm.fontface_clone(this.__wbg_ptr);
        return FontFace.__wrap(ret);
    }
}

const ImageBitmapFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_imagebitmap_free(ptr >>> 0, 1));
/**
 * An image bitmap with pixel data.
 */
export class ImageBitmap {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(ImageBitmap.prototype);
        obj.__wbg_ptr = ptr;
        ImageBitmapFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        ImageBitmapFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_imagebitmap_free(ptr, 0);
    }
    /**
     * The x coordinate of the bitmap.
     * @returns {number}
     */
    get x() {
        const ret = wasm.__wbg_get_imagebitmap_x(this.__wbg_ptr);
        return ret;
    }
    /**
     * The x coordinate of the bitmap.
     * @param {number} arg0
     */
    set x(arg0) {
        wasm.__wbg_set_imagebitmap_x(this.__wbg_ptr, arg0);
    }
    /**
     * The y coordinate of the bitmap.
     * @returns {number}
     */
    get y() {
        const ret = wasm.__wbg_get_imagebitmap_y(this.__wbg_ptr);
        return ret;
    }
    /**
     * The y coordinate of the bitmap.
     * @param {number} arg0
     */
    set y(arg0) {
        wasm.__wbg_set_imagebitmap_y(this.__wbg_ptr, arg0);
    }
    /**
     * The width of the bitmap.
     * @returns {number}
     */
    get width() {
        const ret = wasm.__wbg_get_imagebitmap_width(this.__wbg_ptr);
        return ret;
    }
    /**
     * The width of the bitmap.
     * @param {number} arg0
     */
    set width(arg0) {
        wasm.__wbg_set_imagebitmap_width(this.__wbg_ptr, arg0);
    }
    /**
     * The height of the bitmap.
     * @returns {number}
     */
    get height() {
        const ret = wasm.__wbg_get_imagebitmap_height(this.__wbg_ptr);
        return ret;
    }
    /**
     * The height of the bitmap.
     * @param {number} arg0
     */
    set height(arg0) {
        wasm.__wbg_set_imagebitmap_height(this.__wbg_ptr, arg0);
    }
    /**
     * Number of pixels in a row of the bitmap.
     * @returns {number}
     */
    get data_width() {
        const ret = wasm.__wbg_get_imagebitmap_data_width(this.__wbg_ptr);
        return ret >>> 0;
    }
    /**
     * Number of pixels in a row of the bitmap.
     * @param {number} arg0
     */
    set data_width(arg0) {
        wasm.__wbg_set_imagebitmap_data_width(this.__wbg_ptr, arg0);
    }
    /**
     * Number of pixels in a column of the bitmap.
     * @returns {number}
     */
    get data_height() {
        const ret = wasm.__wbg_get_imagebitmap_data_height(this.__wbg_ptr);
        return ret >>> 0;
    }
    /**
     * Number of pixels in a column of the bitmap.
     * @param {number} arg0
     */
    set data_height(arg0) {
        wasm.__wbg_set_imagebitmap_data_height(this.__wbg_ptr, arg0);
    }
    /**
     * Creates a new ImageBitmap with the given x, y, width, height, and pixel data.
     * @param {number} x - The x coordinate of the bitmap.
     * @param {number} y - The y coordinate of the bitmap.
     * @param {number} width - The width of the bitmap.
     * @param {number} height - The height of the bitmap.
     * @param {number} data_width - Number of pixels in a row of the bitmap.
     * @param {number} data_height - Number of pixels in a column of the bitmap.
     * @param {Uint8Array} data - The pixel data of the bitmap.
     */
    constructor(x, y, width, height, data_width, data_height, data) {
        const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.imagebitmap_new(x, y, width, height, data_width, data_height, ptr0, len0);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        this.__wbg_ptr = ret[0] >>> 0;
        ImageBitmapFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Gets the pixel data of the bitmap.
     * @returns {Uint8Array} The pixel data of the bitmap.
     */
    get data() {
        const ret = wasm.imagebitmap_data(this.__wbg_ptr);
        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
        return v1;
    }
    /**
     * Sets the pixel data of the bitmap.
     * @param {number} data_width - The number of pixels in a row of the bitmap.
     * @param {number} data_height - The number of pixels in a column of the bitmap.
     * @param {Uint8Array} data - The pixel data of the bitmap.
     */
    set_data(data_width, data_height, data) {
        const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.imagebitmap_set_data(this.__wbg_ptr, data_width, data_height, ptr0, len0);
        if (ret[1]) {
            throw takeFromExternrefTable0(ret[0]);
        }
    }
    /**
     * Returns the default ImageBitmap, which is an empty bitmap.
     * @returns {ImageBitmap} The default image bitmap.
     */
    static default_image_bitmap() {
        const ret = wasm.imagebitmap_default_image_bitmap();
        return ImageBitmap.__wrap(ret);
    }
    /**
     * Gets the color of a Point2D in the bitmap.
     * @param {Point2D} p - The point to get the pixel color at.
     * @returns {Color} The color of the pixel.
     */
    get_pixel(p) {
        _assertClass(p, Point2D);
        var ptr0 = p.__destroy_into_raw();
        const ret = wasm.imagebitmap_get_pixel(this.__wbg_ptr, ptr0);
        return Color.__wrap(ret);
    }
    /**
     * Sets a pixel color at a Point2D in the bitmap.
     * @param {Point2D} p - The point to set the pixel color at.
     * @param {Color} color - The color of the pixel.
     */
    set_pixel(p, color) {
        _assertClass(p, Point2D);
        var ptr0 = p.__destroy_into_raw();
        _assertClass(color, Color);
        wasm.imagebitmap_set_pixel(this.__wbg_ptr, ptr0, color.__wbg_ptr);
    }
    /**
     * Gets a bitmap that is filled with a color.
     * @param {number} x - The x coordinate of the bitmap.
     * @param {number} y - The y coordinate of the bitmap.
     * @param {number} width - The width of the bitmap.
     * @param {number} height - The height of the bitmap.
     * @param {number} data_width - Number of pixels in a row of the bitmap.
     * @param {number} data_height - Number of pixels in a column of the bitmap.
     * @param {Color} color - The color to fill the bitmap with.
     * @returns {ImageBitmap} The filled image bitmap.
     */
    static fill(x, y, width, height, data_width, data_height, color) {
        _assertClass(color, Color);
        const ret = wasm.imagebitmap_fill(x, y, width, height, data_width, data_height, color.__wbg_ptr);
        return ImageBitmap.__wrap(ret);
    }
    /**
     * Gets a bitmap that is filled with a linear gradient.
     * @param {number} x - The x coordinate of the bitmap.
     * @param {number} y - The y coordinate of the bitmap.
     * @param {number} width - The width of the bitmap.
     * @param {number} height - The height of the bitmap.
     * @param {number} data_width - Number of pixels in a row of the bitmap.
     * @param {number} data_height - Number of pixels in a column of the bitmap.
     * @param {LinearGradient} gradient - The linear gradient to fill the bitmap with.
     * @returns {ImageBitmap} The filled image bitmap.
     */
    static fill_linear_gradient(x, y, width, height, data_width, data_height, gradient) {
        _assertClass(gradient, LinearGradient);
        const ret = wasm.imagebitmap_fill_linear_gradient(x, y, width, height, data_width, data_height, gradient.__wbg_ptr);
        return ImageBitmap.__wrap(ret);
    }
    /**
     * Gets a bitmap that is filled with a radial gradient.
     * @param {number} x - The x coordinate of the bitmap.
     * @param {number} y - The y coordinate of the bitmap.
     * @param {number} width - The width of the bitmap.
     * @param {number} height - The height of the bitmap.
     * @param {number} data_width - Number of pixels in a row of the bitmap.
     * @param {number} data_height - Number of pixels in a column of the bitmap.
     * @param {RadialGradient} gradient - The radial gradient to fill the bitmap with.
     * @returns {ImageBitmap} The filled image bitmap.
     */
    static fill_radial_gradient(x, y, width, height, data_width, data_height, gradient) {
        _assertClass(gradient, RadialGradient);
        const ret = wasm.imagebitmap_fill_radial_gradient(x, y, width, height, data_width, data_height, gradient.__wbg_ptr);
        return ImageBitmap.__wrap(ret);
    }
    /**
     * Gets the data as base64 encoded string.
     * @returns {string} The base64 encoded string of the image bitmap.
     */
    get base64() {
        let deferred2_0;
        let deferred2_1;
        try {
            const ret = wasm.imagebitmap_base64(this.__wbg_ptr);
            var ptr1 = ret[0];
            var len1 = ret[1];
            if (ret[3]) {
                ptr1 = 0; len1 = 0;
                throw takeFromExternrefTable0(ret[2]);
            }
            deferred2_0 = ptr1;
            deferred2_1 = len1;
            return getStringFromWasm0(ptr1, len1);
        } finally {
            wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
        }
    }
    /**
     * Linearly interpolates between two ImageBitmaps given a progress value.
     * @param {ImageBitmap} bitmap1 - The first image bitmap.
     * @param {ImageBitmap} bitmap2 - The second image bitmap.
     * @param {number} t - The progress value.
     * @returns {ImageBitmap} The interpolated image bitmap.
     */
    static lerp(bitmap1, bitmap2, t) {
        _assertClass(bitmap1, ImageBitmap);
        _assertClass(bitmap2, ImageBitmap);
        const ret = wasm.imagebitmap_lerp(bitmap1.__wbg_ptr, bitmap2.__wbg_ptr, t);
        return ImageBitmap.__wrap(ret);
    }
}

const ImageDataFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_imagedata_free(ptr >>> 0, 1));
/**
 * A ImageData represents the data of an image.
 */
export class ImageData {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(ImageData.prototype);
        obj.__wbg_ptr = ptr;
        ImageDataFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        ImageDataFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_imagedata_free(ptr, 0);
    }
    /**
     * Creates a new ImageData from image data.
     * @param {Uint8Array} data
     */
    constructor(data) {
        const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.imagedata_new(ptr0, len0);
        this.__wbg_ptr = ret >>> 0;
        ImageDataFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the data of the image.
     * @returns {Uint8Array} The data of the image.
     */
    get data() {
        const ret = wasm.imagedata_data(this.__wbg_ptr);
        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
        return v1;
    }
    /**
     * Clones the image data.
     * @returns {ImageData}
     */
    clone() {
        const ret = wasm.imagedata_clone(this.__wbg_ptr);
        return ImageData.__wrap(ret);
    }
}

const ImageLibraryFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_imagelibrary_free(ptr >>> 0, 1));
/**
 * A ImageLibrary represents a mapping of image names to image data.
 */
export class ImageLibrary {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(ImageLibrary.prototype);
        obj.__wbg_ptr = ptr;
        ImageLibraryFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        ImageLibraryFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_imagelibrary_free(ptr, 0);
    }
    /**
     * Creates a new ImageLibrary from image data.
     */
    constructor() {
        const ret = wasm.imagelibrary_new();
        this.__wbg_ptr = ret >>> 0;
        ImageLibraryFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the image names in the library.
     * @returns {string[]} The names of the images in the library.
     */
    get keys() {
        const ret = wasm.imagelibrary_keys(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Returns the image data
     * @returns {ImageData[]} The data of the image.
     */
    get values() {
        const ret = wasm.imagelibrary_values(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Gets the image data for a given image name.
     * @param {string} name
     * @returns {ImageData | undefined} The data of the image.
     */
    get(name) {
        const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.imagelibrary_get(this.__wbg_ptr, ptr0, len0);
        return ret === 0 ? undefined : ImageData.__wrap(ret);
    }
    /**
     * Sets the image data for a given image name.
     * @param {string} name
     * @param {ImageData} data
     */
    set(name, data) {
        const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        _assertClass(data, ImageData);
        var ptr1 = data.__destroy_into_raw();
        wasm.imagelibrary_set(this.__wbg_ptr, ptr0, len0, ptr1);
    }
    /**
     * Removes the image data for a given image name.
     * @param {string} name
     */
    remove(name) {
        const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        wasm.imagelibrary_remove(this.__wbg_ptr, ptr0, len0);
    }
    /**
     * Clones the image library.
     * @returns {ImageLibrary}
     */
    clone() {
        const ret = wasm.imagelibrary_clone(this.__wbg_ptr);
        return ImageLibrary.__wrap(ret);
    }
}

const IntegerLerpFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_integerlerp_free(ptr >>> 0, 1));
/**
 * A variant of lerp that returns the integer index and remainder. Useful for discrete interpolation.
 */
export class IntegerLerp {

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        IntegerLerpFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_integerlerp_free(ptr, 0);
    }
    /**
     * Interpolates between two values and returns the integer index and remainder.
     * @param {number} a - The start value.
     * @param {number} b - The end value.
     * @param {number} t - The progress value.
     */
    constructor(a, b, t) {
        const ret = wasm.integerlerp_new(a, b, t);
        this.__wbg_ptr = ret >>> 0;
        IntegerLerpFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Gets the integer index.
     * @returns {number} The integer index.
     */
    get index() {
        const ret = wasm.integerlerp_index(this.__wbg_ptr);
        return ret;
    }
    /**
     * Gets the remainder.
     * @returns {number} The remainder.
     */
    get remainder() {
        const ret = wasm.integerlerp_remainder(this.__wbg_ptr);
        return ret;
    }
}

const LineFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_line_free(ptr >>> 0, 1));
/**
 * A Line is a straight one-dimensional figure that extends infinitely in both directions.
 * It is defined by two points.
 */
export class Line {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Line.prototype);
        obj.__wbg_ptr = ptr;
        LineFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        LineFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_line_free(ptr, 0);
    }
    /**
     * The starting point of the line as Point2D.
     * @returns {Point2D}
     */
    get start() {
        const ret = wasm.__wbg_get_line_start(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * The starting point of the line as Point2D.
     * @param {Point2D} arg0
     */
    set start(arg0) {
        _assertClass(arg0, Point2D);
        var ptr0 = arg0.__destroy_into_raw();
        wasm.__wbg_set_line_start(this.__wbg_ptr, ptr0);
    }
    /**
     * The ending point of the line as Point2D.
     * @returns {Point2D}
     */
    get end() {
        const ret = wasm.__wbg_get_line_end(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * The ending point of the line as Point2D.
     * @param {Point2D} arg0
     */
    set end(arg0) {
        _assertClass(arg0, Point2D);
        var ptr0 = arg0.__destroy_into_raw();
        wasm.__wbg_set_line_end(this.__wbg_ptr, ptr0);
    }
    /**
     * Creates a new Line object from two points.
     * @param {Point2D} start
     * @param {Point2D} end
     */
    constructor(start, end) {
        _assertClass(start, Point2D);
        var ptr0 = start.__destroy_into_raw();
        _assertClass(end, Point2D);
        var ptr1 = end.__destroy_into_raw();
        const ret = wasm.line_new(ptr0, ptr1);
        this.__wbg_ptr = ret >>> 0;
        LineFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Gets a VectorObjectBuilder with the line's points.
     * @returns {VectorObjectBuilder} A vector object builder with the line's points.
     */
    get vector_object_builder() {
        const ret = wasm.line_vector_object_builder(this.__wbg_ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the length of the line.
     * @returns {number} The length of the line.
     */
    get length() {
        const ret = wasm.line_length(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the midpoint of the line as a Point2D.
     * @returns {Point2D} The midpoint of the line.
     */
    midpoint() {
        const ret = wasm.line_midpoint(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the slope of the line.
     * @returns {number} The slope of the line.
     */
    slope() {
        const ret = wasm.line_slope(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the y-intercept of the line.
     * @returns {number} The y-intercept of the line.
     */
    y_intercept() {
        const ret = wasm.line_y_intercept(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the normal slope of the line.
     * @returns {number} The normal slope of the line.
     */
    normal_slope() {
        const ret = wasm.line_normal_slope(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the perpendicular line of the line at a given Point2D.
     * @param {Point2D} point - The point to create the perpendicular line at.
     * @returns {Line} The perpendicular line of the line at the given point.
     */
    perpendicular_line(point) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        const ret = wasm.line_perpendicular_line(this.__wbg_ptr, ptr0);
        return Line.__wrap(ret);
    }
    /**
     * Returns the intersection Point2D of the line with another line, if it exists.
     * @param {Line} other - The other line to intersect with.
     * @returns {Point2D | undefined} The intersection point of the two lines if it exists.
     */
    intersection(other) {
        _assertClass(other, Line);
        const ret = wasm.line_intersection(this.__wbg_ptr, other.__wbg_ptr);
        return ret === 0 ? undefined : Point2D.__wrap(ret);
    }
    /**
     * Returns whether the line contains a given Point2D.
     * @param {Point2D} point - The point to check if it is contained.
     * @returns {boolean} Whether the line contains the given point.
     */
    contains(point) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        const ret = wasm.line_contains(this.__wbg_ptr, ptr0);
        return ret !== 0;
    }
    /**
     * Returns the distance from the line to a given Point2D.
     * @param {Point2D} point - The point to calculate the distance to.
     * @returns {number} The distance from the line to the given point.
     */
    distance_to_point(point) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        const ret = wasm.line_distance_to_point(this.__wbg_ptr, ptr0);
        return ret;
    }
    /**
     * Creates a VectorObjectBuilder with the line's points and a tip at the start.
     * @param {VectorObjectBuilder} tip_shape - The shape of the tip. The shape must be pointing to the right and centered to (0, 0), this function will rotate and move it to the correct angle.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder with the line's points and a tip at the start.
     */
    with_tip_at_the_start(tip_shape) {
        _assertClass(tip_shape, VectorObjectBuilder);
        var ptr0 = tip_shape.__destroy_into_raw();
        const ret = wasm.line_with_tip_at_the_start(this.__wbg_ptr, ptr0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Creates a VectorObjectBuilder with the line's points and a tip at the end.
     * @param {VectorObjectBuilder} tip_shape - The shape of the tip. The shape must be pointing to the right and centered to (0, 0), this function will rotate and move it to the correct angle.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder with the line's points and a tip at the end.
     */
    with_tip_at_the_end(tip_shape) {
        _assertClass(tip_shape, VectorObjectBuilder);
        var ptr0 = tip_shape.__destroy_into_raw();
        const ret = wasm.line_with_tip_at_the_end(this.__wbg_ptr, ptr0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Creates a VectorObjectBuilder with the line's points and tips at both ends.
     * @param {VectorObjectBuilder} tip_shape - The shape of the tip. The shape must be pointing to the right, this function will rotate and move it to the correct angle.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder with the line's points and tips at both ends.
     */
    with_tips_at_both_ends(tip_shape) {
        _assertClass(tip_shape, VectorObjectBuilder);
        var ptr0 = tip_shape.__destroy_into_raw();
        const ret = wasm.line_with_tips_at_both_ends(this.__wbg_ptr, ptr0);
        return VectorObjectBuilder.__wrap(ret);
    }
}

const LinearGradientFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_lineargradient_free(ptr >>> 0, 1));
/**
 * A linear gradient with a start and end point and color stops.
 */
export class LinearGradient {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(LinearGradient.prototype);
        obj.__wbg_ptr = ptr;
        LinearGradientFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        LinearGradientFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_lineargradient_free(ptr, 0);
    }
    /**
     * The start point of the gradient.
     * @returns {Point2D}
     */
    get p1() {
        const ret = wasm.__wbg_get_lineargradient_p1(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * The start point of the gradient.
     * @param {Point2D} arg0
     */
    set p1(arg0) {
        _assertClass(arg0, Point2D);
        var ptr0 = arg0.__destroy_into_raw();
        wasm.__wbg_set_lineargradient_p1(this.__wbg_ptr, ptr0);
    }
    /**
     * The end point of the gradient.
     * @returns {Point2D}
     */
    get p2() {
        const ret = wasm.__wbg_get_lineargradient_p2(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * The end point of the gradient.
     * @param {Point2D} arg0
     */
    set p2(arg0) {
        _assertClass(arg0, Point2D);
        var ptr0 = arg0.__destroy_into_raw();
        wasm.__wbg_set_lineargradient_p2(this.__wbg_ptr, ptr0);
    }
    /**
     * Creates a new LinearGradient with the given start point, end point, and ColorStops.
     * @param {Point2D} p1 - The start point of the gradient.
     * @param {Point2D} p2 - The end point of the gradient.
     * @param {ColorStop[]} color_stops - The color stops of the gradient.
     */
    constructor(p1, p2, color_stops) {
        _assertClass(p1, Point2D);
        var ptr0 = p1.__destroy_into_raw();
        _assertClass(p2, Point2D);
        var ptr1 = p2.__destroy_into_raw();
        const ptr2 = passArrayJsValueToWasm0(color_stops, wasm.__wbindgen_malloc);
        const len2 = WASM_VECTOR_LEN;
        const ret = wasm.lineargradient_new(ptr0, ptr1, ptr2, len2);
        this.__wbg_ptr = ret >>> 0;
        LinearGradientFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the default LinearGradient, which is a gradient from the start to the end the same color.
     * @param {Point2D} p1 - The start point of the gradient.
     * @param {Point2D} p2 - The end point of the gradient.
     * @param {Color} color - The color of the gradient.
     * @param {number | null} [repeats] - Number of times to repeat the color.
     * @returns {LinearGradient} The default linear gradient.
     */
    static single_color_gradient(p1, p2, color, repeats) {
        _assertClass(p1, Point2D);
        var ptr0 = p1.__destroy_into_raw();
        _assertClass(p2, Point2D);
        var ptr1 = p2.__destroy_into_raw();
        _assertClass(color, Color);
        var ptr2 = color.__destroy_into_raw();
        const ret = wasm.lineargradient_single_color_gradient(ptr0, ptr1, ptr2, isLikeNone(repeats) ? 0x100000001 : (repeats) >>> 0);
        return LinearGradient.__wrap(ret);
    }
    /**
     * Returns the default LinearGradient, which is a gradient from the origin to the origin with no ColorStops.
     * @returns {LinearGradient} The default linear gradient.
     */
    static default_linear_gradient() {
        const ret = wasm.lineargradient_default_linear_gradient();
        return LinearGradient.__wrap(ret);
    }
    /**
     * Gets the ColorStops of the gradient.
     * @returns {ColorStop[]} The color stops of the gradient.
     */
    get color_stops() {
        const ret = wasm.lineargradient_color_stops(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Sets the ColorStops of the gradient.
     * @param {ColorStop[]} color_stops - The color stops of the gradient.
     */
    set color_stops(color_stops) {
        const ptr0 = passArrayJsValueToWasm0(color_stops, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        wasm.lineargradient_set_color_stops(this.__wbg_ptr, ptr0, len0);
    }
    /**
     * Gets the Color at a given offset along the gradient.
     * @param {number} position - The offset to get the color at.
     * @returns {Color} The color at the given offset.
     */
    color_at_offset(position) {
        const ret = wasm.lineargradient_color_at_offset(this.__wbg_ptr, position);
        return Color.__wrap(ret);
    }
    /**
     * Gets the Color at a given point along the gradient.
     * @param {Point2D} p - The point to get the color at.
     * @returns {Color} The color at the given point.
     */
    color_at(p) {
        _assertClass(p, Point2D);
        var ptr0 = p.__destroy_into_raw();
        const ret = wasm.lineargradient_color_at(this.__wbg_ptr, ptr0);
        return Color.__wrap(ret);
    }
    /**
     * Linearly interpolates between two LinearGradients given a progress value.
     * @param {LinearGradient} gradient1 - The first linear gradient.
     * @param {LinearGradient} gradient2 - The second linear gradient.
     * @param {number} t - The progress value.
     * @returns {LinearGradient} The interpolated linear gradient.
     */
    static lerp(gradient1, gradient2, t) {
        _assertClass(gradient1, LinearGradient);
        _assertClass(gradient2, LinearGradient);
        const ret = wasm.lineargradient_lerp(gradient1.__wbg_ptr, gradient2.__wbg_ptr, t);
        return LinearGradient.__wrap(ret);
    }
}

const ParametricFunctionPlotFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_parametricfunctionplot_free(ptr >>> 0, 1));
/**
 * A ParametricFunctionPlot represents a plot of a parametric function (x(t), y(t)).
 */
export class ParametricFunctionPlot {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(ParametricFunctionPlot.prototype);
        obj.__wbg_ptr = ptr;
        ParametricFunctionPlotFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        ParametricFunctionPlotFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_parametricfunctionplot_free(ptr, 0);
    }
    /**
     * Creates a new ParametricFunctionPlot from an expression, domain, x-range, y-range, and other optional parameters.
     * @param {string} expression_x - The x expression of the parametric function.
     * @param {string} expression_y - The y expression of the parametric function.
     * @param {ClosedInterval} domain - The domain of the parametric function.
     * @param {ClosedInterval} x_range - The x-range of the plot.
     * @param {ClosedInterval} y_range - The y-range of the plot.
     * @param {number[]} discontinuities - The discontinuities of the plot.
     * @param {number | null} [min_depth] - The minimum depth of the plot.
     * @param {number | null} [max_depth] - The maximum depth of the plot.
     * @param {number | null} [threshold] - The threshold of the plot.
     */
    constructor(expression_x, expression_y, domain, x_range, y_range, discontinuities, min_depth, max_depth, threshold) {
        const ptr0 = passStringToWasm0(expression_x, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ptr1 = passStringToWasm0(expression_y, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len1 = WASM_VECTOR_LEN;
        _assertClass(domain, ClosedInterval);
        var ptr2 = domain.__destroy_into_raw();
        _assertClass(x_range, ClosedInterval);
        var ptr3 = x_range.__destroy_into_raw();
        _assertClass(y_range, ClosedInterval);
        var ptr4 = y_range.__destroy_into_raw();
        var ptr5 = isLikeNone(discontinuities) ? 0 : passArrayF32ToWasm0(discontinuities, wasm.__wbindgen_malloc);
        var len5 = WASM_VECTOR_LEN;
        const ret = wasm.parametricfunctionplot_new(ptr0, len0, ptr1, len1, ptr2, ptr3, ptr4, ptr5, len5, isLikeNone(min_depth) ? 0x100000001 : (min_depth) >>> 0, isLikeNone(max_depth) ? 0x100000001 : (max_depth) >>> 0, isLikeNone(threshold) ? 0x100000001 : Math.fround(threshold));
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        this.__wbg_ptr = ret[0] >>> 0;
        ParametricFunctionPlotFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the x expression of the parametric function.
     * @returns {string} The x expression of the parametric function.
     */
    get expression_x() {
        let deferred1_0;
        let deferred1_1;
        try {
            const ret = wasm.parametricfunctionplot_expression_x(this.__wbg_ptr);
            deferred1_0 = ret[0];
            deferred1_1 = ret[1];
            return getStringFromWasm0(ret[0], ret[1]);
        } finally {
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
    /**
     * Returns the y expression of the parametric function.
     * @returns {string} The y expression of the parametric function.
     */
    get expression_y() {
        let deferred1_0;
        let deferred1_1;
        try {
            const ret = wasm.parametricfunctionplot_expression_y(this.__wbg_ptr);
            deferred1_0 = ret[0];
            deferred1_1 = ret[1];
            return getStringFromWasm0(ret[0], ret[1]);
        } finally {
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
    /**
     * Returns the expression of the parametric function.
     * @returns {string} The expression of the parametric function.
     */
    get expression() {
        let deferred1_0;
        let deferred1_1;
        try {
            const ret = wasm.parametricfunctionplot_expression(this.__wbg_ptr);
            deferred1_0 = ret[0];
            deferred1_1 = ret[1];
            return getStringFromWasm0(ret[0], ret[1]);
        } finally {
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
    /**
     * Returns the domain of the parametric function.
     * @returns {ClosedInterval} The domain of the parametric function.
     */
    get domain() {
        const ret = wasm.parametricfunctionplot_domain(this.__wbg_ptr);
        return ClosedInterval.__wrap(ret);
    }
    /**
     * Returns the x-range of the plot.
     * @returns {ClosedInterval} The x-range of the plot.
     */
    get x_range() {
        const ret = wasm.parametricfunctionplot_x_range(this.__wbg_ptr);
        return ClosedInterval.__wrap(ret);
    }
    /**
     * Returns the y-range of the plot.
     * @returns {ClosedInterval} The y-range of the plot.
     */
    get y_range() {
        const ret = wasm.parametricfunctionplot_y_range(this.__wbg_ptr);
        return ClosedInterval.__wrap(ret);
    }
    /**
     * Returns the discontinuities of the plot.
     * @returns {number[]} The discontinuities of the plot.
     */
    get discontinuities() {
        const ret = wasm.parametricfunctionplot_discontinuities(this.__wbg_ptr);
        var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Returns the minimum depth of the plot.
     * @returns {number} The minimum depth of the plot.
     */
    get min_depth() {
        const ret = wasm.parametricfunctionplot_min_depth(this.__wbg_ptr);
        return ret >>> 0;
    }
    /**
     * Returns the maximum depth of the plot.
     * @returns {number} The maximum depth of the plot.
     */
    get max_depth() {
        const ret = wasm.parametricfunctionplot_max_depth(this.__wbg_ptr);
        return ret >>> 0;
    }
    /**
     * Returns the threshold of the plot.
     * @returns {number} The threshold of the plot.
     */
    get threshold() {
        const ret = wasm.parametricfunctionplot_threshold(this.__wbg_ptr);
        return ret;
    }
    /**
     * Checks if a number is a discontinuity of the plot.
     * @param {number} number - The number to check.
     * @returns {boolean} A boolean indicating if the number is a discontinuity of the plot.
     */
    is_discontinuity(number) {
        const ret = wasm.parametricfunctionplot_is_discontinuity(this.__wbg_ptr, number);
        return ret !== 0;
    }
    /**
     * Returns the error of both Point2Ds.
     * @param {Point2D} point1 - The first Point2D.
     * @param {Point2D} point2 - The second Point2D.
     * @returns {number} The error of both Point2Ds.
     */
    error(point1, point2) {
        _assertClass(point1, Point2D);
        var ptr0 = point1.__destroy_into_raw();
        _assertClass(point2, Point2D);
        var ptr1 = point2.__destroy_into_raw();
        const ret = wasm.parametricfunctionplot_error(this.__wbg_ptr, ptr0, ptr1);
        return ret;
    }
    /**
     * Cheap hash function for the plot. Reference: https://github.com/stevenpetryk/mafs/blob/85c954ee649bebe65963bc8e7ad5708797c394d6/src/display/Plot/PlotUtils.tsx#L26
     * @param {number} min - The minimum value of the object to hash.
     * @param {number} max - The maximum value of the object to hash.
     * @returns {number} The hash of the plot.
     */
    hash(min, max) {
        const ret = wasm.parametricfunctionplot_hash(this.__wbg_ptr, min, max);
        return ret;
    }
    /**
     * Checks if point is within the plot.
     * @param {Point2D} point - The point to check.
     * @returns {boolean} A boolean indicating if the point is within the plot.
     */
    contains(point) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        const ret = wasm.parametricfunctionplot_contains(this.__wbg_ptr, ptr0);
        return ret !== 0;
    }
    /**
     * Gets a VectorObjectBuilder with the plot's points.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder with the plot's points.
     */
    get vector_object_builder() {
        const ret = wasm.parametricfunctionplot_vector_object_builder(this.__wbg_ptr);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        return VectorObjectBuilder.__wrap(ret[0]);
    }
    /**
     * Evaluates the parametric function at a given value.
     * @param {number} t - The value to evaluate the parametric function at.
     * @returns {Point2D | undefined} The evaluated point.
     */
    evaluate(t) {
        const ret = wasm.parametricfunctionplot_evaluate(this.__wbg_ptr, t);
        return ret === 0 ? undefined : Point2D.__wrap(ret);
    }
}

const Path2DFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_path2d_free(ptr >>> 0, 1));
/**
 * A 2D path.
 */
export class Path2D {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Path2D.prototype);
        obj.__wbg_ptr = ptr;
        Path2DFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        Path2DFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_path2d_free(ptr, 0);
    }
    /**
     * Creates a new Path2D with the given points.
     * @param {Point2D[]} points - The points of the path.
     */
    constructor(points) {
        const ptr0 = passArrayJsValueToWasm0(points, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.path2d_new(ptr0, len0);
        this.__wbg_ptr = ret >>> 0;
        Path2DFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Creates a new Path2D given a AnchorsAndHandles object.
     * @param {AnchorsAndHandles} anchors_and_handles - The AnchorsAndHandles object.
     * @returns {Path2D} A 2D path.
     */
    static from_anchors_and_handles(anchors_and_handles) {
        _assertClass(anchors_and_handles, AnchorsAndHandles);
        const ret = wasm.path2d_from_anchors_and_handles(anchors_and_handles.__wbg_ptr);
        return Path2D.__wrap(ret);
    }
    /**
     * Clones the Path2D.
     * @returns {Path2D}
     */
    clone() {
        const ret = wasm.path2d_clone(this.__wbg_ptr);
        return Path2D.__wrap(ret);
    }
    /**
     * Repeats the Path2D a given number of times.
     * @param {number} count - The number of times to repeat the path.
     * @returns {Path2D} The repeated path.
     */
    repeat(count) {
        const ret = wasm.path2d_repeat(this.__wbg_ptr, count);
        return Path2D.__wrap(ret);
    }
    /**
     * Returns the Point2Ds of the Path2D.
     * @returns {Point2D[]} The points of the path.
     */
    get points() {
        const ret = wasm.path2d_points(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Sets the Point2Ds of the Path2D.
     * @param {Point2D[]} points - The points of the path.
     */
    set points(points) {
        const ptr0 = passArrayJsValueToWasm0(points, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        wasm.path2d_set_points(this.__wbg_ptr, ptr0, len0);
    }
    /**
     * Returns whether the Path2D is empty.
     * @returns {boolean} A boolean indicating whether the path is empty.
     */
    get is_empty() {
        const ret = wasm.path2d_is_empty(this.__wbg_ptr);
        return ret !== 0;
    }
    /**
     * Returns the closest Point2D in the Path2D to a given Point2D.
     * @param {Point2D} point - The point to find the closest point to.
     * @returns {Point2D} The closest point in the path.
     */
    closest_point(point) {
        _assertClass(point, Point2D);
        const ret = wasm.path2d_closest_point(this.__wbg_ptr, point.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the length of the Path2D.
     * @returns {number} The length of the path.
     */
    get len() {
        const ret = wasm.path2d_len(this.__wbg_ptr);
        return ret >>> 0;
    }
    /**
     * Returns the Point2D at a given index.
     * @param {number} index - The index of the point.
     * @returns {Point2D} The first point of the path.
     */
    get(index) {
        const ret = wasm.path2d_get(this.__wbg_ptr, index);
        return Point2D.__wrap(ret);
    }
    /**
     * Sets the Point2D at the given index.
     * @param {number} index - The index of the point.
     * @param {Point2D} point - The new point.
     */
    set(index, point) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        wasm.path2d_set(this.__wbg_ptr, index, ptr0);
    }
    /**
     * Appends a Point2D to the Path2D.
     * @param {Point2D} point - The point to append.
     */
    push(point) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        wasm.path2d_push(this.__wbg_ptr, ptr0);
    }
    /**
     * Removes the last Point2D from the Path2D.
     * @returns {Point2D | undefined} The last point of the path.
     */
    pop() {
        const ret = wasm.path2d_pop(this.__wbg_ptr);
        return ret === 0 ? undefined : Point2D.__wrap(ret);
    }
    /**
     * Inserts a Point2D at a given index.
     * @param {number} index - The index to insert the point at.
     * @param {Point2D} point - The point to insert.
     */
    insert(index, point) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        wasm.path2d_insert(this.__wbg_ptr, index, ptr0);
    }
    /**
     * Removes a Point2D at a given index.
     * @param {number} index - The index of the point to remove.
     * @returns {Point2D} The removed point.
     */
    remove(index) {
        const ret = wasm.path2d_remove(this.__wbg_ptr, index);
        return Point2D.__wrap(ret);
    }
    /**
     * Removes all Point2Ds from the Path2D.
     */
    clear() {
        wasm.path2d_clear(this.__wbg_ptr);
    }
    /**
     * Returns a new Path2D representing a bezier curve portion of the Path2D.
     * @param {number} a - The start proportion of the input path. A number between 0 and 1.
     * @param {number} b - The end proportion of the input path. A number between 0 and 1.
     * @returns {Path2D} A Path2D object representing the portion of the input path.
     */
    partial_bezier_path(a, b) {
        const ret = wasm.path2d_partial_bezier_path(this.__wbg_ptr, a, b);
        return Path2D.__wrap(ret);
    }
    /**
     * Creates a new Path2D by filling the Path2D with a given Point2D a given number of times.
     * @param {Point2D} point - The point to fill the path with.
     * @param {number} count - The number of times to fill the path with the point.
     * @returns {Path2D} A path that is a portion of the input path.
     */
    static fill(point, count) {
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        const ret = wasm.path2d_fill(ptr0, count);
        return Path2D.__wrap(ret);
    }
    /**
     * Reverse the Path2D.
     */
    reverse() {
        wasm.path2d_reverse(this.__wbg_ptr);
    }
    /**
     * Sets a slice of the Path2D.
     * @param {number} start - The start index of the slice.
     * @param {number} end - The end index of the slice.
     * @param {Path2D} path - The new path.
     */
    set_slice(start, end, path) {
        _assertClass(path, Path2D);
        var ptr0 = path.__destroy_into_raw();
        wasm.path2d_set_slice(this.__wbg_ptr, start, end, ptr0);
    }
    /**
     * Returns a slice of the Path2D
     * @param {number} start - The start index of the slice.
     * @param {number} end - The end index of the slice.
     * @returns {Path2D} A slice of the path.
     */
    slice(start, end) {
        const ret = wasm.path2d_slice(this.__wbg_ptr, start, end);
        return Path2D.__wrap(ret);
    }
    /**
     * Returns a CubicBezierTuple at a given index.
     * @returns {CubicBezierTuple[]} The cubic bezier tuples of the path.
     */
    get cubic_bezier_tuples() {
        const ret = wasm.path2d_cubic_bezier_tuples(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Appends a CubicBezierTuple to the Path2D.
     * @param {CubicBezierTuple} cubic_bezier - The cubic bezier tuple to add.
     */
    push_bezier(cubic_bezier) {
        _assertClass(cubic_bezier, CubicBezierTuple);
        var ptr0 = cubic_bezier.__destroy_into_raw();
        wasm.path2d_push_bezier(this.__wbg_ptr, ptr0);
    }
    /**
     * Returns an approximation of the length of the path, based on sampling points along each cubic bezier curve in the path and an optional extra length to add to each approximation.
     * @param {number | null} [samples_per_cubic] - The number of samples to take along each cubic bezier curve.
     * @param {number | null} [extra_length_per_cubic] - An optional extra length to add to each cubic bezier length approximation.
     * @returns {number} An approximation of the length of the path.
     */
    length(samples_per_cubic, extra_length_per_cubic) {
        const ret = wasm.path2d_length(this.__wbg_ptr, isLikeNone(samples_per_cubic) ? 0x100000001 : (samples_per_cubic) >>> 0, isLikeNone(extra_length_per_cubic) ? 0x100000001 : Math.fround(extra_length_per_cubic));
        return ret;
    }
    /**
     * Gets the first point of the Path2D.
     * @returns {Point2D} The first point of the path.
     */
    get first() {
        const ret = wasm.path2d_first(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Gets the last point of the Path2D.
     * @returns {Point2D | undefined} The last point of the path.
     */
    get last() {
        const ret = wasm.path2d_last(this.__wbg_ptr);
        return ret === 0 ? undefined : Point2D.__wrap(ret);
    }
}

const Point2DFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_point2d_free(ptr >>> 0, 1));
/**
 * A 2D point.
 */
export class Point2D {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Point2D.prototype);
        obj.__wbg_ptr = ptr;
        Point2DFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    static __unwrap(jsValue) {
        if (!(jsValue instanceof Point2D)) {
            return 0;
        }
        return jsValue.__destroy_into_raw();
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        Point2DFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_point2d_free(ptr, 0);
    }
    /**
     * The x-coordinate of the point.
     * @returns {number}
     */
    get x() {
        const ret = wasm.__wbg_get_point2d_x(this.__wbg_ptr);
        return ret;
    }
    /**
     * The x-coordinate of the point.
     * @param {number} arg0
     */
    set x(arg0) {
        wasm.__wbg_set_point2d_x(this.__wbg_ptr, arg0);
    }
    /**
     * The y-coordinate of the point.
     * @returns {number}
     */
    get y() {
        const ret = wasm.__wbg_get_point2d_y(this.__wbg_ptr);
        return ret;
    }
    /**
     * The y-coordinate of the point.
     * @param {number} arg0
     */
    set y(arg0) {
        wasm.__wbg_set_point2d_y(this.__wbg_ptr, arg0);
    }
    /**
     * Creates a new Point2D with the given coordinates.
     * @param {number} x - The x-coordinate of the point.
     * @param {number} y - The y-coordinate of the point.
     */
    constructor(x, y) {
        const ret = wasm.point2d_new(x, y);
        this.__wbg_ptr = ret >>> 0;
        Point2DFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Linearly interpolates between two Point2D objects.
     * @param {Point2D} point1 - The start point.
     * @param {Point2D} point2 - The end point.
     * @param {number} t - The progress value.
     * @returns {Point2D} The interpolated point.
     */
    static lerp(point1, point2, t) {
        _assertClass(point1, Point2D);
        _assertClass(point2, Point2D);
        const ret = wasm.point2d_lerp(point1.__wbg_ptr, point2.__wbg_ptr, t);
        return Point2D.__wrap(ret);
    }
    /**
     * Gets a cartesian point from polar coordinates.
     * @param {number} radius - The radius of the point.
     * @param {number} angle - The angle of the point.
     * @returns {Point2D} A 2D point.
     */
    static from_polar(radius, angle) {
        const ret = wasm.point2d_from_polar(radius, angle);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the distance between two Point2Ds.
     * @param {Point2D} other - The other point.
     * @returns {number} The distance between the two points.
     */
    distance_squared(other) {
        _assertClass(other, Point2D);
        const ret = wasm.point2d_distance_squared(this.__wbg_ptr, other.__wbg_ptr);
        return ret;
    }
    /**
     * Checks if two Point2D objects are equal within a given tolerance.
     * @param {Point2D} other - The other point.
     * @param {number | null} [tolerance] - The tolerance.
     * @returns {boolean} A boolean indicating whether the two points are equal.
     */
    equals(other, tolerance) {
        _assertClass(other, Point2D);
        const ret = wasm.point2d_equals(this.__wbg_ptr, other.__wbg_ptr, isLikeNone(tolerance) ? 0x100000001 : Math.fround(tolerance));
        return ret !== 0;
    }
    /**
     * Returns the Point2D rotated around a given center point by a given angle.
     * @param {Point2D} center - The center point to rotate around.
     * @param {number} angle - The angle to rotate by.
     * @returns {Point2D} The rotated point.
     */
    rotate_around(center, angle) {
        _assertClass(center, Point2D);
        var ptr0 = center.__destroy_into_raw();
        const ret = wasm.point2d_rotate_around(this.__wbg_ptr, ptr0, angle);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the distance between two Point2Ds.
     * @param {Point2D} other - The other point.
     * @returns {number} The distance between the two points.
     */
    distance(other) {
        _assertClass(other, Point2D);
        const ret = wasm.point2d_distance(this.__wbg_ptr, other.__wbg_ptr);
        return ret;
    }
    /**
     * Clones the Point2D.
     * @returns {Point2D}
     */
    clone() {
        const ret = wasm.point2d_clone(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the squared magnitude of the Point2D.
     * @returns {number} The squared magnitude of the point.
     */
    get magnitude_squared() {
        const ret = wasm.point2d_magnitude_squared(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the magnitude of the Point2D.
     * @returns {number} The magnitude of the point.
     */
    get magnitude() {
        const ret = wasm.point2d_magnitude(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the normalized Point2D.
     * @returns {Point2D} The normalized point.
     */
    get normalized() {
        const ret = wasm.point2d_normalized(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the dot product of Point2D objects.
     * @param {Point2D} other - The other point.
     * @returns {number} The dot product of the two points.
     */
    dot(other) {
        _assertClass(other, Point2D);
        const ret = wasm.point2d_dot(this.__wbg_ptr, other.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the angle between two Point2Ds.
     * @param {Point2D} other - The other point.
     * @returns {number} The angle between the two points.
     */
    angle(other) {
        _assertClass(other, Point2D);
        const ret = wasm.point2d_angle(this.__wbg_ptr, other.__wbg_ptr);
        return ret;
    }
    /**
     * Gets the direction angle with respect to (0, 0) of the Point2D.
     * @returns {number} The direction angle of the point.
     */
    get direction() {
        const ret = wasm.point2d_direction(this.__wbg_ptr);
        return ret;
    }
    /**
     * Projects a point onto a line given the start and end points of the line.
     * @param {Point2D} start - The start point of the line.
     * @param {Point2D} end - The end point of the line.
     * @returns {number} The proportion of the line.
     */
    project_onto_line(start, end) {
        _assertClass(start, Point2D);
        _assertClass(end, Point2D);
        const ret = wasm.point2d_project_onto_line(this.__wbg_ptr, start.__wbg_ptr, end.__wbg_ptr);
        return ret;
    }
    /**
     * Checks if a point is finite
     * @returns {boolean} A boolean indicating whether the point is finite.
     */
    is_finite() {
        const ret = wasm.point2d_is_finite(this.__wbg_ptr);
        return ret !== 0;
    }
}

const RadialGradientFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_radialgradient_free(ptr >>> 0, 1));
/**
 * A radial gradient with two circles and color stops.
 */
export class RadialGradient {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(RadialGradient.prototype);
        obj.__wbg_ptr = ptr;
        RadialGradientFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        RadialGradientFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_radialgradient_free(ptr, 0);
    }
    /**
     * The start circle center point of the gradient.
     * @returns {Point2D}
     */
    get f() {
        const ret = wasm.__wbg_get_lineargradient_p1(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * The start circle center point of the gradient.
     * @param {Point2D} arg0
     */
    set f(arg0) {
        _assertClass(arg0, Point2D);
        var ptr0 = arg0.__destroy_into_raw();
        wasm.__wbg_set_lineargradient_p1(this.__wbg_ptr, ptr0);
    }
    /**
     * The end circle center point of the gradient.
     * @returns {Point2D}
     */
    get c() {
        const ret = wasm.__wbg_get_lineargradient_p2(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * The end circle center point of the gradient.
     * @param {Point2D} arg0
     */
    set c(arg0) {
        _assertClass(arg0, Point2D);
        var ptr0 = arg0.__destroy_into_raw();
        wasm.__wbg_set_lineargradient_p2(this.__wbg_ptr, ptr0);
    }
    /**
     * The radius of the gradient.
     * @returns {number}
     */
    get r() {
        const ret = wasm.__wbg_get_imagebitmap_x(this.__wbg_ptr);
        return ret;
    }
    /**
     * The radius of the gradient.
     * @param {number} arg0
     */
    set r(arg0) {
        wasm.__wbg_set_imagebitmap_x(this.__wbg_ptr, arg0);
    }
    /**
     * Creates a new RadialGradient with the given focal point, center point, radius, and ColorStops.
     * @param {Point2D} f - The start circle center point of the gradient.
     * @param {Point2D} c - The end circle center point of the gradient.
     * @param {number} r - The radius of the gradient.
     * @param {ColorStop[]} color_stops - The color stops of the gradient.
     */
    constructor(f, c, r, color_stops) {
        _assertClass(f, Point2D);
        var ptr0 = f.__destroy_into_raw();
        _assertClass(c, Point2D);
        var ptr1 = c.__destroy_into_raw();
        const ptr2 = passArrayJsValueToWasm0(color_stops, wasm.__wbindgen_malloc);
        const len2 = WASM_VECTOR_LEN;
        const ret = wasm.radialgradient_new(ptr0, ptr1, r, ptr2, len2);
        this.__wbg_ptr = ret >>> 0;
        RadialGradientFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the default RadialGradient, which is a gradient from the focal point to the center with the same color.
     * @returns {RadialGradient} The default radial gradient.
     */
    static default_radial_gradient() {
        const ret = wasm.radialgradient_default_radial_gradient();
        return RadialGradient.__wrap(ret);
    }
    /**
     * Gets the ColorStops of the gradient.
     * @returns {ColorStop[]} The color stops of the gradient.
     */
    get color_stops() {
        const ret = wasm.radialgradient_color_stops(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Sets the ColorStops of the gradient.
     * @param {ColorStop[]} color_stops - The color stops of the gradient.
     */
    set color_stops(color_stops) {
        const ptr0 = passArrayJsValueToWasm0(color_stops, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        wasm.radialgradient_set_color_stops(this.__wbg_ptr, ptr0, len0);
    }
    /**
     * Gets the Color at a given offset along the gradient.
     * @param {number} position - The offset to get the color at.
     * @returns {Color} The color at the given offset.
     */
    color_at_offset(position) {
        const ret = wasm.radialgradient_color_at_offset(this.__wbg_ptr, position);
        return Color.__wrap(ret);
    }
    /**
     * Gets the Color at a given point along the gradient.
     * @param {Point2D} p - The point to get the color at.
     * @returns {Color} The color at the given point.
     */
    color_at(p) {
        _assertClass(p, Point2D);
        var ptr0 = p.__destroy_into_raw();
        const ret = wasm.radialgradient_color_at(this.__wbg_ptr, ptr0);
        return Color.__wrap(ret);
    }
    /**
     * Returns a single color radial gradient.
     * @param {Point2D} f - The start circle center point of the gradient.
     * @param {Point2D} c - The end circle center point of the gradient.
     * @param {number} r - The radius of the gradient.
     * @param {Color} color - The color of the gradient.
     * @param {number | null} [repeats] - Number of times to repeat the color.
     * @returns {RadialGradient} A single color radial gradient.
     */
    static single_color_gradient(f, c, r, color, repeats) {
        _assertClass(f, Point2D);
        var ptr0 = f.__destroy_into_raw();
        _assertClass(c, Point2D);
        var ptr1 = c.__destroy_into_raw();
        _assertClass(color, Color);
        var ptr2 = color.__destroy_into_raw();
        const ret = wasm.radialgradient_single_color_gradient(ptr0, ptr1, r, ptr2, isLikeNone(repeats) ? 0x100000001 : (repeats) >>> 0);
        return RadialGradient.__wrap(ret);
    }
    /**
     * Linearly interpolates between two RadialGradients given a progress value.
     * @param {RadialGradient} gradient1 - The first radial gradient.
     * @param {RadialGradient} gradient2 - The second radial gradient.
     * @param {number} t - The progress value.
     * @returns {RadialGradient} The interpolated radial gradient.
     */
    static lerp(gradient1, gradient2, t) {
        _assertClass(gradient1, RadialGradient);
        _assertClass(gradient2, RadialGradient);
        const ret = wasm.radialgradient_lerp(gradient1.__wbg_ptr, gradient2.__wbg_ptr, t);
        return RadialGradient.__wrap(ret);
    }
}

const RectangleFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_rectangle_free(ptr >>> 0, 1));
/**
 * A Rectangle is a quadrilateral with four right angles.
 */
export class Rectangle {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Rectangle.prototype);
        obj.__wbg_ptr = ptr;
        RectangleFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        RectangleFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_rectangle_free(ptr, 0);
    }
    /**
     * Creates a new Rectangle from a BoundingBox and an optional rotation.
     * @param {BoundingBox} bbox - The BoundingBox of the rectangle.
     * @param {number | null} [rotation] - The rotation of the rectangle, if any.
     */
    constructor(bbox, rotation) {
        _assertClass(bbox, BoundingBox);
        var ptr0 = bbox.__destroy_into_raw();
        const ret = wasm.rectangle_new(ptr0, isLikeNone(rotation) ? 0x100000001 : Math.fround(rotation));
        this.__wbg_ptr = ret >>> 0;
        RectangleFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Gets a VectorObjectBuilder with the rectangle's points.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder representing the rectangle.
     */
    get vector_object_builder() {
        const ret = wasm.rectangle_vector_object_builder(this.__wbg_ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the position of the rectangle.
     * @returns {Point2D} The position of the rectangle.
     */
    get position() {
        const ret = wasm.rectangle_position(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the size of the rectangle.
     * @returns {BoundingBox} The size of the rectangle.
     */
    get bbox() {
        const ret = wasm.rectangle_bbox(this.__wbg_ptr);
        return BoundingBox.__wrap(ret);
    }
    /**
     * Returns the rotation of the rectangle.
     * @returns {number | undefined} The rotation of the rectangle.
     */
    get rotation() {
        const ret = wasm.rectangle_rotation(this.__wbg_ptr);
        return ret === 0x100000001 ? undefined : ret;
    }
    /**
     * Returns the top left corner of the rectangle as a Point2D.
     * @returns {Point2D} The top left corner of the rectangle.
     */
    get top_left() {
        const ret = wasm.rectangle_position(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the top right corner of the rectangle as a Point2D.
     * @returns {Point2D} The top right corner of the rectangle.
     */
    get top_right() {
        const ret = wasm.rectangle_top_right(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the bottom left corner of the rectangle as a Point2D.
     * @returns {Point2D} The bottom left corner of the rectangle.
     */
    get bottom_left() {
        const ret = wasm.rectangle_bottom_left(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the bottom right corner of the rectangle as a Point2D.
     * @returns {Point2D} The bottom right corner of the rectangle.
     */
    get bottom_right() {
        const ret = wasm.rectangle_bottom_right(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the top of the rectangle as a Point2D.
     * @returns {Point2D} The top of the rectangle.
     */
    get top() {
        const ret = wasm.rectangle_top(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the bottom of the rectangle as a Point2D.
     * @returns {Point2D} The bottom of the rectangle.
     */
    get bottom() {
        const ret = wasm.rectangle_bottom(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the left of the rectangle as a Point2D.
     * @returns {Point2D} The left of the rectangle.
     */
    get left() {
        const ret = wasm.rectangle_left(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the right of the rectangle as a Point2D.
     * @returns {Point2D} The right of the rectangle.
     */
    get right() {
        const ret = wasm.rectangle_right(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the area of the rectangle.
     * @returns {number} The area of the rectangle.
     */
    get area() {
        const ret = wasm.rectangle_area(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the center of the rectangle as a Point2D.
     * @returns {Point2D} The center of the rectangle.
     */
    get center() {
        const ret = wasm.rectangle_center(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
}

const RightTriangleFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_righttriangle_free(ptr >>> 0, 1));
/**
 * A RightTriangle is a triangle in which one angle is a right angle.
 */
export class RightTriangle {

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        RightTriangleFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_righttriangle_free(ptr, 0);
    }
    /**
     * Creates a new RightTriangle from a center point, base length, height, rotation, and flip.
     * @param {Point2D} center - The center Point2D of the right triangle.
     * @param {number} base_length - The base length of the right triangle.
     * @param {number} height - The height of the right triangle.
     * @param {number | null} [rotation] - The rotation of the right triangle, if any.
     * @param {boolean | null} [flip] - The flip of the right triangle, by default false.
     */
    constructor(center, base_length, height, rotation, flip) {
        _assertClass(center, Point2D);
        var ptr0 = center.__destroy_into_raw();
        const ret = wasm.righttriangle_new(ptr0, base_length, height, isLikeNone(rotation) ? 0x100000001 : Math.fround(rotation), isLikeNone(flip) ? 0xFFFFFF : flip ? 1 : 0);
        this.__wbg_ptr = ret >>> 0;
        RightTriangleFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Creates a Triangle from the right triangle.
     * @returns {Triangle} A triangle.
     */
    get triangle() {
        const ret = wasm.righttriangle_triangle(this.__wbg_ptr);
        return Triangle.__wrap(ret);
    }
    /**
     * Creates a VectorObjectBuilder from the right triangle.
     * @returns {VectorObjectBuilder} A vector object builder with the right triangle's points.
     */
    get vector_object_builder() {
        const ret = wasm.righttriangle_vector_object_builder(this.__wbg_ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the center Point2D of the right triangle.
     * @returns {Point2D} The center point of the right triangle.
     */
    get center() {
        const ret = wasm.equilateraltriangle_center(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the base length of the right triangle.
     * @returns {number} The base length of the right triangle.
     */
    get base_length() {
        const ret = wasm.equilateraltriangle_side_length(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the height of the right triangle.
     * @returns {number} The height of the right triangle.
     */
    get height() {
        const ret = wasm.righttriangle_height(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the area of the right triangle.
     * @returns {number} The area of the right triangle.
     */
    get area() {
        const ret = wasm.righttriangle_area(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the perimeter of the RightTriangle.
     * @returns {number} The perimeter of the right triangle.
     */
    get perimeter() {
        const ret = wasm.righttriangle_perimeter(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the hypotenuse of the RightTriangle.
     * @returns {number} The hypotenuse of the right triangle.
     */
    get hypotenuse() {
        const ret = wasm.righttriangle_hypotenuse(this.__wbg_ptr);
        return ret;
    }
}

const SquareFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_square_free(ptr >>> 0, 1));
/**
 * A square is a rectangle with equal width and height.
 */
export class Square {

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        SquareFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_square_free(ptr, 0);
    }
    /**
     * Creates a new Square from a center point, side length, and optional rotation.
     * @param {Point2D} center - The center point of the square as a Point2D.
     * @param {number} side_length - The side length of the square.
     * @param {number | null} [rotation] - The rotation of the square, if any.
     */
    constructor(center, side_length, rotation) {
        _assertClass(center, Point2D);
        var ptr0 = center.__destroy_into_raw();
        const ret = wasm.square_new(ptr0, side_length, isLikeNone(rotation) ? 0x100000001 : Math.fround(rotation));
        this.__wbg_ptr = ret >>> 0;
        SquareFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Creates a new Rectangle from the square.
     * @returns {Rectangle} A Rectangle representing the square.
     */
    get rectangle() {
        const ret = wasm.square_rectangle(this.__wbg_ptr);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        return Rectangle.__wrap(ret[0]);
    }
    /**
     * Creates a VectorObjectBuilder from the square.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder representing the square.
     */
    get vector_object_builder() {
        const ret = wasm.square_vector_object_builder(this.__wbg_ptr);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        return VectorObjectBuilder.__wrap(ret[0]);
    }
    /**
     * Returns the center point of the square.
     * @returns {Point2D} The center point of the square as a Point2D.
     */
    get center() {
        const ret = wasm.rectangle_position(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the side length of the square.
     * @returns {number} The side length of the square as a Point2D.
     */
    get side_length() {
        const ret = wasm.square_side_length(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the rotation of the square.
     * @returns {number | undefined} The rotation of the square, if any.
     */
    get rotation() {
        const ret = wasm.rectangle_rotation(this.__wbg_ptr);
        return ret === 0x100000001 ? undefined : ret;
    }
    /**
     * Returns the area of the square.
     * @returns {number} The area of the square.
     */
    get area() {
        const ret = wasm.square_area(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the perimeter of the square.
     * @returns {number} The perimeter of the square.
     */
    get perimeter() {
        const ret = wasm.square_perimeter(this.__wbg_ptr);
        return ret;
    }
}

const StyleFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_style_free(ptr >>> 0, 1));
/**
 * A style with a color, linear gradient, radial gradient, or image.
 */
export class Style {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Style.prototype);
        obj.__wbg_ptr = ptr;
        StyleFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        StyleFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_style_free(ptr, 0);
    }
    /**
     * Creates a new Style with the given color, linear gradient, radial gradient, or image. It must have exactly one of these.
     * @param {Color | null} [color] - The color of the style, if provided.
     * @param {LinearGradient | null} [linear_gradient] - The linear gradient of the style, if provided.
     * @param {RadialGradient | null} [radial_gradient] - The radial gradient of the style, if provided.
     * @param {ImageBitmap | null} [image] - The image of the style, if provided.
     */
    constructor(color, linear_gradient, radial_gradient, image) {
        let ptr0 = 0;
        if (!isLikeNone(color)) {
            _assertClass(color, Color);
            ptr0 = color.__destroy_into_raw();
        }
        let ptr1 = 0;
        if (!isLikeNone(linear_gradient)) {
            _assertClass(linear_gradient, LinearGradient);
            ptr1 = linear_gradient.__destroy_into_raw();
        }
        let ptr2 = 0;
        if (!isLikeNone(radial_gradient)) {
            _assertClass(radial_gradient, RadialGradient);
            ptr2 = radial_gradient.__destroy_into_raw();
        }
        let ptr3 = 0;
        if (!isLikeNone(image)) {
            _assertClass(image, ImageBitmap);
            ptr3 = image.__destroy_into_raw();
        }
        const ret = wasm.style_new(ptr0, ptr1, ptr2, ptr3);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        this.__wbg_ptr = ret[0] >>> 0;
        StyleFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Clones the Style.
     * @returns {Style} The cloned style.
     */
    clone() {
        const ret = wasm.style_clone(this.__wbg_ptr);
        return Style.__wrap(ret);
    }
    /**
     * Creates a new Style with the given color.
     * @param {Color} color - The color of the style.
     * @returns {Style} A new style from the color.
     */
    static from_color(color) {
        _assertClass(color, Color);
        var ptr0 = color.__destroy_into_raw();
        const ret = wasm.style_from_color(ptr0);
        return Style.__wrap(ret);
    }
    /**
     * Creates a new Style with the given linear gradient.
     * @param {LinearGradient} gradient - The linear gradient of the style.
     * @returns {Style} A new style from the linear gradient.
     */
    static from_linear_gradient(gradient) {
        _assertClass(gradient, LinearGradient);
        var ptr0 = gradient.__destroy_into_raw();
        const ret = wasm.style_from_linear_gradient(ptr0);
        return Style.__wrap(ret);
    }
    /**
     * Creates a new Style with the given radial gradient.
     * @param {RadialGradient} gradient
     * @returns {Style} A new style from the radial gradient.
     */
    static from_radial_gradient(gradient) {
        _assertClass(gradient, RadialGradient);
        var ptr0 = gradient.__destroy_into_raw();
        const ret = wasm.style_from_radial_gradient(ptr0);
        return Style.__wrap(ret);
    }
    /**
     * Creates a new Style with the given image.
     * @param {ImageBitmap} image - The image of the style.
     * @returns {Style} A new style from the image.
     */
    static from_image(image) {
        _assertClass(image, ImageBitmap);
        var ptr0 = image.__destroy_into_raw();
        const ret = wasm.style_from_image(ptr0);
        return Style.__wrap(ret);
    }
    /**
     * Returns the default Style, which is a color with the default color.
     * @returns {Style} The default style.
     */
    static default_style() {
        const ret = wasm.style_default_style();
        return Style.__wrap(ret);
    }
    /**
     * Fades the Style by a given amount.
     * @param {number} amount - The amount to fade the style by.
     * @returns {Style} The faded style.
     */
    fade(amount) {
        const ret = wasm.style_fade(this.__wbg_ptr, amount);
        return Style.__wrap(ret);
    }
    /**
     * Gets the Color of the style, if it's a color.
     * @returns {Color | undefined} The color of the style.
     */
    get color() {
        const ret = wasm.style_color(this.__wbg_ptr);
        return ret === 0 ? undefined : Color.__wrap(ret);
    }
    /**
     * Sets the style to a Color.
     * @param {Color} color - The color of the style.
     */
    set color(color) {
        _assertClass(color, Color);
        var ptr0 = color.__destroy_into_raw();
        wasm.style_set_color(this.__wbg_ptr, ptr0);
    }
    /**
     * Gets the LinearGradient of the style, if it's a linear gradient.
     * @returns {LinearGradient | undefined} The linear gradient of the style.
     */
    get linear_gradient() {
        const ret = wasm.style_linear_gradient(this.__wbg_ptr);
        return ret === 0 ? undefined : LinearGradient.__wrap(ret);
    }
    /**
     * Sets the style to a LinearGradient.
     * @param {LinearGradient} linear_gradient - The linear gradient of the style.
     */
    set linear_gradient(linear_gradient) {
        _assertClass(linear_gradient, LinearGradient);
        var ptr0 = linear_gradient.__destroy_into_raw();
        wasm.style_set_linear_gradient(this.__wbg_ptr, ptr0);
    }
    /**
     * Gets the RadialGradient of the style, if it's a radial gradient.
     * @returns {RadialGradient | undefined} The radial gradient of the style.
     */
    get radial_gradient() {
        const ret = wasm.style_radial_gradient(this.__wbg_ptr);
        return ret === 0 ? undefined : RadialGradient.__wrap(ret);
    }
    /**
     * Sets the style to a RadialGradient.
     * @param {RadialGradient} radial_gradient - The radial gradient of the style.
     */
    set radial_gradient(radial_gradient) {
        _assertClass(radial_gradient, RadialGradient);
        var ptr0 = radial_gradient.__destroy_into_raw();
        wasm.style_set_radial_gradient(this.__wbg_ptr, ptr0);
    }
    /**
     * Gets the ImageBitmap of the style, if it's an image.
     * @returns {ImageBitmap | undefined} The image of the style.
     */
    get image() {
        const ret = wasm.style_image(this.__wbg_ptr);
        return ret === 0 ? undefined : ImageBitmap.__wrap(ret);
    }
    /**
     * Sets the style to an ImageBitmap.
     * @param {ImageBitmap} image
     */
    set image(image) {
        _assertClass(image, ImageBitmap);
        var ptr0 = image.__destroy_into_raw();
        wasm.style_set_image(this.__wbg_ptr, ptr0);
    }
    /**
     * Gets the Color at a given point.
     * @param {Point2D} p - The x coordinate of the point.
     * @returns {Color} The color at the given point.
     */
    color_at(p) {
        _assertClass(p, Point2D);
        var ptr0 = p.__destroy_into_raw();
        const ret = wasm.style_color_at(this.__wbg_ptr, ptr0);
        return Color.__wrap(ret);
    }
    /**
     * Linearly interpolates between two Styles given a progress value.
     * @param {Style} style1 - The first style.
     * @param {Style} style2 - The second style.
     * @param {number} t - The progress value.
     * @param {number | null} [x] - Top left x coordinate of the bitmap. Must be provided if both styles are images.
     * @param {number | null} [y] - Top left y coordinate of the bitmap. Must be provided if both styles are images.
     * @param {number | null} [width] - Width of the bitmap. Must be provided if both styles are images.
     * @param {number | null} [height] - Height of the bitmap. Must be provided if both styles are images.
     * @param {number | null} [data_width] - Number of pixels in a row of the bitmap. Must be provided if both styles are different kinds of gradients or one of them is an image.
     * @param {number | null} [data_height] - Number of pixels in a column of the bitmap. Must be provided if both styles are different kinds of gradients or one of them is an image.
     * @returns {Style} The interpolated style.
     */
    static lerp(style1, style2, t, x, y, width, height, data_width, data_height) {
        _assertClass(style1, Style);
        _assertClass(style2, Style);
        const ret = wasm.style_lerp(style1.__wbg_ptr, style2.__wbg_ptr, t, isLikeNone(x) ? 0x100000001 : Math.fround(x), isLikeNone(y) ? 0x100000001 : Math.fround(y), isLikeNone(width) ? 0x100000001 : Math.fround(width), isLikeNone(height) ? 0x100000001 : Math.fround(height), isLikeNone(data_width) ? 0x100000001 : (data_width) >>> 0, isLikeNone(data_height) ? 0x100000001 : (data_height) >>> 0);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        return Style.__wrap(ret[0]);
    }
}

const TickFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_tick_free(ptr >>> 0, 1));
/**
 * A Tick is a mark on an axis at a specific value.
 */
export class Tick {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Tick.prototype);
        obj.__wbg_ptr = ptr;
        TickFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    static __unwrap(jsValue) {
        if (!(jsValue instanceof Tick)) {
            return 0;
        }
        return jsValue.__destroy_into_raw();
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        TickFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_tick_free(ptr, 0);
    }
    /**
     * Creates a new Tick with the given value.
     * @param {number} value - The value of the tick.
     * @param {VectorObjectBuilder | null} [label] - The label of the tick.
     * @param {number | null} [size] - The size of the tick.
     * @param {Style | null} [style] - The style of the tick.
     * @param {number | null} [stroke_width] - The stroke width of the tick.
     */
    constructor(value, label, size, style, stroke_width) {
        let ptr0 = 0;
        if (!isLikeNone(label)) {
            _assertClass(label, VectorObjectBuilder);
            ptr0 = label.__destroy_into_raw();
        }
        let ptr1 = 0;
        if (!isLikeNone(style)) {
            _assertClass(style, Style);
            ptr1 = style.__destroy_into_raw();
        }
        const ret = wasm.tick_new(value, ptr0, isLikeNone(size) ? 0x100000001 : Math.fround(size), ptr1, isLikeNone(stroke_width) ? 0x100000001 : Math.fround(stroke_width));
        this.__wbg_ptr = ret >>> 0;
        TickFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the value of the tick.
     * @returns {number} The value of the tick.
     */
    get value() {
        const ret = wasm.tick_value(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the label of the tick, if any.
     * @returns {VectorObjectBuilder | undefined} The label of the tick.
     */
    get label() {
        const ret = wasm.tick_label(this.__wbg_ptr);
        return ret === 0 ? undefined : VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the size of the tick.
     * @returns {number} The size of the tick.
     */
    get size() {
        const ret = wasm.tick_size(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the style of the tick.
     * @returns {Style} The style of the tick.
     */
    get style() {
        const ret = wasm.tick_style(this.__wbg_ptr);
        return Style.__wrap(ret);
    }
    /**
     * Returns the stroke width of the tick.
     * @returns {number} The stroke width of the tick.
     */
    get stroke_width() {
        const ret = wasm.tick_stroke_width(this.__wbg_ptr);
        return ret;
    }
}

const TransformationMatrixFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_transformationmatrix_free(ptr >>> 0, 1));
/**
 * A TransformationMatrix is a 2D transformation matrix following the CSS matrix transform format.
 */
export class TransformationMatrix {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(TransformationMatrix.prototype);
        obj.__wbg_ptr = ptr;
        TransformationMatrixFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        TransformationMatrixFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_transformationmatrix_free(ptr, 0);
    }
    /**
     * The a component of the matrix.
     * @returns {number}
     */
    get a() {
        const ret = wasm.__wbg_get_transformationmatrix_a(this.__wbg_ptr);
        return ret;
    }
    /**
     * The a component of the matrix.
     * @param {number} arg0
     */
    set a(arg0) {
        wasm.__wbg_set_transformationmatrix_a(this.__wbg_ptr, arg0);
    }
    /**
     * The b component of the matrix.
     * @returns {number}
     */
    get b() {
        const ret = wasm.__wbg_get_transformationmatrix_b(this.__wbg_ptr);
        return ret;
    }
    /**
     * The b component of the matrix.
     * @param {number} arg0
     */
    set b(arg0) {
        wasm.__wbg_set_transformationmatrix_b(this.__wbg_ptr, arg0);
    }
    /**
     * The c component of the matrix.
     * @returns {number}
     */
    get c() {
        const ret = wasm.__wbg_get_transformationmatrix_c(this.__wbg_ptr);
        return ret;
    }
    /**
     * The c component of the matrix.
     * @param {number} arg0
     */
    set c(arg0) {
        wasm.__wbg_set_transformationmatrix_c(this.__wbg_ptr, arg0);
    }
    /**
     * The d component of the matrix.
     * @returns {number}
     */
    get d() {
        const ret = wasm.__wbg_get_transformationmatrix_d(this.__wbg_ptr);
        return ret;
    }
    /**
     * The d component of the matrix.
     * @param {number} arg0
     */
    set d(arg0) {
        wasm.__wbg_set_transformationmatrix_d(this.__wbg_ptr, arg0);
    }
    /**
     * The e component of the matrix.
     * @returns {number}
     */
    get e() {
        const ret = wasm.__wbg_get_transformationmatrix_e(this.__wbg_ptr);
        return ret;
    }
    /**
     * The e component of the matrix.
     * @param {number} arg0
     */
    set e(arg0) {
        wasm.__wbg_set_transformationmatrix_e(this.__wbg_ptr, arg0);
    }
    /**
     * The f component of the matrix.
     * @returns {number}
     */
    get f() {
        const ret = wasm.__wbg_get_transformationmatrix_f(this.__wbg_ptr);
        return ret;
    }
    /**
     * The f component of the matrix.
     * @param {number} arg0
     */
    set f(arg0) {
        wasm.__wbg_set_transformationmatrix_f(this.__wbg_ptr, arg0);
    }
    /**
     * Creates a new TransformationMatrix with the given components.
     * @param {number} a - The a component of the matrix.
     * @param {number} b - The b component of the matrix.
     * @param {number} c - The c component of the matrix.
     * @param {number} d - The d component of the matrix.
     * @param {number} e - The e component of the matrix.
     * @param {number} f - The f component of the matrix.
     */
    constructor(a, b, c, d, e, f) {
        const ret = wasm.transformationmatrix_new(a, b, c, d, e, f);
        this.__wbg_ptr = ret >>> 0;
        TransformationMatrixFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the identity matrix.
     * @returns {TransformationMatrix} The identity matrix.
     */
    static identity() {
        const ret = wasm.transformationmatrix_identity();
        return TransformationMatrix.__wrap(ret);
    }
    /**
     * Gets the matrix that translates by a given x and y value.
     * @param {number} x - The x value to translate by.
     * @param {number} y - The y value to translate by.
     * @returns {TransformationMatrix} The translated matrix.
     */
    static translate(x, y) {
        const ret = wasm.transformationmatrix_translate(x, y);
        return TransformationMatrix.__wrap(ret);
    }
    /**
     * Clones the TransformationMatrix.
     * @returns {TransformationMatrix}
     */
    clone() {
        const ret = wasm.transformationmatrix_clone(this.__wbg_ptr);
        return TransformationMatrix.__wrap(ret);
    }
    /**
     * Gets the matrix that scales by a given x and y value.
     * @param {number} x - The x value to scale by.
     * @param {number} y - The y value to scale by.
     * @returns {TransformationMatrix} The scaled matrix.
     */
    static scale(x, y) {
        const ret = wasm.transformationmatrix_scale(x, y);
        return TransformationMatrix.__wrap(ret);
    }
    /**
     * Applies another TransformationMatrix to this matrix.
     * @param {TransformationMatrix} other
     */
    apply(other) {
        _assertClass(other, TransformationMatrix);
        wasm.transformationmatrix_apply(this.__wbg_ptr, other.__wbg_ptr);
    }
    /**
     * Gets the matrix that rotates by a given angle in radians.
     * @param {number} angle - The angle in radians to rotate by.
     * @returns {TransformationMatrix} The rotated matrix.
     */
    static rotate(angle) {
        const ret = wasm.transformationmatrix_rotate(angle);
        return TransformationMatrix.__wrap(ret);
    }
    /**
     * Gets the matrix that undoes this TransformationMatrix.
     * @returns {TransformationMatrix} The inverse matrix.
     */
    inverse() {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.transformationmatrix_inverse(ptr);
        return TransformationMatrix.__wrap(ret);
    }
}

const TriangleFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_triangle_free(ptr >>> 0, 1));
/**
 * A Triangle is a polygon with three edges and three vertices.
 */
export class Triangle {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Triangle.prototype);
        obj.__wbg_ptr = ptr;
        TriangleFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        TriangleFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_triangle_free(ptr, 0);
    }
    /**
     * Creates a new Triangle object from three points.
     * @param {Point2D} a - The first vertex of the triangle as Point2D.
     * @param {Point2D} b - The second vertex of the triangle as Point2D.
     * @param {Point2D} c - The third vertex of the triangle as Point2D.
     */
    constructor(a, b, c) {
        _assertClass(a, Point2D);
        var ptr0 = a.__destroy_into_raw();
        _assertClass(b, Point2D);
        var ptr1 = b.__destroy_into_raw();
        _assertClass(c, Point2D);
        var ptr2 = c.__destroy_into_raw();
        const ret = wasm.triangle_new(ptr0, ptr1, ptr2);
        this.__wbg_ptr = ret >>> 0;
        TriangleFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the area of the triangle.
     * @returns {number} The area of the triangle.
     */
    get area() {
        const ret = wasm.triangle_area(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the perimeter of the triangle.
     * @returns {number} The perimeter of the triangle.
     */
    get perimeter() {
        const ret = wasm.triangle_perimeter(this.__wbg_ptr);
        return ret;
    }
    /**
     * Creates a VectorObjectBuilder with the triangle's points.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder with the triangle's points.
     */
    vector_object_builder() {
        const ret = wasm.triangle_vector_object_builder(this.__wbg_ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Returns the first vertex of the triangle as Point2D.
     * @returns {Point2D} The first vertex of the triangle.
     */
    get a() {
        const ret = wasm.triangle_a(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the second vertex of the triangle as Point2D.
     * @returns {Point2D} The second vertex of the triangle.
     */
    get b() {
        const ret = wasm.equilateraltriangle_center(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
    /**
     * Returns the third vertex of the triangle as Point2D.
     * @returns {Point2D} The third vertex of the triangle.
     */
    get c() {
        const ret = wasm.triangle_c(this.__wbg_ptr);
        return Point2D.__wrap(ret);
    }
}

const TypstFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_typst_free(ptr >>> 0, 1));
/**
 * A Typst is a typesetting object that can be used to render math text with Typst.
 */
export class Typst {

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        TypstFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_typst_free(ptr, 0);
    }
    /**
     * Creates a new Typst object from a source string.
     * @param {string} source - The source of the Typst object.
     */
    constructor(source) {
        const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.typst_new(ptr0, len0);
        this.__wbg_ptr = ret >>> 0;
        TypstFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the source of the Typst object.
     * @returns {string} The source of the Typst object.
     */
    get source() {
        let deferred1_0;
        let deferred1_1;
        try {
            const ret = wasm.typst_source(this.__wbg_ptr);
            deferred1_0 = ret[0];
            deferred1_1 = ret[1];
            return getStringFromWasm0(ret[0], ret[1]);
        } finally {
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
    /**
     * Renders the Typst object to an SVG string.
     * @param {FontFace[] | null} [font_faces] - The font faces to use when rendering the Typst object.
     * @returns {string} The SVG string.
     */
    to_svg(font_faces) {
        let deferred3_0;
        let deferred3_1;
        try {
            var ptr0 = isLikeNone(font_faces) ? 0 : passArrayJsValueToWasm0(font_faces, wasm.__wbindgen_malloc);
            var len0 = WASM_VECTOR_LEN;
            const ret = wasm.typst_to_svg(this.__wbg_ptr, ptr0, len0);
            var ptr2 = ret[0];
            var len2 = ret[1];
            if (ret[3]) {
                ptr2 = 0; len2 = 0;
                throw takeFromExternrefTable0(ret[2]);
            }
            deferred3_0 = ptr2;
            deferred3_1 = len2;
            return getStringFromWasm0(ptr2, len2);
        } finally {
            wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
        }
    }
    /**
     * Renders the Typst object to a VectorObjectBuilder.
     * @param {FontFace[] | null} [font_faces] - The FontFaces to use when rendering the Typst object, if any.
     * @returns {VectorObjectBuilder} A VectorObjectBuilder representing the typesetting object.
     */
    vector_object_builder(font_faces) {
        var ptr0 = isLikeNone(font_faces) ? 0 : passArrayJsValueToWasm0(font_faces, wasm.__wbindgen_malloc);
        var len0 = WASM_VECTOR_LEN;
        const ret = wasm.typst_vector_object_builder(this.__wbg_ptr, ptr0, len0);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        return VectorObjectBuilder.__wrap(ret[0]);
    }
}

const VectorObjectFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_vectorobject_free(ptr >>> 0, 1));
/**
 * A VectorObject is a vector object that can be drawn on a vector graphics canvas.
 */
export class VectorObject {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(VectorObject.prototype);
        obj.__wbg_ptr = ptr;
        VectorObjectFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    static __unwrap(jsValue) {
        if (!(jsValue instanceof VectorObject)) {
            return 0;
        }
        return jsValue.__destroy_into_raw();
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        VectorObjectFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_vectorobject_free(ptr, 0);
    }
    /**
     * Creates a new VectorObject.
     * @param {Path2D} path - The Path2D of the vector object.
     * @param {Style} fill - The fill Style of the vector object.
     * @param {string} fill_rule - The fill rule of the vector object.
     * @param {Style} stroke - The stroke Style of the vector object.
     * @param {number} stroke_width - The stroke width of the vector object.
     * @param {string} stroke_line_cap - The stroke line cap of the vector object.
     * @param {string} stroke_line_join - The stroke line join of the vector object.
     * @param {number} stroke_miter_limit - The stroke miter limit of the vector object.
     * @param {number} stroke_dash_offset - The stroke dash offset of the vector object.
     * @param {number[]} stroke_dash_array - The stroke dash array of the vector object.
     * @param {VectorObject[]} children - The children of the vector object.
     * @param {string | null | undefined} name - The name of the vector object.
     * @param {TransformationMatrix} transform - The TransformationMatrix of the vector object.
     */
    constructor(path, fill, fill_rule, stroke, stroke_width, stroke_line_cap, stroke_line_join, stroke_miter_limit, stroke_dash_offset, stroke_dash_array, children, name, transform) {
        _assertClass(path, Path2D);
        var ptr0 = path.__destroy_into_raw();
        _assertClass(fill, Style);
        var ptr1 = fill.__destroy_into_raw();
        const ptr2 = passStringToWasm0(fill_rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len2 = WASM_VECTOR_LEN;
        _assertClass(stroke, Style);
        var ptr3 = stroke.__destroy_into_raw();
        const ptr4 = passStringToWasm0(stroke_line_cap, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len4 = WASM_VECTOR_LEN;
        const ptr5 = passStringToWasm0(stroke_line_join, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len5 = WASM_VECTOR_LEN;
        const ptr6 = passArrayF32ToWasm0(stroke_dash_array, wasm.__wbindgen_malloc);
        const len6 = WASM_VECTOR_LEN;
        const ptr7 = passArrayJsValueToWasm0(children, wasm.__wbindgen_malloc);
        const len7 = WASM_VECTOR_LEN;
        var ptr8 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len8 = WASM_VECTOR_LEN;
        _assertClass(transform, TransformationMatrix);
        var ptr9 = transform.__destroy_into_raw();
        const ret = wasm.vectorobject_new(ptr0, ptr1, ptr2, len2, ptr3, stroke_width, ptr4, len4, ptr5, len5, stroke_miter_limit, stroke_dash_offset, ptr6, len6, ptr7, len7, ptr8, len8, ptr9);
        this.__wbg_ptr = ret >>> 0;
        VectorObjectFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Clones the vector object.
     * @returns {VectorObject} The cloned vector object.
     */
    clone() {
        const ret = wasm.vectorobject_clone(this.__wbg_ptr);
        return VectorObject.__wrap(ret);
    }
    /**
     * Creates a new empty VectorObject.
     * @returns {VectorObject} A new empty vector object.
     */
    static default_vector_object() {
        const ret = wasm.vectorobject_default_vector_object();
        return VectorObject.__wrap(ret);
    }
    /**
     * Gets the Path2D of the VectorObject.
     * @returns {Path2D} The path of the vector object.
     */
    get path() {
        const ret = wasm.vectorobject_path(this.__wbg_ptr);
        return Path2D.__wrap(ret);
    }
    /**
     * Gets the fill Style of the VectorObject.
     * @returns {Style} The fill style of the vector object.
     */
    get fill() {
        const ret = wasm.vectorobject_fill(this.__wbg_ptr);
        return Style.__wrap(ret);
    }
    /**
     * Gets the fill rule of the VectorObject.
     * @returns {string} The fill rule of the vector object.
     */
    get fill_rule() {
        let deferred1_0;
        let deferred1_1;
        try {
            const ret = wasm.vectorobject_fill_rule(this.__wbg_ptr);
            deferred1_0 = ret[0];
            deferred1_1 = ret[1];
            return getStringFromWasm0(ret[0], ret[1]);
        } finally {
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
    /**
     * Gets the stroke Style of the VectorObject.
     * @returns {Style} The stroke style of the vector object.
     */
    get stroke() {
        const ret = wasm.vectorobject_stroke(this.__wbg_ptr);
        return Style.__wrap(ret);
    }
    /**
     * Gets the stroke width of the VectorObject.
     * @returns {number} The stroke width of the vector object.
     */
    get stroke_width() {
        const ret = wasm.vectorobject_stroke_width(this.__wbg_ptr);
        return ret;
    }
    /**
     * Gets the stroke line cap of the VectorObject.
     * @returns {string} The stroke line cap of the vector object.
     */
    get stroke_line_cap() {
        let deferred1_0;
        let deferred1_1;
        try {
            const ret = wasm.vectorobject_stroke_line_cap(this.__wbg_ptr);
            deferred1_0 = ret[0];
            deferred1_1 = ret[1];
            return getStringFromWasm0(ret[0], ret[1]);
        } finally {
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
    /**
     * Gets the stroke line join of the VectorObject.
     * @returns {string} The stroke line join of the vector object.
     */
    get stroke_line_join() {
        let deferred1_0;
        let deferred1_1;
        try {
            const ret = wasm.vectorobject_stroke_line_join(this.__wbg_ptr);
            deferred1_0 = ret[0];
            deferred1_1 = ret[1];
            return getStringFromWasm0(ret[0], ret[1]);
        } finally {
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
    /**
     * Gets the stroke miter limit of VectorObject.
     * @returns {number} The stroke miter limit of the vector object.
     */
    get stroke_miter_limit() {
        const ret = wasm.vectorobject_stroke_miter_limit(this.__wbg_ptr);
        return ret;
    }
    /**
     * Gets the stroke dash offset of the VectorObject.
     * @returns {number} The stroke dash offset of the vector object.
     */
    get stroke_dash_offset() {
        const ret = wasm.vectorobject_stroke_dash_offset(this.__wbg_ptr);
        return ret;
    }
    /**
     * Gets the stroke dash array of the VectorObject.
     * @returns {number[]} The stroke dash array of the vector object.
     */
    get stroke_dash_array() {
        const ret = wasm.vectorobject_stroke_dash_array(this.__wbg_ptr);
        var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Gets the children of the VectorObject.
     * @returns {VectorObject[]} The children of the vector object.
     */
    get children() {
        const ret = wasm.vectorobject_children(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Gets the name of the VectorObject.
     * @returns {string | undefined} The name of the vector object.
     */
    get name() {
        const ret = wasm.vectorobject_name(this.__wbg_ptr);
        let v1;
        if (ret[0] !== 0) {
            v1 = getStringFromWasm0(ret[0], ret[1]).slice();
            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
        }
        return v1;
    }
    /**
     * Gets the transformation matrix of the VectorObject.
     * @returns {TransformationMatrix} The transformation matrix of the vector object.
     */
    get transform() {
        const ret = wasm.vectorobject_transform(this.__wbg_ptr);
        return TransformationMatrix.__wrap(ret);
    }
    /**
     * Gets the Path2D with the applied TransformationMatrix.
     * @returns {Path2D} The path of the vector object with the applied transform.
     */
    get actual_path() {
        const ret = wasm.vectorobject_actual_path(this.__wbg_ptr);
        return Path2D.__wrap(ret);
    }
    /**
     * Gets the BoundingBox of the VectorObject.
     * @param {boolean | null} [recursive] - Whether to include the children of the vector object.
     * @returns {BoundingBox | undefined} The bounding box of the vector object.
     */
    bounding_box(recursive) {
        const ret = wasm.vectorobject_bounding_box(this.__wbg_ptr, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return ret === 0 ? undefined : BoundingBox.__wrap(ret);
    }
    /**
     * Gets the center Point2D of the VectorObject.
     * @returns {Point2D | undefined} The center of the vector object.
     */
    get center() {
        const ret = wasm.vectorobject_center(this.__wbg_ptr);
        return ret === 0 ? undefined : Point2D.__wrap(ret);
    }
    /**
     * Gets the critical Point2D of the VectorObject.
     * @param {number} key_x - The x key of the critical point. If negative, the minimum x is returned. If positive, the maximum x is returned. If zero, the center x is returned.
     * @param {number} key_y - The y key of the critical point. If negative, the minimum y is returned. If positive, the maximum y is returned. If zero, the center y is returned.
     * @param {boolean | null} [recursive] - Whether to include the children of the vector object.
     * @returns {Point2D | undefined} The critical point of the vector object.
     */
    get_critical_point(key_x, key_y, recursive) {
        const ret = wasm.vectorobject_get_critical_point(this.__wbg_ptr, key_x, key_y, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return ret === 0 ? undefined : Point2D.__wrap(ret);
    }
    /**
     * Gets the children of the VectorObject recursively.
     * @param {boolean | null} [with_points] - Whether to include the children of the children of the vector object, default is false.
     * @returns {VectorObject[]} The children of the vector object.
     */
    get_children_recursive(with_points) {
        const ret = wasm.vectorobject_get_children_recursive(this.__wbg_ptr, isLikeNone(with_points) ? 0xFFFFFF : with_points ? 1 : 0);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Gets the number of cubic bezier curves in the vector object.
     * @returns {number} The number of curves in the vector object.
     */
    get num_curves() {
        const ret = wasm.vectorobject_num_curves(this.__wbg_ptr);
        return ret >>> 0;
    }
    /**
     * Gets the number of points in the VectorObject's path.
     * @returns {number} The number of points in the vector object.
     */
    get num_points() {
        const ret = wasm.vectorobject_num_points(this.__wbg_ptr);
        return ret >>> 0;
    }
    /**
     * Gets the number of children in the VectorObject.
     * @returns {number} The number of children in the vector object.
     */
    get num_children() {
        const ret = wasm.vectorobject_num_children(this.__wbg_ptr);
        return ret >>> 0;
    }
    /**
     * Gets whether the VectorObject's path is closed.
     * @returns {boolean} Whether the vector object's path is closed.
     */
    get is_closed() {
        const ret = wasm.vectorobject_is_closed(this.__wbg_ptr);
        return ret !== 0;
    }
    /**
     * Gets the subpaths of the VectorObject.
     * @returns {Path2D[]} The subpaths of the vector object.
     */
    get subpaths() {
        const ret = wasm.vectorobject_subpaths(this.__wbg_ptr);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Gets the width of the VectorObject.
     * @returns {number | undefined} The width of the vector object.
     */
    get width() {
        const ret = wasm.vectorobject_width(this.__wbg_ptr);
        return ret === 0x100000001 ? undefined : ret;
    }
    /**
     * Gets the height of the VectorObject.
     * @returns {number | undefined} The height of the vector object.
     */
    get height() {
        const ret = wasm.vectorobject_height(this.__wbg_ptr);
        return ret === 0x100000001 ? undefined : ret;
    }
    /**
     * Slices the VectorObject's children.
     * @param {number} start - The start index of the children to slice.
     * @param {number} end - The end index of the children to slice.
     * @returns {VectorObject[]} The sliced children of the vector object.
     */
    slice_children(start, end) {
        const ret = wasm.vectorobject_slice_children(this.__wbg_ptr, start, end);
        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v1;
    }
    /**
     * Gets the children of the VectorObject with the given names.
     * @param {string[]} names - The names of the children to get.
     * @returns {VectorObject[]} The children with the given names.
     */
    get_children_by_names(names) {
        const ptr0 = passArrayJsValueToWasm0(names, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobject_get_children_by_names(this.__wbg_ptr, ptr0, len0);
        var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
        return v2;
    }
}

const VectorObjectBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_vectorobjectbuilder_free(ptr >>> 0, 1));
/**
 * A VectorObjectBuilder can be used to build a VectorObject with operations.
 */
export class VectorObjectBuilder {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(VectorObjectBuilder.prototype);
        obj.__wbg_ptr = ptr;
        VectorObjectBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    static __unwrap(jsValue) {
        if (!(jsValue instanceof VectorObjectBuilder)) {
            return 0;
        }
        return jsValue.__destroy_into_raw();
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        VectorObjectBuilderFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_vectorobjectbuilder_free(ptr, 0);
    }
    /**
     * Creates a new VectorObjectBuilder from a VectorObject.
     * @param {VectorObject} vector_object - The vector object to start building on.
     */
    constructor(vector_object) {
        _assertClass(vector_object, VectorObject);
        const ret = wasm.vectorobjectbuilder_new(vector_object.__wbg_ptr);
        this.__wbg_ptr = ret >>> 0;
        VectorObjectBuilderFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * Returns the default tip shape pointing to the right and centered at the origin as a VectorObjectBuilder.
     * @param {number} tip_length - The length of the tip shape.
     * @returns {VectorObjectBuilder} The default tip shape pointing to the right and centered at the origin.
     */
    static default_tip_shape(tip_length) {
        const ret = wasm.vectorobjectbuilder_default_tip_shape(tip_length);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Creates a new VectorObjectBuilder from an SVG string.
     * @param {string} svg - The SVG string to create the vector object builder from.
     * @param {FontFace[] | null} [font_faces] - Data from font faces to use for text rendering.
     * @param {ImageLibrary | null} [image_library] - Image library to use for image rendering.
     * @returns {VectorObjectBuilder} A new vector object builder.
     */
    static from_svg(svg, font_faces, image_library) {
        const ptr0 = passStringToWasm0(svg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        var ptr1 = isLikeNone(font_faces) ? 0 : passArrayJsValueToWasm0(font_faces, wasm.__wbindgen_malloc);
        var len1 = WASM_VECTOR_LEN;
        let ptr2 = 0;
        if (!isLikeNone(image_library)) {
            _assertClass(image_library, ImageLibrary);
            ptr2 = image_library.__destroy_into_raw();
        }
        const ret = wasm.vectorobjectbuilder_from_svg(ptr0, len0, ptr1, len1, ptr2);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Clones the VectorObjectBuilder.
     * @returns {VectorObjectBuilder} A clone of the vector object builder.
     */
    clone() {
        const ret = wasm.vectorobjectbuilder_clone(this.__wbg_ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Creates a VectorObjectBuilder representing an empty VectorObject.
     * @returns {VectorObjectBuilder} A new vector object builder representing an empty vector object.
     */
    static default_vector_object_builder() {
        const ret = wasm.vectorobjectbuilder_default_vector_object_builder();
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Shifts the VectorObjectBuilder by the given dx and dy.
     * @param {number} dx - The x-coordinate to translate the vector object by.
     * @param {number} dy - The y-coordinate to translate the vector object by.
     * @param {boolean | null} [recursive] - Whether to apply the shift operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the shift operation.
     */
    shift(dx, dy, recursive) {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_shift(ptr, dx, dy, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Centers the VectorObjectBuilder at the given Point2D.
     * @param {Point2D} point - The point to center the vector object at.
     * @param {boolean | null} [recursive] - Whether to apply the move to operation to the children of the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the move to operation.
     */
    move_to(point, recursive) {
        const ptr = this.__destroy_into_raw();
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_move_to(ptr, ptr0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Scales the VectorObjectBuilder by the given factor.
     * @param {number} factor_x - The factor to scale the vector object by.
     * @param {number} factor_y - The factor to scale the vector object by.
     * @param {Point2D | null} [about_point] - The point to scale the vector object about.
     * @param {boolean | null} [recursive] - Whether to apply the scale operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the scale operation.
     */
    scale(factor_x, factor_y, about_point, recursive) {
        const ptr = this.__destroy_into_raw();
        let ptr0 = 0;
        if (!isLikeNone(about_point)) {
            _assertClass(about_point, Point2D);
            ptr0 = about_point.__destroy_into_raw();
        }
        const ret = wasm.vectorobjectbuilder_scale(ptr, factor_x, factor_y, ptr0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Scales the VectorObjectBuilder to the given width.
     * @param {number} width - The width to scale the vector object to.
     * @param {boolean | null} [stretch] - Whether to stretch the vector object to the given width, default is false.
     * @param {Point2D | null} [about_point] - The point to scale the vector object about, default is the center of the bounding box.
     * @param {boolean | null} [recursive] - Whether to apply the scale to width operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the scale to width operation.
     */
    scale_to_width(width, stretch, about_point, recursive) {
        const ptr = this.__destroy_into_raw();
        let ptr0 = 0;
        if (!isLikeNone(about_point)) {
            _assertClass(about_point, Point2D);
            ptr0 = about_point.__destroy_into_raw();
        }
        const ret = wasm.vectorobjectbuilder_scale_to_width(ptr, width, isLikeNone(stretch) ? 0xFFFFFF : stretch ? 1 : 0, ptr0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Scales the VectorObjectBuilder to the given height.
     * @param {number} height - The height to scale the vector object to.
     * @param {boolean | null} [stretch] - Whether to stretch the vector object to the given height, default is false.
     * @param {Point2D | null} [about_point] - The point to scale the vector object about, default is the center of the bounding box.
     * @param {boolean | null} [recursive] - Whether to apply the scale to height operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the scale to height operation.
     */
    scale_to_height(height, stretch, about_point, recursive) {
        const ptr = this.__destroy_into_raw();
        let ptr0 = 0;
        if (!isLikeNone(about_point)) {
            _assertClass(about_point, Point2D);
            ptr0 = about_point.__destroy_into_raw();
        }
        const ret = wasm.vectorobjectbuilder_scale_to_height(ptr, height, isLikeNone(stretch) ? 0xFFFFFF : stretch ? 1 : 0, ptr0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Rotates the VectorObjectBuilder by the given angle in radians.
     * @param {number} angle - The angle in radians to rotate the vector object by.
     * @param {Point2D | null} [from_point] - The point to rotate the vector object about, default is the center of the bounding box.
     * @param {boolean | null} [recursive] - Whether to apply the rotate operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the rotate operation.
     */
    rotate(angle, from_point, recursive) {
        const ptr = this.__destroy_into_raw();
        let ptr0 = 0;
        if (!isLikeNone(from_point)) {
            _assertClass(from_point, Point2D);
            ptr0 = from_point.__destroy_into_raw();
        }
        const ret = wasm.vectorobjectbuilder_rotate(ptr, angle, ptr0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the TransformationMatrix of the VectorObjectBuilder.
     * @param {TransformationMatrix} matrix - The matrix in CSS format to transform the vector object by.
     * @param {boolean | null} [recursive] - Whether to apply the transform operation to the children of the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the transform operation.
     */
    set_transform(matrix, recursive) {
        const ptr = this.__destroy_into_raw();
        _assertClass(matrix, TransformationMatrix);
        var ptr0 = matrix.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_set_transform(ptr, ptr0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Applies the TransformationMatrix to the VectorObjectBuilder.
     * @param {TransformationMatrix} matrix - The matrix in CSS format to apply to the vector object.
     * @param {boolean | null} [recursive] - Whether to apply the apply transform operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the apply transform operation.
     */
    apply_transform(matrix, recursive) {
        const ptr = this.__destroy_into_raw();
        _assertClass(matrix, TransformationMatrix);
        var ptr0 = matrix.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_apply_transform(ptr, ptr0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Adds a child to the VectorObjectBuilder.
     * @param {VectorObjectBuilder[]} children - The children to add at the end of the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the add children operation.
     */
    add_children(children) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passArrayJsValueToWasm0(children, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_add_children(ptr, ptr0, len0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Inserts a child into the VectorObjectBuilder at the given index.
     * @param {number} index - The index to insert the child at.
     * @param {VectorObjectBuilder} child - The child to insert into the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the insert child operation.
     */
    insert_child(index, child) {
        const ptr = this.__destroy_into_raw();
        _assertClass(child, VectorObjectBuilder);
        var ptr0 = child.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_insert_child(ptr, index, ptr0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Inserts children into the VectorObjectBuilder at the given index.
     * @param {number} index - The index to insert the children at.
     * @param {VectorObjectBuilder[]} children - The children to insert into the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the insert children operation.
     */
    insert_children(index, children) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passArrayJsValueToWasm0(children, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_insert_children(ptr, index, ptr0, len0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Removes a child from the VectorObjectBuilder given its index.
     * @param {number} index - The index of the child to remove from the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the remove child by index operation.
     */
    remove_child_by_index(index) {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_remove_child_by_index(ptr, index);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Removes a child from the VectorObjectBuilder given its name.
     * @param {string} name - The name of the child to remove from the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the remove child by name operation.
     */
    remove_child_by_name(name) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_remove_child_by_name(ptr, ptr0, len0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Matches the style properties of the VectorObjectBuilder with another VectorObject.
     * @param {VectorObjectBuilder} vector_object_builder - The vector object to match the style properties of.
     * @returns {VectorObjectBuilder} The vector object being built with the match style properties operation.
     */
    match_style_properties(vector_object_builder) {
        const ptr = this.__destroy_into_raw();
        _assertClass(vector_object_builder, VectorObjectBuilder);
        var ptr0 = vector_object_builder.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_match_style_properties(ptr, ptr0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the actual path of the VectorObjectBuilder. Actual path is the path that is drawn with its transformation matrix applied.
     * @param {Path2D} actual_path - The path to set the vector object to.
     * @returns {VectorObjectBuilder} The vector object being built with the set actual path operation.
     */
    set_actual_path(actual_path) {
        const ptr = this.__destroy_into_raw();
        _assertClass(actual_path, Path2D);
        var ptr0 = actual_path.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_set_actual_path(ptr, ptr0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Trims the stroke of the VectorObjectBuilder to the given start and end proportions.
     * @param {number} start - The proportion of the path to start at.
     * @param {number} end - The proportion of the path to end at.
     * @param {number | null} [samples] - Number of samples to compute the length of each cubic bezier curve segment.
     * @param {number | null} [extra_length] - Extra length to add to each length computation to ensure the path is not too short.
     * @param {boolean | null} [recursive] - Whether to apply the become partial operation to the children of the vector object, default is true
     * @returns {VectorObjectBuilder} The vector object being built with the become partial operation.
     */
    become_partial(start, end, samples, extra_length, recursive) {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_become_partial(ptr, start, end, isLikeNone(samples) ? 0x100000001 : (samples) >>> 0, isLikeNone(extra_length) ? 0x100000001 : Math.fround(extra_length), isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Trims the path of the VectorObjectBuilder to the given start and end proportions.
     * @param {number} start - The proportion of the path to start at.
     * @param {number} end - The proportion of the path to end at.
     * @param {boolean | null} [recursive] - Whether to apply the pointwise become partial operation to the children of the vector object, default is true
     * @returns {VectorObjectBuilder}
     */
    pointwise_become_partial(start, end, recursive) {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_pointwise_become_partial(ptr, start, end, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Moves the current drawing point to the given Point2D.
     * @param {Point2D} point - The point to start a new bezier curve at.
     * @returns {VectorObjectBuilder} The vector object being built with the move point operation.
     */
    move_point(point) {
        const ptr = this.__destroy_into_raw();
        _assertClass(point, Point2D);
        const ret = wasm.vectorobjectbuilder_move_point(ptr, point.__wbg_ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Draws a line from the current drawing point to the given Point2D.
     * @param {Point2D} p - The point to draw a line to.
     * @returns {VectorObjectBuilder} The vector object being built with the line to operation.
     */
    line_to(p) {
        const ptr = this.__destroy_into_raw();
        _assertClass(p, Point2D);
        const ret = wasm.vectorobjectbuilder_line_to(ptr, p.__wbg_ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Draws a quadratic bezier curve from the current drawing point with the given control Point2D and end Point2D.
     * @param {Point2D} p1 - The control point of the quadratic curve.
     * @param {Point2D} p2 - The end point of the quadratic curve.
     * @returns {VectorObjectBuilder} The vector object being built with the quadratic curve to operation.
     */
    quadratic_curve_to(p1, p2) {
        const ptr = this.__destroy_into_raw();
        _assertClass(p1, Point2D);
        _assertClass(p2, Point2D);
        const ret = wasm.vectorobjectbuilder_quadratic_curve_to(ptr, p1.__wbg_ptr, p2.__wbg_ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Draws a cubic bezier curve from the current drawing point with the given control Point2Ds and end Point2D.
     * @param {Point2D} p1 - The first control point of the bezier curve.
     * @param {Point2D} p2 - The second control point of the bezier curve.
     * @param {Point2D} p3 - The end point of the bezier curve.
     * @returns {VectorObjectBuilder} The vector object being built with the bezier curve to operation.
     */
    bezier_curve_to(p1, p2, p3) {
        const ptr = this.__destroy_into_raw();
        _assertClass(p1, Point2D);
        _assertClass(p2, Point2D);
        _assertClass(p3, Point2D);
        const ret = wasm.vectorobjectbuilder_bezier_curve_to(ptr, p1.__wbg_ptr, p2.__wbg_ptr, p3.__wbg_ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Closes the current subpath of the VectorObjectBuilder.
     * @returns {VectorObjectBuilder} The vector object being built with the close operation.
     */
    close() {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_close(ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Fades fill's opacity of the VectorObjectBuilder by the given factor.
     * @param {number} factor - The factor to fade the fill style by.
     * @param {boolean | null} [recursive] - Whether to apply the fade fill operation to the children of the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the fade fill operation.
     */
    fade_fill(factor, recursive) {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_fade_fill(ptr, factor, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Fades stroke's opacity of the VectorObjectBuilder by the given factor.
     * @param {number} factor - The factor to fade the stroke style by.
     * @param {boolean | null} [recursive] - Whether to apply the fade stroke operation to the children of the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the fade stroke operation.
     */
    fade_stroke(factor, recursive) {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_fade_stroke(ptr, factor, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the Path2D of the VectorObjectBuilder.
     * @param {Path2D} path - The path to set the vector object to.
     * @returns {VectorObjectBuilder} The vector object being built with the set path operation.
     */
    set_path(path) {
        const ptr = this.__destroy_into_raw();
        _assertClass(path, Path2D);
        var ptr0 = path.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_set_path(ptr, ptr0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the fill Style of the VectorObjectBuilder.
     * @param {Style} fill - The fill style to set the vector object to.
     * @param {boolean | null} [recursive] - Whether to apply the set fill operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the set fill operation.
     */
    set_fill(fill, recursive) {
        const ptr = this.__destroy_into_raw();
        _assertClass(fill, Style);
        var ptr0 = fill.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_set_fill(ptr, ptr0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the fill rule of the VectorObjectBuilder.
     * @param {string} fill_rule - The fill rule to set the vector object to.
     * @param {boolean | null} [recursive] - Whether to apply the set fill rule operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the set fill rule operation.
     */
    set_fill_rule(fill_rule, recursive) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passStringToWasm0(fill_rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_set_fill_rule(ptr, ptr0, len0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the stroke Style of the VectorObjectBuilder.
     * @param {Style} stroke - The stroke style to set the vector object to.
     * @param {boolean | null} [recursive] - Whether to apply the set stroke operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the set stroke operation.
     */
    set_stroke(stroke, recursive) {
        const ptr = this.__destroy_into_raw();
        _assertClass(stroke, Style);
        var ptr0 = stroke.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_set_stroke(ptr, ptr0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the stroke width of the VectorObjectBuilder.
     * @param {number} stroke_width - The stroke width to set the vector object to.
     * @param {boolean | null} [recursive] - Whether to apply the set stroke width operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the set stroke width operation.
     */
    set_stroke_width(stroke_width, recursive) {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_set_stroke_width(ptr, stroke_width, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the stroke line cap of the VectorObjectBuilder.
     * @param {string} stroke_line_cap - The stroke line cap to set the vector object to.
     * @param {boolean | null} [recursive] - Whether to apply the set stroke line cap operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the set stroke line cap operation.
     */
    set_stroke_line_cap(stroke_line_cap, recursive) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passStringToWasm0(stroke_line_cap, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_set_stroke_line_cap(ptr, ptr0, len0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the stroke line join of the VectorObjectBuilder.
     * @param {string} stroke_line_join - The stroke line join to set the vector object to.
     * @param {boolean | null} [recursive] - Whether to apply the set stroke line join operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the set stroke line join operation.
     */
    set_stroke_line_join(stroke_line_join, recursive) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passStringToWasm0(stroke_line_join, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_set_stroke_line_join(ptr, ptr0, len0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the stroke miter limit of the VectorObjectBuilder.
     * @param {number} stroke_miter_limit - The stroke miter limit to set the vector object to.
     * @param {boolean | null} [recursive] - Whether to apply the set stroke miter limit operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the set stroke miter limit operation.
     */
    set_stroke_miter_limit(stroke_miter_limit, recursive) {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_set_stroke_miter_limit(ptr, stroke_miter_limit, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the stroke dash offset of the VectorObjectBuilder.
     * @param {number} stroke_dash_offset - The stroke dash offset to set the vector object to.
     * @param {boolean | null} [recursive] - Whether to apply the set stroke dash offset operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the set stroke dash offset operation.
     */
    set_stroke_dash_offset(stroke_dash_offset, recursive) {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_set_stroke_dash_offset(ptr, stroke_dash_offset, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the stroke dash array of the VectorObjectBuilder.
     * @param {number[]} stroke_dash_array - The stroke dash array to set the vector object to.
     * @param {boolean | null} [recursive] - Whether to apply the set stroke dash array operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the set stroke dash array operation.
     */
    set_stroke_dash_array(stroke_dash_array, recursive) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passArrayF32ToWasm0(stroke_dash_array, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_set_stroke_dash_array(ptr, ptr0, len0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the children of the VectorObjectBuilder.
     * @param {VectorObjectBuilder[]} children - The children to set the vector object to.
     * @returns {VectorObjectBuilder} The vector object being built with the set children operation.
     */
    set_children(children) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passArrayJsValueToWasm0(children, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_set_children(ptr, ptr0, len0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the name of the VectorObjectBuilder.
     * @param {string | null} [name] - The name to set the vector object to.
     * @returns {VectorObjectBuilder} The vector object being built with the set name operation.
     */
    set_name(name) {
        const ptr = this.__destroy_into_raw();
        var ptr0 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_set_name(ptr, ptr0, len0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Applies the current transformation to the path of the VectorObjectBuilder.
     * @param {boolean | null} [untransform] - Whether to remove transformations after applying the current transformation to the path, default is true.
     * @param {boolean | null} [recursive] - Whether to apply the actual path as path operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the apply transformation operation.
     */
    actual_path_as_path(untransform, recursive) {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_actual_path_as_path(ptr, isLikeNone(untransform) ? 0xFFFFFF : untransform ? 1 : 0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Adds a child to the VectorObjectBuilder.
     * @param {VectorObjectBuilder} child - The child to add to the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the add child operation.
     */
    add_child(child) {
        const ptr = this.__destroy_into_raw();
        _assertClass(child, VectorObjectBuilder);
        var ptr0 = child.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_add_child(ptr, ptr0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Removes all children with the given indices from the VectorObjectBuilder.
     * @param {number[]} indices - The indices of the children to remove from the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the remove children at indices operation.
     */
    remove_children_at_indices(indices) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_remove_children_at_indices(ptr, ptr0, len0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Removes all children with the given names from the VectorObjectBuilder.
     * @param {string[]} names - The names of the children to remove from the vector object.
     * @returns {VectorObjectBuilder} The vector object being built with the remove children by names operation.
     */
    remove_children_by_names(names) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passArrayJsValueToWasm0(names, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_remove_children_by_names(ptr, ptr0, len0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Sets the children from the start index to the end index of the VectorObjectBuilder.
     * @param {number} start - The start index of the children to replace.
     * @param {number} end - The end index of the children to replace.
     * @param {VectorObjectBuilder[]} children - The children to replace the children from the start index to the end index with.
     * @returns {VectorObjectBuilder} The vector object being built with the set slice children operation.
     */
    set_slice_children(start, end, children) {
        const ptr = this.__destroy_into_raw();
        const ptr0 = passArrayJsValueToWasm0(children, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.vectorobjectbuilder_set_slice_children(ptr, start, end, ptr0, len0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Puts the VectorObjectBuilder next to the given Point2D at the given direction, with a buff distance between them and aligning at the given edge.
     * @param {Point2D} point - The point to translate the vector object to.
     * @param {Point2D | null} [direction] - The direction to translate the vector object in. If not given, the vector object will be at the right of the point, default is right.
     * @param {number | null} [buff] - The buffer to leave between the vector object and the point. If not given, the vector object will be touching the point, default is 0.
     * @param {Point2D | null} [aligned_edge] - The edge of the vector object to align with the point. If not given, the vector object will be aligned at the middle, default is the middle.
     * @param {boolean | null} [recursive] - Whether to apply the next to point operation to the children of the vector object. If not given, the operation will be applied to the children, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the next to point operation.
     */
    next_to_point(point, direction, buff, aligned_edge, recursive) {
        const ptr = this.__destroy_into_raw();
        _assertClass(point, Point2D);
        var ptr0 = point.__destroy_into_raw();
        let ptr1 = 0;
        if (!isLikeNone(direction)) {
            _assertClass(direction, Point2D);
            ptr1 = direction.__destroy_into_raw();
        }
        let ptr2 = 0;
        if (!isLikeNone(aligned_edge)) {
            _assertClass(aligned_edge, Point2D);
            ptr2 = aligned_edge.__destroy_into_raw();
        }
        const ret = wasm.vectorobjectbuilder_next_to_point(ptr, ptr0, ptr1, isLikeNone(buff) ? 0x100000001 : Math.fround(buff), ptr2, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Puts the VectorObjectBuilder next to the given VectorObjectBuilder at the given direction, with a buff distance between them and aligning at the given edge.
     * @param {VectorObjectBuilder} other - The other vector object to translate the vector object to.
     * @param {Point2D | null} [direction] - The direction to translate the vector object in. If not given, the vector object will be at the right of the other vector object, default is right.
     * @param {number | null} [buff] - The buffer to leave between the vector object and the other vector object. If not given, the vector object will be touching the other vector object, default is 0.
     * @param {Point2D | null} [aligned_edge] - The edge of the vector object to align with the other vector object. If not given, the vector object will be aligned at the middle, default is the middle.
     * @param {boolean | null} [recursive] - Whether to apply the next to other operation to the children of the vector object. If not given, the operation will be applied to the children, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the next to other operation.
     */
    next_to_other(other, direction, buff, aligned_edge, recursive) {
        const ptr = this.__destroy_into_raw();
        _assertClass(other, VectorObjectBuilder);
        var ptr0 = other.__destroy_into_raw();
        let ptr1 = 0;
        if (!isLikeNone(direction)) {
            _assertClass(direction, Point2D);
            ptr1 = direction.__destroy_into_raw();
        }
        let ptr2 = 0;
        if (!isLikeNone(aligned_edge)) {
            _assertClass(aligned_edge, Point2D);
            ptr2 = aligned_edge.__destroy_into_raw();
        }
        const ret = wasm.vectorobjectbuilder_next_to_other(ptr, ptr0, ptr1, isLikeNone(buff) ? 0x100000001 : Math.fround(buff), ptr2, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Arranges the children of the VectorObjectBuilder in the given direction, with a buff distance between them and aligning at the given edge.
     * @param {Point2D | null} [direction] - The direction to arrange the children. If not given, the children will be arranged horizontally in the positive x direction.
     * @param {number | null} [buff] - The buffer to leave between the children. If not given, the children will be touching, default is 0.
     * @param {Point2D | null} [aligned_edge] - The edge of the children to align with the point. If not given, the children will be aligned at the middle.
     * @param {Point2D | null} [center] - The center of the children. If not given, the children won't be centered at any point.
     * @param {boolean | null} [recursive] - Whether to apply the arrange subobjects operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the arrange subobjects operation.
     */
    arrange_children(direction, buff, aligned_edge, center, recursive) {
        const ptr = this.__destroy_into_raw();
        let ptr0 = 0;
        if (!isLikeNone(direction)) {
            _assertClass(direction, Point2D);
            ptr0 = direction.__destroy_into_raw();
        }
        let ptr1 = 0;
        if (!isLikeNone(aligned_edge)) {
            _assertClass(aligned_edge, Point2D);
            ptr1 = aligned_edge.__destroy_into_raw();
        }
        let ptr2 = 0;
        if (!isLikeNone(center)) {
            _assertClass(center, Point2D);
            ptr2 = center.__destroy_into_raw();
        }
        const ret = wasm.vectorobjectbuilder_arrange_children(ptr, ptr0, isLikeNone(buff) ? 0x100000001 : Math.fround(buff), ptr1, ptr2, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Reverses the path of the VectorObjectBuilder.
     * @returns {VectorObjectBuilder} The vector object being built with the reverse path operation.
     */
    reverse_path() {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_reverse_path(ptr);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Linearly interpolates the fill Style of the VectorObjectBuilder with another VectorObjectBuilder.
     * @param {Style} fill - The vector object to interpolate the fill style with.
     * @param {number} t - The factor to interpolate the fill style by.
     * @param {number | null} [x] - The image's top left corner x-coordinate. It must be provided if the fill style contains an image or different kinds of gradients.
     * @param {number | null} [y] - The image's top left corner y-coordinate. It must be provided if the fill style contains an image or different kinds of gradients.
     * @param {number | null} [width] - The image's rendering width. It must be provided if the fill style contains an image or different kinds of gradients.
     * @param {number | null} [height] - The image's rendering height. It must be provided if the fill style contains an image or different kinds of gradients.
     * @param {number | null} [data_width] - The image's number of pixels in a row. It must be provided if the fill style contains an image or different kinds of gradients.
     * @param {number | null} [data_height] - The image's number of pixels in a column. It must be provided if the fill style contains an image or different kinds of gradients.
     * @param {boolean | null} [recursive] - Whether to apply the interpolate fill operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the interpolate fill operation.
     */
    lerp_fill(fill, t, x, y, width, height, data_width, data_height, recursive) {
        const ptr = this.__destroy_into_raw();
        _assertClass(fill, Style);
        var ptr0 = fill.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_lerp_fill(ptr, ptr0, t, isLikeNone(x) ? 0x100000001 : Math.fround(x), isLikeNone(y) ? 0x100000001 : Math.fround(y), isLikeNone(width) ? 0x100000001 : Math.fround(width), isLikeNone(height) ? 0x100000001 : Math.fround(height), isLikeNone(data_width) ? 0x100000001 : (data_width) >>> 0, isLikeNone(data_height) ? 0x100000001 : (data_height) >>> 0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Linearly interpolates the stroke Style of the VectorObjectBuilder with another VectorObjectBuilder.
     * @param {Style} stroke - The vector object to interpolate the stroke style with.
     * @param {number} t - The factor to interpolate the stroke style by.
     * @param {number | null} [x] - The image's top left corner x-coordinate. It must be provided if the stroke style contains an image or different kinds of gradients.
     * @param {number | null} [y] - The image's top left corner y-coordinate. It must be provided if the stroke style contains an image or different kinds of gradients.
     * @param {number | null} [width] - The image's rendering width. It must be provided if the stroke style contains an image or different kinds of gradients.
     * @param {number | null} [height] - The image's rendering height. It must be provided if the stroke style contains an image or different kinds of gradients.
     * @param {number | null} [data_width] - The image's number of pixels in a row. It must be provided if the stroke style contains an image or different kinds of gradients.
     * @param {number | null} [data_height] - The image's number of pixels in a column. It must be provided if the stroke style contains an image or different kinds of gradients.
     * @param {boolean | null} [recursive] - Whether to apply the interpolate stroke operation to the children of the vector object, default is true.
     * @returns {VectorObjectBuilder} The vector object being built with the interpolate stroke operation.
     */
    lerp_stroke(stroke, t, x, y, width, height, data_width, data_height, recursive) {
        const ptr = this.__destroy_into_raw();
        _assertClass(stroke, Style);
        var ptr0 = stroke.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_lerp_stroke(ptr, ptr0, t, isLikeNone(x) ? 0x100000001 : Math.fround(x), isLikeNone(y) ? 0x100000001 : Math.fround(y), isLikeNone(width) ? 0x100000001 : Math.fround(width), isLikeNone(height) ? 0x100000001 : Math.fround(height), isLikeNone(data_width) ? 0x100000001 : (data_width) >>> 0, isLikeNone(data_height) ? 0x100000001 : (data_height) >>> 0, isLikeNone(recursive) ? 0xFFFFFF : recursive ? 1 : 0);
        return VectorObjectBuilder.__wrap(ret);
    }
    /**
     * Builds the VectorObject by applying sequentially all the operations to the VectorObjectBuilder.
     * @returns {VectorObject} The vector object built by applying the operations to it.
     */
    build() {
        const ptr = this.__destroy_into_raw();
        const ret = wasm.vectorobjectbuilder_build(ptr);
        return VectorObject.__wrap(ret);
    }
}

async function __wbg_load(module, imports) {
    if (typeof Response === 'function' && module instanceof Response) {
        if (typeof WebAssembly.instantiateStreaming === 'function') {
            try {
                return await WebAssembly.instantiateStreaming(module, imports);

            } catch (e) {
                if (module.headers.get('Content-Type') != 'application/wasm') {
                    console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);

                } else {
                    throw e;
                }
            }
        }

        const bytes = await module.arrayBuffer();
        return await WebAssembly.instantiate(bytes, imports);

    } else {
        const instance = await WebAssembly.instantiate(module, imports);

        if (instance instanceof WebAssembly.Instance) {
            return { instance, module };

        } else {
            return instance;
        }
    }
}

function __wbg_get_imports() {
    const imports = {};
    imports.wbg = {};
    imports.wbg.__wbg_colorstop_new = function(arg0) {
        const ret = ColorStop.__wrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_colorstop_unwrap = function(arg0) {
        const ret = ColorStop.__unwrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_cubicbeziertuple_new = function(arg0) {
        const ret = CubicBezierTuple.__wrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_error_cf5b49c323ad9c18 = function(arg0, arg1) {
        console.error(getStringFromWasm0(arg0, arg1));
    };
    imports.wbg.__wbg_fontface_unwrap = function(arg0) {
        const ret = FontFace.__unwrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_getTime_46267b1c24877e30 = function(arg0) {
        const ret = arg0.getTime();
        return ret;
    };
    imports.wbg.__wbg_imagedata_new = function(arg0) {
        const ret = ImageData.__wrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_log_a1cd05195b80661f = function(arg0, arg1) {
        console.log(getStringFromWasm0(arg0, arg1));
    };
    imports.wbg.__wbg_new0_f788a2397c7ca929 = function() {
        const ret = new Date();
        return ret;
    };
    imports.wbg.__wbg_path2d_new = function(arg0) {
        const ret = Path2D.__wrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_point2d_new = function(arg0) {
        const ret = Point2D.__wrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_point2d_unwrap = function(arg0) {
        const ret = Point2D.__unwrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_tick_new = function(arg0) {
        const ret = Tick.__wrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_tick_unwrap = function(arg0) {
        const ret = Tick.__unwrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_vectorobject_new = function(arg0) {
        const ret = VectorObject.__wrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_vectorobject_unwrap = function(arg0) {
        const ret = VectorObject.__unwrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_vectorobjectbuilder_unwrap = function(arg0) {
        const ret = VectorObjectBuilder.__unwrap(arg0);
        return ret;
    };
    imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
        const ret = debugString(arg1);
        const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len1 = WASM_VECTOR_LEN;
        getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
        getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
    };
    imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
        const ret = new Error(getStringFromWasm0(arg0, arg1));
        return ret;
    };
    imports.wbg.__wbindgen_init_externref_table = function() {
        const table = wasm.__wbindgen_export_2;
        const offset = table.grow(4);
        table.set(0, undefined);
        table.set(offset + 0, undefined);
        table.set(offset + 1, null);
        table.set(offset + 2, true);
        table.set(offset + 3, false);
        ;
    };
    imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
        const obj = arg1;
        const ret = typeof(obj) === 'string' ? obj : undefined;
        var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len1 = WASM_VECTOR_LEN;
        getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
        getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
    };
    imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
        const ret = getStringFromWasm0(arg0, arg1);
        return ret;
    };
    imports.wbg.__wbindgen_throw = function(arg0, arg1) {
        throw new Error(getStringFromWasm0(arg0, arg1));
    };

    return imports;
}

function __wbg_init_memory(imports, memory) {

}

function __wbg_finalize_init(instance, module) {
    wasm = instance.exports;
    __wbg_init.__wbindgen_wasm_module = module;
    cachedDataViewMemory0 = null;
    cachedFloat32ArrayMemory0 = null;
    cachedUint32ArrayMemory0 = null;
    cachedUint8ArrayMemory0 = null;


    wasm.__wbindgen_start();
    return wasm;
}

function initSync(module) {
    if (wasm !== undefined) return wasm;


    if (typeof module !== 'undefined') {
        if (Object.getPrototypeOf(module) === Object.prototype) {
            ({module} = module)
        } else {
            console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
        }
    }

    const imports = __wbg_get_imports();

    __wbg_init_memory(imports);

    if (!(module instanceof WebAssembly.Module)) {
        module = new WebAssembly.Module(module);
    }

    const instance = new WebAssembly.Instance(module, imports);

    return __wbg_finalize_init(instance, module);
}

async function __wbg_init(module_or_path) {
    if (wasm !== undefined) return wasm;


    if (typeof module_or_path !== 'undefined') {
        if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
            ({module_or_path} = module_or_path)
        } else {
            console.warn('using deprecated parameters for the initialization function; pass a single object instead')
        }
    }

    if (typeof module_or_path === 'undefined') {
        module_or_path = new URL('index_bg.wasm', import.meta.url);
    }
    const imports = __wbg_get_imports();

    if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
        module_or_path = fetch(module_or_path);
    }

    __wbg_init_memory(imports);

    const { instance, module } = await __wbg_load(await module_or_path, imports);

    return __wbg_finalize_init(instance, module);
}

export { initSync };
export default __wbg_init;