"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "addLinkMetadata", {
  enumerable: true,
  get: function get() {
    return _addLinkMetadata.addLinkMetadata;
  }
});
exports.commandWithMetadata = void 0;
Object.defineProperty(exports, "getLinkMetadataFromTransaction", {
  enumerable: true,
  get: function get() {
    return _getLinkMetadataFromTransaction.getLinkMetadataFromTransaction;
  }
});
var _addLinkMetadata = require("./addLinkMetadata");
var _getLinkMetadataFromTransaction = require("./getLinkMetadataFromTransaction");
/**
 * Adds metadata to the transaction created from a command
 * The metadata describes the user intent and input method
 * for executing the command
 */
var commandWithMetadata = exports.commandWithMetadata = function commandWithMetadata(command, metadata) {
  return function (state, dispatch, view) {
    if (!dispatch) {
      return command(state, dispatch, view);
    }
    return command(state, function (tr) {
      (0, _addLinkMetadata.addLinkMetadata)(state.selection, tr, metadata);
      dispatch(tr);
    }, view);
  };
};
// eslint-disable-next-line @atlaskit/editor/no-re-export

// eslint-disable-next-line @atlaskit/editor/no-re-export