/*!CK:783655131!*//*1459191195,*/

if (self.CavalryLogger) { CavalryLogger.start_js(["Sk6rR"]); }

__d("NamePronunciationLogEvent",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={PLAY_NAME:"play_name",PREVIEW_NAME:"preview_name",PREVIEW_FULL:"preview_full",PREVIEW_SYLLABLE:"preview_syllable",PREVIEW_CUSTOM:"preview_custom",OPEN_EDITOR:"open_editor",CANCEL_EDITING:"cancel_editing",SEE_TIPS:"see_tips",HIDE_TIPS:"hide_tips",CREATE:"create",ERROR:"error",EDIT:"edit",DELETE:"delete"};},null);
__d("TTSVoiceFlavor",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={FLAVOR_ECHO:"echo",FLAVOR_PRONOUNCER:"pronouncer"};},null);
__d('PronunciationBanzaiLogger',['Banzai','NamePronunciationLogEvent'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h={formatCustomPlayerData:function(i,j,k){if(!i)return null;var l=babelHelpers['extends']({},i);switch(j){case 'first':l.firstname_text=k;break;case 'last':l.lastname_text=k;break;}l.event=c('NamePronunciationLogEvent').PREVIEW_CUSTOM;return l;},formatStaticPlayerData:function(i,j,k){if(!i)return null;var l=babelHelpers['extends']({},i);switch(j){case 'first':l.firstname_text=k.phoneme;l.firstname_sampa=k.sampa;l.firstname_option=k.option;break;case 'last':l.lastname_text=k.phoneme;l.lastname_sampa=k.sampa;l.lastname_option=k.option;break;}l.event=c('NamePronunciationLogEvent').PREVIEW_NAME;return l;},formatPreviewPlayerData:function(i,j,k){if(!i||!j||!k)return null;var l=babelHelpers['extends']({},i);l.firstname_text=j.phoneme;l.firstname_sampa=j.sampa;l.lastname_text=k.phoneme;l.lastname_sampa=k.sampa;l.event=c('NamePronunciationLogEvent').PREVIEW_FULL;return l;},logSyllableSuggestionClick:function(i,j,k){var l=babelHelpers['extends']({},i);switch(j){case 'first':l.firstname_text=k;break;case 'last':l.lastname_text=k;break;}l.event=c('NamePronunciationLogEvent').PREVIEW_SYLLABLE;this.logToBanzai(l);},logToBanzai:function(i){if(i!==null)c('Banzai').post('name_pronunciation_play',i);},logSeeTipsClick:function(i,j){if(!i)return null;var k=babelHelpers['extends']({},i);k.event=j?c('NamePronunciationLogEvent').SEE_TIPS:c('NamePronunciationLogEvent').HIDE_TIPS;this.logToBanzai(k);}};f.exports=h;},null);
__d("XText2SpeechController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/tts\/",{text:{type:"String",required:true},voice:{type:"String"},samplerate:{type:"Int",defaultValue:44100},format:{type:"String",defaultValue:"mp3"},pid:{type:"Int",defaultValue:3},d:{type:"Bool",defaultValue:false},language:{type:"String",defaultValue:"en"},country:{type:"String",defaultValue:"US"},gender:{type:"String",defaultValue:"female"},flavor:{type:"String",defaultValue:"echo"},id:{type:"Int"},speed:{type:"Int",defaultValue:110},range:{type:"Bool",defaultValue:false}});},null);
__d('TextToSpeechAudioMixin',['PronunciationBanzaiLogger','React','ReactDOM','TTSVoiceFlavor','URI','UserAgent','XText2SpeechController','getObjectValues'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('React').PropTypes,i={propTypes:{flavor:h.oneOf(c('getObjectValues')(c('TTSVoiceFlavor'))),gender:h.string,logData:h.object,onEnded:h.func,onPlay:h.func,profileID:h.string,pronunciation:h.string},getDefaultProps:function(){return {flavor:c('TTSVoiceFlavor').FLAVOR_PRONOUNCER,logData:null,pronunciation:''};},getInitialState:function(){return {loading:false,playing:false};},componentWillReceiveProps:function(j){if(this.props.pronunciation!==j.pronunciation)this.shouldLoad=true;},componentDidMount:function(){var j=c('ReactDOM').findDOMNode(this.refs.audio);j.addEventListener('canplay',this._handleCanPlay);j.addEventListener('ended',this._handleEnded);j.addEventListener('loadstart',this._handleLoadStart);j.addEventListener('pause',this._handleEnded);j.addEventListener('playing',this._handlePlaying);j.addEventListener('timeupdate',this._handleTimeUpdate);},componentWillUnmount:function(){var j=c('ReactDOM').findDOMNode(this.refs.audio);j.removeEventListener('canplay',this._handleCanPlay);j.removeEventListener('ended',this._handleEnded);j.removeEventListener('loadstart',this._handleLoadStart);j.removeEventListener('pause',this._handleEnded);j.removeEventListener('playing',this._handlePlaying);j.removeEventListener('timeupdate',this._handleTimeUpdate);},_handleLoadStart:function(){if(this.props.pronunciation!=='')this.setState({loading:true});},_handleCanPlay:function(){this.setState({loading:false});if(this.shouldPlay){this.shouldPlay=false;this.play();}},_handleOnClick:function(){if(this.props.pronunciation==='')return;this.play();},_handleEnded:function(){if(this.props.onEnded)this.props.onEnded();this.setState({playing:false});},_handlePlaying:function(){this.setState({playing:true});var j=this.props.logData;c('PronunciationBanzaiLogger').logToBanzai(j);this.props.onPlay&&this.props.onPlay();},_handleTimeUpdate:function(){var j=c('ReactDOM').findDOMNode(this.refs.audio);if(c('UserAgent').isPlatform('Android')&&this.state.playing&&j.currentTime===0&&j.duration===0){this.shouldLoad=true;this._handleEnded();}if(c('UserAgent').isPlatform('iOS')&&!this.state.loading&&!this.state.playing&&j.currentTime!==0){j.pause();this.shouldPlay=true;j.load();}},play:function(){var j=c('ReactDOM').findDOMNode(this.refs.audio);if(this.shouldLoad){this.shouldPlay=true;j.load();this.shouldLoad=false;return;}j.play();},_getURIForText:function(j){return this._getURIForTextAndFormat(j,'mp3');},_getURIForTextAndFormat:function(j,k){if(j==='')return new (c('URI'))('');return c('XText2SpeechController').getURIBuilder().setString('flavor',this.props.flavor).setString('text',j).setString('gender',this.props.gender).setInt('id',this.props.profileID).setString('format',k).getURI();}};f.exports=i;},null);
__d('PronounceNameButton.react',['cx','ix','Image.react','Keys','React','ReactComponentWithPureRenderMixin','TextToSpeechAudioMixin','XUISpinner.react','joinClasses'],function a(b,c,d,e,f,g,h,i){if(c.__markCompiled)c.__markCompiled();var j=c('React').PropTypes,k=12,l=16,m=c('React').createClass({displayName:'PronounceNameButton',propTypes:{size:j.oneOf(['small','medium'])},getDefaultProps:function(){return {size:'medium'};},mixins:[c('ReactComponentWithPureRenderMixin'),c('TextToSpeechAudioMixin')],render:function(){var n=null;if(this.state.loading)n=c('React').createElement(c('XUISpinner.react'),{background:'light',className:"_4brk"+(this.props.size==='medium'?' '+"__3c":''),size:'small'});var o=this.props.pronunciation==='',p,q;if(this.props.size==='small'){q=k;if(o){p=i('/images/language_technology/playBtn_disabled_small.png');}else p=i('/images/language_technology/playBtn_small.png');}else{q=l;if(o){p=i('/images/language_technology/playBtn_disabled.png');}else p=i('/images/language_technology/play_button.png');}return (c('React').createElement('span',babelHelpers['extends']({},this.props,{className:c('joinClasses')(this.props.className,"_d2c"+(this.props.size==='small'?' '+"__3d":'')+(this.props.size==='medium'?' '+"__3e":'')+(o?' '+"_4brl":'')),onClick:this._handleOnClick,onKeyDown:this._handleKeyDown,tabIndex:0}),c('React').createElement(c('Image.react'),{className:"_4brm",height:q,ref:'image',src:p,width:q}),n,c('React').createElement('audio',{preload:'auto',ref:'audio'},c('React').createElement('source',{src:this._getURIForText(this.props.pronunciation),type:'audio/mpeg'}))));},_handleKeyDown:function(event){switch(event.keyCode){case c('Keys').RETURN:case c('Keys').SPACE:this._handleOnClick();}}});f.exports=m;},null);