/*
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 { GridCellBase } from "./GridCellBase";
import { Base, runOn, markType } from "igniteui-webcomponents-core";
import { stringIsNullOrEmpty } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let ImageCell = /*@__PURE__*/ (() => {
    class ImageCell extends GridCellBase {
        constructor(a) {
            super(a);
            this.ce = null;
            this.b8 = 1;
            this.b9 = 3;
            this.cg = null;
            this.ca = false;
            this.cb = 1;
            this.cd = null;
            this.ce = a.createElement("img");
            this.ce.listen("load", runOn(this, this.cj));
            this.cd = a.createElement("div");
            this.cd.setRawStyleProperty("background-size", "contain");
            this.cd.setRawStyleProperty("background-repeat", "no-repeat");
            this.cd.setRawStyleProperty("background-position", "center");
            this.cd.setRawStyleProperty("width", "100%");
            this.cd.setRawStyleProperty("height", "100%");
            this.z.setRawStyleProperty("text-align", "left");
            this.z.setRawStyleProperty("vertical-align", "middle");
            this.z.append(this.cd);
        }
        get cf() {
            return this.ce;
        }
        get cc() {
            return this.cb;
        }
        set cc(a) {
            this.cb = a;
        }
        cj(a) {
            this.ca = false;
            if (!stringIsNullOrEmpty(this.cg)) {
                this.cd.setRawStyleProperty("opacity", "1");
                this.cd.setRawStyleProperty("background-image", "url(" + this.cg + ")");
            }
        }
        ck(a, b) {
            if (a == this.cg) {
                return;
            }
            this.ch();
            this.cd.setRawStyleProperty("opacity", "0");
            if (a == null || a.length == 0) {
                this.ci(this.ce);
                return;
            }
            if (Base.equalsStatic(a, this.cg)) {
                return;
            }
            this.co(a, b);
            let img_ = this.ce.getNativeElement();
            if (img_ != null && (img_.complete)) {
                this.ca = false;
                this.ce.setRawStyleProperty("opacity", "1");
                this.cd.setRawStyleProperty("background-image", "url(" + this.cg + ")");
            }
        }
        ci(a) {
            a.setAttribute("src", "");
            this.cd.setRawStyleProperty("background-image", "");
        }
        cn(a) {
            switch (a) {
                case 1:
                    this.cd.setRawStyleProperty("background-size", "100% 100%");
                    break;
                case 2:
                    this.cd.setRawStyleProperty("background-size", "auto");
                    break;
                case 0:
                    this.cd.setRawStyleProperty("background-size", "contain");
                    break;
            }
        }
        co(a, b) {
            this.ca = true;
            this.cg = a;
            this.cf.setAttribute("src", a);
        }
        ch() {
            if (this.ca) {
                this.ci(this.ce);
                this.cg = "";
            }
        }
        cl(a) {
            this.b8 = a;
        }
        cm(a) {
            this.b9 = a;
        }
        get_r() {
            return true;
        }
        bh(a, b, c) {
            super.bh(a, b, c);
            if (a == "Indent" || a == "IsCollapsable") {
                this.cd.setRawStyleProperty("margin-left", this.av + this.ax + this.aw + "px");
            }
        }
    }
    ImageCell.$t = /*@__PURE__*/ markType(ImageCell, 'ImageCell', GridCellBase.$);
    return ImageCell;
})();
//# sourceMappingURL=ImageCell.js.map
