/*! For license information please see dll.Typewriter.js.LICENSE.txt */
(window.webpackJsonp_name_hash_=window.webpackJsonp_name_hash_||[]).push([[115],{1065:function(t,e,n){"use strict";n.r(e);var s=n(13),i=n.n(s),o=n(12),a=n.n(o),r=n(7),u=n.n(r),l=n(14),c=n.n(l),p=n(15),h=n.n(p),d=n(8),f=n.n(d),m=n(5),v=n.n(m),y=n(0),x=n.n(y),T=n(1),b=n.n(T),g=n(1409),k=n.n(g),w=n(20),_=n.n(w);function A(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,s=f()(t);if(e){var i=f()(this).constructor;n=Reflect.construct(s,arguments,i)}else n=s.apply(this,arguments);return h()(this,n)}}var C=function(t){c()(n,t);var e=A(n);function n(t){var s;return i()(this,n),s=e.call(this,t),v()(u()(s),"playAudio",(function(t){s.audio.volume=.3+.7*k()()," "!==t&&s.audio.play()})),v()(u()(s),"setText",(function(){if(s.state.ct<s.props.text.length){var t=s.state.ct+1,e=s.props.text.slice(0,t);if(s.props.sound){var n=e[e.length-1];s.playAudio(n)}s.setState({ct:t,actualText:e})}})),v()(u()(s),"setArrayText",(function(){if(s.state.textCt<s.props.text.length){var t=s.props.text[s.state.textCt];if(s.state.ct<t.length){var e=s.state.ct+1,n=t.slice(0,e);if(s.props.sound){var i=n[n.length-1];s.playAudio(i)}s.setState({ct:e,actualText:n})}else{var o=s.state.textCt+1;s.timeout=setTimeout((function(){s.setState({ct:0,textCt:o})}),s.props.hold)}}})),v()(u()(s),"process",(function(){!1===s.started?s.init():s.next()})),s.started=!1,s.state={actualText:"",ct:0,textCt:0},s}return a()(n,[{key:"componentWillUnmount",value:function(){this.timeout&&(clearTimeout(this.timeout),this.timeout=0)}},{key:"init",value:function(){var t=this;this.audio||(this.audio=new Audio("https://isle.heinz.cmu.edu/keystroke2_1544120411143.ogg")),null!==this.props.delay?this.timeout=setTimeout((function(){t.started=!0,t.next()}),this.props.delay):(this.started=!0,this.next())}},{key:"next",value:function(){var t=this.props.interval;this.props.random&&(t=k()()*this.props.deviation,t-=.5*this.props.deviation,t=parseInt(t,10),t+=this.props.interval),_()(this.props.text)?this.timeout=setTimeout(this.setArrayText,t):this.timeout=setTimeout(this.setText,t)}},{key:"type",value:function(){return this.process(),x.a.createElement("span",{style:this.props.style},this.state.actualText)}},{key:"render",value:function(){return x.a.createElement("span",null,this.type())}}]),n}(y.Component);C.propTypes={deviation:b.a.number,delay:b.a.number,hold:b.a.number,interval:b.a.number,random:b.a.bool,sound:b.a.bool,style:b.a.object,text:b.a.string},C.defaultProps={deviation:30,delay:null,hold:2e3,interval:100,random:!1,sound:!1,style:{},text:""},e.default=C}}]);