{"version":3,"sources":["../ui/src/components/modules/video-player-library/players/staticPlayer/player.tsx"],"sourcesContent":["import {useEffect, useState} from \"react\";\r\nimport { handlePlayPause, handleVideoElementSizeInfo } from \"redux-share/actions\";\r\nimport { useAppDispatch, useAppSelector } from \"redux-share/hooks\";\r\nimport { conditions, isTouchScreen, videoTag } from \"helpers\";\r\nimport { ConditionName, zIndex } from \"interfaces\";\r\nimport { setShowScreen } from \"redux-share/slices/videoDataSlice\";\r\nimport useActiveInActive from \"helpers/hooks/useActiveInActive\";\r\nimport useFullScreen from \"helpers/hooks/useFullScreen\";\r\nimport PlayerCore from \"ui/src/components/player-core/playerCore\";\r\nimport { shallowEqual } from 'react-redux'\r\nimport Image from \"next/image\";\r\nimport dynamic from \"next/dynamic\";\r\n\r\nconst TouchVolumeBrightness = dynamic(() => import(\"ui/src/components/player-components/touchVolumeBrightness/touchVolumeBrightness\"));\r\nconst BackwardForward = dynamic(() => import(\"ui/src/components/player-components/backwardForward/backwardForward\"));\r\nconst Advertisement = dynamic(() => import(\"ui/src/components/player-components/ad/advertisement\"));\r\nconst Header = dynamic(() => import(\"ui/src/components/mainComponent/header/header\"));\r\nconst Footer = dynamic(() => import(\"ui/src/components/mainComponent/footer/footer\"));\r\nconst Main = dynamic(() => import(\"ui/src/components/mainComponent/main/main\"));\r\n\r\nconst Player = () => {\r\n\r\n    const [isRightDoubleTouched, setIsRightDoubleTouched] = useState<boolean>(false);\r\n    const [isLeftDoubleTouched, setIsLeftDoubleTouched] = useState<boolean>(false);\r\n    const { params } = useAppSelector(({ videoData: { params, isAdBlockerActivate, ads, recommendationList } }) => ({ params, isAdBlockerActivate, ads, recommendationList }), shallowEqual);\r\n    const { firstPlay, showMiniPlayer, isFullScreen } = useAppSelector(({ controller: { firstPlay, showMiniPlayer, isFullScreen, activeElements, canPlayVideo, isEnded } }) => ({ firstPlay, showMiniPlayer, isFullScreen, activeElements, canPlayVideo, isEnded }), shallowEqual);\r\n    useAppSelector(({ popovers: { autoPlayPopover } }) => ({ autoPlayPopover }), shallowEqual);\r\n\r\n    const dispatch = useAppDispatch();\r\n\r\n    useEffect(() => {\r\n        if (videoTag()) {\r\n            let timeout:any;\r\n            const handleResize = () => {\r\n                if (!conditions(ConditionName.showMiniPlayer)) {\r\n                    timeout = setTimeout(() => {\r\n                        handleVideoElementSizeInfo();\r\n                        dispatch(setShowScreen(true));\r\n                    }, conditions(ConditionName.isTouchScreen) ? 0 : 300)\r\n                }\r\n            }\r\n            handleResize();\r\n            window.addEventListener(\"resize\", handleResize);\r\n\r\n            return () => {\r\n                window.removeEventListener(\"resize\", handleResize);\r\n                clearTimeout(timeout);\r\n            }\r\n        }\r\n    }, [firstPlay, showMiniPlayer, isFullScreen, videoTag()])\r\n\r\n    // --- Managing the active and inActive of elements in desktop and mobile devices --- //\r\n    useActiveInActive(isRightDoubleTouched, isLeftDoubleTouched);\r\n\r\n    useFullScreen();\r\n\r\n    return (\r\n        <div className=\"pl-h-screen pl-flex pl-justify-center pl-items-center pl-overflow-hidden\">\r\n            <div\r\n                className={`pl-relative pl-w-full pl-h-full pl-bg-black pl-max-h-screen pl-aspect-video pl-flex pl-items-center ${!conditions(ConditionName.isActiveElements) && \"pl-cursor-none\"}`}\r\n                onClick={(event) => conditions(ConditionName.showBannerStaticFiles) && !conditions(ConditionName.isAdBlockerActivate) ? handlePlayPause(event) : () => {}}\r\n                id=\"video-area\"\r\n            >\r\n                {conditions(ConditionName.showBannerStaticFiles) && <div className='pl-absolute pl-w-full pl-h-full pl-flex pl-justify-center'>\r\n                    <Image src={params.cover!} layout='fill'  alt=\"sdfdf\" objectFit=\"contain\"/>\r\n                </div>}\r\n                {conditions(ConditionName.showTouchVolumeBrightness) && <TouchVolumeBrightness />}\r\n                {conditions(ConditionName.showBackwardForward) && !conditions(ConditionName.isPlayingAd) && (\r\n                    <div\r\n                        className={`pl-absolute pl-top-0 pl-right-0 pl-w-full pl-h-full pl-overflow-hidden pl-flex pl-items-center`}\r\n                        style={{zIndex: (isLeftDoubleTouched || isRightDoubleTouched) ? zIndex.backwardForwardActive : zIndex.backwardForwardInActive}}>\r\n                        <BackwardForward type=\"touchForward\" isRightDoubleTouched={isRightDoubleTouched} setIsRightDoubleTouched={setIsRightDoubleTouched} />\r\n                        <BackwardForward type=\"touchBackward\" isLeftDoubleTouched={isLeftDoubleTouched} setIsLeftDoubleTouched={setIsLeftDoubleTouched} />\r\n                    </div>\r\n                )}\r\n                {conditions(ConditionName.isPlayingAd) && !conditions(ConditionName.isFirstPlay) && <Advertisement />}\r\n                {conditions(ConditionName.isAdBlockerActivate) && (\r\n                    <div onClick={(e) => {\r\n                        e.preventDefault();\r\n                        e.stopPropagation();\r\n                    }} onDoubleClick={(e) => {\r\n                        e.preventDefault();\r\n                        e.stopPropagation();\r\n                    }}\r\n                        className={`${isTouchScreen() ? \"pl-text-[13px]\" : \"pl-text-[16px]\"} pl-text-center pl-top-0 pl-left-0 pl-absolute pl-h-full pl-w-full pl-bg-secondary-700/[0.8] pl-backdrop-blur-[4px] pl-flex pl-items-center pl-justify-center pl-p-2 pl-z-[10000000] pl-text-white`}>\r\n                        کاربر گرامی، برای مشاهده ویدیو، لطفا افزونه عدم نمایش تبلیغات را غیرفعال نمایید.\r\n                    </div>\r\n                )}\r\n                <div className={`${conditions(ConditionName.isPlayingAd) && \"pl-absolute pl-w-full pl-h-full\"}`}><PlayerCore /></div>\r\n                {(conditions(ConditionName.canPlayVideo) || conditions(ConditionName.isIOS)) && (\r\n                    <div id=\"playerElements\"\r\n                        className={`pl-absolute pl-top-0 pl-right-0 pl-w-full pl-h-full ${conditions(ConditionName.showAutoPlayPopover) && \"pl-bg-black\"}`}>\r\n                        <div className={`pl-flex pl-flex-col pl-justify-between pl-w-full pl-h-full`}>\r\n                            {!conditions(ConditionName.isPlayingAd) && conditions(ConditionName.showHeader) && <Header /> }\r\n                            {((conditions(ConditionName.isPlayingAd) && conditions(ConditionName.isFirstPlay)) || !conditions(ConditionName.isPlayingAd)) && <Main /> }\r\n                            {!conditions(ConditionName.isPlayingAd) && !conditions(ConditionName.isFirstPlay) && <Footer /> }\r\n                        </div>\r\n                    </div>\r\n                )}\r\n            </div>\r\n        </div>\r\n    )\r\n}\r\n\r\nexport default Player;"],"mappings":"yPAAAA,IAAA,OAAQ,aAAAC,EAAW,YAAAC,MAAe,QASlC,OAAS,gBAAAC,MAAoB,cAC7B,OAAOC,MAAW,aAClB,OAAOC,MAAa,eAqDA,cAAAC,EAIA,QAAAC,MAJA,oBAnDpB,IAAMC,EAAwBH,EAAQ,IAAM,OAAO,sCAAiF,CAAC,EAC/HI,EAAkBJ,EAAQ,IAAM,OAAO,gCAAqE,CAAC,EAC7GK,EAAgBL,EAAQ,IAAM,OAAO,8BAAsD,CAAC,EAC5FM,EAASN,EAAQ,IAAM,OAAO,uBAA+C,CAAC,EAC9EO,EAASP,EAAQ,IAAM,OAAO,uBAA+C,CAAC,EAC9EQ,EAAOR,EAAQ,IAAM,OAAO,qBAA2C,CAAC,EAExES,EAAS,IAAM,CAEjB,GAAM,CAACC,EAAsBC,CAAuB,EAAIC,EAAkB,EAAK,EACzE,CAACC,EAAqBC,CAAsB,EAAIF,EAAkB,EAAK,EACvE,CAAE,OAAAG,CAAO,EAAIC,EAAe,CAAC,CAAE,UAAW,CAAE,OAAAD,EAAQ,oBAAAE,EAAqB,IAAAC,EAAK,mBAAAC,CAAmB,CAAE,KAAO,CAAE,OAAAJ,EAAQ,oBAAAE,EAAqB,IAAAC,EAAK,mBAAAC,CAAmB,GAAIrB,CAAY,EACjL,CAAE,UAAAsB,EAAW,eAAAC,EAAgB,aAAAC,CAAa,EAAIN,EAAe,CAAC,CAAE,WAAY,CAAE,UAAAI,EAAW,eAAAC,EAAgB,aAAAC,EAAc,eAAAC,EAAgB,aAAAC,EAAc,QAAAC,CAAQ,CAAE,KAAO,CAAE,UAAAL,EAAW,eAAAC,EAAgB,aAAAC,EAAc,eAAAC,EAAgB,aAAAC,EAAc,QAAAC,CAAQ,GAAI3B,CAAY,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wB,GACpI,EAEHmB,eAAoC,GAAK,CAACA,eAAoC,GAAKhC,EAACI,EAAA,EAAc,EAClG4B,uBAA4C,GACzChC,EAAC,OAAI,QAAUuC,GAAM,CACjBA,EAAE,eAAe,EACjBA,EAAE,gBAAgB,CACtB,EAAG,cAAgBA,GAAM,CACrBA,EAAE,eAAe,EACjBA,EAAE,gBAAgB,CACtB,EACI,UAAW,GAAGC,EAAc,EAAI,iBAAmB,gBAAgB,qMAAsM,2aAE7Q,EAEJxC,EAAC,OAAI,UAAW,GAAGgC,eAAoC,GAAK,iCAAiC,GAAI,SAAAhC,EAACyC,EAAA,EAAW,EAAE,GAC7GT,gBAAqC,GAAKA,SAA8B,IACtEhC,EAAC,OAAI,GAAG,iBACJ,UAAW,uDAAuDgC,uBAA4C,GAAK,aAAa,GAChI,SAAA/B,EAAC,OAAI,UAAW,6DACX,WAAC+B,eAAoC,GAAKA,cAAmC,GAAKhC,EAACK,EAAA,EAAO,GACxF2B,eAAoC,GAAKA,eAAoC,GAAM,CAACA,eAAoC,IAAMhC,EAACO,EAAA,EAAK,EACtI,CAACyB,eAAoC,GAAK,CAACA,eAAoC,GAAKhC,EAACM,EAAA,EAAO,GACjG,EACJ,GAER,EACJ,CAER,EAEOoC,GAAQlC","names":["init_esm_shims","useEffect","useState","shallowEqual","Image","dynamic","jsx","jsxs","TouchVolumeBrightness","BackwardForward","Advertisement","Header","Footer","Main","Player","isRightDoubleTouched","setIsRightDoubleTouched","useState","isLeftDoubleTouched","setIsLeftDoubleTouched","params","useAppSelector","isAdBlockerActivate","ads","recommendationList","firstPlay","showMiniPlayer","isFullScreen","activeElements","canPlayVideo","isEnded","autoPlayPopover","dispatch","useAppDispatch","useEffect","videoTag","timeout","handleResize","conditions","handleVideoElementSizeInfo","setShowScreen","useActiveInActive_default","useFullScreen_default","event","handlePlayPause","e","isTouchScreen","playerCore_default","player_default"]}