"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.chartReviver = void 0;
var NumberRange_1 = require("../../Core/NumberRange");
var Thickness_1 = require("../../Core/Thickness");
/**
 * The reviver function needed when parsing definitions to JSON
 */
function chartReviver(key, value) {
    switch (key) {
        case "visibleRange":
        case "visibleRangeLimit":
        case "visibleRangeSizeLimit":
        case "growBy":
            return new NumberRange_1.NumberRange(value.min, value.max);
        case "padding":
            var t = value;
            return new Thickness_1.Thickness(t.top, t.right, t.bottom, t.left);
        default:
            // handle NaN serialization/deserialization since NaN is stringified as "null"
            return value === null ? NaN : value;
    }
}
exports.chartReviver = chartReviver;
