"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.propsForBankEntryUnauthorizedEdit = exports.propsForStimulusBankEntryEditPrompt = exports.propsForItemBankEntryEditPrompt = exports.propsForBankEntryEditPrompt = exports.propsForBankEntryVersioningWrapper = exports.propsForStimulusVersioningWrapper = exports.propsForItemVersioningWrapper = void 0;

var _react = _interopRequireDefault(require("react"));

var _partial = _interopRequireDefault(require("lodash/partial"));

var _Text = _interopRequireDefault(require("@instructure/ui-elements/lib/components/Text"));

var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/lib/format-message"));

var immutableItemDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Niekt\xF3rzy uczestnicy ju\u017C przes\u0142ali odpowiedzi dla tego elementu!"), "\xA0", "Mo\u017Cna zastosowa\u0107 zmiany do kopii tego elementu, kt\xF3re b\u0119d\u0105 widziane tylko przez uczestnik\xF3w, kt\xF3rzy nie podchodzili do testu.");

var itemCopyDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Edytowanie kopii."), "\xA0", "Statystyki elementu z tej nowego kopii pojawi\u0105 si\u0119 jako oddzielone wzgl\u0119dem poprzedniej wersji tego pytania.");

var immutableStimulusDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Niekt\xF3rzy uczestnicy ju\u017C przes\u0142ali odpowiedzi dla tego bod\u017Aca!"), "\xA0", "Mo\u017Cna zastosowa\u0107 zmiany do kopii tego bod\u017Aca, kt\xF3re b\u0119d\u0105 widziane tylko przez uczestnik\xF3w, kt\xF3rzy nie podchodzili do testu. Za\u0142\u0105czone elementy r\xF3wnie\u017C zostan\u0105 skopiowane.");

var stimulusCopyDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Edytowanie kopii."), "\xA0", "Statystyki bod\u017Aca z tej nowego kopii pojawi\u0105 si\u0119 jako oddzielone wzgl\u0119dem poprzedniej wersji.");

var itemBankEntryEditDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Element dodany do banku."), "\xA0", "Niekt\xF3re opcje i warto\u015Bci punkt\xF3w mo\u017Cna zmieni\u0107 tutaj, ale edycji nale\u017Cy dokona\u0107 w banku.");

var stimulusBankEntryEditDescription = _react.default.createElement(_Text.default, {
  "data-automation": "sdk-editInBanks-warning"
}, _react.default.createElement("b", null, "Bodziec dodany do banku."), "\xA0", "Edytowanie tego bod\u017Aca nale\u017Cy wykona\u0107 w banku.");

var bankEntryUnauthorizedEditDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Element dodany do banku."), "\xA0", "Nie masz uprawnie\u0144 potrzebnych do edytowania tego elementu.");

var archivedBankEntryDescription = _react.default.createElement(_Text.default, null, "Ten element zosta\u0142 usuni\u0119ty z banku element\xF3w. Uczestnicy zobacz\u0105 go przy kolejnych pr\xF3bach. Aby wprowadzi\u0107 zmiany, utw\xF3rz kopi\u0119 elementu.");

var propsForVersioningWrapper = function propsForVersioningWrapper(copyDescription, immutableDescription, isImmutable, shouldClone, setShouldClone, switchOffEditing, isEditing) {
  var alertType = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : 'warning';
  var defaultProps = {
    disableChildren: false,
    showAlert: false
  };
  if (!isEditing) return {
    showAlert: false
  };

  if (isImmutable && shouldClone) {
    Object.assign(defaultProps, {
      description: copyDescription,
      hideActions: true,
      showAlert: true
    });
  } else if (isImmutable) {
    Object.assign(defaultProps, {
      alertType: alertType,
      cancelActionCallback: switchOffEditing,
      defaultActionCallback: (0, _partial.default)(setShouldClone, true),
      defaultActionText: "Edytuj kopi\u0119",
      description: immutableDescription,
      disableChildren: true,
      showAlert: true
    });
  }

  return defaultProps;
};

var propsForItemVersioningWrapper = function propsForItemVersioningWrapper() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }

  return propsForVersioningWrapper.apply(void 0, [itemCopyDescription, immutableItemDescription].concat(args));
};

exports.propsForItemVersioningWrapper = propsForItemVersioningWrapper;

var propsForStimulusVersioningWrapper = function propsForStimulusVersioningWrapper() {
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
    args[_key2] = arguments[_key2];
  }

  return propsForVersioningWrapper.apply(void 0, [stimulusCopyDescription, immutableStimulusDescription].concat(args));
};

exports.propsForStimulusVersioningWrapper = propsForStimulusVersioningWrapper;

var propsForBankEntryVersioningWrapper = function propsForBankEntryVersioningWrapper() {
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
    args[_key3] = arguments[_key3];
  }

  return propsForVersioningWrapper.apply(void 0, [itemCopyDescription, archivedBankEntryDescription].concat(args));
};

exports.propsForBankEntryVersioningWrapper = propsForBankEntryVersioningWrapper;

var propsForBankEntryEditPrompt = function propsForBankEntryEditPrompt(isEditing, switchOffEditing, defaultActionCallback, description) {
  if (!isEditing) return {
    showAlert: false
  };
  return {
    cancelActionCallback: switchOffEditing,
    disableChildren: true,
    description: description,
    defaultActionCallback: defaultActionCallback,
    defaultActionText: "Edytuj w banku",
    showAlert: true
  };
};

exports.propsForBankEntryEditPrompt = propsForBankEntryEditPrompt;

var propsForItemBankEntryEditPrompt = function propsForItemBankEntryEditPrompt() {
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
    args[_key4] = arguments[_key4];
  }

  return propsForBankEntryEditPrompt.apply(void 0, args.concat([itemBankEntryEditDescription]));
};

exports.propsForItemBankEntryEditPrompt = propsForItemBankEntryEditPrompt;

var propsForStimulusBankEntryEditPrompt = function propsForStimulusBankEntryEditPrompt() {
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
    args[_key5] = arguments[_key5];
  }

  return propsForBankEntryEditPrompt.apply(void 0, args.concat([stimulusBankEntryEditDescription]));
};

exports.propsForStimulusBankEntryEditPrompt = propsForStimulusBankEntryEditPrompt;

var propsForBankEntryUnauthorizedEdit = function propsForBankEntryUnauthorizedEdit(isEditing) {
  if (!isEditing) return {
    showAlert: false
  };
  return {
    alertType: 'warning',
    disableChildren: true,
    description: bankEntryUnauthorizedEditDescription,
    hideActions: true,
    showAlert: true
  };
};

exports.propsForBankEntryUnauthorizedEdit = propsForBankEntryUnauthorizedEdit;