'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var getFromName = function getFromName() {
  var delta = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  var pages = getCurrentPages();
  var page = pages[pages.length - 1 - delta];
  return (page === null || page === void 0 ? void 0 : page.route) || '';
};
var getToName = function getToName(routerParams) {
  if (!(routerParams === null || routerParams === void 0 ? void 0 : routerParams[0])) {
    return '';
  }
  var _ref = (routerParams === null || routerParams === void 0 ? void 0 : routerParams[0]) || {},
    _ref$url = _ref.url,
    url = _ref$url === void 0 ? '' : _ref$url;
  var name = url.split('?')[0] || '';
  return name;
};
function getUniRouteName(_ref2) {
  var isNavigateBack = _ref2.isNavigateBack,
    routerParams = _ref2.routerParams;
  if (isNavigateBack) {
    var _ref3 = (routerParams === null || routerParams === void 0 ? void 0 : routerParams[0]) || {},
      _ref3$delta = _ref3.delta,
      delta = _ref3$delta === void 0 ? 1 : _ref3$delta;
    return {
      from: getFromName(),
      to: getFromName(delta)
    };
  }
  return {
    from: getFromName(),
    to: getToName(routerParams)
  };
}

exports.getFromName = getFromName;
exports.getToName = getToName;
exports.getUniRouteName = getUniRouteName;
