/**
 * DevExtreme (cjs/events/pointer.js)
 * Version: 23.2.6 (build 24140-0112)
 * Build date: Sun May 19 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
exports.default = void 0;
var _config = _interopRequireDefault(require("../core/config"));
var support = _interopRequireWildcard(require("../core/utils/support"));
var _iterator = require("../core/utils/iterator");
var _devices = _interopRequireDefault(require("../core/devices"));
var _event_registrator = _interopRequireDefault(require("./core/event_registrator"));
var _touch = _interopRequireDefault(require("./pointer/touch"));
var _mouse = _interopRequireDefault(require("./pointer/mouse"));
var _mouse_and_touch = _interopRequireDefault(require("./pointer/mouse_and_touch"));

function _getRequireWildcardCache(nodeInterop) {
    if ("function" !== typeof WeakMap) {
        return null
    }
    var cacheBabelInterop = new WeakMap;
    var cacheNodeInterop = new WeakMap;
    return (_getRequireWildcardCache = function(nodeInterop) {
        return nodeInterop ? cacheNodeInterop : cacheBabelInterop
    })(nodeInterop)
}

function _interopRequireWildcard(obj, nodeInterop) {
    if (!nodeInterop && obj && obj.__esModule) {
        return obj
    }
    if (null === obj || "object" !== typeof obj && "function" !== typeof obj) {
        return {
            default: obj
        }
    }
    var cache = _getRequireWildcardCache(nodeInterop);
    if (cache && cache.has(obj)) {
        return cache.get(obj)
    }
    var newObj = {};
    var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for (var key in obj) {
        if ("default" !== key && Object.prototype.hasOwnProperty.call(obj, key)) {
            var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
            if (desc && (desc.get || desc.set)) {
                Object.defineProperty(newObj, key, desc)
            } else {
                newObj[key] = obj[key]
            }
        }
    }
    newObj.default = obj;
    if (cache) {
        cache.set(obj, newObj)
    }
    return newObj
}

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}
const getStrategy = (support, _ref) => {
    let {
        tablet: tablet,
        phone: phone
    } = _ref;
    const pointerEventStrategy = getStrategyFromGlobalConfig();
    if (pointerEventStrategy) {
        return pointerEventStrategy
    }
    if (support.touch && !(tablet || phone)) {
        return _mouse_and_touch.default
    }
    if (support.touch) {
        return _touch.default
    }
    return _mouse.default
};
const EventStrategy = getStrategy(support, _devices.default.real());
(0, _iterator.each)(EventStrategy.map, (pointerEvent, originalEvents) => {
    (0, _event_registrator.default)(pointerEvent, new EventStrategy(pointerEvent, originalEvents))
});
const pointer = {
    down: "dxpointerdown",
    up: "dxpointerup",
    move: "dxpointermove",
    cancel: "dxpointercancel",
    enter: "dxpointerenter",
    leave: "dxpointerleave",
    over: "dxpointerover",
    out: "dxpointerout"
};

function getStrategyFromGlobalConfig() {
    const eventStrategyName = (0, _config.default)().pointerEventStrategy;
    return {
        "mouse-and-touch": _mouse_and_touch.default,
        touch: _touch.default,
        mouse: _mouse.default
    } [eventStrategyName]
}
var _default = pointer;
exports.default = _default;
module.exports = exports.default;
module.exports.default = exports.default;
