"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.PfExceptionMap = void 0;
var _vue = require("vue");
var _noFound = _interopRequireDefault(require("./noFound"));
var _serverError = _interopRequireDefault(require("./serverError"));
var _unauthorized = _interopRequireWildcard(require("./unauthorized"));
var _empty = _interopRequireDefault(require("./empty"));
var _noResult = _interopRequireWildcard(require("./noResult"));
var _noNetwork = _interopRequireWildcard(require("./noNetwork"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var PfExceptionMap = {
  '404': _noFound.default,
  '500': _serverError.default,
  '403': _unauthorized.default,
  empty: _empty.default,
  noResult: _noResult.default,
  noNetwork: _noNetwork.default
};
exports.PfExceptionMap = PfExceptionMap;
var DefaultPfResultProps = {
  '404': {
    subTitle: '服务器查询不到信息'
  },
  '500': {
    subTitle: '非常抱歉，您访问的页面没有找到...'
  },
  '403': {
    title: (0, _vue.createVNode)(_unauthorized.UnauthorizedTitle, null, null),
    subTitle: '非常抱歉，您没有权限访问此页面...'
  },
  empty: {
    subTitle: '无数据'
  },
  noResult: {
    title: (0, _vue.createVNode)(_noResult.NoResultTitle, null, null),
    subTitle: '没有相关的搜索结果，换个关键字吧'
  },
  noNetwork: {
    title: (0, _vue.createVNode)(_noNetwork.NoNetworkTitle, null, null),
    subTitle: '该星球无信号，请检查网络连接！'
  }
};
var RenderPfResult = function RenderPfResult(prefixCls, _ref) {
  var status = _ref.status,
    title = _ref.title,
    subTitle = _ref.subTitle,
    extra = _ref.extra;
  var defaultProps = DefaultPfResultProps["".concat(status)];
  var _prefixCls = "".concat(prefixCls, "-pf");
  var SVGComponent = PfExceptionMap[status];
  var _title = title || (defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.title);
  var _subTitle = subTitle || (defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.subTitle);
  var _extra = extra || (defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.extra);
  console.log('_extra', _extra);
  return (0, _vue.createVNode)("div", {
    "class": _prefixCls
  }, [(0, _vue.createVNode)(SVGComponent, null, null), (0, _vue.createVNode)("div", {
    "class": "".concat(_prefixCls, "-content")
  }, [_title && (0, _vue.createVNode)("div", {
    "class": "".concat(_prefixCls, "-title"),
    "style": {
      marginBottom: _subTitle || _extra ? '16px' : '0'
    }
  }, [_title]), _subTitle && (0, _vue.createVNode)("div", {
    "class": "".concat(_prefixCls, "-subtitle"),
    "style": {
      marginBottom: _extra ? '14px' : '0'
    }
  }, [_subTitle]), _extra && (0, _vue.createVNode)("div", {
    "class": "".concat(_prefixCls, "-extra")
  }, [_extra])])]);
};
var _default = RenderPfResult;
exports.default = _default;