(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9979],{99847:(e,t,r)=>{let o,s,l;var i=Object.create,a=Object.defineProperty,n=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,p=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,d=(e,t,r,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of u(t))h.call(e,s)||s===r||a(e,s,{get:()=>t[s],enumerable:!(o=n(t,s))||o.enumerable});return e},c=(e,t,r)=>{let o;return(o="symbol"!=typeof t?t+"":t)in e?a(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,r},y={},m={default:()=>O};for(var f in m)a(y,f,{get:m[f],enumerable:!0});e.exports=d(a({},"__esModule",{value:!0}),y);var b=(l=null!=(o=r(50245))?i(p(o)):{},d(!s&&o&&o.__esModule?l:a(l,"default",{value:o,enumerable:!0}),o)),P=r(90533),g=r(60595);class O extends b.Component{constructor(){super(...arguments),c(this,"callPlayer",P.callPlayer),c(this,"duration",null),c(this,"currentTime",null),c(this,"fractionLoaded",null),c(this,"mute",()=>{this.setVolume(0)}),c(this,"unmute",()=>{null!==this.props.volume&&this.setVolume(this.props.volume)}),c(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,t){(0,P.getSDK)("https://w.soundcloud.com/player/api.js","SC").then(r=>{if(!this.iframe)return;let{PLAY:o,PLAY_PROGRESS:s,PAUSE:l,FINISH:i,ERROR:a}=r.Widget.Events;t||(this.player=r.Widget(this.iframe),this.player.bind(o,this.props.onPlay),this.player.bind(l,()=>{this.duration-this.currentTime<.05||this.props.onPause()}),this.player.bind(s,e=>{this.currentTime=e.currentPosition/1e3,this.fractionLoaded=e.loadedProgress}),this.player.bind(i,()=>this.props.onEnded()),this.player.bind(a,e=>this.props.onError(e))),this.player.load(e,{...this.props.config.options,callback:()=>{this.player.getDuration(e=>{this.duration=e/1e3,this.props.onReady()})}})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,t=!0){this.callPlayer("seekTo",1e3*e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",100*e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.fractionLoaded*this.duration}render(){let{display:e}=this.props;return b.default.createElement("iframe",{ref:this.ref,src:`https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,style:{width:"100%",height:"100%",display:e},frameBorder:0,allow:"autoplay"})}}c(O,"displayName","SoundCloud"),c(O,"canPlay",g.canPlay.soundcloud),c(O,"loopOnEnded",!0)}}]);