"use strict";

require("core-js/modules/es.object.keys.js");

require("core-js/modules/es.symbol.js");

require("core-js/modules/es.array.filter.js");

require("core-js/modules/es.object.get-own-property-descriptor.js");

require("core-js/modules/es.array.for-each.js");

require("core-js/modules/web.dom-collections.for-each.js");

require("core-js/modules/es.object.get-own-property-descriptors.js");

require("core-js/modules/es.object.define-properties.js");

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

require("core-js/modules/es.array.concat.js");

require("core-js/modules/es.object.define-property.js");

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var GlobalServerConfig = /*#__PURE__*/function () {
  function GlobalServerConfig() {
    _classCallCheck(this, GlobalServerConfig);

    _defineProperty(this, "baseurl", void 0);

    _defineProperty(this, "retries", void 0);

    _defineProperty(this, "timeout", void 0);

    _defineProperty(this, "_headers", void 0);

    var hostname = window.location.hostname;
    var protocol = window.location.protocol;
    this.baseurl = "".concat(protocol, "//").concat(hostname);
    this.timeout = 10000;
    this.retries = 3;
    this._headers = {};
  }

  _createClass(GlobalServerConfig, [{
    key: "headers",
    get:
    /**
     * The baseurl for each server request. Default is `protocol`://`hostname`
     */

    /**
     * The max retries to use for each server request. Default is 3
     */

    /**
     * The timeout to use for each server request. Default is 10000
     */

    /**
     * The headers to add to every API server request. Default is {}
     */
    function get() {
      return _objectSpread({}, this._headers);
    },
    set: function set(headers) {
      this._headers = _objectSpread({}, headers);
    }
  }]);

  return GlobalServerConfig;
}();

var globalServerConfig = new GlobalServerConfig();
exports.globalServerConfig = globalServerConfig;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21tb24vc2VydmVyL3NlcnZlci1jb25maWcudHMiXSwibmFtZXMiOlsiR2xvYmFsU2VydmVyQ29uZmlnIiwiaG9zdG5hbWUiLCJ3aW5kb3ciLCJsb2NhdGlvbiIsInByb3RvY29sIiwiYmFzZXVybCIsInRpbWVvdXQiLCJyZXRyaWVzIiwiX2hlYWRlcnMiLCJoZWFkZXJzIiwiZ2xvYmFsU2VydmVyQ29uZmlnIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7SUFFTUEsa0I7QUE2QkosZ0NBQWM7QUFBQTs7QUFBQTs7QUFBQTs7QUFBQTs7QUFBQTs7QUFDWixRQUFNQyxRQUFRLEdBQUdDLE1BQU0sQ0FBQ0MsUUFBUCxDQUFnQkYsUUFBakM7QUFDQSxRQUFNRyxRQUFRLEdBQUdGLE1BQU0sQ0FBQ0MsUUFBU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