(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "../di/TypeKey"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var TypeKey_1 = require("../di/TypeKey");
    var PropertyMap = /** @class */ (function () {
        function PropertyMap() {
        }
        // tslint:disable-next-line:ban-types
        PropertyMap.from = function (o) {
            var c = Object.getPrototypeOf(o);
            var key = TypeKey_1.TypeKey.get(c);
            var map = PropertyMap.map;
            var m = map[key] || (map[key] = PropertyMap.createMap(o));
            return m;
        };
        PropertyMap.createMap = function (c) {
            var map = {};
            var nameList = [];
            while (c) {
                var names = Object.getOwnPropertyNames(c);
                for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
                    var name_1 = names_1[_i];
                    if (/hasOwnProperty|constructor|toString|isValid|errors/i.test(name_1)) {
                        continue;
                    }
                    // // map[name] = Object.getOwnPropertyDescriptor(c, name) ? true : false;
                    // const pd = Object.getOwnPropertyDescriptor(c, name);
                    // // tslint:disable-next-line:no-console
                    // console.log(`${name} = ${c.enumerable}`);
                    map[name_1] = true;
                    nameList.push(name_1);
                }
                c = Object.getPrototypeOf(c);
            }
            var m = new PropertyMap();
            m.map = map;
            m.names = nameList;
            return m;
        };
        PropertyMap.map = {};
        return PropertyMap;
    }());
    exports.PropertyMap = PropertyMap;
});
//# sourceMappingURL=PropertyMap.js.map