/*! VERSION | 11.0.82 */"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[7992],{15218:(e,t,i)=>{i.d(t,{N:()=>a});var s=i(76683);let a=(e,t=e.parentElement,i=!1,a=!1)=>{if(s.Z.info("[GPU Resizer]: Enabling CSS resizer for stream",{videoElement:e,videoElementContainer:t}),!window.MutationObserver&&!window.ResizeObserver||!t||!e)return s.Z.info("[GPU Resizer]: Could not init css resizer: MutationObserver or ResizeObserver are not available or video element container not found",{videoElementContainer:t}),{destroy:()=>{}};let n=e.getAttribute("style")||"";e.style.opacity="0",e.style.position="absolute",e.style.width="1024px",e.style.height="1024px",e.style.transformOrigin="0 0",e.style.objectFit="contain",s.Z.info("[GPU Resizer]: video element dimensions should be set to 1024x1024");let o=()=>{},r=()=>{s.Z.info("[GPU Resizer]: recalculate cover positions"),e.style.objectFit="unset";let a=document.contains(e),n=document.contains(t);if(!a||!n)return s.Z.info("[GPU Resizer]: No video element or container found in document. Destroying",{hasVideoElement:a,hasVideoElementContainer:n}),o(),!1;let{videoWidth:r,videoHeight:l}=e,{width:d,height:h}=t.getBoundingClientRect(),m=r/l,c=d/h;if(isNaN(m)||isNaN(c))return s.Z.info("[GPU Resizer]: Cannot calculate aspect ratios. Skipping.",{videoAspectRatio:m,videoContainerAspectRatio:c}),i&&(e.style.opacity="0"),e.style.transform="scale3d(0.0009765625, 0.0009765625, 1)",!0;if(s.Z.info("[GPU Resizer]: Got initial conditions: ",{videoAspectRatio:m,videoContainerAspectRatio:c,containerWidth:d,containerHeight:h,videoWidth:r,videoHeight:l}),c>1&&c>=m||c<=1&&c>=m){let t=d/m,i=Math.max(t,d),a=Math.min(-(i-h)/2,0),n=Math.min(-(i-d)/2,0),o=i/1024;s.Z.info("Matching widths",{targetSquareSize:i,targetVideoWidth:d,targetVideoHeight:t,topOffset:a,scaleCoefficient:o,leftOffset:n}),e.style.transform=`translate3d(${n}px, ${a}px, 0) scale3d(${o}, ${o}, 1)`}else{let t=h*m,i=Math.max(h,t),a=-(i-h)/2,n=-(i-d)/2,o=i/1024;s.Z.info("Matching heights",{targetSquareSize:i,targetVideoWidth:t,targetVideoHeight:h,topOffset:a,scaleCoefficient:o,leftOffset:n}),e.style.transform=`translate3d(${n}px, ${a}px, 0) scale3d(${o}, ${o}, 1)`}return e.style.opacity="1",!0},l=()=>{if(s.Z.info("[GPU Resizer]: recalculate"),a)return r();e.style.objectFit="contain";let n=document.contains(e),l=document.contains(t);if(!n||!l)return s.Z.info("[GPU Resizer]: No video element or container found in document. Destroying",{hasVideoElement:n,hasVideoElementContainer:l}),o(),!1;let{videoWidth:d,videoHeight:h}=e,{width:m,height:c}=t.getBoundingClientRect(),p=d/h,u=m/c;if(isNaN(p)||isNaN(u))return s.Z.info("[GPU Resizer]: Cannot calculate aspect ratios. Skipping.",{videoAspectRatio:p,videoContainerAspectRatio:u}),i&&(e.style.opacity="0"),e.style.transform="scale3d(0.0009765625, 0.0009765625, 1)",!1;if(s.Z.info("[GPU Resizer]: Got initial conditions: ",{videoAspectRatio:p,videoContainerAspectRatio:u,containerWidth:m,containerHeight:c,videoWidth:d,videoHeight:h}),u<1){if(p>=1){s.Z.info("[GPU Resizer]: Horizontal stream in vertical container");let t=m/1024,i=(c-m)/2;e.style.transform=`translate3d(0, ${i}px, 0) scale3d(${t}, ${t}, 1)`}if(p<1){if(p>u){s.Z.info("[GPU Resizer]: Vertical stream in vertical container, but use special case when video aspect ratio greater than container aspect ratio");let t=m/p,i=(m-t)/2,a=(c-t)/2,n=m/1024/p;e.style.transform=`translate3d(${i}px, ${a}px, 0) scale3d(${n}, ${n}, 1)`}else{s.Z.info("[GPU Resizer]: Vertical stream in vertical container");let t=c/1024,i=c*p,a=(m-i)/2-(1024*t-i)/2;e.style.transform=`translate3d(${a}px, 0, 0) scale3d(${t}, ${t}, 1)`}}}if(u>=1){if(p>=1){if(u>p){s.Z.info("[GPU Resizer]: Horizontal stream in horizontal container, but use special case when container aspect ratio greater than video aspect ratio");let t=c*p,i=(m-t)/2,a=(t-c)/2,n=t/1024;e.style.transform=`translate3d(${i}px, -${a}px, 0) scale3d(${n}, ${n}, 1)`}else{s.Z.info("[GPU Resizer]: Horizontal stream in horizontal container");let t=m/1024,i=m/p,a=c-i,n=(i-m)/2+a/2;e.style.transform=`translate3d(0, ${n}px, 0) scale3d(${t}, ${t}, 1)`}}if(p<1){s.Z.info("[GPU Resizer]: Vertical stream in horizontal container");let t=c/1024,i=c*p,a=(m-i)/2-(1024*t-i)/2;e.style.transform=`translate3d(${a}px, 0, 0) scale3d(${t}, ${t}, 1)`}}return e.style.opacity="1",!0},d=()=>{l()},h=window.MutationObserver?new MutationObserver(d):null;h&&h.observe(t,{childList:!0});let m=window.ResizeObserver?new ResizeObserver(d):null;return m&&m.observe(t),t.addEventListener("resize",d),e.addEventListener("canplay",d),e.addEventListener("canplaythrough",d),e.addEventListener("play",d),e.addEventListener("playing",d),l(),{destroy:o=()=>{s.Z.info("[GPU Resizer]: Destroying"),e.setAttribute("style",n),h&&h.disconnect(),m&&(m.unobserve(t),m.disconnect()),t.removeEventListener("resize",d),e.removeEventListener("canplay",d),e.removeEventListener("canplaythrough",d),e.removeEventListener("play",d),e.removeEventListener("playing",d)}}}},37992:(e,t,i)=>{i.d(t,{Z:()=>N});var s=i(18775),a=i(23136),n=i(37051),o=i(77397),r=i(64489),l=i(93644),d=i(52913),h=i(27378),m=i(48204),c=i(87444),p=i(35506),u=i(85353),v=i(4368),y=i(99973),f=i(99748),g=i(87937),E=i(12710),P=i(15484),Z=i(42815),S=i(64696),R=i(62512),_=i(87766),b=i(37112),T=i(61061),V=i(80262),U=i(76683),w=i(96811),C=i(58320),L=i(79561),H=i(32630);let z=({isPlaying:e,isLoading:t,isCanvasEnabledByFeature:i,streamId:s,onChange:a,shouldDisableCanvasAfterDuration:n,isRenderedInPip:o,id:r})=>{let l=(0,H.c)({isPlaying:e,isLoading:t,isCanvasEnabledByFeature:i,streamId:s,shouldDisableCanvasAfterDuration:n,isRenderedInPip:o,id:r});return(0,h.useEffect)(()=>{a(l)},[l]),null};var A=i(15218);let D=0,I=0,$=0,x="updateVideoDurationTimeoutId";class k extends h.Component{componentDidMount(){let{isRemote:e,isRenderedInPip:t,isCollectLogs:i,useGPUResizer:s,shouldHideVideoWhileNaNDimensionsInCSSResizer:a,isLiveThumb:n,isBlurVideoOnPrivate:o}=this.props,{isCanvas:r}=this.state;if(this.videoElementWrapperRef&&(0,g.C5)()){if(this.videoElementWrapperRef.appendChild(this.videoElement),s&&!t&&e&&!n){let{destroy:e}=(0,A.N)(this.videoElement,this.videoElementWrapperRef,a,o);this.resizeDestroyer=e}r&&this.videoElementWrapperRef.appendChild(this.canvasElement)}(0,S.Z)(this.propsUpdateToActionsMap,{},this.props),i&&(this.timer=setInterval(()=>{b.Z.setFields({width:this.videoElement.videoWidth,height:this.videoElement.videoHeight})},1e3))}componentDidUpdate(e){(0,S.Z)(this.propsUpdateToActionsMap,e,this.props);let{isCanvas:t,isPlaying:i}=this.state;if(this.videoElement){var s,a;t?(this.videoElement.classList.add("video-hidden"),null===(s=this.canvasElement)||void 0===s||s.classList.remove("hidden"),i&&this.videoElement.currentTime>0&&!this.videoElement.paused&&!this.videoElement.ended&&requestAnimationFrame(this.startAnimationFrame)):(this.videoElement.classList.remove("video-hidden"),null===(a=this.canvasElement)||void 0===a||a.classList.add("hidden"))}}componentWillUnmount(){var e;void 0!==this.timer&&clearInterval(this.timer),this.resizeDestroyer&&this.resizeDestroyer(),null===(e=this.abortBlurredElement)||void 0===e||e.call(this),Z.ZP.addSnapshot(),this.removeMediaStream(),this.destroyVideoElement(),this.cancelResetStream(),this.cancelAnimationFrame(),this.stopTimeUpdate()}renderControls(){let{isRemote:e,isBlurred:t}=this.props,{isLoading:i,isPlaying:s}=this.state;return e?i?h.createElement(u.Z,{isCentered:!0}):s||t?null:h.createElement(T.Z,{onClick:this.handleVideoClick}):null}render(){let{lastSnapshotUrl:e,isWatermark:t,wasPlayed:i,modelName:s,isCanvas:a,shouldExplicitlySetAspectRatio:n}=this.props,{isLoading:o}=this.state;return h.createElement("div",{key:"video_element_wrappper",className:(0,f.AK)("video-element-wrapper",{"video-element-wrapper--loading":o,"video-element-wrapper--canvas":this.state.isCanvas}),ref:e=>{this.videoElementWrapperRef=e},style:n&&this.state.aspectRatio?{aspectRatio:this.state.aspectRatio}:void 0},h.createElement("div",{className:(0,f.AK)("video-element-wrapper-blur",{"with-poster":!i,"with-blur":!0})},e&&h.createElement(v.s,{src:e,area:"snapshot",username:s})),t&&h.createElement(c.l,{ref:this.watermarkRef,videoElement:this.videoElement}),this.renderControls(),h.createElement(z,{isLoading:this.state.isLoading,isPlaying:this.state.isPlaying,isCanvasEnabledByFeature:a,streamId:this.props.modelName,onChange:this.toggleIsCanvas,shouldDisableCanvasAfterDuration:this.props.shouldDisableCanvasAfterDuration,id:this.props.id,isRenderedInPip:this.props.isRenderedInPip}))}constructor(e){super(e),(0,s._)(this,"abortBlurredElement",void 0),(0,s._)(this,"canvasElement",void 0),(0,s._)(this,"canvasContext",null),(0,s._)(this,"videoElementWrapperRef",null),(0,s._)(this,"watermarkRef",(0,h.createRef)()),(0,s._)(this,"videoElement",void 0),(0,s._)(this,"canvasAnimationFrameId",null),(0,s._)(this,"streamResetDelayId",void 0),(0,s._)(this,"timer",void 0),(0,s._)(this,"resizeDestroyer",void 0),(0,s._)(this,"attachStream",e=>{U.Z.info("Video attach stream",e),this.videoElement&&e&&this.videoElement.src!==e&&((0,a.Z)(e)?this.videoElement.src=e:this.getIsSrcObjectAvailable()?this.videoElement.srcObject=e:this.videoElement.src=window.URL.createObjectURL(e))}),(0,s._)(this,"attachEvents",()=>{U.Z.info("Video attach events"),(0,R.H0)(this,this.videoElement,"click",this.handleVideoClick),(0,R.H0)(this,this.videoElement,"play",this.onPlayHandler),(0,R.H0)(this,this.videoElement,"playing",this.onPlayingHandler),(0,R.H0)(this,this.videoElement,"abort",this.onAbortHandler),(0,R.H0)(this,this.videoElement,"pause",this.onPauseHandler),(0,R.H0)(this,this.videoElement,"canplay",this.onCanPlayHandler),(0,R.H0)(this,this.videoElement,"error",this.onErrorHandler),(0,R.H0)(this,this.videoElement,"timeupdate",this.onTimeUpdateHandler),(0,R.H0)(this,this.videoElement,"loadstart",this.onLoadStartHandler),(0,R.H0)(this,this.videoElement,"loadeddata",this.onLoadedDataHandler),(0,R.H0)(this,this.videoElement,"waiting",this.onWaiting),(0,R.H0)(this,this.videoElement,"stalled",this.onStalled),(0,R.H0)(this,this.videoElement,"seeking",this.onSeeking),(0,R.H0)(this,this.videoElement,"seeked",this.onSeeked),(0,R.H0)(this,this.videoElement,"webkitendfullscreen",this.onEndFullscreenHandler),(0,R.H0)(this,this.videoElement,"resize",this.onVideoResizeHandler),this.startTimeUpdate()}),(0,s._)(this,"attachEventsLocal",()=>{(0,R.H0)(this,this.videoElement,"playing",this.onPlayingHandler),(0,R.H0)(this,this.videoElement,"resize",this.onVideoResizeHandler)}),(0,s._)(this,"createVideoElement",e=>{U.Z.info("Video create video element");let{isGlobal:t,isRemote:i,className:s,isNonAnonymous:a,isMuted:n,stream:o,isBlurred:r,isLiveThumb:l}=e,{isCanvas:d}=this.state,h=t?V.Z.getVideoElement():document.createElement("video");return s&&h.classList.add(s),h.autoplay=!0,h.controls=!1,h.playsInline=!0,h.defaultMuted=n||!!r,h.muted=n||!!r,a||(h.crossOrigin="anonymous"),l&&!t&&(h.disableRemotePlayback=!0),this.videoElement=h,d&&(this.canvasElement=document.createElement("canvas"),this.canvasElement.classList.add(s),this.canvasElement.classList.add("video-element"),this.videoElement.classList.add("video-hidden"),this.canvasContext=this.canvasElement.getContext("2d")),i?this.attachEvents():this.attachEventsLocal(),this.attachStream(o),h}),(0,s._)(this,"destroyVideoElement",()=>{let{isGlobal:e}=this.props;this.videoElement&&(e&&V.Z.clearVideoElement(),(0,R.OM)(this))}),(0,s._)(this,"propsUpdateToActionsMap",[{update:["stream"],action:(e={})=>{let{stream:t}=this.props,{stream:i}=e;i!==t&&(U.Z.info("Video update stream",{stream:t}),t?this.updateMediaStream(t):this.removeMediaStream(),this.updated())}},{update:["isBlurred"],action:()=>{let{isBlurred:e}=this.props;e&&this.videoElement?requestAnimationFrame(()=>{this.abortBlurredElement=(0,f.Cu)(this.videoElement)}):this.abortBlurredElement&&(this.abortBlurredElement(),this.abortBlurredElement=void 0)}},{update:["volume"],action:()=>{let{volume:e}=this.props;this.updateVolume(e)}},{update:["useGPUResizer","isRenderedInPip","isRemote","isLiveThumb","isBlurVideoOnPrivate"],action:()=>{let{isRenderedInPip:e,isRemote:t,useGPUResizer:i,shouldHideVideoWhileNaNDimensionsInCSSResizer:s,isLiveThumb:a,isBlurVideoOnPrivate:n}=this.props;if(this.resizeDestroyer&&(this.resizeDestroyer(),this.resizeDestroyer=void 0),i&&t&&!e&&!a){let{destroy:e}=(0,A.N)(this.videoElement,this.videoElementWrapperRef,s,n);this.resizeDestroyer=e}else this.videoElement.style.opacity="1"}}]),(0,s._)(this,"updateVolume",e=>{let{videoElement:t}=this;t&&(t.volume=Math.min((0,E.Dm)(e/100),1),t.muted=!e)}),(0,s._)(this,"handleVideoClick",()=>{U.Z.info("Video on click handler");let{videoElement:e}=this;e&&this.play().catch(n.Z)}),(0,s._)(this,"updateMediaStream",e=>{U.Z.info("Video update media stream",e);let{videoElement:t}=this;if(!t)return;this.attachStream(e);let i=this.play();i instanceof Promise&&i.catch(n.Z)}),(0,s._)(this,"removeMediaStream",()=>{U.Z.info("Video remove media stream");let{videoElement:e}=this;e&&(this.pause(),this.cancelAnimationFrame(),this.getIsSrcObjectAvailable()?e.srcObject=null:window.URL.revokeObjectURL(e.src),e.src&&e.removeAttribute("src"))}),(0,s._)(this,"getIsSrcObjectAvailable",()=>{var e;return(null===(e=this.videoElement)||void 0===e?void 0:e.srcObject)!==void 0}),(0,s._)(this,"load",()=>(0,P.g)(this.videoElement,"load")),(0,s._)(this,"play",()=>(0,P.g)(this.videoElement,"play").catch(e=>{throw p.ZP.warn(e,this.props),e})),(0,s._)(this,"restart",()=>{this.setState({isRestarted:!0}),this.pause().catch(n.Z)}),(0,s._)(this,"pause",()=>(0,P.g)(this.videoElement,"pause")),(0,s._)(this,"checkAutoPlayEnabled",()=>{if(this.state.canPlay){if(U.Z.info("Video check auto play enabled"),$>5){U.Z.info("Video check auto play limit"),this.paused();return}$+=1,this.play().then(()=>{let{canPlay:e}=this.state;U.Z.info("Video auto play enabled"),e&&this.playing()}).catch(e=>{let{canPlay:t}=this.state;U.Z.info("Video auto play disabled",e),t&&this.paused()})}}),(0,s._)(this,"updatePlayerResolution",(0,o.Z)(this.props.updatePlayerResolution)),(0,s._)(this,"startTimeUpdate",()=>{var e,t;this.stopTimeUpdate(),_.Z.startTimeout(x,500,this.onTimeUpdate);let{videoWidth:i,videoHeight:s}=this.videoElement;Math.min(s,i)>50&&this.updatePlayerResolution(i,s),null===(t=this.watermarkRef)||void 0===t||null===(e=t.current)||void 0===e||e.updatePosition()}),(0,s._)(this,"stopTimeUpdate",()=>{_.Z.stopTimeout(x)}),(0,s._)(this,"onTimeUpdate",()=>{let{videoElement:e}=this,{canPlay:t}=this.state;if(!t){this.startTimeUpdate();return}I!==e.currentTime?(I=e.currentTime,w.Z.playing()):w.Z.paused(),this.startTimeUpdate()}),(0,s._)(this,"updateVideoResolution",()=>{let{videoElement:e}=this,{videoWidth:t,videoHeight:i}=e;this.updatePlayerResolution(t,i)}),(0,s._)(this,"onTimeUpdateHandler",(0,r.Z)(e=>{var t,i;if(this.props.onTimeUpdate(e),e.defaultPrevented)return;let{videoElement:s}=this,{canPlay:a,isPlaying:n,isLoading:o,isRestarted:r}=this.state;if(this.updateVideoResolution(),null===(t=this.watermarkRef.current)||void 0===t||t.updatePosition(),!a)return;$=0;let l=D!==s.currentTime;U.Z.info(`Video onTime Update - isPlaying: ${n}, isLoading: ${o}, isTimeChanged: ${l}`),U.Z.info(`Video onTime Update - prevTime: ${D}, nextTime: ${s.currentTime}`);let d=null===(i=s.srcObject)||void 0===i?void 0:i.getVideoTracks();(null==d?void 0:d.length)&&d.every(e=>!e.enabled||e.muted)&&U.Z.info("Video is empty"),l&&this.cancelResetStream(),D!==s.currentTime?(y.BROWSER_CAPABILITIES.iOS&&y.BROWSER_CAPABILITIES.safari15Dot1&&!r&&this.restart(),D=s.currentTime,(!n||o)&&this.playing()):o?this.resetPlay():this.loading()},1e3,{trailing:!1})),(0,s._)(this,"cancelResetStream",()=>{this.streamResetDelayId&&clearTimeout(this.streamResetDelayId)}),(0,s._)(this,"resetStream",(e,t)=>{e&&(this.cancelResetStream(),this.streamResetDelayId=(0,l.Z)(()=>{let{stream:i}=this.props;U.Z.info(`Video reset stream debounce for reason ${t} with delay ${e}`,i),i&&(this.removeMediaStream(),this.updateMediaStream(i))},e))}),(0,s._)(this,"startAnimationFrame",()=>{let{isLoading:e,isCanvas:t}=this.state;if(this.cancelAnimationFrame(),t){var i,s;let{width:t,height:a}=this.canvasElement.getBoundingClientRect(),{videoWidth:n,videoHeight:o}=this.videoElement,r=n/o;if(t/a<1&&r>1){let e=Math.max(t,n),s=t/n*o;if(this.canvasContext){let t=devicePixelRatio;this.canvasElement.width=e*t,this.canvasElement.height=a*t,this.canvasContext.scale(t,t)}null===(i=this.canvasContext)||void 0===i||i.drawImage(this.videoElement,t>e?(t-e)/2:0,(a-s)/2,e,s)}else{let e=this.props.shouldExplicitlySetAspectRatio?a:Math.max(a,o),i=a/o*n;if(this.canvasContext){let i=devicePixelRatio;this.canvasElement.width=t*i,this.canvasElement.height=e*i,this.canvasContext.scale(i,i)}null===(s=this.canvasContext)||void 0===s||s.drawImage(this.videoElement,(t-i)/2,a>e?(a-e)/2:0,i,e)}e||(this.canvasAnimationFrameId=requestAnimationFrame(this.startAnimationFrame))}}),(0,s._)(this,"cancelAnimationFrame",()=>{this.canvasAnimationFrameId&&(cancelAnimationFrame(this.canvasAnimationFrameId),this.canvasAnimationFrameId=null)}),(0,s._)(this,"playing",()=>{let{isCanvas:e}=this.state;U.Z.info("Video playing"),this.setState({isLoading:!1,isPlaying:!0},()=>{e&&this.startAnimationFrame()}),this.props.onPlaying(),this.cancelResetStream()}),(0,s._)(this,"loading",()=>{U.Z.info("Video loading"),this.setState({isLoading:!0,isPlaying:!1}),this.props.onLoading(),this.cancelAnimationFrame(),this.cancelResetStream()}),(0,s._)(this,"paused",()=>{U.Z.info("Video paused"),this.setState({isLoading:!1,isPlaying:!1}),this.props.onPaused(),this.cancelResetStream()}),(0,s._)(this,"updated",()=>{U.Z.info("Video updated"),this.setState({canPlay:!1,isLoading:!0,isPlaying:!1,isRestarted:!1}),this.props.onPaused(),this.cancelResetStream()}),(0,s._)(this,"onPlayHandler",e=>{U.Z.info("Video on play"),this.props.onPlay(e),this.updateVideoResolution()}),(0,s._)(this,"onLoadStartHandler",()=>{let{timeoutUpdateStream:e}=this.props;U.Z.info("Video on load start handler"),this.loading(),this.resetStream(e,"onLoadStartHandler")}),(0,s._)(this,"onLoadedDataHandler",()=>{U.Z.info("Video on loaded data handler"),this.cancelResetStream()}),(0,s._)(this,"onWaiting",()=>{let{timeoutWaitingStream:e,disableLoaderOnWaiting:t}=this.props;U.Z.warn("Video on waiting"),w.Z.paused(),t||this.loading(),this.resetStream(e,"onWaiting")}),(0,s._)(this,"onSeeking",()=>{U.Z.warn("Video on seeking"),w.Z.paused()}),(0,s._)(this,"onStalled",()=>{let{timeoutWaitingStream:e}=this.props;U.Z.warn("Video on stalled"),w.Z.paused(),this.resetStream(e,"onStalled")}),(0,s._)(this,"onSeeked",()=>{U.Z.warn("Video on seeked"),w.Z.paused()}),(0,s._)(this,"onVideoResizeHandler",e=>{try{let{videoWidth:t,videoHeight:i}=e.target,s=t/i;this.setState({aspectRatio:s}),this.canvasElement&&e.target&&(this.props.shouldExplicitlySetAspectRatio?this.canvasElement.style.aspectRatio=`${s}`:this.canvasElement.style.aspectRatio="")}catch(e){}}),(0,s._)(this,"onPlayingHandler",()=>{U.Z.info("Video on playing handler"),w.Z.canPlay(),w.Z.playing(),D=0,I=0,this.updateVideoResolution(),this.playing()}),(0,s._)(this,"onAbortHandler",e=>{this.videoElement&&(U.Z.info("Video on abort handler"),this.props.onAbort(e),e.defaultPrevented||this.loading())}),(0,s._)(this,"onPauseHandler",e=>{U.Z.info("Video on pause handler"),w.Z.paused(),this.props.onPause(e),e.defaultPrevented||this.checkAutoPlayEnabled()}),(0,s._)(this,"onCanPlayHandler",e=>{U.Z.info("Video on can play"),this.props.onCanPlay(e),this.updateVideoResolution(),e.defaultPrevented||this.setState({canPlay:!0},()=>this.checkAutoPlayEnabled())}),(0,s._)(this,"onEndFullscreenHandler",e=>{U.Z.info("Video on end fullscreen"),this.props.onEndFullscreen(e)}),(0,s._)(this,"onErrorHandler",e=>{var t,i;if(U.Z.warn(`'Video on error: ${null===(t=this.videoElement.error)||void 0===t?void 0:t.code}, ${null===(i=this.videoElement.error)||void 0===i?void 0:i.message}`,e),this.props.onError(e),!e.defaultPrevented){let{isHLS:e,timeoutUpdateStream:t}=this.props,{MEDIA_ERR_SRC_NOT_SUPPORTED:i}=MediaError,{error:s}=this.videoElement,{code:a}=(0,d.Z)(s,["code"]);if(e){this.resetStream(t,"onError");return}a===i?this.paused():this.resetPlay()}}),(0,s._)(this,"resetPlay",()=>{U.Z.info("Video reset"),this.videoElement&&(this.loading(),this.load())}),(0,s._)(this,"toggleIsCanvas",e=>{this.setState({isCanvas:e})}),this.state={canPlay:!1,isLoading:!0,isPlaying:!0,isRestarted:!1,isCanvas:e.isCanvas},this.createVideoElement(e)}}(0,s._)(k,"defaultProps",{isWatermark:!0,isGlobal:!1,isMuted:!1,isBlurred:!1,isCameraDisabled:!1,volume:0,lastSnapshotUrl:"",onPlaying:n.Z,onLoading:n.Z,onPaused:n.Z,onEndFullscreen:n.Z,onTimeUpdate:n.Z,onError:n.Z,onCanPlay:n.Z,onPause:n.Z,onAbort:n.Z,onPlay:n.Z,updatePlayerResolution:n.Z,wasPlayed:!1,isCanvas:!1,isCollectLogs:!1,useGPUResizer:!1,shouldHideVideoWhileNaNDimensionsInCSSResizer:!1,disableLoaderOnWaiting:!1,isLiveThumb:!1,isBlurVideoOnPrivate:!1});let N=(0,m.$j)(e=>({isBlurred:(0,L.tS)(e),useGPUResizer:(0,C._V)(e),shouldHideVideoWhileNaNDimensionsInCSSResizer:(0,C.Bk)(e),isBlurVideoOnPrivate:(0,C.$C)(e)}),null,null,{forwardRef:!0})(k)},61061:(e,t,i)=>{i.d(t,{Z:()=>n});var s=i(27378),a=i(29413);let n=e=>s.createElement("div",{className:"play-button",onClick:e.onClick},"Live",s.createElement(a.Z,{img:"play-3"}))},96811:(e,t,i)=>{i.d(t,{Z:()=>l});var s=i(18775),a=i(32367),n=i(87766),o=i(76683);let r="updateStreamStatsTimeoutId",l=new class{constructor(){(0,s._)(this,"isInit",!1),(0,s._)(this,"canPlayTimePoint",null),(0,s._)(this,"playingTimePoint",null),(0,s._)(this,"playingTimeRange",[]),(0,s._)(this,"ordinalUpdateNumber",0),(0,s._)(this,"config",void 0),(0,s._)(this,"init",e=>{o.Z.info("StreamStats init"),this.isInit=!0,this.canPlayTimePoint=null,this.playingTimePoint=null,this.playingTimeRange=[],this.ordinalUpdateNumber=0,this.config=e,this.startScheduler()}),(0,s._)(this,"restart",()=>{this.isInit&&(o.Z.info("StreamStats restart",this.canPlayTimePoint),this.canPlayTimePoint&&(this.canPlayTimePoint=Date.now()),this.playingTimePoint&&(this.playingTimePoint=Date.now()),this.playingTimeRange=[],this.startScheduler())}),(0,s._)(this,"destroy",()=>{this.isInit=!1,o.Z.info("StreamStats destroy"),this.stopScheduler()}),(0,s._)(this,"canPlay",()=>{this.isInit&&(o.Z.info("StreamStats canPlay",this.canPlayTimePoint),this.canPlayTimePoint||(this.canPlayTimePoint=Date.now()))}),(0,s._)(this,"playing",()=>{this.isInit&&(o.Z.info("StreamStats playing"),this.playingTimePoint||(this.playingTimePoint=Date.now()))}),(0,s._)(this,"paused",()=>{this.isInit&&(o.Z.info("StreamStats paused"),this.playingTimePoint&&(this.playingTimeRange.push({start:this.playingTimePoint,end:Date.now()}),this.playingTimePoint=null))}),(0,s._)(this,"getShouldUpdateToServer",()=>!!this.ordinalUpdateNumber&&!!this.config&&!!this.config.update&&(this.ordinalUpdateNumber===this.config.initialUpdateNumber||this.ordinalUpdateNumber%this.config.nextUpdateNumber==0)),(0,s._)(this,"updateStreamStats",()=>{if(!this.isInit)return;if(o.Z.info("StreamStats updateStreamStats",this.canPlayTimePoint),!this.canPlayTimePoint){this.startScheduler();return}this.playingTimePoint&&this.playingTimeRange.push({start:this.playingTimePoint,end:Date.now()}),this.ordinalUpdateNumber+=1;let e=Date.now()-this.canPlayTimePoint,t=(0,a.Z)(this.playingTimeRange,(e,t)=>!this.canPlayTimePoint||t.start{var e;this.stopScheduler(),(null===(e=this.config)||void 0===e?void 0:e.timeoutUpdateStats)&&n.Z.startTimeout(r,this.config.timeoutUpdateStats,this.updateStreamStats)}),(0,s._)(this,"stopScheduler",()=>{n.Z.stopTimeout(r)})}}},32630:(e,t,i)=>{i.d(t,{c:()=>o});var s=i(27378),a=i(95654),n=i(27251);let o=({isCanvasEnabledByFeature:e,isPlaying:t,isLoading:i,streamId:o,canvasDuration:r=1e3,shouldDisableCanvasAfterDuration:l=!0,isRenderedInPip:d})=>{let[h,m]=s.useState(e),c=(0,a.C)(n.Mp),p=s.useRef(),u=s.useRef();return s.useEffect(()=>{e&&i&&o!==u.current&&(u.current=o,m(!0))},[i]),s.useEffect(()=>(t&&e&&l?(m(!0),p.current=setTimeout(()=>{m(!1)},r)):e||m(!1),()=>{p.current&&clearTimeout(p.current)}),[t,e,c,d]),h}}}]);