import "regenerator-runtime/runtime";
import _asyncToGenerator from "/Users/maxilo/workspace/code/npm/maxilo-vue-bootstrap-component/node_modules/_@babel_runtime@7.0.0-beta.47@@babel/runtime/helpers/builtin/es6/asyncToGenerator";
var state = {
  manager: {
    dropMenu: {}
  },
  relations: {}
};
var getters = {
  manager: function manager(state) {
    return state.manager;
  }
};
var actions = {
  getRelation: function () {
    var _getRelation = _asyncToGenerator(
    /*#__PURE__*/
    regeneratorRuntime.mark(function _callee(_ref, type) {
      var state;
      return regeneratorRuntime.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              state = _ref.state;

              if (state.relations[type]) {
                _context.next = 9;
                break;
              }

              _context.t0 = type;
              _context.next = _context.t0 === 'editor' ? 5 : 9;
              break;

            case 5:
              _context.next = 7;
              return import('@ckeditor/ckeditor5-build-classic');

            case 7:
              state.relations.editor = _context.sent;
              return _context.abrupt("break", 9);

            case 9:
              return _context.abrupt("return", state.relations[type] ? state.relations[type] : null);

            case 10:
            case "end":
              return _context.stop();
          }
        }
      }, _callee, this);
    }));

    return function getRelation(_x, _x2) {
      return _getRelation.apply(this, arguments);
    };
  }()
};
var mutations = {
  addDropMenu: function addDropMenu(state, payload) {
    state.manager.dropMenu[payload.uuid] = payload.instance;
  },
  addRelation: function addRelation(state, payload) {
    state.relations[payload.key] = payload.relation;
  }
};
export default {
  namespaced: true,
  state: state,
  getters: getters,
  actions: actions,
  mutations: mutations
};