(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.normalizeDate = exports.swap = void 0;
    /* swap функция перемешивает 2 элемента массива между собой по start и end,
    вызов swap([1,2,3], 0, 1) вернет [2,1,3]
     */
    var swap = function (arr, start, end) {
        if (start === void 0) { start = 0; }
        if (end === void 0) { end = 0; }
        var result = new Map();
        arr.map(function (_, idx) {
            if (idx === start) {
                return result.set(idx, arr[end]);
            }
            else if (idx === end) {
                return result.set(idx, arr[start]);
            }
            return result.set(idx, arr[idx]);
        });
        return Array.from(result.values());
    };
    exports.swap = swap;
    var normalizeDate = function (dateRange) {
        return typeof dateRange === "string"
            ? (0, exports.swap)(dateRange.split("."), 0, 1).reverse().join("-")
            : null;
    };
    exports.normalizeDate = normalizeDate;
});
