import { autocompletePluginKey, createAutocompletePlugin } from './pm-plugins/autocomplete-plugin';
export var autocompletePlugin = function autocompletePlugin(_ref) {
  var options = _ref.config,
    api = _ref.api;
  return {
    name: 'autocomplete',
    getSharedState: function getSharedState(editorState) {
      if (!editorState) {
        return undefined;
      }
      return autocompletePluginKey.getState(editorState);
    },
    pmPlugins: function pmPlugins() {
      return [{
        name: 'autocomplete',
        plugin: function plugin() {
          return createAutocompletePlugin(options, api);
        }
      }];
    }
  };
};