"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseRelativeUnit = parseRelativeUnit;
const isFrameRelative_1 = require("../isFrameRelative");
const isParentRelative_1 = require("../isParentRelative");
function parseRelativeUnit(value, getParentUnit, getFrameUnit) {
    if (typeof value === 'number') {
        return value;
    }
    else {
        if ((0, isParentRelative_1.isParentRelativeValue)(value)) {
            const valueNum = value.substring(0, value.length - 1);
            const valueUnit = Number.parseFloat(valueNum);
            const parentUnit = getParentUnit();
            const percent = valueUnit / 100;
            return percent * parentUnit;
        }
        else if ((0, isFrameRelative_1.isFrameRelativeValue)(value)) {
            const valueNum = value.substring(0, value.length - 2);
            const valueUnit = Number.parseFloat(valueNum);
            const frameUnit = getFrameUnit();
            const percent = valueUnit / 100;
            return percent * frameUnit;
        }
        else {
            const valueUnit = Number.parseFloat(value);
            return valueUnit;
        }
    }
}
//# sourceMappingURL=parseRelativeUnit.js.map