(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"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    /**
     * Adds root level category name to class name
     * @param name Category Name
     */
    function Category(name) {
        return (target) => {
            // target.testCategory = name;
            // return target;
            // save a reference to the original constructor
            const original = target;
            // a utility function to generate instances of a class
            // tslint:disable-next-line: ban-types
            function cx(constructor, args) {
                const c = function () {
                    return constructor.apply(this, args);
                };
                c.prototype = constructor.prototype;
                return new c();
            }
            // the new constructor behavior
            const f = function (...args) {
                this.testCategory = name;
                return cx(original, args);
            };
            // copy prototype so instance of operator still works
            f.prototype = original.prototype;
            // return new constructor (will override original)
            return f;
        };
    }
    exports.default = Category;
});
//# sourceMappingURL=Category.js.map