import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _nodeViewRenderers;
var _excluded = ["node", "nodeIndex", "NodeViewContainer"],
  _excluded2 = ["node"];
import loadable from "@loadable/component";
import React, { useMemo } from "react";
import { Node_Type } from "./../../../ricos-types/index.js";
var GalleryRenderer = function GalleryRenderer(_ref) {
  var node = _ref.node,
    nodeIndex = _ref.nodeIndex,
    NodeViewContainer = _ref.NodeViewContainer,
    props = _objectWithoutPropertiesLoose(_ref, _excluded);
  var Gallery = useMemo(function () {
    return loadable({
      resolved: {},
      chunkName: function chunkName() {
        return "ricos_plugin_gallery";
      },
      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_gallery" */"../gallery-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("../gallery-loadable.js");
        }
        return eval('require.resolve')("../gallery-loadable.js");
      }
    });
  }, []);
  return /* @__PURE__ */React.createElement(Gallery, _extends({
    key: node.id,
    node: node,
    nodeIndex: nodeIndex,
    NodeViewContainer: NodeViewContainer
  }, props));
};
var GalleryLoadable = function GalleryLoadable(_ref2) {
  var node = _ref2.node,
    props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
  return /* @__PURE__ */React.createElement(GalleryRenderer, _extends({
    key: node.id,
    node: node
  }, props));
};
var nodeViewRenderers = (_nodeViewRenderers = {}, _nodeViewRenderers[Node_Type.GALLERY] = GalleryLoadable, _nodeViewRenderers);
export { nodeViewRenderers };