/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { Base, Point_$type, typeCast, fromEnum, markType } from "igniteui-react-core/ES5/type";
import { Rect } from "igniteui-react-core/ES5/Rect";
import { RotateTransform } from "igniteui-react-core/ES5/RotateTransform";
import { TransformGroup } from "igniteui-react-core/ES5/TransformGroup";
import { TranslateTransform } from "igniteui-react-core/ES5/TranslateTransform";
import { RectUtil } from "igniteui-react-core/ES5/RectUtil";
/**
 * @hidden
 */
var VisualExportHelper = /** @class */ (function (_super) {
    tslib_1.__extends(VisualExportHelper, _super);
    function VisualExportHelper() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    VisualExportHelper.a = function (a) {
        var e_1, _a;
        var b = { $type: Point_$type, x: a.n, y: a.o };
        var c = new Rect(0, b.x, b.y, a.m, a.l);
        var d = a.j;
        if (d == null) {
            return c;
        }
        var e = 0;
        var f = 0;
        var g = 0;
        var h = null;
        if (typeCast(RotateTransform.$, d) !== null) {
            h = typeCast(RotateTransform.$, d);
            e = h.j;
        }
        else if (typeCast(TransformGroup.$, d) !== null) {
            var i = typeCast(TransformGroup.$, d);
            try {
                for (var _b = tslib_1.__values(fromEnum(i.j)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var j = _c.value;
                    if (typeCast(RotateTransform.$, j) !== null) {
                        h = typeCast(RotateTransform.$, j);
                        e = h.j;
                    }
                    if (typeCast(TranslateTransform.$, j) !== null) {
                        var k = typeCast(TranslateTransform.$, j);
                        f = k.j;
                        g = k.k;
                    }
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_1) throw e_1.error; }
            }
        }
        if (h != null) {
            c = RectUtil.x(c, h.k, h.l, e);
        }
        c.x = c.x + f;
        c.y = c.y + g;
        return c;
    };
    VisualExportHelper.$t = markType(VisualExportHelper, 'VisualExportHelper');
    return VisualExportHelper;
}(Base));
export { VisualExportHelper };
