/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { CodeGeneratingComponentRendererHandlerEmitter } from "./CodeGeneratingComponentRendererHandlerEmitter";
import { markType } from "./type";
import { CodeGeneratingRegexHelper } from "./CodeGeneratingRegexHelper";
import { stringReplace, stringStartsWith, stringEndsWith } from "./string";
/**
 * @hidden
 */
var TSCodeGeneratingComponentRendererHandlerEmitter = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(TSCodeGeneratingComponentRendererHandlerEmitter, _super);
    function TSCodeGeneratingComponentRendererHandlerEmitter(a, b, c) {
        var _this = _super.call(this, a, b) || this;
        _this.l = 0;
        _this.l = c;
        return _this;
    }
    Object.defineProperty(TSCodeGeneratingComponentRendererHandlerEmitter.prototype, "m", {
        get: function () {
            switch (this.l) {
                case 1: return "angular";
                case 2: return "react";
                case 3: return "webcomponents";
            }
            return "";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TSCodeGeneratingComponentRendererHandlerEmitter.prototype, "n", {
        get: function () {
            switch (this.l) {
                case 1: return "Igx";
                case 2: return "Igr";
                case 3: return "Igc";
            }
            return "";
        },
        enumerable: true,
        configurable: true
    });
    TSCodeGeneratingComponentRendererHandlerEmitter.prototype.k = function (a, b) {
        var _this = this;
        _super.prototype.k.call(this, a, b);
        var c = new CodeGeneratingRegexHelper("import {([^}]+)}\\s+from\\s+['\"]([^'\"]+)['\"]");
        c.b(b, function (d, e, f) {
            var g = d(1);
            var h = d(2);
            h = stringReplace(h, "webcomponents", _this.m);
            h = stringReplace(h, "react", _this.m);
            h = stringReplace(h, "angular", _this.m);
            var i = g.split(',');
            for (var k = 0; k < i.length; k++) {
                var j = i[k];
                var l = j.trim();
                if (stringStartsWith(l, "Igc")) {
                    l = _this.n + l.substr(3);
                }
                if (stringStartsWith(l, "Igr")) {
                    l = _this.n + l.substr(3);
                }
                if (stringStartsWith(l, "Igx")) {
                    l = _this.n + l.substr(3);
                }
                if (stringStartsWith(l, "Igr") && stringEndsWith(l, "Component")) {
                    l = l.substr(0, l.length - ("Component").length);
                }
                a.addPackageImport(h.trim(), l.trim());
            }
            return null;
        });
    };
    TSCodeGeneratingComponentRendererHandlerEmitter.prototype.i = function (a) {
        return a;
    };
    TSCodeGeneratingComponentRendererHandlerEmitter.$t = markType(TSCodeGeneratingComponentRendererHandlerEmitter, 'TSCodeGeneratingComponentRendererHandlerEmitter', CodeGeneratingComponentRendererHandlerEmitter.$);
    return TSCodeGeneratingComponentRendererHandlerEmitter;
}(CodeGeneratingComponentRendererHandlerEmitter));
export { TSCodeGeneratingComponentRendererHandlerEmitter };
