if (self.CavalryLogger) { CavalryLogger.start_js(["q8qsO"]); } __d('TypeaheadView.react',['cx','React'],(function a(b,c,d,e,f,g,h){var i,j;if(c.__markCompiled)c.__markCompiled();var k=c('React').PropTypes;i=babelHelpers.inherits(l,c('React').Component);j=i&&i.prototype;function l(){var m,n;'use strict';for(var o=arguments.length,p=Array(o),q=0;q0&&(this.props.showEntriesOnFocus||this.props.queryString.length>0);return !!(o&&(this.props.presenter.alwaysVisibleOnFocus||p));},_onEntriesFound:function m(n,o,p){if(!this.isMounted())return;if(this.props.excludedEntries){var q=this.props.excludedEntries;n=n.filter(function(y){return !q.hasOwnProperty(y.getUniqueID());});}var r=this.props.presenter,s=typeof r.sortEntries=='function'?r.sortEntries(n,this.state.activeEntries,this.props.queryString):n,t=s.slice(0,r.maxEntries||k),u=this._determineViewVisibility(t,this.state.focused);if(!t.length){this.setState({ariaActiveDescendantID:null,activeEntries:t,highlightedEntry:null,isAutoHighlight:this.props.autoHighlight});this._setViewIsVisible(u);if(this.props.onNoEntriesFound&&p===c('SearchSourceQueryStatus').COMPLETE)this.props.onNoEntriesFound();return;}if(this.props.onEntriesFound)this.props.onEntriesFound(t,p);var v=this.state.highlightedEntry,w=v&&t.indexOf(v)!==-1;if(!this.props.autoHighlight){this.setState({activeEntries:t,highlightedEntry:w?v:null});if(u)this._setViewIsVisible(true);return;}var x=this.state.isAutoHighlight;if(x){v=t[0];}else{v=w?v:t[0];x=!w;}this.setState({activeEntries:t,highlightedEntry:v,isAutoHighlight:x});if(u)this._setViewIsVisible(true);},_onInputFocus:function m(){var n=this._determineViewVisibility(this.state.activeEntries,true);if(n)this._setViewIsVisible(true);this.setState({focused:true});this.props.onFocus&&this.props.onFocus();},_onInputBlurWindowSafe:function m(){var n=void 0,o=Event.listen(window,'blur',function(){o.remove();c('clearImmediate')(n);});n=c('setImmediate')(function(){o.remove();this._onInputBlur();}.bind(this));},_onInputBlur:function m(){this.setState({focused:false});if(this.props.hideViewWithEntries)this._close();if(this.props.selectOnBlur&&this.state.highlightedEntry)this.props.onSelectAttempt(this.state.highlightedEntry);this.props.onBlur&&this.props.onBlur();},_onInputClick:function m(n){var o=this.getTextFieldDOM(),p=c('InputSelection').get(o);if(p&&p.start==p.end)o.select();this.props.onClick&&this.props.onClick(n);},_onEscape:function m(){this._close();this.blurInput();this.setState({focused:false});this.props.onEscape&&this.props.onEscape();},_onEnter:function m(event){if(this.props.onEnterWithoutSelection&&(!this.state.viewIsVisible||!this.state.highlightedEntry)){this.props.onEnterWithoutSelection(event);return;}if(!this.state.viewIsVisible)return;if(!this.state.highlightedEntry){event.preventDefault();return;}if(this.props.hideViewWithEntries)this._close();if(this.props.onSelectAttempt)this.props.onSelectAttempt(this.state.highlightedEntry,event);event.preventDefault();},_onTab:function m(event){if(this.props.selectOnTab&&this.state.viewIsVisible&&this.props.onSelectAttempt&&this.state.highlightedEntry){if(this.props.hideViewWithEntries){this._close();event.preventDefault();}this.props.onSelectAttempt(this.state.highlightedEntry,event);}},_onDownArrow:function m(event){event.preventDefault();this.props.navigation.moveDown(this.state.activeEntries||j,this.state.highlightedEntry,this._setHighlight);},_onUpArrow:function m(event){event.preventDefault();this.props.navigation.moveUp(this.state.activeEntries||j,this.state.highlightedEntry,this._setHighlight);},_setHighlight:function m(n){this.setState({highlightedEntry:n,isArrowNavigation:true,isAutoHighlight:!n});},_onInputChange:function m(event){if(this.props.onChange)this.props.onChange(event);this._setViewIsVisible(this.state.focused&&(this.props.showEntriesOnFocus||event.target.value.length>0)&&(this.props.presenter.alwaysVisibleOnFocus||this.state.activeEntries!=null&&this.state.activeEntries.length>0));},_onViewHighlight:function m(n){this.setState({highlightedEntry:n,isArrowNavigation:false,isAutoHighlight:false});},_getView:function m(){return (c('React').createElement(c('TypeaheadView.react'),{Renderer:this.props.presenter.ViewRenderer,extraRendererProps:babelHelpers['extends']({},this.props.presenter.extraRendererProps,{isArrowNavigation:this.state.isArrowNavigation}),highlightedEntry:this.state.highlightedEntry,selectedEntry:this.props.selectedEntry,isVisible:this.state.viewIsVisible,ariaOwneeID:this.state.ariaOwneeID,onHighlight:this._onViewHighlight,onRenderHighlight:this._onRenderHighlight,onSelect:this.props.onSelectAttempt,entries:this.state.activeEntries||j,queryString:this.props.queryString}));},_setViewIsVisible:function m(n){if(n!==this.state.viewIsVisible){if(this.props.onTypeaheadVisibilityChanged)this.props.onTypeaheadVisibilityChanged(n,this.state.activeEntries||j);this.setState({viewIsVisible:n});}},componentWillReceiveProps:function m(n){if(!n.queryString&&!this.props.showEntriesOnFocus)this.clearActiveEntries();},componentDidUpdate:function m(){var n=this._determineViewVisibility(this.state.activeEntries,this.state.focused);if(n)this._setViewIsVisible(true);},renderLayers:function m(){if(!this.props.presenter.useLayer)return {};var n=null,o=null;if(this.props.context){n=this.props.context;}else o=function(){return this.refs.input;}.bind(this);return {typeaheadView:c('React').createElement(c('ContextualLayer.react'),{alignment:this.props.presenter.alignment,behaviors:this.props.presenter.layerBehaviors,containerWidthMatchContext:this.props.entriesWidthMatchContext,contextRef:o,context:n,position:this.props.presenter.layerPosition||"below",shown:this.state.viewIsVisible,shouldSetARIAProperties:false},this._getView())};},render:function m(){var n=this.state.activeEntries,o=!!(n&&n.length),p=c('React').createElement(c('SearchableTextInput.react'),{'aria-activedescendant':this.state.ariaActiveDescendantID,'aria-expanded':o,'aria-autocomplete':'list','aria-label':this.props.ariaLabel,'aria-owns':this.state.ariaOwneeID,required:this.props.required,ref:'input',autoCapitalize:this.props.autoCapitalize,autoComplete:this.props.autoComplete,autoCorrect:this.props.autoCorrect,className:this.props.inputClassName,id:this.props.inputID,name:this.props.name,queryString:this.props.queryString,placeholder:this.props.placeholder,maxLength:this.props.maxLength,searchSource:this.props.searchSource,searchSourceOptions:this.props.searchSourceOptions,searchOnFocus:!!this.props.showEntriesOnFocus,disabled:this.props.disabled,onEntriesFound:this._onEntriesFound,onEscape:this._onEscape,onBlur:this.props.blurOnWindowBlur?this._onInputBlur:this._onInputBlurWindowSafe,onFocus:this._onInputFocus,onChange:this._onInputChange,onDownArrow:this._onDownArrow,onUpArrow:this._onUpArrow,onTab:this._onTab,onEnter:this._onEnter,onBackspace:this.props.onBackspace,onPaste:this.props.onPaste,onClick:this._onInputClick,style:this.props.inputStyle,tabIndex:this.props.tabIndex,'data-testid':this.props['data-testid']}),q=null;if(!this.props.presenter.useLayer)q=this._getView();var r=Object.assign({},this.props);delete r.additionalElements;delete r.inputClassName;delete r.inputID;delete r.inputStyle;delete r.searchSource;delete r.searchSourceOptions;delete r.excludedEntries;delete r.presenter;delete r.onSelectAttempt;delete r.onEntriesFound;delete r.onNoEntriesFound;delete r.onEnterWithoutSelection;delete r.autoHighlight;delete r.showEntriesOnFocus;delete r.selectOnBlur;delete r.blurOnWindowBlur;delete r.selectOnTab;delete r.focusedOnInit;delete r.hideViewWithEntries;delete r.disabled;delete r.entriesWidthMatchContext;delete r.selectedEntry;delete r.onTypeaheadVisibilityChanged;delete r.onPaste;delete r.navigation;return (c('React').createElement('span',babelHelpers['extends']({},r,{className:c('joinClasses')(this.props.className,"_58ah"),onBlur:null,onChange:null,onClick:null,onFocus:null,tabIndex:null}),p,this.props.additionalElements,q));},componentDidMount:function m(){if(this.props.focusedOnInit)this.focusInput();},clearActiveEntries:function m(){this.setState({ariaActiveDescendantID:null,activeEntries:null,highlightedEntry:null});},focusInput:function m(){var n=this.getTextFieldDOM();if(n.value)c('InputSelection').set(n,n.value.length);this.refs.input.focusInput();},blurInput:function m(){if(this.refs.input.blur){this.refs.input.blur();}else if(this.refs.input.blurInput)this.refs.input.blurInput();},hideView:function m(){this._setViewIsVisible(false);},_close:function m(){this._setViewIsVisible(false);this.clearActiveEntries();},getTextFieldDOM:function m(){return this.refs.input.getTextFieldDOM();}});f.exports=l;}),null); __d('XUITypeaheadTextOnlyView.react',['cx','React','TypeaheadViewItem','TypeaheadViewPropTypes'],(function a(b,c,d,e,f,g,h){var i,j;if(c.__markCompiled)c.__markCompiled();var k=c('React').createClass({displayName:'XUITypeaheadTextOnlyViewItem',mixins:[c('TypeaheadViewItem').Mixin],propTypes:c('TypeaheadViewItem').propTypes,render:function m(){var n=this.props.entry,o="_599m"+(this.props.highlighted?' '+"_599n":'');return (c('React').createElement('li',{'aria-label':n.getTitle(),'aria-selected':this.props.highlighted,className:o,key:n.getUniqueID(),onMouseDown:this._onSelect,onMouseEnter:this._onHighlight,role:this.props.role,title:n.getTitle()},c('React').createElement('div',{className:"_599p"},n.getTitle())));}});i=babelHelpers.inherits(l,c('React').Component);j=i&&i.prototype;function l(){var m,n;'use strict';for(var o=arguments.length,p=Array(o),q=0;q