import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _nodeViewRenderers;
var _excluded = ["node"],
  _excluded2 = ["node"],
  _excluded3 = ["node"],
  _excluded4 = ["node"];
import loadable from "@loadable/component";
import React, { useMemo } from "react";
import { Node_Type } from "./../../../ricos-types/index.js";
var SmartBlockRenderer = function SmartBlockRenderer(_ref) {
  var node = _ref.node,
    props = _objectWithoutPropertiesLoose(_ref, _excluded);
  var SmartBlock = useMemo(function () {
    return loadable({
      resolved: {},
      chunkName: function chunkName() {
        return "ricos_plugin_SmartBlock";
      },
      isReady: function isReady(props) {
        var key = this.resolve(props);
        if (this.resolved[key] !== true) {
          return false;
        }
        if (typeof __webpack_modules__ !== 'undefined') {
          return !!__webpack_modules__[key];
        }
        return false;
      },
      importAsync: function importAsync() {
        return import(/* webpackChunkName: "ricos_plugin_SmartBlock" */"../smart-block-loadable.js");
      },
      requireAsync: function requireAsync(props) {
        var _this = this;
        var key = this.resolve(props);
        this.resolved[key] = false;
        return this.importAsync(props).then(function (resolved) {
          _this.resolved[key] = true;
          return resolved;
        });
      },
      requireSync: function requireSync(props) {
        var id = this.resolve(props);
        if (typeof __webpack_require__ !== 'undefined') {
          return __webpack_require__(id);
        }
        return eval('module.require')(id);
      },
      resolve: function resolve() {
        if (require.resolveWeak) {
          return require.resolveWeak("../smart-block-loadable.js");
        }
        return eval('require.resolve')("../smart-block-loadable.js");
      }
    });
  }, []);
  return /* @__PURE__ */React.createElement(SmartBlock, _extends({
    key: node.id,
    node: node
  }, props));
};
var SmartBlockLoadable = function SmartBlockLoadable(_ref2) {
  var node = _ref2.node,
    props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
  return /* @__PURE__ */React.createElement(SmartBlockRenderer, _extends({
    key: node.id,
    node: node
  }, props));
};
var SmartBlockCellRenderer = function SmartBlockCellRenderer(_ref3) {
  var node = _ref3.node,
    props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
  var SmartBlockCell = useMemo(function () {
    return loadable({
      resolved: {},
      chunkName: function chunkName() {
        return "ricos_plugin_SmartBlockCell";
      },
      isReady: function isReady(props) {
        var key = this.resolve(props);
        if (this.resolved[key] !== true) {
          return false;
        }
        if (typeof __webpack_modules__ !== 'undefined') {
          return !!__webpack_modules__[key];
        }
        return false;
      },
      importAsync: function importAsync() {
        return import(/* webpackChunkName: "ricos_plugin_SmartBlockCell" */"../smart-block-cell-loadable.js");
      },
      requireAsync: function requireAsync(props) {
        var _this = this;
        var key = this.resolve(props);
        this.resolved[key] = false;
        return this.importAsync(props).then(function (resolved) {
          _this.resolved[key] = true;
          return resolved;
        });
      },
      requireSync: function requireSync(props) {
        var id = this.resolve(props);
        if (typeof __webpack_require__ !== 'undefined') {
          return __webpack_require__(id);
        }
        return eval('module.require')(id);
      },
      resolve: function resolve() {
        if (require.resolveWeak) {
          return require.resolveWeak("../smart-block-cell-loadable.js");
        }
        return eval('require.resolve')("../smart-block-cell-loadable.js");
      }
    });
  }, []);
  return /* @__PURE__ */React.createElement(SmartBlockCell, _extends({
    key: node.id,
    node: node
  }, props));
};
var SmartBlockCellLoadable = function SmartBlockCellLoadable(_ref4) {
  var node = _ref4.node,
    props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
  return /* @__PURE__ */React.createElement(SmartBlockCellRenderer, _extends({
    key: node.id,
    node: node
  }, props));
};
var nodeViewRenderers = (_nodeViewRenderers = {}, _nodeViewRenderers[Node_Type.SMART_BLOCK] = SmartBlockLoadable, _nodeViewRenderers[Node_Type.SMART_BLOCK_CELL] = SmartBlockCellLoadable, _nodeViewRenderers);
export { nodeViewRenderers };