"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../node_modules/react-redux/es/index.js");var i=require("../utils/genericFunctions/eventDispatch.js");require("../node_modules/tslib/tslib.es6.js"),require("../store/index.js");var t=require("../node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs.js"),d=require("../node_modules/react-redux/es/hooks/useSelector.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=a(e),r=function(a){var r=a.children,h=d.useSelector((function(e){return e.currentCall})),s=h.incoming,o=h.outgoing,c=h.accepted,l=h.transferring,g=h.incomingWebRTC,p=h.incomingSocket,w=h.conferencing,u=d.useSelector((function(e){return e.listen})).isListen,x=d.useSelector((function(e){return e.island})),f=x.view,m=x.isOpen,v=x.actionsExpanded,b=x.sideViewIsVisible,_=x.transcriptionViewIsVisible,y=x.isFromStreaming,k=x.isExtraLarge,S=d.useSelector((function(e){return e.alerts.status})).activeAlertsCount,A=d.useSelector((function(e){return e.motions})),j=A.variants,C=A.border_radius_collapsed,E=A.border_radius_expanded,q=A.border_radius_collapsed_conference,B=A.padding_x_collapsed,D=A.padding_y_collapsed,L=A.padding_expanded,I=A.alert_padding_expanded,V=d.useSelector((function(e){return e.conference})).isActive,M=e.useMemo((function(){var e={width:0,height:0,padding:L};switch(f){case"call":m?c&&l&&w?e=v?{width:j.call.expanded.transfer.actionsExpanded.width,height:j.call.expanded.transfer.actionsExpanded.height}:{width:j.call.expanded.transfer.width,height:j.call.expanded.transfer.height}:c&&v?e={width:j.call.expanded.accepted.actionsExpanded.width,height:j.call.expanded.accepted.actionsExpanded.height}:c&&!u?e={width:j.call.expanded.accepted.width,height:j.call.expanded.accepted.height}:c&&u?e={width:j.call.expanded.listening.width,height:j.call.expanded.listening.height}:s&&!y?e={width:j.call.expanded.incoming.width,height:j.call.expanded.incoming.height}:s&&y?e={width:j.call.expanded.incomingStreaming.width,height:j.call.expanded.incomingStreaming.height}:o&&!y?e={width:j.call.expanded.outgoing.width,height:j.call.expanded.outgoing.height}:o&&y&&(e={width:j.call.expanded.outgoingStreaming.width,height:j.call.expanded.outgoingStreaming.height}):e={width:j.call.collapsed.width,height:j.call.collapsed.height};break;case"keypad":e=m?{width:j.keypad.expanded.width,height:j.keypad.expanded.height}:{width:j.transfer.collapsed.width,height:j.transfer.collapsed.height};break;case"video":e=m?{width:j.video.expanded.width,height:j.video.expanded.height,padding:j.video.expanded.padding}:{width:j.video.collapsed.width,height:j.video.collapsed.height};break;case"transfer":case"player":case"recorder":case"physicalPhoneRecorder":case"settings":case"conference":e=m?{width:j[f].expanded.width,height:j[f].expanded.height}:{width:j[f].collapsed.width,height:j[f].collapsed.height};break;case"switchDevice":e=m?{width:j.switchDevice.expanded.width,height:j.switchDevice.expanded.height}:{width:j.video.collapsed.width,height:j.video.collapsed.height};break;case"waitingConference":e=m?{width:j.waitingConference.expanded.width,height:j.waitingConference.expanded.height}:{width:j.waitingConference.collapsed.width,height:j.waitingConference.collapsed.height};break;case"streamingAnswer":e=m?k?{width:j.streamingAnswer.extraLarge.width,height:j.streamingAnswer.extraLarge.height,padding:j.streamingAnswer.extraLarge.padding}:{width:j.streamingAnswer.expanded.width,height:j.streamingAnswer.expanded.height,padding:j.streamingAnswer.expanded.padding}:{width:j.streamingAnswer.collapsed.width,height:j.streamingAnswer.collapsed.height};break;case"operatorBusy":e=m?{width:j.operatorBusy.expanded.width,height:j.operatorBusy.expanded.height}:{width:j.operatorBusy.collapsed.width,height:j.operatorBusy.collapsed.height}}var i=S>0;return{width:"".concat(0===e.width&&i?j.alerts.width:e.width,"px"),height:"".concat(i&&m?j.alerts.height+(0===e.height?2*I:I):e.height,"px"),borderRadius:"".concat(m?E:V&&"waitingConference"===f?q:C,"px"),padding:m?null!=e.padding?"".concat(e.padding,"px"):"".concat(L,"px"):"".concat(B,"px ").concat(D,"px")}}),[f,m,c,l,v,u,s,o,S,j,C,E,B,D,L,I,g,p,V,y,k]);return e.useEffect((function(){var e={};e.width=null==M?void 0:M.width,e.height=null==M?void 0:M.height,i.eventDispatch("phone-island-size-change",{sizeInformation:e})}),[M,f,m,c,l,v,u,s,o,S,j,C,E,B,D,L,I,b,_,p,g,V,k]),n.default.createElement(t.motion.div,{className:"".concat(m?"pi-cursor-grab":"pi-cursor-pointer"," pi-pointer-events-auto pi-overflow-hidden dark:pi-bg-gray-950 pi-bg-gray-50 pi-text-xs dark:pi-text-white pi-text-gray-900 hover:pi-shadow-2xl pi-rounded-3xl pi-transition-shadow"),animate:M,transition:{duration:.15,ease:"easeOut"}},r)};exports.IslandMotion=r,exports.default=r;
//# sourceMappingURL=IslandMotion.js.map
