/*
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 { Base, Point_$type, markType, INotifyPropertyChanged_$type, PropertyChangedEventArgs, runOn, delegateCombine } from "igniteui-webcomponents-core";
import { RenderingContext } from "igniteui-webcomponents-core";
import { List$1 } from "igniteui-webcomponents-core";
import { Path } from "igniteui-webcomponents-core";
import { DoubleAnimator } from "igniteui-webcomponents-core";
import { CanvasViewRenderer } from "igniteui-webcomponents-core";
import { Brush } from "igniteui-webcomponents-core";
import { Color } from "igniteui-webcomponents-core";
import { TransformGroup } from "igniteui-webcomponents-core";
import { TranslateTransform } from "igniteui-webcomponents-core";
import { RotateTransform } from "igniteui-webcomponents-core";
import { truncate, isNaN_ } from "igniteui-webcomponents-core";
import { EasingFunctions } from "igniteui-webcomponents-core";
import { Geometry } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let GridExpansionIndicatorView = /*@__PURE__*/ (() => {
    class GridExpansionIndicatorView extends Base {
        constructor(a) {
            super();
            this.k = null;
            this.f = 1;
            this.e = 0;
            this.d = 0;
            this.c = new List$1(Path.$, 0);
            this.m = null;
            this.b = null;
            this.l = null;
            this.j = 0;
            this.g = 0;
            this.i = 0;
            this.h = 0;
            this.a = null;
            this.a = a;
        }
        o(a) {
            if (a == null) {
                this.m = null;
                this.l = null;
                this.b = null;
                if (this.k != null) {
                    window.removeEventListener("resize", this.k, false);
                    this.k = null;
                }
                return;
            }
            this.f = (isNaN_(this.a.m) ? this.a.j : this.a.m);
            let b = a;
            this.l = b;
            this.a.c.u(this.l);
            this.l.rootWrapper.addClass("ui-expansion-indicator-container");
            let c = this.f;
            let d = Math.round(b.rootWrapper.width());
            let e = Math.round(b.rootWrapper.height());
            let f = d * c;
            let g = e * c;
            let h = this.l.createElement("canvas");
            h.setStyleProperty("position", "absolute");
            this.l.append(h);
            this.e = truncate(Math.round(f));
            this.d = truncate(Math.round(g));
            h.setAttribute("width", f.toString());
            h.setAttribute("height", g.toString());
            h.setStyleProperty("width", d.toString() + "px");
            h.setStyleProperty("height", e.toString() + "px");
            this.j = d;
            this.g = e;
            this.m = h;
            let i = this.l.get2DCanvasContext(this.m);
            this.b = new RenderingContext(new CanvasViewRenderer(), i);
            if (isNaN_(this.a.m)) {
                this.a.j = window.devicePixelRatio;
                this.f = this.a.j;
            }
            this.q();
        }
        p(a, b) {
            this.j = a;
            this.g = b;
            this.q();
        }
        s() {
            if (this.a.ae != null) {
                return this.a.ae;
            }
            return ((() => {
                let $ret = new Brush();
                $ret.color = Color.u(138, 0, 0, 0);
                return $ret;
            })());
        }
        r() {
            this.q();
        }
        n() {
            this.c.clear();
            this.a.x(this.j, this.g, this.c);
        }
        q() {
            if (this.m == null || this.b == null) {
                return;
            }
            if (this.i != this.j || this.h != this.g) {
                this.n();
                this.i = this.j;
                this.h = this.g;
            }
            if (this.c.count > 0) {
                let a = { $type: Point_$type, x: this.j / 2, y: this.g / 2 };
                let b = new TransformGroup();
                b.j.add(((() => {
                    let $ret = new TranslateTransform();
                    $ret.j = -a.x;
                    $ret.k = -a.y;
                    return $ret;
                })()));
                b.j.add(((() => {
                    let $ret = new RotateTransform();
                    $ret.j = this.a.k;
                    return $ret;
                })()));
                b.j.add(((() => {
                    let $ret = new TranslateTransform();
                    $ret.j = a.x;
                    $ret.k = a.y;
                    return $ret;
                })()));
                this.c._inner[0].j = b;
            }
            let c = Math.round(this.j * this.f);
            let d = Math.round(this.g * this.f);
            if (this.e != c || this.d != d) {
                this.m.setAttribute("width", c.toString());
                this.m.setAttribute("height", d.toString());
                this.m.setStyleProperty("width", this.j.toString() + "px");
                this.m.setStyleProperty("height", this.g.toString() + "px");
                this.m.setStyleProperty("top", "0px");
                this.m.setStyleProperty("left", "0px");
                this.e = truncate(Math.round(c));
                this.d = truncate(Math.round(d));
            }
            if (this.b.d && this.f != 1) {
                this.b.z();
                this.b.aa(this.f, this.f);
            }
            this.b.k(0, 0, this.j, this.g);
            this.b.z();
            for (let e = 0; e < this.c.count; e++) {
                this.b.j(this.c._inner[e].j);
                let f = this.s();
                if (this.a.ae != null) {
                    f = this.a.ae;
                }
                this.c._inner[e]._stroke = f;
                this.b.s(this.c._inner[e]);
            }
            this.b.y();
            if (this.b.d && this.f != 1) {
                this.b.y();
            }
        }
    }
    GridExpansionIndicatorView.$t = /*@__PURE__*/ markType(GridExpansionIndicatorView, 'GridExpansionIndicatorView');
    return GridExpansionIndicatorView;
})();
/**
 * @hidden
 */
