"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cssTextToObj = cssTextToObj;
exports.objToCssText = objToCssText;
exports.rawExtractStyle = rawExtractStyle;
const id_1 = require("./id");
function cssTextToObj(cssText) {
    return Object.fromEntries(cssText
        .split(';')
        .filter((rule) => rule.trim())
        .map((rule) => rule.split(':').map((part) => part.trim())));
}
function objToCssText(obj) {
    return Object.entries(obj)
        .map(([key, value]) => `${(0, id_1.camelToDashed)(key)}: ${value};`)
        .join(' ');
}
function rawExtractStyle(element, trait, measureText) {
    if (element instanceof Text) {
        return {};
    }
    const { style } = element;
    return cssTextToObj(style.cssText);
}
//# sourceMappingURL=rawExtractStyle.js.map