"use strict";
/**
 * Copyright (c) Haiku 2016-2018. All rights reserved.
 */
Object.defineProperty(exports, "__esModule", { value: true });
var DEFAULT_SCOPE = 'div';
var SCOPE_STRATA = {
    div: 'div',
    svg: 'svg',
};
var STRING = 'string';
function scopifyElements(mana, parent, scope) {
    if (!mana) {
        return mana;
    }
    if (typeof mana === STRING) {
        return mana;
    }
    mana.__scope = scope || DEFAULT_SCOPE;
    if (mana.children) {
        for (var i = 0; i < mana.children.length; i++) {
            var child = mana.children[i];
            scopifyElements(child, mana, 
            // If the current element defines a new strata, make that a new scope
            // and pass it down to the children.
            SCOPE_STRATA[mana.elementName] || scope);
        }
    }
}
exports.default = scopifyElements;
//# sourceMappingURL=scopifyElements.js.map