"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Provider = void 0;
const use_shared_1 = require("@rcp/use.shared");
const antd_1 = require("antd");
const zh_CN_1 = __importDefault(require("antd/lib/locale/zh_CN"));
const react_1 = __importDefault(require("react"));
const react_dnd_1 = require("react-dnd");
const get_from_main_1 = require("../utils/get-from-main");
const { _sharedMap, _sharedUpdateMap, ddManager } = (0, get_from_main_1.getSharedFromMain)();
function Provider({ children }) {
    react_1.default.useLayoutEffect(() => {
        const bk = ddManager.getBackend();
        bk.addEventListeners(window);
        return () => {
            bk.removeEventListeners(window);
        };
    }, [ddManager]);
    return (react_1.default.createElement(use_shared_1.SharedProvider, { _internal: { valuesMap: _sharedMap, updateMap: _sharedUpdateMap } },
        react_1.default.createElement(antd_1.ConfigProvider, { locale: zh_CN_1.default, prefixCls: 'mmt-ant' },
            react_1.default.createElement(react_dnd_1.DndProvider, { manager: ddManager }, children))));
}
exports.Provider = Provider;
//# sourceMappingURL=provider.js.map