/*
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 { EventProxy } from "./EventProxy";
import { Point_$type, runOn, markType, PointUtil, String_$type, Delegate_$type } from "./type";
import { Rect } from "./Rect";
import { MouseEventArgs } from "./MouseEventArgs";
import { Dictionary$2 } from "./Dictionary$2";
import { List$1 } from "./List$1";
/**
 * @hidden
 */
var BaseDOMEventProxy = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(BaseDOMEventProxy, _super);
    function BaseDOMEventProxy() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.bx = null;
        _this.bq = false;
        _this.bw = null;
        _this.bi = false;
        _this.bu = 0;
        _this.bv = 0;
        _this.bs = 0;
        _this.bt = 0;
        _this.by = 0;
        _this.cw = null;
        _this.cv = null;
        _this.bh = false;
        _this.bz = -1;
        _this.bm = false;
        _this.bj = false;
        _this.bg = false;
        return _this;
    }
    BaseDOMEventProxy.prototype.d = function () {
        var a = new DOMEventProxy(this.bx, this.bw, this.bq);
        a.aa = this.aa;
        a.al = this.al;
        return a;
    };
    Object.defineProperty(BaseDOMEventProxy, "br", {
        get: function () {
            return (BaseDOMEventProxy.bn || BaseDOMEventProxy.bo);
        },
        enumerable: true,
        configurable: true
    });
    BaseDOMEventProxy.prototype.be = function (a) {
        return DOMEventProxy.cx(a);
    };
    BaseDOMEventProxy.prototype.bl = function (e_) {
        var pointerEvent_ = e_.originalEvent;
        var a = false;
        if (BaseDOMEventProxy.bo) {
            a = (pointerEvent_.pointerType == 'touch');
        }
        else {
            a = (pointerEvent_.pointerType == pointerEvent_.MSPOINTER_TYPE_TOUCH);
        }
        return a;
    };
    BaseDOMEventProxy.prototype.cn = function (a) {
        if (!this.ac) {
            if (this.bk(a)) {
                if (this.an == null || this.an(a)) {
                    a.preventDefault();
                }
            }
        }
    };
    BaseDOMEventProxy.prototype.bk = function (e_) {
        return (e_.originalEvent.cancelable || e_.originalEvent.cancelable == undefined);
    };
    BaseDOMEventProxy.prototype.cj = function () {
        var source_ = this.bx.getNativeElement();
        BaseDOMEventProxy.cm(source_);
    };
    BaseDOMEventProxy.cm = function (source_) {
        if (BaseDOMEventProxy.bo) {
            source_.style.touchAction = 'none';
        }
        else {
            source_.style.msTouchAction = 'none';
        }
        source_.style.msUserSelect = 'none';
        source_.style.webkitTouchCallout = 'none';
        source_.style.webkitUserSelect = 'none';
        source_.style.khtmlUserSelect = 'none';
        source_.style.mozUserSelect = 'none';
        source_.style.userSelect = 'none';
    };
    BaseDOMEventProxy.cg = function (source_) {
        if (BaseDOMEventProxy.bo) {
            source_.style.touchAction = 'auto';
        }
        else {
            source_.style.msTouchAction = 'auto';
        }
        source_.style.msUserSelect = 'auto';
        source_.style.webkitTouchCallout = 'none';
        source_.style.webkitUserSelect = 'auto';
        source_.style.khtmlUserSelect = 'auto';
        source_.style.mozUserSelect = 'auto';
        source_.style.userSelect = 'auto';
    };
    BaseDOMEventProxy.prototype.ch = function () {
        var source_ = this.bx.getNativeElement();
        BaseDOMEventProxy.cg(source_);
    };
    BaseDOMEventProxy.prototype.ar = function () {
        _super.prototype.ar.call(this);
        if (!this.ac) {
            this.cj();
        }
        else {
            this.ch();
        }
    };
    BaseDOMEventProxy.prototype.b4 = function () {
        var ver_ = -1;
        var matchIE_ = /Trident\/([\d.]+)/;
        if ((matchIE_.exec(navigator.userAgent) != null)) {
            ver_ = (parseFloat(RegExp.$1));
        }
        return ver_;
    };
    BaseDOMEventProxy.prototype.b3 = function () {
        var ver_ = -1;
        var matchIE_ = /Edge\/([\d.]+)/;
        if ((matchIE_.exec(navigator.userAgent) != null)) {
            ver_ = (parseFloat(RegExp.$1));
        }
        return ver_;
    };
    BaseDOMEventProxy.cl = function (e_) {
        var a = BaseDOMEventProxy.b5 >= 6;
        var oe_ = e_.originalEvent;
        if ((((typeof e_.pageX == 'undefined')) || a) && oe_.clientX != null) {
            var od_ = void 0;
            if ((e_.target !== undefined)) {
                od_ = e_.target.ownerDocument;
            }
            else {
                od_ = e_.originalEvent.target.ownerDocument;
            }
            var ed_ = od_ ? od_ : document;
            var doc_ = ed_.documentElement;
            var body_ = ed_.body;
            var clientX_ = oe_.clientX;
            var clientY_ = oe_.clientY;
            var scrollLeft_ = doc_ && doc_.scrollLeft || body_ && body_.scrollLeft || 0;
            var scrollTop_ = doc_ && doc_.scrollTop || body_ && body_.scrollTop || 0;
            var clientLeft_ = doc_ && doc_.clientLeft || body_ && body_.clientLeft || 0;
            var clientTop_ = doc_ && doc_.clientTop || body_ && body_.clientTop || 0;
            e_.pageX = clientX_ + (scrollLeft_ - clientLeft_);
            e_.pageY = clientY_ + (scrollTop_ - clientTop_);
        }
        if ((!e_.pageX)) {
            e_.pageX = e_.originalEvent.pageX;
        }
        if ((!e_.pageY)) {
            e_.pageY = e_.originalEvent.pageY;
        }
        if (((typeof e_.button == 'undefined')) && ((typeof oe_.button != 'undefined'))) {
            e_.button = oe_.button;
        }
    };
    BaseDOMEventProxy.cx = function (a) {
        var b = BaseDOMEventProxy.b5 >= 6;
        var source_ = a.getNativeElement();
        var d_ = source_.ownerDocument;
        var doc_ = d_ ? d_.documentElement : null;
        var z_ = doc_ ? doc_.msContentZoomFactor : null;
        var body_ = doc_.body;
        if ((z_ && z_ > 1) || b) {
            var rect_ = source_.getBoundingClientRect();
            var x_ = (rect_.left);
            var y_ = (rect_.top);
            var scrollLeft_ = (doc_ && doc_.scrollLeft || body_ && body_.scrollLeft || 0);
            var scrollTop_ = (doc_ && doc_.scrollTop || body_ && body_.scrollTop || 0);
            var clientLeft_ = (doc_ && doc_.clientLeft || body_ && body_.clientLeft || 0);
            var clientTop_ = (doc_ && doc_.clientTop || body_ && body_.clientTop || 0);
            var c = x_ + scrollLeft_ - clientLeft_;
            var d = y_ + scrollTop_ - clientTop_;
            return new Rect(0, c, d, 0, 0);
        }
        else {
            var e = a.getOffset();
            return new Rect(0, e.left, e.top, 0, 0);
        }
    };
    Object.defineProperty(BaseDOMEventProxy.prototype, "b1", {
        get: function () {
            return this.by;
        },
        set: function (a) {
            this.by = a;
        },
        enumerable: true,
        configurable: true
    });
    BaseDOMEventProxy.prototype.cq = function (a) {
        this.ao = a;
        BaseDOMEventProxy.cl(a);
        var b = BaseDOMEventProxy.cx(this.bx);
        var c = 0;
        var d = 0;
        if (Rect.l_op_Inequality(this.bf, null)) {
            c = this.bf.left;
            d = this.bf.top;
        }
        this.bu = a.pageX - b.left;
        this.bv = a.pageY - b.top;
        this.bs = this.bu - c;
        this.bt = this.bv - d;
        this.cw = { $type: Point_$type, x: this.bu, y: this.bv };
        this.cv = { $type: Point_$type, x: this.bs, y: this.bt };
    };
    BaseDOMEventProxy.prototype.cr = function (e_) {
        this.ao = e_;
        BaseDOMEventProxy.cl(e_);
        if (BaseDOMEventProxy.br) {
            var a = e_.pageX;
            var b = e_.pageY;
            var c = BaseDOMEventProxy.cx(this.bx);
            this.bu = a - c.left;
            this.bv = b - c.top;
        }
        else {
            this.by = 0;
            if (!e_.originalEvent.targetTouches || e_.originalEvent.targetTouches.length < 1) {
                return;
            }
            ;
            this.by = (e_.originalEvent.targetTouches.length);
            var d = (e_.originalEvent.targetTouches[0].pageX);
            var e = (e_.originalEvent.targetTouches[0].pageY);
            var f = BaseDOMEventProxy.cx(this.bx);
            this.bu = d - f.left;
            this.bv = e - f.top;
        }
        var g = 0;
        var h = 0;
        if (Rect.l_op_Inequality(this.bf, null)) {
            g = this.bf.left;
            h = this.bf.top;
        }
        this.bs = this.bu - g;
        this.bt = this.bv - h;
        this.cw = { $type: Point_$type, x: this.bu, y: this.bv };
        this.cv = { $type: Point_$type, x: this.bs, y: this.bt };
    };
    BaseDOMEventProxy.prototype.cf = function (e_) {
        this.cp(e_);
        if (this.ab(this.cw, false, true)) {
            var deltaY_ = 0;
            var ev_ = e_;
            deltaY_ = (ev_.originalEvent ? ev_.originalEvent.deltaY : ev_.deltaY);
            var deltaX_ = 0;
            deltaX_ = (ev_.originalEvent ? ev_.originalEvent.deltaX : ev_.deltaX);
            var a = (ev_.originalEvent ? (ev_.originalEvent.deltaMode == 1) : (ev_.deltaMode == 1));
            if (a) {
                deltaY_ = deltaY_ * 40;
                deltaX_ = deltaX_ * 40;
            }
            var b = this.ag(this.cv, deltaY_);
            var c = this.ah(this.cv, deltaX_);
            if (b || c) {
                this.cn(e_);
            }
        }
    };
    BaseDOMEventProxy.prototype.cd = function (e_) {
        this.cp(e_);
        this.cq(e_);
        if (this.ab(this.cw, false, true)) {
            var ev_ = e_;
            var delta_ = 0;
            if (ev_.wheelDelta) {
                delta_ = ev_.wheelDelta / 120;
            }
            ;
            if (ev_.originalEvent && ev_.originalEvent.wheelDelta) {
                delta_ = ev_.originalEvent.wheelDelta / 120;
            }
            ;
            if (ev_.detail) {
                delta_ = -ev_.detail / 3;
            }
            ;
            if (ev_.originalEvent && ev_.originalEvent.detail) {
                delta_ = -ev_.originalEvent.detail / 3;
            }
            ;
            delta_ = delta_ / 10;
            var a = this.ag(this.cv, delta_);
            if (a) {
                this.cn(e_);
            }
        }
    };
    BaseDOMEventProxy.prototype.ck = function () {
        if (this.bh) {
            if (this.bz == -1) {
                this.bz = this.bw.setTimeout(runOn(this, this.ci), 500);
            }
            else {
                window.clearTimeout(this.bz);
                this.bz = -1;
                this.bz = this.bw.setTimeout(runOn(this, this.ci), 500);
            }
        }
    };
    BaseDOMEventProxy.prototype.b6 = function () {
        this.bh = true;
        if (this.bz != -1) {
            window.clearTimeout(this.bz);
            this.bz = -1;
        }
    };
    BaseDOMEventProxy.prototype.ci = function () {
        this.bh = false;
    };
    Object.defineProperty(BaseDOMEventProxy.prototype, "bp", {
        get: function () {
            return this.bj;
        },
        set: function (a) {
            this.bj = a;
        },
        enumerable: true,
        configurable: true
    });
    BaseDOMEventProxy.prototype.cb = function (a) {
        if (this.bj || this.bh) {
            return;
        }
        this.cq(a);
        if (this.bm) {
            this.bm = false;
            this.a3(this.cv);
        }
    };
    BaseDOMEventProxy.prototype.cc = function (a) {
        if (this.bj || this.bh) {
            return;
        }
        this.cq(a);
        this.cp(a);
        var b = new MouseEventArgs();
        b.position = this.cw;
        if (this.ab(this.cw, false, false)) {
            if (!this.bm) {
                this.bm = true;
                this.a2(this.cw);
            }
            this.a4(this.cw, true, false);
            this.at(this.cv, false);
        }
        else if (this.bm) {
            this.cb(a);
        }
    };
    BaseDOMEventProxy.prototype.co = function (a) {
        this.bx.focus();
    };
    BaseDOMEventProxy.prototype.ca = function (a) {
        if (this.bj || this.bh) {
            return;
        }
        this.co(a);
        this.cq(a);
        this.cp(a);
        if (this.ab(this.cw, false, false)) {
            this.bg = true;
            this.a1(this.cw);
            this.au(this.cv, false);
            this.cn(a);
        }
    };
    BaseDOMEventProxy.prototype.cs = function (a) {
        if (this.bj || this.bh) {
            return;
        }
        if (this.bg) {
            this.ce(a);
        }
    };
    BaseDOMEventProxy.prototype.ce = function (a) {
        if (this.bj || this.bh) {
            return;
        }
        this.cp(a);
        if (PointUtil.equals(this.cw, null) || PointUtil.equals(this.cv, null)) {
            this.cq(a);
        }
        var b = this.ab(this.cw, false, false) || this.bg || this.bm;
        this.bg = false;
        this.a5(this.cw);
        this.as(this.cv, false);
        if (b) {
            this.cn(a);
        }
    };
    BaseDOMEventProxy.prototype.b7 = function (a) {
        this.b8(a, true);
    };
    BaseDOMEventProxy.prototype.b9 = function (a) {
        this.b8(a, false);
    };
    BaseDOMEventProxy.prototype.cu = function (a) {
        return BaseDOMEventProxy.ct(a);
    };
    BaseDOMEventProxy.ct = function (a) {
        var b;
        switch (a.which) {
            case 33:
                b = 10;
                break;
            case 34:
                b = 11;
                break;
            case 36:
                b = 13;
                break;
            case 37:
                b = 14;
                break;
            case 38:
                b = 15;
                break;
            case 39:
                b = 16;
                break;
            case 40:
                b = 17;
                break;
            case 9:
                b = 2;
                break;
            case 32:
                b = 9;
                break;
            case 13:
                b = 3;
                break;
            case 27:
                b = 8;
                break;
            case 16:
                b = 4;
                break;
            case 17:
                b = 5;
                break;
            case 18:
                b = 6;
                break;
            case 8:
                b = 1;
                break;
            case 35:
                b = 12;
                break;
            case 45:
                b = 18;
                break;
            case 46:
                b = 19;
                break;
            case 106:
                b = 78;
                break;
            case 107:
                b = 79;
                break;
            case 109:
                b = 80;
                break;
            case 110:
                b = 81;
                break;
            case 111:
                b = 82;
                break;
            case 220:
                b = 85;
                break;
            case 192:
                b = 86;
                break;
            case 191:
                b = 84;
                break;
            case 186:
                b = 83;
                break;
            case 189:
                b = 88;
                break;
            case 187:
                b = 87;
                break;
            default:
                if (112 <= a.which && a.which <= 123) {
                    b = (56 + a.which - 112);
                }
                else if (65 <= a.which && a.which <= 90) {
                    b = (30 + a.which - 65);
                }
                else if (48 <= a.which && a.which <= 57) {
                    b = (20 + a.which - 48);
                }
                else if (96 <= a.which && a.which <= 105) {
                    b = (68 + a.which - 96);
                }
                else {
                    b = 0;
                }
                break;
        }
        return b;
    };
    BaseDOMEventProxy.prototype.b8 = function (a, b) {
        var c = this.cu(a);
        var d = c != 0;
        this.cp(a);
        if (d) {
            var e = false;
            if (b) {
                e = this.ae(c);
            }
            else {
                e = this.af(c);
            }
            if (e) {
                this.cn(a);
            }
        }
    };
    BaseDOMEventProxy.prototype.cp = function (a) {
        this.ao = a;
        this.bc = 0;
        if (a.shiftKey) {
            this.bc = this.bc | 4;
        }
        if (a.altKey) {
            this.bc = this.bc | 1;
        }
        if (a.ctrlKey) {
            this.bc = this.bc | 2;
        }
        this.ai = a.button == 2;
    };
    BaseDOMEventProxy.prototype.bd = function () {
        var a = BaseDOMEventProxy.cx(this.bx);
        var b = a.left;
        var c = a.top;
        return { $type: Point_$type, x: b, y: c };
    };
    BaseDOMEventProxy.$t = markType(BaseDOMEventProxy, 'BaseDOMEventProxy', EventProxy.$);
    BaseDOMEventProxy.bn = false;
    BaseDOMEventProxy.bo = false;
    BaseDOMEventProxy.b5 = 0;
    BaseDOMEventProxy.b2 = 0;
    return BaseDOMEventProxy;
}(EventProxy));
export { BaseDOMEventProxy };
/**
 * @hidden
 */
