"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BackgroundSizeParser = void 0;
const dimension_style_parser_1 = require("../dimension-style.parser");
class BackgroundSizeParser extends dimension_style_parser_1.DimensionStyleParser {
    constructor() {
        super('size');
    }
    parseSize(x) {
        if (x === 'auto') {
            return x;
        }
        else {
            return super.parse(x).size;
        }
    }
    parse(value) {
        let [width, height] = value.split(' ').map(x => this.parseSize(x));
        const result = {
            imageStyle: {}
        };
        if (width != 'auto') {
            result.imageStyle['width'] = width;
        }
        height = height || width;
        if (height != 'auto') {
            result.imageStyle['height'] = height;
        }
        return result;
    }
}
exports.BackgroundSizeParser = BackgroundSizeParser;
//# sourceMappingURL=background-size.parser.js.map