import { SVGInstance } from "../../../node/instance/SVGInstance.js";
export class TextAttributes extends SVGInstance {
    text(text) {
        if (typeof text === "string") {
            this.element.innerHTML = text;
            return this;
        }
        return this.element.innerHTML;
    }
    textAlign(position) {
        var _a;
        if (position === "left") {
            return this.textAnchor("start");
        }
        else if (position === "center") {
            return this.textAnchor("middle");
        }
        else if (position === "right") {
            return this.textAnchor("end");
        }
        else {
            return (_a = this.textAnchor()) !== null && _a !== void 0 ? _a : "left";
        }
    }
    textAnchor(textAnchor) {
        if (typeof textAnchor === "undefined") {
            const textAnchor = this.attr("text-anchor");
            return typeof textAnchor === "string" ? textAnchor : null;
        }
        else if (typeof textAnchor === "string") {
            this.attr("text-anchor", textAnchor);
            return this;
        }
        return null;
    }
    dx(dx) {
        if (typeof dx === "string" || typeof dx === "number") {
            this.attr("dx", dx);
            return this;
        }
        return this.attr("dx");
    }
    dy(dy) {
        if (typeof dy === "string" || typeof dy === "number") {
            this.attr("dy", dy);
            return this;
        }
        return this.attr("dy");
    }
}
//# sourceMappingURL=text.js.map