"use strict";
(self["webpackChunkGenesysCloudWebrtcSdk"] = self["webpackChunkGenesysCloudWebrtcSdk"] || []).push([["node_modules_gnaudio_jabra-js_browser-esm_chrome-extension-transport-COEAACGo_js"],{

/***/ "./node_modules/@gnaudio/jabra-js/browser-esm/chrome-extension-transport-COEAACGo.js"
/*!*******************************************************************************************!*\
  !*** ./node_modules/@gnaudio/jabra-js/browser-esm/chrome-extension-transport-COEAACGo.js ***!
  \*******************************************************************************************/
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TransportChromeExtension: () => (/* binding */ r)
/* harmony export */ });
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/promise */ "./node_modules/@babel/runtime-corejs3/core-js-stable/promise.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_set_timeout__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/set-timeout */ "./node_modules/@babel/runtime-corejs3/core-js-stable/set-timeout.js");
/* harmony import */ var _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index-t1Gt7dja.js */ "./node_modules/@gnaudio/jabra-js/browser-esm/index-t1Gt7dja.js");
/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/dist/esm5/internal/Subject.js");





class r {
  constructor(t, s) {
    this.logger = t, this.recorder = s, this.events = new rxjs__WEBPACK_IMPORTED_MODULE_3__.Subject(), this.consoleAppEvent = this.events, this.connectHasBeenCalled = !1, this.context = _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_2__.T.CHROME_EXTENSION;
  }
  connect() {
    return this.connectHasBeenCalled ? _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0__.reject(new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_2__.J("Already connected", _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_2__.E.UNEXPECTED_ERROR)) : (this.connectHasBeenCalled = !0, window.addEventListener("message-from-jabra-chrome-extension", e => {
      var t;
      let s = e.detail;
      this.recorder && (s = null === (t = this.recorder) || void 0 === t ? void 0 : t.recordInput(s)), this.events.next(s);
    }), this.writeAction({
      event: "ping"
    }), _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0__.resolve());
  }
  static sendToBrowserExtension(e) {
    const t = new CustomEvent("message-to-jabra-chrome-extension", {
      detail: structuredClone(e)
    });
    window.dispatchEvent(t);
  }
  static checkInstallation() {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_2__._)(this, void 0, void 0, function* () {
      return new _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0__(e => {
        r.sendToBrowserExtension("check-console-app-installation"), window.addEventListener("installation-status-from-jabra-chrome-extension", t => {
          e({
            ok: t.detail,
            message: t.detail ? "Installation ok" : "The Jabra Chromehost is not installed"
          });
        }), _babel_runtime_corejs3_core_js_stable_set_timeout__WEBPACK_IMPORTED_MODULE_1__(() => {
          e({
            ok: !1,
            message: "The Jabra Chrome Extension is not installed"
          });
        }, 3e3);
      });
    });
  }
  writeAction(e) {
    var t;
    return null === (t = this.recorder) || void 0 === t || t.recordOutput(e), r.sendToBrowserExtension(e), _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_0__.resolve();
  }
}


/***/ }

}]);
//# sourceMappingURL=node_modules_gnaudio_jabra-js_browser-esm_chrome-extension-transport-COEAACGo_js.genesys-cloud-webrtc-sdk.bundle.js.map