"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.rawSimulateTextStyle = rawSimulateTextStyle;
exports.rawExtractStyle = rawExtractStyle;
function rawSimulateTextStyle(element, trait, measureText) {
    const { textContent } = element;
    const { width, height } = measureText(textContent, trait.fontSize, trait.width);
    return {
        width: `${width}px`,
        height: `${height}px`,
    };
}
function rawExtractStyle(element, trait, measureText) {
    if (element instanceof Text) {
        return rawSimulateTextStyle(element, trait, measureText);
    }
    const _style = {};
    const { style } = element;
    for (let i = 0; i < style.length; i++) {
        const key = style[i];
        const value = style.getPropertyValue(key);
        _style[key] = value;
    }
    return _style;
}
//# sourceMappingURL=rawExtractStyle.js.map