"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

// TODO: when webpack 2 upgrade finished, change this to use System.import
var interactionTypeRecordForItem = function interactionTypeRecordForItem(intTypeSlug) {
  // MC and MA interactionTypes are the only two that don't have slugs that match
  // the naming conventions on quiz_interactions, we we change them to match
  var componentKey = intTypeSlug && intTypeSlug.replace('-', '_');

  if (componentKey === 'multi_answer') {
    componentKey = 'multiple_answer';
  }

  if (componentKey === 'choice') {
    componentKey = 'multiple_choice';
  } // TODO: change quiz interactions
  // to include the underscore


  if (componentKey === 'hot_spot') {
    componentKey = 'hotspot';
  } // Try to find the module in the quiz_interactions library with
  // the key that matches the pattern of the slug and use


  try {
    return require("quiz-interactions/lib/records/interactions/".concat(componentKey, ".js")).default;
  } catch (ex) {
    return require('quiz-interactions/lib/records/InteractionType.js').default;
  }
};

var _default = interactionTypeRecordForItem;
exports.default = _default;