(window.webpackJsonp=window.webpackJsonp||[]).push([[123],{488:function(e,r,f){"use strict";f.r(r),function(i){f.d(r,"default",function(){return n});var e=f(15),a=f.n(e),t=f(16),s=f.n(t),e=f(341),o=f.n(e),t=f(342),u=f.n(t),e=f(343),c=f.n(e),t=f(344),p=f(346),l=f(345),e=f(54),d=f.n(e),e=f(359),h=f.n(e);function y(n){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var e,t=c()(n);return t=r?(e=c()(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),u()(this,t)}}var n=function(e){o()(r,e);var n=y(r);function r(e){var t;return a()(this,r),(t=n.call(this,e)).dom=t.speaker=e,t.loaded=!1,t}return s()(r,[{key:"onCreate",value:function(){var t=this,n=this;this.speaker.addEventListener("click",function e(){t.waitAudio5(n).then(function(){t.speaker.removeEventListener("click",e),t.init()}).catch(function(e){return console.error(e)})})}},{key:"waitAudio5",value:function(r){var a=this;return new i(function(e){function t(){a.player=new window.Audio5js({seekable:!0,ready:function(){r.audioReady(this,r),e()}})}var n;window.Audio5js?t():(n=window.Config.cache,new i(function(e){return h()("https://c.jsuol.com.br/assets/?loadComponent=media&contentType=js&tpl=assets/dist/libs/audio5.min&cache=".concat(n),e)}).then(t).catch(function(e){return console.error(e)}))})}},{key:"init",value:function(){var t=this;this.sound=this.speaker.querySelector(".i-sound"),this.duration=this.speaker.querySelector(".duration"),this.bar=this.speaker.querySelector(".bar"),this.speaker.addEventListener("click",function(e){t.playPause()}),l.a.checkin(["xs"])||this.bar.addEventListener("click",function(e){t.seek(e)}),this.playPause()}},{key:"timeToSeconds",value:function(e){e=e.split(":");return 2<e.length?3600*parseInt(e[0])+60*parseInt(e[1])+parseInt(e[2]):1<e.length?60*parseInt(e[0])+parseInt(e[1]):parseInt(e[0])}},{key:"formatTime",value:function(e){var t=parseInt(e/3600,10)%24,n=parseInt(e/60,10)%60,e=parseInt(e%60,10),e=(n<10?"0"+n:n)+":"+(e<10?"0"+e:e);return 0<t?(t<10?"0"+t:t)+":"+e:e}},{key:"updateProgress",value:function(e){var t,n="";n="progress"==e.type?Math.ceil(e.position/100*100):(t=Math.round(e.position/e.duration*100),Math.ceil(+t)),e.dom.querySelector(e.progressSelector).style.width=n+"%"}},{key:"playPause",value:function(){var t=this,e=this.speaker.getAttribute("data-url"),n=this.speaker.getAttribute("data-full-url"),r=d()(this.dom).parents("[data-url]:last").attr("data-url");-1!=e.indexOf("service.htm")&&""!=r&&(e=r);var a,i=window.location.search,s="",s="https://app-na.readspeaker.com/cgi-bin/rsent?customerid=7406&lang=pt_br&readid=texto&url="+(""==i||this.speaker.getAttribute("data-url-force")?-1!=encodeURIComponent(e).indexOf("%3F")?encodeURIComponent(e)+"%26cpVersion=readspeaker%26cpExtend=true":encodeURIComponent(e)+"%3FcpVersion=readspeaker%26cpExtend=true":(-1!=(i=i.replace("?","")).indexOf("doc")&&(i=i.replace("&component","")),r=window.location.origin+window.location.pathname,window.location.port&&(r=r.replace(/:\d{4}/,"")),-1!=encodeURIComponent(r).indexOf("%3F")?encodeURIComponent(r)+"%26cpVersion=readspeaker%26cpExtend=true%26"+i:encodeURIComponent(r)+"%3FcpVersion=readspeaker%26cpExtend=true%26"+i));(s=n&&""!=n?n:s)&&(a="",window.System.isBlockedAccess?(e=e+(-1!=e.indexOf("?")?"&":"?")+"gettoken",Object(p.a)(e,function(e){a="%26"+e.parameter+"="+e.token,t.playLoad.call(t,s+a)})):this.playLoad.call(this,s))}},{key:"play",value:function(){this.speaker.setAttribute("data-status","playing"),this.duration.style.display="block",this.bar.style.display="block",(this.sound||this.speaker.querySelector(".i-play")).setAttribute("class","i-pause control"),this.player.play(),this.player.playing=!0}},{key:"pause",value:function(){this.speaker.setAttribute("data-status","paused"),this.speaker.querySelector(".i-pause").setAttribute("class","i-play control"),this.player.pause(),this.player.playing=!1}},{key:"stop",value:function(){this.duration.style.display="none",this.bar.style.display="none",this.speaker.removeAttribute("data-status"),this.speaker.querySelector(".i-pause").setAttribute("class","i-sound control"),this.player.audio.seek(0),this.player.audio.pause()}},{key:"timeUpdate",value:function(e,t,n){this.duration.innerText=e,this.updateProgress({position:this.timeToSeconds(e),duration:t,type:"timeupdate",progressSelector:".timeupdate",dom:n})}},{key:"progress",value:function(e,t){this.updateProgress({position:e,duration:this.player.duration,type:"progress",progressSelector:".progress",dom:t})}},{key:"audioReady",value:function(e,n){e.on("ended",function(){n.stop()}),e.on("timeupdate",function(e,t){n.timeUpdate(e,n.timeToSeconds(t),n.dom)}),e.on("progress",function(e){n.progress(e,n.dom)})}},{key:"playLoad",value:function(e){this.loaded||(this.player.load(e),this.loaded=!0),this.speaker.querySelector(".text")&&this.speaker.querySelector(".text").remove(),this.player.playing?this.pause():this.play()}},{key:"seek",value:function(e){var t=e.offsetX,e=parseInt(e.target.parentNode.clientWidth),t=Math.ceil(t/e*100),e="string"==typeof this.player.duration?this.timeToSeconds(this.player.duration):parseInt(this.player.duration),n=parseInt(t*e/100);this.player.seek(n)}}]),r}(t.a)}.call(this,f(33))}}]);