export let GridExpansionIndicator = /*@__PURE__*/ (() => {
    class GridExpansionIndicator extends Base {
        constructor() {
            super();
            this.a = null;
            this.o = null;
            this.e = false;
            this.ad = null;
            this.d = false;
            this.propertyChanged = null;
            this.b = null;
            this.i = NaN;
            this.h = 1;
            this.k = 0;
            this.l = 0;
            this.n = 0;
            this.k = 0;
            this.a = new GridExpansionIndicatorView(this);
            this.b = new DoubleAnimator(0, 1, 400);
            this.b.b = EasingFunctions.cubicEase;
            let a = this.b;
            a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.w));
        }
        get p() {
            return this.o;
        }
        set p(a) {
            this.o = a;
        }
        get g() {
            return this.e;
        }
        set g(a) {
            let b = this.e;
            this.e = a;
            if (b != this.e) {
                this.z("IsExpanded", b, this.e);
            }
        }
        get ae() {
            return this.ad;
        }
        set ae(a) {
            let b = this.ad;
            this.ad = a;
            if (b != this.ad) {
                this.z("IconColor", b, this.ad);
            }
        }
        get f() {
            return this.d;
        }
        set f(a) {
            let b = this.d;
            this.d = a;
            if (b != this.d) {
                this.z("IsAnimationEnabled", b, this.d);
            }
        }
        get c() {
            return this.b;
        }
        get m() {
            return this.i;
        }
        set m(a) {
            let b = this.i;
            this.i = a;
            this.z("PixelScalingRatio", b, this.i);
        }
        get j() {
            return this.h;
        }
        set j(a) {
            let b = this.h;
            this.h = a;
            this.z("ActualPixelScalingRatio", b, this.h);
        }
        z(a, b, c) {
            this.aa(a, b, c);
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
        }
        aa(a, b, c) {
            switch (a) {
                case "PixelScalingRatio":
                    this.j = this.m;
                    break;
                case "ActualPixelScalingRatio":
                    this.a.r();
                    break;
                case "IconColor":
                    this.a.r();
                    break;
                case "IsExpanded":
                    if (this.f || this.b.f()) {
                        this.b.w();
                    }
                    this.l = this.k;
                    this.n = this.g ? 90 : 0;
                    if (this.f) {
                        this.b.v();
                    }
                    else {
                        this.k = this.n;
                        this.a.r();
                    }
                    break;
            }
        }
        w(a, b) {
            this.k = this.l + this.b.o * (this.n - this.l);
            this.a.r();
        }
        x(a, b, c) {
            let d = Geometry.a("M 10.18 6.343 l 5.64 5.675 -5.64 5.639");
            c.add(((() => {
                let $ret = new Path();
                $ret.ak = d;
                $ret.aj = 2;
                $ret.stroke = this.a.s();
                $ret.ac = 2;
                return $ret;
            })()));
        }
        ab(a) {
            this.a.o(a);
        }
        ac(a) {
            this.c.u(a);
        }
        q() {
            return this.a.m.getNativeElement();
        }
        y(a, b) {
            this.a.p(a, b);
        }
    }
    GridExpansionIndicator.$t = /*@__PURE__*/ markType(GridExpansionIndicator, 'GridExpansionIndicator', Base.$, [INotifyPropertyChanged_$type]);
    return GridExpansionIndicator;
})();
//# sourceMappingURL=GridExpansionIndicatorView_combined.js.map
