"use strict";

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.ChartPluginService = void 0;

const base_plugin_service_1 = require("../base/base-plugin-service");

class ChartPluginService extends base_plugin_service_1.BasePluginService {
    constructor(globalInstance) {
        super(), this.globalInstance = globalInstance;
    }
    getPlugin(name) {
        return this._plugins.find((plugin => plugin.name === name));
    }
    onInit(chartSpec) {
        this._plugins.forEach((plugin => {
            plugin.onInit && plugin.onInit(this, chartSpec);
        }));
    }
    onBeforeResize(width, height) {
        this._plugins.forEach((plugin => {
            plugin.onBeforeResize && plugin.onBeforeResize(this, width, height);
        }));
    }
    onAfterChartSpecTransform(chartSpec, actionSource) {
        this._plugins.forEach((plugin => {
            plugin.onAfterChartSpecTransform && plugin.onAfterChartSpecTransform(this, chartSpec, actionSource);
        }));
    }
    onAfterModelSpecTransform(chartSpec, chartSpecInfo, actionSource) {
        this._plugins.forEach((plugin => {
            plugin.onAfterModelSpecTransform && plugin.onAfterModelSpecTransform(this, chartSpec, chartSpecInfo, actionSource);
        }));
    }
    onBeforeInitChart(chartSpec, actionSource) {
        this._plugins.forEach((plugin => {
            plugin.onBeforeInitChart && plugin.onBeforeInitChart(this, chartSpec, actionSource);
        }));
    }
    onLayoutRectUpdate() {
        this._plugins.forEach((plugin => {
            plugin.onLayoutRectUpdate && plugin.onLayoutRectUpdate(this);
        }));
    }
    onAfterRender() {
        this._plugins.forEach((plugin => {
            plugin.onAfterRender && plugin.onAfterRender(this);
        }));
    }
    releaseAll() {
        super.releaseAll(), this.globalInstance = null;
    }
}

exports.ChartPluginService = ChartPluginService;
//# sourceMappingURL=plugin-service.js.map