var DOMEventProxy = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(DOMEventProxy, _super);
    function DOMEventProxy(a, b, c) {
        var _this = _super.call(this) || this;
        _this.c8 = 0;
        _this.c9 = "";
        _this.cz = false;
        _this.c5 = null;
        _this.c1 = new Dictionary$2(String_$type, List$1.$.specialize(Delegate_$type), 0);
        _this.dw = null;
        _this.c6 = -1;
        _this.dx = null;
        _this.c3 = 0;
        _this.c4 = 0;
        _this.c2 = 5;
        _this.cy = false;
        _this.dv = null;
        _this.bq = c;
        _this.bw = b;
        _this.al = function (d) { return true; };
        _this.aa = false;
        DOMEventProxy.c7++;
        _this.c8 = DOMEventProxy.c7;
        _this.c9 = ".DOMProxy" + _this.c8.toString();
        _this.bc = 0;
        _this.bx = a;
        BaseDOMEventProxy.bn = false;
        try {
            BaseDOMEventProxy.bn = (window.navigator.msPointerEnabled && MSGesture !== undefined);
        }
        catch (d) {
        }
        BaseDOMEventProxy.bo = false;
        try {
            BaseDOMEventProxy.bo = (window.PointerEvent || window.navigator.pointerEnabled);
        }
        catch (e) {
        }
        BaseDOMEventProxy.b5 = _this.b4();
        BaseDOMEventProxy.b2 = _this.b3();
        _this.ap(_this.bx, "");
        _this.ak = function (f) { return true; };
        return _this;
    }
    DOMEventProxy.prototype.da = function (a, b, c) {
    };
    DOMEventProxy.prototype.ap = function (a, b) {
        var c = a;
        var d = this.c9 + b;
        if (!this.bw.supportsDOMEvents()) {
            return;
        }
        var e = new List$1(Delegate_$type, 0);
        this.c1.addItem(d, e);
        this.da(a, b, e);
        if (!BaseDOMEventProxy.br) {
            e.add(c.listen("mousemove", runOn(this, this.cc)));
            e.add(c.listen("mouseleave", runOn(this, this.cb)));
            e.add(c.listen("mousedown", runOn(this, this.ca)));
            e.add(c.listen("mouseup", runOn(this, this.ce)));
            e.add(this.bw.globalListen("window", "mouseup", runOn(this, this.cs)));
        }
        e.add(c.listen("keydown", runOn(this, this.b7)));
        e.add(c.listen("keyup", runOn(this, this.b9)));
        var source_ = this.bx.getNativeElement();
        if (!this.ac) {
            BaseDOMEventProxy.cm(source_);
        }
        if (BaseDOMEventProxy.br) {
            var f = this.bx.getNativeElement();
            if ((window.MSGesture !== undefined)) {
                var g = (new MSGesture());
                g.target = f;
                this.c5 = g;
                e.add(c.listen("MSGestureStart", runOn(this, this.dd)));
                e.add(c.listen("MSGestureChange", runOn(this, this.db)));
                e.add(c.listen("MSGestureEnd", runOn(this, this.dc)));
            }
            if (BaseDOMEventProxy.bo) {
                e.add(c.listen("pointerdown", runOn(this, this.dg)));
                e.add(c.listen("pointerup", runOn(this, this.dj)));
                e.add(c.listen("pointercancel", runOn(this, this.df)));
                e.add(c.listen("pointermove", runOn(this, this.dh)));
                e.add(c.listen("pointerout", runOn(this, this.di)));
                e.add(c.listen("lostpointercapture", runOn(this, this.de)));
            }
            else {
                e.add(c.listen("MSPointerDown", runOn(this, this.dg)));
                e.add(c.listen("MSPointerUp", runOn(this, this.dj)));
                e.add(c.listen("MSPointerCancel", runOn(this, this.df)));
                e.add(c.listen("MSPointerMove", runOn(this, this.dh)));
                e.add(c.listen("MSPointerOut", runOn(this, this.di)));
                e.add(c.listen("MSLostPointerCapture", runOn(this, this.de)));
            }
        }
        else {
            e.add(c.listen("gesturestart", runOn(this, this.dd)));
            e.add(c.listen("gesturechange", runOn(this, this.db)));
            e.add(c.listen("gestureend", runOn(this, this.dc)));
            e.add(c.listen("touchstart", runOn(this, this.dm)));
            e.add(c.listen("touchmove", runOn(this, this.dl)));
            e.add(c.listen("touchend", runOn(this, this.dk)));
        }
        if (this.bq) {
            e.add(c.listen("wheel", runOn(this, this.cf)));
        }
        else {
            e.add(c.listen("DOMMouseScroll", runOn(this, this.cd)));
            e.add(c.listen("mousewheel", runOn(this, this.cd)));
        }
    };
    DOMEventProxy.prototype.dj = function (e_) {
        var a = this.bl(e_);
        if (a) {
            this.b1 = this.b1 - 1;
            if (this.b1 < 0) {
                this.b1 = 0;
            }
        }
        if (this.b1 < 2 && this.cz && a) {
            this.cz = false;
            var b = (e_.originalEvent.scale);
            this.az(this.cv, b);
        }
        else {
            if (a) {
                this.dk(e_);
            }
            else {
                this.ce(e_);
            }
        }
    };
    DOMEventProxy.prototype.de = function (e_) {
        var a = this.bl(e_);
        if (a) {
            this.b1--;
            if (this.b1 < 0) {
                this.b1 = 0;
            }
        }
        if (this.b1 < 2 && this.cz && a) {
            this.cz = false;
            var b = (e_.originalEvent.scale);
            this.az(this.cv, b);
        }
    };
    DOMEventProxy.prototype.df = function (e_) {
        var a = this.bl(e_);
        if (a) {
            this.b1--;
            if (this.b1 < 0) {
                this.b1 = 0;
            }
        }
        if (this.b1 < 2 && this.cz && a) {
            this.cz = false;
            var b = (e_.originalEvent.scale);
            this.az(this.cv, b);
        }
    };
    DOMEventProxy.prototype.dg = function (e_) {
        var a = this.bl(e_);
        if (this.c5 != null && a) {
            this.b1++;
            this.c5.addPointer((e_.originalEvent.pointerId));
        }
        var eventSource_ = this.bx.getNativeElement();
        if (BaseDOMEventProxy.bo) {
            eventSource_.setPointerCapture(e_.originalEvent.pointerId);
        }
        else {
            eventSource_.msSetPointerCapture(e_.originalEvent.pointerId);
        }
        if (this.b1 > 1 && !this.cz && a) {
            this.cz = true;
            this.cr(e_);
            var b = (e_.originalEvent.scale);
            this.a7(this.cv, b);
        }
        else {
            if (a) {
                this.dm(e_);
            }
            else {
                this.ca(e_);
            }
        }
    };
    DOMEventProxy.prototype.dh = function (e_) {
        var a = this.bl(e_);
        if (this.cz) {
            return;
        }
        if (a) {
            this.dl(e_);
        }
        else {
            this.cc(e_);
        }
    };
    DOMEventProxy.prototype.di = function (e_) {
        var a = this.bl(e_);
        if (this.cz) {
            return;
        }
        if (a) {
        }
        else {
            this.cb(e_);
        }
    };
    DOMEventProxy.prototype.dd = function (e_) {
        this.bm = true;
        this.cp(e_);
        this.cr(e_);
        this.dp();
        if (this.ab(this.cw, true, false)) {
            this.cn(e_);
            if (BaseDOMEventProxy.br && this.b1 < 2) {
                return;
            }
            var a = (e_.originalEvent.scale);
            this.a7(this.cv, a);
        }
    };
    DOMEventProxy.prototype.db = function (e_) {
        this.bm = true;
        this.cp(e_);
        this.cr(e_);
        if (this.ab(this.cw, true, false)) {
            this.cn(e_);
            if (BaseDOMEventProxy.br && this.b1 < 2) {
                return;
            }
            var a = (e_.originalEvent.scale);
            this.a6(this.cv, a);
        }
    };
    DOMEventProxy.prototype.dc = function (e_) {
        this.cn(e_);
        var a = (e_.originalEvent.scale);
        this.bm = false;
        this.cp(e_);
        this.cr(e_);
        if (!BaseDOMEventProxy.br || this.cz) {
            this.az(this.cv, a);
        }
    };
    DOMEventProxy.prototype.dm = function (e_) {
        this.bm = true;
        this.cp(e_);
        this.cr(e_);
        this.dw = this.cv;
        if (this.ab(this.cw, true, false)) {
            if (!this.aa) {
                this.cn(e_);
            }
            else {
                this.bp = true;
            }
            this.a4(this.cw, false, true);
            this.a1(this.cw);
            this.au(this.cv, true);
            this.ds();
        }
    };
    DOMEventProxy.prototype.ds = function () {
        if (this.c6 == -1) {
            this.c3 = this.cw.x;
            this.c4 = this.cw.y;
            this.c6 = this.bw.setTimeout(runOn(this, this.dq), 1500);
        }
    };
    DOMEventProxy.prototype.dp = function () {
        if (Math.abs(this.c3 - this.cw.x) > this.c2 || Math.abs(this.c4 - this.cw.y) > this.c2) {
            this.dt();
        }
    };
    DOMEventProxy.prototype.dt = function () {
        if (this.c6 != -1) {
            window.clearTimeout(this.c6);
            this.c6 = -1;
        }
    };
    DOMEventProxy.prototype.dq = function () {
        this.c6 = -1;
        if (this.bp) {
            this.bp = false;
            this.b6();
        }
        this.a0(this.cv);
    };
    DOMEventProxy.prototype.dl = function (a) {
        this.bm = true;
        this.cp(a);
        this.cr(a);
        if (this.bp) {
            if (this.ab(this.cw, true, false) && this.c0()) {
                this.bp = false;
                this.b6();
            }
        }
        this.dp();
        this.du();
        if (this.ab(this.cw, true, false) && this.b1 == 1 && !this.bp) {
            this.cn(a);
            if (!this.cy) {
                this.cy = true;
                this.dv = this.cv;
                this.ay(this.dv);
            }
            else {
                this.a4(this.cw, true, true);
                this.at(this.cv, true);
                this.ax(this.cv);
            }
        }
    };
    DOMEventProxy.prototype.c0 = function () {
        var a = { $type: Point_$type, x: this.dw.x - this.cv.x, y: this.dw.y - this.cv.y };
        if (Math.abs(a.x) < 2 && Math.abs(a.y) < 2) {
            return false;
        }
        if (Math.abs(a.x) > Math.abs(a.y)) {
            a.y = 0;
        }
        if (Math.abs(a.y) > Math.abs(a.x)) {
            a.x = 0;
        }
        return this.al(a);
    };
    DOMEventProxy.prototype.dk = function (a) {
        this.bm = false;
        this.cp(a);
        this.cr(a);
        this.dt();
        if (this.bp) {
            this.bp = false;
            this.b6();
        }
        this.cn(a);
        this.a4(this.cw, false, true);
        this.a5(this.cw);
        if (this.b1 == 0) {
            this.dr(this.cw);
            this.ck();
        }
        if (this.cy && this.b1 == 0) {
            this.cy = false;
            this.dv = null;
            this.aw(this.cv);
            this.ck();
        }
        this.as(this.cv, true);
    };
    DOMEventProxy.prototype.dr = function (a) {
        if (Rect.l_op_Equality(this.dx, null)) {
            this.dx = new Rect(0, a.x - 50, a.y - 50, 100, 100);
            this.bw.setTimeout(runOn(this, this.du), 500);
        }
        else {
            if (a.x >= this.dx.x && a.x <= this.dx.right && a.y >= this.dx.y && a.y <= this.dx.bottom) {
                this.du();
                this.av(a);
            }
        }
    };
    DOMEventProxy.prototype.du = function () {
        this.dx = null;
    };
    DOMEventProxy.prototype.dn = function (a) {
        if (this.c1.containsKey(a)) {
            var b = this.c1.item(a);
            this.c1.removeItem(a);
            for (var c = 0; c < b.count; c++) {
                b._inner[c]();
            }
            b.clear();
        }
    };
    DOMEventProxy.prototype.bb = function (a, b) {
        var c = a;
        var d = this.c9 + b;
        this.dn(d);
    };
    DOMEventProxy.prototype.aq = function () {
        if (this.bx == null) {
            return;
        }
        this.dn(this.c9);
        this.bx = null;
    };
    DOMEventProxy.$t = markType(DOMEventProxy, 'DOMEventProxy', BaseDOMEventProxy.$);
    DOMEventProxy.c7 = 0;
    return DOMEventProxy;
}(BaseDOMEventProxy));
export { DOMEventProxy };
//# sourceMappingURL=BaseDOMEventProxy_combined.js.map
