"use strict";(this.webpackChunk_lingxiteam_pcfactory=this.webpackChunk_lingxiteam_pcfactory||[]).push([[55],{92968:function(e,n,t){t.r(n);var l=t(32723),a=t(34795),o=t(7896),i=t(33028),u=t(90359),r=t.n(u),c=t(40887),s=t(53111),d=t(80693),p=t(84707),m=t(23716),v="AWSSoundPlayer";var f=(0,s.withCustomAudio)((function(e){var n=e.audioTitle,t=e.soundCloudAudio,l=e.autoPlay,a=e.hideType,s=e.visible,p=e.style,m=e.backgroundType,f=e.appId,y=e.engineApis,g=(0,u.useMemo)((function(){return(0,i.Z)((0,i.Z)({},e),{},{style:null})}),[e]),h=(t||{}).audio,T=(0,d.Z)({engineApis:y,backgroundType:m,appId:f,mode:"engine"}).backgroundStyle;return l&&h&&!h.autoPlay&&(h.autoplay=!0),h&&!h.crossOrigin&&(h.crossOrigin="anonymous"),s?r().createElement("div",{className:v,style:(0,i.Z)((0,i.Z)({},p),T)},r().createElement("div",{className:"".concat(v,"-audioTitle")},n),r().createElement("div",{className:"".concat(v,"-audioContent")},r().createElement(c.PlayButton,g),r().createElement(c.Timer,(0,o.Z)({className:"".concat(v,"-audioTimer")},g)),r().createElement(c.Progress,(0,o.Z)({className:"".concat(v,"-progress")},g)),r().createElement(c.VolumeControl,g))):"hidden"===a?r().createElement("div",{className:v,style:(0,i.Z)((0,i.Z)((0,i.Z)({},p),T),{},{display:"none"})},r().createElement("div",{className:"".concat(v,"-audioTitle")},n),r().createElement("div",{className:"".concat(v,"-audioContent")},r().createElement(c.PlayButton,g),r().createElement(c.Timer,(0,o.Z)({className:"".concat(v,"-audioTimer")},g)),r().createElement(c.Progress,(0,o.Z)({className:"".concat(v,"-progress")},g)),r().createElement(c.VolumeControl,g))):null})),y=(0,u.forwardRef)((function(e,n){var t=e.audioTitle,o=e.autoPlay,i=e.preloadType,c=e.streamUrl,s=e.streamType,d=e.fileCode,v=e.visible,y=e.hideType,g=e.style,h=e.backgroundType,T=e.appId,E=e.getEngineApis,A=e.audioStatus,Z=(null==E?void 0:E())||{},b=(0,p.b)(Z).getLocale,C=(0,u.useState)(""),k=C[0],w=C[1],N=(0,u.useRef)();(0,u.useEffect)((function(){"fileCode"===s?d?(0,a.Z)((0,l.Z)().mark((function e(){var n,t;return(0,l.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,null==Z||null===(n=Z.service)||void 0===n?void 0:n.getAppFileUrlByFileCode(d);case 3:t=e.sent,w(t),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),m.error("".concat(null==b?void 0:b("Audio.warning"),":").concat(e.t0));case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))():w(""):c&&w(function(e){if(e){if(e.startsWith("http:")||e.startsWith("https:"))return e;if(e.startsWith("/"))return window.location.origin+e}return e}(c))}),[s,d,c]);var P=function(e){switch(e){case"play":!function(){if(v||"remove"!==y){if(N&&null!=N&&N.current){var e,n,t=null==N||null===(e=N.current)||void 0===e||null===(n=e.soundCloudAudio)||void 0===n?void 0:n.audio;null!=t&&t.play&&(null==t||t.play())}}else m.info(null==b?void 0:b("Audio.cannotPlay"))}();break;case"pasue":!function(){if(v||"remove"!==y){if(N&&null!=N&&N.current){var e,n,t=null==N||null===(e=N.current)||void 0===e||null===(n=e.soundCloudAudio)||void 0===n?void 0:n.audio;null!=t&&t.pause&&(null==t||t.pause())}}else m.info(null==b?void 0:b("Audio.cannotStop"))}();break;case"toggle":!function(){if(v||"remove"!==y){if(N&&null!=N&&N.current){var e,n,t=null==N||null===(e=N.current)||void 0===e||null===(n=e.soundCloudAudio)||void 0===n?void 0:n.audio,l=null==t?void 0:t.paused;t&&(!l&&null!=t&&t.pause?null==t||t.pause():l&&null!=t&&t.play&&(null==t||t.play()))}}else m.info(null==b?void 0:b("Audio.cannotSwitch"))}()}};return(0,u.useEffect)((function(){P(A)}),[A]),r().createElement(f,{audioTitle:t,autoPlay:o,preloadType:i,streamUrl:k,visible:v,hideType:y,ref:N,style:g,backgroundType:h,appId:T,engineApis:Z})}));n.default=y}}]);