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