"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseLayoutValue = void 0;
const string_1 = require("../util/string");
const reflectChildrenTrait_1 = require("./reflectChildrenTrait");
function parseLayoutValue(value) {
    value = (0, string_1.removeWhiteSpace)(value);
    // AD HOC
    if (value === '' ||
        value === 'auto' ||
        value === 'fit-content' ||
        value === 'none') {
        return [0, 0];
    }
    const percentTest = reflectChildrenTrait_1.REGEX_PERCENT.exec(value);
    if (percentTest) {
        return [0, parseFloat(percentTest[1])];
    }
    else {
        const pxTest = reflectChildrenTrait_1.REGEX_PX.exec(value);
        if (pxTest) {
            return [parseFloat(pxTest[1]), 0];
        }
        else {
            const calcTest = reflectChildrenTrait_1.REGEX_CALC.exec(value);
            if (calcTest) {
                return [
                    parseFloat(calcTest[2].replace('+-', '-')),
                    parseFloat(calcTest[1]),
                ];
            }
            else {
                // throw new Error('layout value not recognized')
                return [0, 0];
            }
        }
    }
}
exports.parseLayoutValue = parseLayoutValue;
//# sourceMappingURL=parseLayoutValue.js.map