"use strict";

var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
_Object$defineProperty(exports, "__esModule", {
  value: true
});
_Object$defineProperty(exports, "MobiusSocket", {
  enumerable: true,
  get: function get() {
    return _mobiusSocket.default;
  }
});
exports.default = void 0;
exports.getMobiusSocketInstance = getMobiusSocketInstance;
exports.resetMobiusSocketInstance = resetMobiusSocketInstance;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
require("@webex/internal-plugin-device");
require("@webex/internal-plugin-feature");
require("@webex/internal-plugin-metrics");
var _mobiusSocket = _interopRequireDefault(require("./mobius-socket"));
var _config = _interopRequireDefault(require("./config"));
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /*!
 * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
 */
// Singleton instance - keeping just one instance of MobiusSocket since there won't be multiple connections
var mobiusSocketInstance;

/**
 * Creates or returns the singleton Mobius socket client for the provided Webex instance.
 *
 * @param webex - The Webex SDK instance
 * @param mobiusSocketConfig - Optional configuration overrides
 * @returns The singleton MobiusSocket instance
 */
function getMobiusSocketInstance(webex, mobiusSocketConfig) {
  if (mobiusSocketInstance) {
    return mobiusSocketInstance;
  }
  mobiusSocketInstance = new _mobiusSocket.default(webex, _objectSpread(_objectSpread({}, _config.default.mobiusSocket), mobiusSocketConfig));
  return mobiusSocketInstance;
}

/**
 * Resets the singleton MobiusSocket instance, allowing a new one to be created.
 */
function resetMobiusSocketInstance() {
  mobiusSocketInstance = undefined;
}
var _default = exports.default = _mobiusSocket.default;
//# sourceMappingURL=index.js.map
