"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initTemplateHelper = initTemplateHelper;
const lodash_es_1 = require("lodash-es");
function initTemplateHelper(context) {
    const { window } = context;
    if (!window.BI) {
        throw new Error('FineBI SDK (window.BI) not found in the simulated environment.');
    }
    const BI = window.BI;
    const { sessionId, subjectId, basePool = {}, pool = {}, designConfigure = {}, reportName = {} } = BI;
    const { confPool, systemPool } = pool;
    const { entryType, link } = basePool;
    const { reportId, reportWidgets } = designConfigure;
    BI.designData = (0, lodash_es_1.merge)({}, (0, lodash_es_1.merge)(BI.Constants.getConstant('bi.constant.design.template.conf')), designConfigure, { isEdit: false });
    const templatehelperProps = {
        ...BI.designData,
        pool: pool,
        basePool: basePool,
        entryType: 1,
        position: 0,
        subjectId: subjectId,
    };
    const templateHelper = new BI.TemplateHelper(templatehelperProps);
    templateHelper.syncWidgets();
}
