"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAngularEmitPlugin = void 0;
/**
 * Gets the constructor for instantiating the Angular `ngtsc`
 * emit plugin supported by `tsc_wrapped`.
 */
function getAngularEmitPlugin() {
    var _a, _b, _c;
    return __awaiter(this, void 0, void 0, function* () {
        try {
            // Note: This is an interop allowing for the `@angular/compiler-cli` package
            // to be shipped as strict ESM, or as CommonJS. If the CLI is a CommonJS
            // package (pre v13 of Angular), then the exports are in the `default` property.
            // See: https://nodejs.org/api/esm.html#esm_import_statements.
            const exports = yield Promise.resolve().then(() => require('@angular/compiler-cli'));
            return (_c = (_a = exports.NgTscPlugin) !== null && _a !== void 0 ? _a : (_b = exports.default) === null || _b === void 0 ? void 0 : _b.NgTscPlugin) !== null && _c !== void 0 ? _c : null;
        }
        catch (_d) {
            return null;
        }
    });
}
exports.getAngularEmitPlugin = getAngularEmitPlugin;
