(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2042],{5516:(e,t,r)=>{var a=Object.create,s=Object.defineProperty,l=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,p=(e,t,r,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of i(t))o.call(e,n)||n===r||s(e,n,{get:()=>t[n],enumerable:!(a=l(t,n))||a.enumerable});return e},h=(e,t,r)=>(((e,t,r)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),r),d={};((e,t)=>{for(var r in t)s(e,r,{get:t[r],enumerable:!0})})(d,{default:()=>m}),e.exports=p(s({},"__esModule",{value:!0}),d);var u=((e,t,r)=>(r=null!=e?a(n(e)):{},p(!t&&e&&e.__esModule?r:s(r,"default",{value:e,enumerable:!0}),e)))(r(14232)),y=r(24657),c=r(73443);class m extends u.Component{constructor(){super(...arguments),h(this,"callPlayer",y.callPlayer),h(this,"playerID",this.props.config.playerId||`twitch-player-${(0,y.randomString)()}`),h(this,"mute",()=>{this.callPlayer("setMuted",!0)}),h(this,"unmute",()=>{this.callPlayer("setMuted",!1)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,t){let{playsinline:r,onError:a,config:s,controls:l}=this.props,i=c.MATCH_URL_TWITCH_CHANNEL.test(e),n=i?e.match(c.MATCH_URL_TWITCH_CHANNEL)[1]:e.match(c.MATCH_URL_TWITCH_VIDEO)[1];if(t)return void(i?this.player.setChannel(n):this.player.setVideo("v"+n));(0,y.getSDK)("https://player.twitch.tv/js/embed/v1.js","Twitch").then(t=>{this.player=new t.Player(this.playerID,{video:i?"":n,channel:i?n:"",height:"100%",width:"100%",playsinline:r,autoplay:this.props.playing,muted:this.props.muted,controls:!!i||l,time:(0,y.parseStartTime)(e),...s.options});let{READY:a,PLAYING:o,PAUSE:p,ENDED:h,ONLINE:d,OFFLINE:u,SEEK:c}=t.Player;this.player.addEventListener(a,this.props.onReady),this.player.addEventListener(o,this.props.onPlay),this.player.addEventListener(p,this.props.onPause),this.player.addEventListener(h,this.props.onEnded),this.player.addEventListener(c,this.props.onSeek),this.player.addEventListener(d,this.props.onLoaded),this.player.addEventListener(u,this.props.onLoaded)},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){this.callPlayer("pause")}seekTo(e,t=!0){this.callPlayer("seek",e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentTime")}getSecondsLoaded(){return null}render(){return u.default.createElement("div",{style:{width:"100%",height:"100%"},id:this.playerID})}}h(m,"displayName","Twitch"),h(m,"canPlay",c.canPlay.twitch),h(m,"loopOnEnded",!0)}}]);