/*
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, markType } from "./type";
import { DataTemplateMeasureInfo } from "./DataTemplateMeasureInfo";
import { DataTemplateRenderInfo } from "./DataTemplateRenderInfo";
import { isNaN_ } from "./number";
var LegendItemHelper = /** @class */ (function (_super) {
    tslib_1.__extends(LegendItemHelper, _super);
    function LegendItemHelper() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Object.defineProperty(LegendItemHelper, "b", {
        get: function () {
            if (isNaN_(LegendItemHelper.a)) {
                LegendItemHelper.a = window.devicePixelRatio == undefined ? 1 : window.devicePixelRatio;
            }
            return LegendItemHelper.a;
        },
        set: function (a) {
            LegendItemHelper.a = a;
        },
        enumerable: true,
        configurable: true
    });
    LegendItemHelper.c = function (a, b, c, d, e, f, g, h, i) {
        var j = a;
        var k = f;
        if (k != null && k.series != null) {
            if (h != null) {
                var l = 18, m = 16;
                var n = j.createElement("canvas");
                n.setAttribute("width", (l * LegendItemHelper.b).toString());
                n.setAttribute("height", (m * LegendItemHelper.b).toString());
                n.setStyleProperty("width", l.toString() + "px");
                n.setStyleProperty("height", m.toString() + "px");
                var o = j.createElement("td");
                o.addClass("ui-legend-item-badge");
                o.append(n);
                var p = j.get2DCanvasContext(n);
                var q = new DataTemplateMeasureInfo();
                q.passInfo = i;
                q.context = p;
                q.width = l;
                q.height = m;
                q.data = k;
                h.measure(q);
                var r = new DataTemplateRenderInfo();
                r.availableWidth = (isNaN_(q.width) ? l : Math.min(q.width, l));
                r.availableHeight = (isNaN_(q.height) ? m : Math.min(q.height, m));
                r.passInfo = i;
                r.context = p;
                r.data = k;
                r.xPosition = 0;
                r.yPosition = 0;
                if (LegendItemHelper.b != 1) {
                    p.save();
                    p.scale(LegendItemHelper.b, LegendItemHelper.b);
                }
                h.render(r);
                if (LegendItemHelper.b != 1) {
                    p.restore();
                }
                j.append(o);
            }
            var s = j.createElement("td");
            var t = j.createElement("span");
            t.setText(g);
            s.append(t);
            s.addClass("ui-legend-item-text");
            j.append(s);
        }
    };
    LegendItemHelper.a = NaN;
    LegendItemHelper.$t = markType(LegendItemHelper, 'LegendItemHelper');
    return LegendItemHelper;
}(Base));
export { LegendItemHelper };
/*<BeginStatics Name="Infragistics.Controls.Charts.LegendItemHelper" />*/
/*<EndStatics Name="Infragistics.Controls.Charts.LegendItemHelper" />*/
//# sourceMappingURL=LegendItemHelper.js.map