(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6125],{72648:function(e,t,o){var l,r,i=Object.create,s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,a=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,__defNormalProp=(e,t,o)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,__copyProps=(e,t,o,l)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of u(t))p.call(e,r)||r===o||s(e,r,{get:()=>t[r],enumerable:!(l=n(t,r))||l.enumerable});return e},__publicField=(e,t,o)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,o),o),d={};((e,t)=>{for(var o in t)s(e,o,{get:t[o],enumerable:!0})})(d,{default:()=>SoundCloud}),e.exports=__copyProps(s({},"__esModule",{value:!0}),d);var c=(r=null!=(l=o(67294))?i(a(l)):{},__copyProps(l&&l.__esModule?r:s(r,"default",{value:l,enumerable:!0}),l)),h=o(38045),_=o(71776);let SoundCloud=class SoundCloud extends c.Component{constructor(){super(...arguments),__publicField(this,"callPlayer",h.callPlayer),__publicField(this,"duration",null),__publicField(this,"currentTime",null),__publicField(this,"fractionLoaded",null),__publicField(this,"mute",()=>{this.setVolume(0)}),__publicField(this,"unmute",()=>{null!==this.props.volume&&this.setVolume(this.props.volume)}),__publicField(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,t){(0,h.getSDK)("https://w.soundcloud.com/player/api.js","SC").then(o=>{if(!this.iframe)return;let{PLAY:l,PLAY_PROGRESS:r,PAUSE:i,FINISH:s,ERROR:n}=o.Widget.Events;t||(this.player=o.Widget(this.iframe),this.player.bind(l,this.props.onPlay),this.player.bind(i,()=>{let e=this.duration-this.currentTime;e<.05||this.props.onPause()}),this.player.bind(r,e=>{this.currentTime=e.currentPosition/1e3,this.fractionLoaded=e.loadedProgress}),this.player.bind(s,()=>this.props.onEnded()),this.player.bind(n,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 c.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"})}};__publicField(SoundCloud,"displayName","SoundCloud"),__publicField(SoundCloud,"canPlay",_.canPlay.soundcloud),__publicField(SoundCloud,"loopOnEnded",!0)}}]);