"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("../Button.js");require("../../node_modules/react-redux/es/index.js");var t=require("../../node_modules/@fortawesome/react-fontawesome/index.es.js"),i=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),a=require("./Actions.js"),s=require("../../lib/webrtc/messages.js"),o=require("../../lib/island/island.js"),n=require("../../lib/phone/call.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 l=require("../../node_modules/react-i18next/dist/es/useTranslation.js");require("../../node_modules/@babel/runtime/helpers/slicedToArray.js");var u=require("../../lib/user/default_device.js"),d=require("../../services/astproxy.js"),c=require("../../utils/customHooks/useEventListener.js"),p=require("../../utils/genericFunctions/eventDispatch.js");require("../../node_modules/tslib/tslib.es6.js"),require("../../store/index.js");var m=require("../CustomThemedTooltip.js"),f=require("../../node_modules/react-redux/es/hooks/useDispatch.js"),b=require("../../node_modules/react-redux/es/hooks/useSelector.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j=y(e),v=["0","1","2","3","4","5","6","7","8","9","*","#"];exports.default=function(){var y=f.useDispatch(),h=b.useSelector((function(e){return e.currentCall})).keypadValue,q=b.useSelector((function(e){return e.island})).isOpen,x=e.useRef(h);function k(e){y.currentCall.updateKeypadValue("".concat(x.current).concat(e)),x.current="".concat(x.current).concat(e),n.playDtmfAudio(e),u.isWebRTC()?s.sendDTMF(e):d.sendPhysicalDTMF(e),p.eventDispatch("phone-island-call-keypad-sent",{})}c.useEventListener("phone-island-call-keypad-send",(function(e){k(e.key)})),e.useEffect((function(){function e(e){v.includes(e.key)&&k(e.key)}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[]);var g=l.useTranslation().t;return j.default.createElement(j.default.Fragment,null,q?j.default.createElement("div",{className:"pi-flex pi-flex-col pi-gap-7"},j.default.createElement("div",{className:"pi-flex pi-gap-4"},j.default.createElement(r.Button,{variant:"transparent",onClick:o.backToPreviousView,"data-tooltip-id":"keyboard-tooltip","data-tooltip-content":g("Tooltip.Back to call")||""},j.default.createElement(t.FontAwesomeIcon,{size:"xl",icon:i.faArrowLeft})),j.default.createElement("input",{"data-stop-propagation":!0,type:"text",readOnly:!0,placeholder:g("Common.Enter a phone number")||"",value:h,autoFocus:!0,className:"pi-w-full pi-rounded-full dark:pi-bg-gray-950 pi-bg-gray-50 pi-border-2 pi-border-emerald-500 dark:pi-border-emerald-200 active:pi-border-emerald-500 dark:active:focus:pi-border-emerald-200 focus:pi-border-emerald-500 dark:focus:pi-border-emerald-200 pi-text-gray-900 dark:pi-text-gray-50 pi-font-light pi-text-xl pi-text-center pi-px-2 focus:pi-outline-0 focus:pi-ring-0 pi-placeholder-gray-400 dark:pi-placeholder-gray-500 pi-font-[inherit]"})),j.default.createElement(a.default,{keyCallback:k})):j.default.createElement("div",{className:"pi-font-medium pi-text-base"},"Keypad"),j.default.createElement(m.CustomThemedTooltip,{className:"pi-z-1000",id:"keyboard-tooltip",place:"right"}))};
//# sourceMappingURL=index.js.map
