"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildModifiers3D = exports.buildModifiers = void 0;
var ChartModifierBase2D_1 = require("../Charting/ChartModifiers/ChartModifierBase2D");
var CursorModifier_1 = require("../Charting/ChartModifiers/CursorModifier");
var DataPointSelectionModifier_1 = require("../Charting/ChartModifiers/DataPointSelectionModifier");
var LegendModifier_1 = require("../Charting/ChartModifiers/LegendModifier");
var MouseWheelZoomModifier_1 = require("../Charting/ChartModifiers/MouseWheelZoomModifier");
var OverviewRangeSelectionModifier_1 = require("../Charting/ChartModifiers/OverviewRangeSelectionModifier");
var PinchZoomModifier_1 = require("../Charting/ChartModifiers/PinchZoomModifier");
var RolloverModifier_1 = require("../Charting/ChartModifiers/RolloverModifier");
var VerticalSliceModifier_1 = require("../Charting/ChartModifiers/VerticalSliceModifier");
var RubberBandXyZoomModifier_1 = require("../Charting/ChartModifiers/RubberBandXyZoomModifier");
var SeriesSelectionModifier_1 = require("../Charting/ChartModifiers/SeriesSelectionModifier");
var XAxisDragModifier_1 = require("../Charting/ChartModifiers/XAxisDragModifier");
var YAxisDragModifier_1 = require("../Charting/ChartModifiers/YAxisDragModifier");
var ZoomExtentsModifier_1 = require("../Charting/ChartModifiers/ZoomExtentsModifier");
var ZoomPanModifier_1 = require("../Charting/ChartModifiers/ZoomPanModifier");
var BaseType_1 = require("../types/BaseType");
var ChartModifierType_1 = require("../types/ChartModifierType");
var chartReviver_1 = require("./helpers/chartReviver");
var classFactory_1 = require("../Core/classFactory");
var AnnotationHoverModifier_1 = require("../Charting/ChartModifiers/AnnotationHoverModifier");
var PolarArcZoomModifier_1 = require("../Charting/ChartModifiers/Polar/PolarArcZoomModifier");
var PolarCursorModifier_1 = require("../Charting/ChartModifiers/Polar/PolarCursorModifier");
var PolarDataPointSelectionModifier_1 = require("../Charting/ChartModifiers/Polar/PolarDataPointSelectionModifier");
var PolarSeriesSelectionModifier_1 = require("../Charting/ChartModifiers/Polar/PolarSeriesSelectionModifier");
var PolarLegendModifier_1 = require("../Charting/ChartModifiers/Polar/PolarLegendModifier");
var PolarMouseWheelZoomModifier_1 = require("../Charting/ChartModifiers/Polar/PolarMouseWheelZoomModifier");
var PolarZoomExtentsModifier_1 = require("../Charting/ChartModifiers/Polar/PolarZoomExtentsModifier");
var PolarPanModifier_1 = require("../Charting/ChartModifiers/Polar/PolarPanModifier");
var MouseWheelZoomModifier3D_1 = require("../Charting3D/ChartModifiers/MouseWheelZoomModifier3D");
var PinchZoomModifier3D_1 = require("../Charting3D/ChartModifiers/PinchZoomModifier3D");
var OrbitModifier3D_1 = require("../Charting3D/ChartModifiers/OrbitModifier3D");
var TooltipModifier3D_1 = require("../Charting3D/ChartModifiers/TooltipModifier3D");
var ResetCamera3DModifier_1 = require("../Charting3D/ChartModifiers/ResetCamera3DModifier");
var ChartModifierBase3D_1 = require("../Charting3D/ChartModifiers/ChartModifierBase3D");
var LegendModifier3D_1 = require("../Charting3D/ChartModifiers/LegendModifier3D");
var SeriesSelectionModifier3D_1 = require("../Charting3D/ChartModifiers/SeriesSelectionModifier3D");
// register modifiers
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.Cursor, function (options) { return new CursorModifier_1.CursorModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.PolarCursor, function (options) { return new PolarCursorModifier_1.PolarCursorModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.DataPointSelection, function (options) { return new DataPointSelectionModifier_1.DataPointSelectionModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.PolarDataPointSelection, function (options) { return new PolarDataPointSelectionModifier_1.PolarDataPointSelectionModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.PolarSeriesSelection, function (options) { return new PolarSeriesSelectionModifier_1.PolarSeriesSelectionModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.MouseWheelZoom, function (options) { return new MouseWheelZoomModifier_1.MouseWheelZoomModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.PolarMouseWheelZoom, function (options) { return new PolarMouseWheelZoomModifier_1.PolarMouseWheelZoomModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.PinchZoom, function (options) { return new PinchZoomModifier_1.PinchZoomModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.Rollover, function (options) { return new RolloverModifier_1.RolloverModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.VerticalSlice, function (options) { return new VerticalSliceModifier_1.VerticalSliceModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.RubberBandXYZoom, function (options) { return new RubberBandXyZoomModifier_1.RubberBandXyZoomModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.PolarArcZoom, function (options) { return new PolarArcZoomModifier_1.PolarArcZoomModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.SeriesSelection, function (options) { return new SeriesSelectionModifier_1.SeriesSelectionModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.AnnotationHover, function (options) { return new AnnotationHoverModifier_1.AnnotationHoverModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.XAxisDrag, function (options) { return new XAxisDragModifier_1.XAxisDragModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.YAxisDrag, function (options) { return new YAxisDragModifier_1.YAxisDragModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.ZoomExtents, function (options) { return new ZoomExtentsModifier_1.ZoomExtentsModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.PolarZoomExtents, function (options) { return new PolarZoomExtentsModifier_1.PolarZoomExtentsModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.ZoomPan, function (options) { return new ZoomPanModifier_1.ZoomPanModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.PolarPan, function (options) { return new PolarPanModifier_1.PolarPanModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.OverviewRangeSelection, function (options) { return new OverviewRangeSelectionModifier_1.OverviewRangeSelectionModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.Legend, function (options) { return new LegendModifier_1.LegendModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart2DModifier, ChartModifierType_1.EChart2DModifierType.PolarLegend, function (options) { return new PolarLegendModifier_1.PolarLegendModifier(options); }, true);
/**
 * Build one or more chart modifiers from a definition that can be pure data.
 * @param definition One or an array of {@link TModifierDefinition}
 * @returns An array of modifiers
 */
var buildModifiers = function (definition) {
    if (typeof definition === "string") {
        definition = JSON.parse(definition, chartReviver_1.chartReviver);
    }
    var modifiers = [];
    if (Array.isArray(definition)) {
        for (var _i = 0, definition_1 = definition; _i < definition_1.length; _i++) {
            var modifier = definition_1[_i];
            modifiers.push(buildModifier(modifier));
        }
    }
    else {
        modifiers.push(buildModifier(definition));
    }
    return modifiers;
};
exports.buildModifiers = buildModifiers;
var buildModifier = function (definition) {
    if (definition instanceof ChartModifierBase2D_1.ChartModifierBase2D) {
        return definition;
    }
    if (definition.type === ChartModifierType_1.EChart2DModifierType.Custom) {
        var customType = "customType" in definition ? definition.customType : undefined;
        return (0, classFactory_1.createType)(BaseType_1.EBaseType.Chart2DModifier, customType, null, definition.options);
    }
    else {
        return (0, classFactory_1.createType)(BaseType_1.EBaseType.Chart2DModifier, definition.type, null, definition.options);
    }
};
// register 3D modifiers
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart3DModifier, ChartModifierType_1.EChart3DModifierType.MouseWheelZoom, function (options) { return new MouseWheelZoomModifier3D_1.MouseWheelZoomModifier3D(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart3DModifier, ChartModifierType_1.EChart3DModifierType.Orbit, function (options) { return new OrbitModifier3D_1.OrbitModifier3D(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart3DModifier, ChartModifierType_1.EChart3DModifierType.PinchZoom, function (options) { return new PinchZoomModifier3D_1.PinchZoomModifier3D(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart3DModifier, ChartModifierType_1.EChart3DModifierType.Tooltip, function (options) { return new TooltipModifier3D_1.TooltipModifier3D(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart3DModifier, ChartModifierType_1.EChart3DModifierType.SeriesSelection, function (options) { return new SeriesSelectionModifier3D_1.SeriesSelectionModifier3D(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart3DModifier, ChartModifierType_1.EChart3DModifierType.ZoomExtents, function (options) { return new ResetCamera3DModifier_1.ResetCamera3DModifier(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Chart3DModifier, ChartModifierType_1.EChart3DModifierType.Legend, function (options) { return new LegendModifier3D_1.LegendModifier3D(options); }, true);
/**
 * Build one or more 3D chart modifiers from a definition that can be pure data.
 * @param definition One or an array of {@link TModifier3DDefinition}
 * @returns An array of modifiers
 */
var buildModifiers3D = function (definition) {
    if (typeof definition === "string") {
        definition = JSON.parse(definition, chartReviver_1.chartReviver);
    }
    var modifiers = [];
    if (Array.isArray(definition)) {
        for (var _i = 0, definition_2 = definition; _i < definition_2.length; _i++) {
            var modifier = definition_2[_i];
            modifiers.push(buildModifier3D(modifier));
        }
    }
    else {
        modifiers.push(buildModifier3D(definition));
    }
    return modifiers;
};
exports.buildModifiers3D = buildModifiers3D;
var buildModifier3D = function (definition) {
    if (definition instanceof ChartModifierBase3D_1.ChartModifierBase3D) {
        return definition;
    }
    if (definition.type === ChartModifierType_1.EChart3DModifierType.Custom) {
        return (0, classFactory_1.createType)(BaseType_1.EBaseType.Chart3DModifier, definition.customType, null, definition.options);
    }
    else {
        return (0, classFactory_1.createType)(BaseType_1.EBaseType.Chart3DModifier, definition.type, null, definition.options);
    }
};
