"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../../node_modules/react-redux/es/index.js");var t=require("../../store/index.js"),r=require("../../node_modules/@fortawesome/react-fontawesome/index.es.js"),i=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),s=require("../../utils/customHooks/useEventListener.js"),o=require("../../utils/genericFunctions/eventDispatch.js"),l=require("../../utils/genericFunctions/localStorage.js");require("../../node_modules/tslib/tslib.es6.js");var a=require("./SettingsHeader.js");require("../../node_modules/@babel/runtime/helpers/defineProperty.js"),require("../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js"),require("../../node_modules/@babel/runtime/helpers/typeof.js"),require("../../node_modules/html-parse-stringify/dist/html-parse-stringify.js"),require("../../node_modules/react-i18next/dist/es/context.js");var u=require("../../node_modules/react-i18next/dist/es/useTranslation.js");require("../../node_modules/@babel/runtime/helpers/slicedToArray.js");var n=require("../../lib/devices/devices.js"),d=require("../../node_modules/react-redux/es/hooks/useSelector.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=c(e);exports.default=function(){var c=d.useSelector((function(e){return e.player.remoteAudio})),m=u.useTranslation().t,f=t.store.select.mediaDevices.audioOutputDevices(t.store.getState()),v=e.useState(n.getCurrentAudioOutputDeviceId()||null),b=v[0],h=v[1],g=function(e){h(e),null==c||c.current.setSinkId(e).then((function(){console.info("Audio output device switch success!"),l.setJSONItem("phone-island-audio-output-device",{deviceId:e}),o.eventDispatch("phone-island-call-audio-output-switched",{})})).catch((function(e){console.error("Audio output device switch error:",e)}))};s.useEventListener("phone-island-call-audio-output-switch",(function(e){g(e.deviceId)}));var x=e.useState(null),y=x[0],j=x[1];return p.default.createElement("div",{className:"pi-flex pi-flex-col pi-w-full"},p.default.createElement(a.SettingsHeader,{title:m("Settings.Speakers"),tooltipPrefix:"audio"}),p.default.createElement("div",{className:"pi-flex pi-flex-col pi-mt-2 pi-space-y-1 pi-max-h-48 pi-overflow-y-auto pi-scrollbar-thin pi-scrollbar-thumb-gray-400 pi-dark:scrollbar-thumb-gray-400 pi-scrollbar-thumb-rounded-full pi-scrollbar-thumb-opacity-50 dark:pi-scrollbar-track-gray-900 pi-scrollbar-track-gray-200 pi-dark:scrollbar-track-gray-900 pi-scrollbar-track-rounded-full pi-scrollbar-track-opacity-25"},f.map((function(e,t){return p.default.createElement("div",{key:t,className:"pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md pi-cursor-pointer",onClick:function(){return g(null==e?void 0:e.deviceId)},onMouseEnter:function(){return j(null==e?void 0:e.deviceId)},onMouseLeave:function(){return j(null)}},p.default.createElement("div",{className:"pi-flex pi-items-center"},p.default.createElement(r.FontAwesomeIcon,{icon:i.faVolumeHigh,className:"pi-mr-2 pi-w-5 pi-h-5"}),p.default.createElement("span",null,(null==e?void 0:e.label)||"Input device ".concat(t+1))),p.default.createElement("div",{className:"pi-flex pi-items-center"},b===(null==e?void 0:e.deviceId)&&p.default.createElement(r.FontAwesomeIcon,{icon:i.faCheck,className:"".concat(y===(null==e?void 0:e.deviceId)?"pi-text-gray-700 dark:pi-text-gray-200":"pi-text-emerald-700 dark:pi-text-emerald-500"," pi-w-5 pi-h-5")})))}))))};
//# sourceMappingURL=AudioView.js.map
