"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get CellCoords () {
        return _base.CellCoords;
    },
    get CellRange () {
        return _base.CellRange;
    },
    get default () {
        return _default;
    }
});
const _base = /*#__PURE__*/ _interop_require_wildcard(require("./base"));
const _registry = require("./registry");
const _eventManager = /*#__PURE__*/ _interop_require_wildcard(require("./eventManager"));
const _translations = require("./translations");
const _jquery = /*#__PURE__*/ _interop_require_default(require("./helpers/wrappers/jquery"));
const _ghostTable = /*#__PURE__*/ _interop_require_default(require("./utils/ghostTable"));
const _parseTable = /*#__PURE__*/ _interop_require_wildcard(require("./utils/parseTable"));
const _array = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/array"));
const _browser = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/browser"));
const _data = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/data"));
const _dateTime = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/dateTime"));
const _errors = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/errors"));
const _feature = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/feature"));
const _function = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/function"));
const _mixed = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/mixed"));
const _number = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/number"));
const _object = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/object"));
const _string = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/string"));
const _unicode = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/unicode"));
const _element = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/dom/element"));
const _event = /*#__PURE__*/ _interop_require_wildcard(require("./helpers/dom/event"));
const _registry1 = require("./editors/registry");
const _factory = require("./editors/factory");
const _registry2 = require("./renderers/registry");
const _factory1 = require("./renderers/factory");
const _registry3 = require("./validators/registry");
const _registry4 = require("./cellTypes/registry");
const _registry5 = require("./plugins/registry");
const _base1 = require("./plugins/base");
const _registry6 = require("./themes/registry");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
function _getRequireWildcardCache(nodeInterop) {
    if (typeof WeakMap !== "function") return null;
    var cacheBabelInterop = new WeakMap();
    var cacheNodeInterop = new WeakMap();
    return (_getRequireWildcardCache = function(nodeInterop) {
        return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
    })(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
    if (!nodeInterop && obj && obj.__esModule) {
        return obj;
    }
    if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
        return {
            default: obj
        };
    }
    var cache = _getRequireWildcardCache(nodeInterop);
    if (cache && cache.has(obj)) {
        return cache.get(obj);
    }
    var newObj = {
        __proto__: null
    };
    var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for(var key in obj){
        if (key !== "default" && 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;
}
(0, _registry.registerAllModules)();
(0, _jquery.default)(_base.default);
// TODO: Remove this exports after rewrite tests about this module
_base.default.__GhostTable = _ghostTable.default;
_base.default._getListenersCounter = _eventManager.getListenersCounter; // For MemoryLeak tests
_base.default._getRegisteredMapsCounter = _translations.getRegisteredMapsCounter; // For MemoryLeak tests
_base.default.EventManager = _eventManager.default;
// Export all helpers to the Handsontable object
const HELPERS = [
    _array,
    _browser,
    _data,
    _dateTime,
    _errors,
    _feature,
    _function,
    _mixed,
    _number,
    _object,
    _string,
    _unicode,
    _parseTable
];
const DOM = [
    _element,
    _event
];
_base.default.helper = {};
_base.default.dom = {};
// Fill general helpers.
_array.arrayEach(HELPERS, (helper)=>{
    _array.arrayEach(Object.getOwnPropertyNames(helper), (key)=>{
        if (key.charAt(0) !== '_') {
            _base.default.helper[key] = helper[key];
        }
    });
});
// Fill DOM helpers.
_array.arrayEach(DOM, (helper)=>{
    _array.arrayEach(Object.getOwnPropertyNames(helper), (key)=>{
        if (key.charAt(0) !== '_') {
            _base.default.dom[key] = helper[key];
        }
    });
});
// Export cell types.
_base.default.cellTypes = _base.default.cellTypes ?? {};
_array.arrayEach((0, _registry4.getRegisteredCellTypeNames)(), (cellTypeName)=>{
    _base.default.cellTypes[cellTypeName] = (0, _registry4.getCellType)(cellTypeName);
});
_base.default.cellTypes.registerCellType = _registry4.registerCellType;
_base.default.cellTypes.getCellType = _registry4.getCellType;
// Export all registered editors from the Handsontable.
_base.default.editors = _base.default.editors ?? {};
_array.arrayEach((0, _registry1.getRegisteredEditorNames)(), (editorName)=>{
    _base.default.editors[`${_string.toUpperCaseFirst(editorName)}Editor`] = (0, _registry1.getEditor)(editorName);
});
_base.default.editors.registerEditor = _registry1.registerEditor;
_base.default.editors.getEditor = _registry1.getEditor;
_base.default.editors.editorFactory = _factory.editorFactory;
// Export all registered renderers from the Handsontable.
_base.default.renderers = _base.default.renderers ?? {};
_array.arrayEach((0, _registry2.getRegisteredRendererNames)(), (rendererName)=>{
    const renderer = (0, _registry2.getRenderer)(rendererName);
    if (rendererName === 'base') {
        _base.default.renderers.cellDecorator = renderer;
    }
    _base.default.renderers[`${_string.toUpperCaseFirst(rendererName)}Renderer`] = renderer;
});
_base.default.renderers.registerRenderer = _registry2.registerRenderer;
_base.default.renderers.getRenderer = _registry2.getRenderer;
_base.default.renderers.rendererFactory = _factory1.rendererFactory;
// Export all registered validators from the Handsontable.
_base.default.validators = _base.default.validators ?? {};
_array.arrayEach((0, _registry3.getRegisteredValidatorNames)(), (validatorName)=>{
    _base.default.validators[`${_string.toUpperCaseFirst(validatorName)}Validator`] = (0, _registry3.getValidator)(validatorName);
});
_base.default.validators.registerValidator = _registry3.registerValidator;
_base.default.validators.getValidator = _registry3.getValidator;
// Export all registered plugins from the Handsontable.
// Make sure to initialize the plugin dictionary as an empty object. Otherwise, while
// transpiling the files into ES and CommonJS format, the injected CoreJS helper
// `import "core-js/modules/es.object.get-own-property-names";` won't be processed
// by the `./config/plugin/babel/add-import-extension` babel plugin. Thus, the distribution
// files will be broken. The reason is not known right now (probably it's caused by bug in
// the Babel or missing something in the plugin).
_base.default.plugins = _base.default.plugins ?? {};
_array.arrayEach((0, _registry5.getPluginsNames)(), (pluginName)=>{
    _base.default.plugins[pluginName] = (0, _registry5.getPlugin)(pluginName);
});
_base.default.plugins[`${_string.toUpperCaseFirst(_base1.BasePlugin.PLUGIN_KEY)}Plugin`] = _base1.BasePlugin;
_base.default.plugins.registerPlugin = _registry5.registerPlugin;
_base.default.plugins.getPlugin = _registry5.getPlugin;
// Export themes namespace.
_base.default.themes = _base.default.themes ?? {};
_base.default.themes.hasTheme = _registry6.hasTheme;
_base.default.themes.getTheme = _registry6.getTheme;
_base.default.themes.getThemeNames = _registry6.getThemeNames;
_base.default.themes.getThemes = _registry6.getThemes;
_base.default.themes.registerTheme = _registry6.registerTheme;
_base.default.themes.reinitTheme = _registry6.reinitTheme;
const _default = _base.default;
