(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", "../core/AtomMap"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var AtomMap_1 = require("../core/AtomMap");
    var TypeKey = /** @class */ (function () {
        function TypeKey() {
        }
        TypeKey.get = function (c) {
            // for (const iterator of this.keys) {
            //     if (iterator.c === c) {
            //         return iterator.key;
            //     }
            // }
            // const key = `${c.name || "key"}${this.keys.length}`;
            // this.keys.push({ c, key});
            // return key;
            return TypeKey.keys.getOrCreate(c, function (c1) {
                var key = "" + (c1.name || "key") + TypeKey.keys.size;
                return key;
            });
        };
        TypeKey.keys = new AtomMap_1.default();
        return TypeKey;
    }());
    exports.TypeKey = TypeKey;
});
// if (Map !== undefined) {
//     const map = new Map<any, string>();
//     const oldGet = TypeKey.get;
//     TypeKey.get = (c: any): string => {
//         const v = map.get(c);
//         if (!v) {
//             return v;
//         }
//         const v1 = oldGet(c);
//         map.set(c, v1);
//         return v1;
//     };
// }
//# sourceMappingURL=TypeKey.js.map