// Compiled by ClojureScript 1.9.229 {}
goog.provide('re_com.typeahead');
goog.require('cljs.core');
goog.require('cljs.core.async');
goog.require('re_com.misc');
goog.require('re_com.util');
goog.require('re_com.popover');
goog.require('re_com.box');
goog.require('re_com.validate');
goog.require('reagent.core');
goog.require('goog.events.KeyCodes');
re_com.typeahead.typeahead_args_desc = new cljs.core.PersistentVector(null, 18, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"data-source","data-source",-658934676),new cljs.core.Keyword(null,"required","required",1807647006),true,new cljs.core.Keyword(null,"type","type",1174270348),"fn",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.fn_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":data-source"], null)," supplies suggestion objects. This can either accept a single string argument (the search term), or a string and a callback. For the first case, the fn should return a collection of suggestion objects (which can be anything). For the second case, the fn should return ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),"nil"], null),", and eventually result in a call to the callback with a collection of suggestion objects."], null)], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"on-change","on-change",-732046149),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"default","default",-1987822328),null,new cljs.core.Keyword(null,"type","type",1174270348),"string -> nil",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.fn_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":change-on-blur?"], null)," controls when it is called. It is passed a suggestion object."], null)], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"change-on-blur?","change-on-blur?",854283925),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"default","default",-1987822328),true,new cljs.core.Keyword(null,"type","type",1174270348),"boolean | atom",new cljs.core.Keyword(null,"description","description",-1428560544),new cljs.core.PersistentVector(null, 8, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),"when true, invoke ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":on-change"], null)," when the use chooses a suggestion, otherwise invoke it on every change (navigating through suggestions with the mouse or keyboard, or if ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),"rigid?"], null)," is also ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),"false"], null),", invoke it on every character typed.)"], null)], null),cljs.core.PersistentArrayMap.fromArray([new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"model","model",331153215),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"default","default",-1987822328),null,new cljs.core.Keyword(null,"type","type",1174270348),"object | atom",new cljs.core.Keyword(null,"description","description",-1428560544),"The initial value of the typeahead (should match the suggestion objects returned by ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":data-source"], null),")."], true, false),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"debounce-delay","debounce-delay",-608187982),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"default","default",-1987822328),(250),new cljs.core.Keyword(null,"type","type",1174270348),"integer",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.integer_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),"After receiving input, the typeahead will wait this many milliseconds without receiving new input before calling ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":data-source"], null),"."], null)], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"render-suggestion","render-suggestion",1472406503),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"render fn",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.fn_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"override the rendering of the suggestion items by passing a fn that returns hiccup forms. The fn will receive two arguments: the search term, and the suggestion object."], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"suggestion-to-string","suggestion-to-string",1991188962),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"suggestion -> string",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.fn_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"When a suggestion is chosen, the input-text value will be set to the result of calling this fn with the suggestion object."], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"rigid?","rigid?",-1498832118),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"default","default",-1987822328),true,new cljs.core.Keyword(null,"type","type",1174270348),"boolean | atom",new cljs.core.Keyword(null,"description","description",-1428560544),new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),"If ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),"false"], null)," the user will be allowed to choose arbitrary text input rather than a suggestion from ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":data-source"], null),". In this case, a string will be supplied in lieu of a suggestion object."], null)], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"status","status",-1997798413),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"keyword",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),re_com.validate.input_status_type_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),"validation status. ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),"nil/omitted"], null)," for normal status or one of: ",re_com.validate.input_status_types_list], null)], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"status-icon?","status-icon?",1328423612),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"default","default",-1987822328),false,new cljs.core.Keyword(null,"type","type",1174270348),"boolean",new cljs.core.Keyword(null,"description","description",-1428560544),new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),"when true, display an icon to match ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":status"], null)," (no icon for nil)"], null)], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"status-tooltip","status-tooltip",1912159007),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"displayed in status icon's tooltip"], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"placeholder","placeholder",-104873083),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"background text shown when empty"], null),new cljs.core.PersistentArrayMap(null, 6, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"width","width",-384071477),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"default","default",-1987822328),"250px",new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"standard CSS width setting for this input"], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"height","height",1025178622),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"standard CSS height setting for this input"], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"disabled?","disabled?",-1523234181),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"default","default",-1987822328),false,new cljs.core.Keyword(null,"type","type",1174270348),"boolean | atom",new cljs.core.Keyword(null,"description","description",-1428560544),"if true, the user can't interact (input anything)"], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"class","class",-2030961996),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"string",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),cljs.core.string_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS class names, space separated"], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"style","style",-496642736),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"CSS style map",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),re_com.validate.css_style_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),"CSS styles to add or override"], null),new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"attr","attr",-604132353),new cljs.core.Keyword(null,"required","required",1807647006),false,new cljs.core.Keyword(null,"type","type",1174270348),"HTML attr map",new cljs.core.Keyword(null,"validate-fn","validate-fn",1430169944),re_com.validate.html_attr_QMARK_,new cljs.core.Keyword(null,"description","description",-1428560544),new cljs.core.PersistentVector(null, 9, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),"HTML attributes, like ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":on-mouse-move"], null),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"br","br",934104792)], null),"No ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":class"], null)," or ",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"code","code",1586293142),":style"], null),"allowed"], null)], null)], null);

/**
 * Return an initial value for the typeahead state, given `args`.
 */
re_com.typeahead.make_typeahead_state = (function re_com$typeahead$make_typeahead_state(p__31236){
var map__31240 = p__31236;
var map__31240__$1 = ((((!((map__31240 == null)))?((((map__31240.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31240.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31240):map__31240);
var args = map__31240__$1;
var on_change = cljs.core.get.call(null,map__31240__$1,new cljs.core.Keyword(null,"on-change","on-change",-732046149));
var rigid_QMARK_ = cljs.core.get.call(null,map__31240__$1,new cljs.core.Keyword(null,"rigid?","rigid?",-1498832118));
var change_on_blur_QMARK_ = cljs.core.get.call(null,map__31240__$1,new cljs.core.Keyword(null,"change-on-blur?","change-on-blur?",854283925));
var data_source = cljs.core.get.call(null,map__31240__$1,new cljs.core.Keyword(null,"data-source","data-source",-658934676));
var suggestion_to_string = cljs.core.get.call(null,map__31240__$1,new cljs.core.Keyword(null,"suggestion-to-string","suggestion-to-string",1991188962));
var debounce_delay = cljs.core.get.call(null,map__31240__$1,new cljs.core.Keyword(null,"debounce-delay","debounce-delay",-608187982));
var model = cljs.core.get.call(null,map__31240__$1,new cljs.core.Keyword(null,"model","model",331153215));
var external_model_value = re_com.util.deref_or_value.call(null,model);
var G__31242 = (function (){var c_input = cljs.core.async.chan.call(null);
return cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"waiting?","waiting?",-2117257215),new cljs.core.Keyword(null,"suggestion-to-string","suggestion-to-string",1991188962),new cljs.core.Keyword(null,"displaying-suggestion?","displaying-suggestion?",1244493862),new cljs.core.Keyword(null,"input-text","input-text",-1336297114),new cljs.core.Keyword(null,"rigid?","rigid?",-1498832118),new cljs.core.Keyword(null,"data-source","data-source",-658934676),new cljs.core.Keyword(null,"c-search","c-search",1832536180),new cljs.core.Keyword(null,"change-on-blur?","change-on-blur?",854283925),new cljs.core.Keyword(null,"suggestions","suggestions",-859472618),new cljs.core.Keyword(null,"c-input","c-input",-1821004232),new cljs.core.Keyword(null,"on-change","on-change",-732046149),new cljs.core.Keyword(null,"external-model","external-model",506095421),new cljs.core.Keyword(null,"model","model",331153215)],[false,(function (){var or__25130__auto__ = suggestion_to_string;
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return cljs.core.str;
}
})(),false,"",rigid_QMARK_,data_source,re_com.typeahead.debounce.call(null,c_input,debounce_delay),change_on_blur_QMARK_,cljs.core.PersistentVector.EMPTY,c_input,on_change,re_com.util.deref_or_value.call(null,model),re_com.util.deref_or_value.call(null,model)]);
})();
if(cljs.core.truth_(external_model_value)){
return re_com.typeahead.display_suggestion.call(null,G__31242,external_model_value);
} else {
return G__31242;
}
});
/**
 * Should `event` update the `typeahead` `model`?
 */
re_com.typeahead.event_updates_model_QMARK_ = (function re_com$typeahead$event_updates_model_QMARK_(p__31243,event){
var map__31247 = p__31243;
var map__31247__$1 = ((((!((map__31247 == null)))?((((map__31247.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31247.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31247):map__31247);
var state = map__31247__$1;
var change_on_blur_QMARK_ = cljs.core.get.call(null,map__31247__$1,new cljs.core.Keyword(null,"change-on-blur?","change-on-blur?",854283925));
var rigid_QMARK_ = cljs.core.get.call(null,map__31247__$1,new cljs.core.Keyword(null,"rigid?","rigid?",-1498832118));
var change_on_blur_QMARK___$1 = re_com.util.deref_or_value.call(null,change_on_blur_QMARK_);
var rigid_QMARK___$1 = re_com.util.deref_or_value.call(null,rigid_QMARK_);
var G__31249 = (((event instanceof cljs.core.Keyword))?event.fqn:null);
switch (G__31249) {
case "input-text-blurred":
var and__25118__auto__ = change_on_blur_QMARK___$1;
if(cljs.core.truth_(and__25118__auto__)){
return cljs.core.not.call(null,rigid_QMARK___$1);
} else {
return and__25118__auto__;
}

break;
case "suggestion-activated":
return cljs.core.not.call(null,change_on_blur_QMARK___$1);

break;
case "input-text-changed":
return cljs.core.not.call(null,(function (){var or__25130__auto__ = change_on_blur_QMARK___$1;
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return rigid_QMARK___$1;
}
})());

break;
default:
throw (new Error([cljs.core.str("No matching clause: "),cljs.core.str(event)].join('')));

}
});
/**
 * Should `event` cause the `input-text` value to be used to show the active suggestion?
 */
re_com.typeahead.event_displays_suggestion_QMARK_ = (function re_com$typeahead$event_displays_suggestion_QMARK_(p__31251,event){
var map__31255 = p__31251;
var map__31255__$1 = ((((!((map__31255 == null)))?((((map__31255.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31255.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31255):map__31255);
var state = map__31255__$1;
var change_on_blur_QMARK_ = cljs.core.get.call(null,map__31255__$1,new cljs.core.Keyword(null,"change-on-blur?","change-on-blur?",854283925));
var change_on_blur_QMARK___$1 = re_com.util.deref_or_value.call(null,change_on_blur_QMARK_);
var G__31257 = (((event instanceof cljs.core.Keyword))?event.fqn:null);
switch (G__31257) {
case "suggestion-activated":
return cljs.core.not.call(null,change_on_blur_QMARK___$1);

break;
default:
return false;

}
});
/**
 * Change the `typeahead` `model` value to `new-value`
 */
re_com.typeahead.update_model = (function re_com$typeahead$update_model(p__31259,new_value){
var map__31262 = p__31259;
var map__31262__$1 = ((((!((map__31262 == null)))?((((map__31262.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31262.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31262):map__31262);
var state = map__31262__$1;
var on_change = cljs.core.get.call(null,map__31262__$1,new cljs.core.Keyword(null,"on-change","on-change",-732046149));
if(cljs.core.truth_(on_change)){
on_change.call(null,new_value);
} else {
}

return cljs.core.assoc.call(null,state,new cljs.core.Keyword(null,"model","model",331153215),new_value);
});
/**
 * Change the `input-text` `model` to the string representation of `suggestion`
 */
re_com.typeahead.display_suggestion = (function re_com$typeahead$display_suggestion(p__31264,suggestion){
var map__31268 = p__31264;
var map__31268__$1 = ((((!((map__31268 == null)))?((((map__31268.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31268.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31268):map__31268);
var state = map__31268__$1;
var suggestion_to_string = cljs.core.get.call(null,map__31268__$1,new cljs.core.Keyword(null,"suggestion-to-string","suggestion-to-string",1991188962));
var suggestion_string = suggestion_to_string.call(null,suggestion);
var G__31270 = state;
if(cljs.core.truth_(suggestion_string)){
return cljs.core.assoc.call(null,G__31270,new cljs.core.Keyword(null,"input-text","input-text",-1336297114),suggestion_string,new cljs.core.Keyword(null,"displaying-suggestion?","displaying-suggestion?",1244493862),true);
} else {
return G__31270;
}
});
re_com.typeahead.clear_suggestions = (function re_com$typeahead$clear_suggestions(state){
return cljs.core.dissoc.call(null,state,new cljs.core.Keyword(null,"suggestions","suggestions",-859472618),new cljs.core.Keyword(null,"suggestion-active-index","suggestion-active-index",-1593564728));
});
/**
 * Make the suggestion at `index` the active suggestion
 */
re_com.typeahead.activate_suggestion_by_index = (function re_com$typeahead$activate_suggestion_by_index(p__31271,index){
var map__31275 = p__31271;
var map__31275__$1 = ((((!((map__31275 == null)))?((((map__31275.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31275.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31275):map__31275);
var state = map__31275__$1;
var suggestions = cljs.core.get.call(null,map__31275__$1,new cljs.core.Keyword(null,"suggestions","suggestions",-859472618));
var suggestion = cljs.core.nth.call(null,suggestions,index);
var G__31277 = state;
var G__31277__$1 = cljs.core.assoc.call(null,G__31277,new cljs.core.Keyword(null,"suggestion-active-index","suggestion-active-index",-1593564728),index)
;
var G__31277__$2 = (cljs.core.truth_(re_com.typeahead.event_updates_model_QMARK_.call(null,state,new cljs.core.Keyword(null,"suggestion-activated","suggestion-activated",316961778)))?re_com.typeahead.update_model.call(null,G__31277__$1,suggestion):G__31277__$1);
if(cljs.core.truth_(re_com.typeahead.event_displays_suggestion_QMARK_.call(null,state,new cljs.core.Keyword(null,"suggestion-activated","suggestion-activated",316961778)))){
return re_com.typeahead.display_suggestion.call(null,G__31277__$2,suggestion);
} else {
return G__31277__$2;
}
});
/**
 * Choose the suggestion at `index`
 */
re_com.typeahead.choose_suggestion_by_index = (function re_com$typeahead$choose_suggestion_by_index(p__31278,index){
var map__31281 = p__31278;
var map__31281__$1 = ((((!((map__31281 == null)))?((((map__31281.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31281.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31281):map__31281);
var state = map__31281__$1;
var suggestions = cljs.core.get.call(null,map__31281__$1,new cljs.core.Keyword(null,"suggestions","suggestions",-859472618));
var suggestion = cljs.core.nth.call(null,suggestions,index);
return re_com.typeahead.clear_suggestions.call(null,re_com.typeahead.display_suggestion.call(null,re_com.typeahead.update_model.call(null,re_com.typeahead.activate_suggestion_by_index.call(null,state,index),suggestion),suggestion));
});
re_com.typeahead.choose_suggestion_active = (function re_com$typeahead$choose_suggestion_active(p__31283){
var map__31287 = p__31283;
var map__31287__$1 = ((((!((map__31287 == null)))?((((map__31287.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31287.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31287):map__31287);
var state = map__31287__$1;
var suggestion_active_index = cljs.core.get.call(null,map__31287__$1,new cljs.core.Keyword(null,"suggestion-active-index","suggestion-active-index",-1593564728));
var G__31289 = state;
if(cljs.core.truth_(suggestion_active_index)){
return re_com.typeahead.choose_suggestion_by_index.call(null,G__31289,suggestion_active_index);
} else {
return G__31289;
}
});
re_com.typeahead.wrap = (function re_com$typeahead$wrap(index,count){
return cljs.core.mod.call(null,(count + index),count);
});
re_com.typeahead.activate_suggestion_next = (function re_com$typeahead$activate_suggestion_next(p__31290){
var map__31294 = p__31290;
var map__31294__$1 = ((((!((map__31294 == null)))?((((map__31294.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31294.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31294):map__31294);
var state = map__31294__$1;
var suggestions = cljs.core.get.call(null,map__31294__$1,new cljs.core.Keyword(null,"suggestions","suggestions",-859472618));
var suggestion_active_index = cljs.core.get.call(null,map__31294__$1,new cljs.core.Keyword(null,"suggestion-active-index","suggestion-active-index",-1593564728));
var G__31296 = state;
if(cljs.core.truth_(suggestions)){
return re_com.typeahead.activate_suggestion_by_index.call(null,G__31296,re_com.typeahead.wrap.call(null,((function (){var or__25130__auto__ = suggestion_active_index;
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return (-1);
}
})() + (1)),cljs.core.count.call(null,suggestions)));
} else {
return G__31296;
}
});
re_com.typeahead.activate_suggestion_prev = (function re_com$typeahead$activate_suggestion_prev(p__31297){
var map__31301 = p__31297;
var map__31301__$1 = ((((!((map__31301 == null)))?((((map__31301.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31301.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31301):map__31301);
var state = map__31301__$1;
var suggestions = cljs.core.get.call(null,map__31301__$1,new cljs.core.Keyword(null,"suggestions","suggestions",-859472618));
var suggestion_active_index = cljs.core.get.call(null,map__31301__$1,new cljs.core.Keyword(null,"suggestion-active-index","suggestion-active-index",-1593564728));
var G__31303 = state;
if(cljs.core.truth_(suggestions)){
return re_com.typeahead.activate_suggestion_by_index.call(null,G__31303,re_com.typeahead.wrap.call(null,((function (){var or__25130__auto__ = suggestion_active_index;
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return (0);
}
})() - (1)),cljs.core.count.call(null,suggestions)));
} else {
return G__31303;
}
});
re_com.typeahead.reset_typeahead = (function re_com$typeahead$reset_typeahead(state){
var G__31305 = state;
var G__31305__$1 = re_com.typeahead.clear_suggestions.call(null,G__31305)
;
var G__31305__$2 = cljs.core.assoc.call(null,G__31305__$1,new cljs.core.Keyword(null,"waiting?","waiting?",-2117257215),false,new cljs.core.Keyword(null,"input-text","input-text",-1336297114),"",new cljs.core.Keyword(null,"displaying-suggestion?","displaying-suggestion?",1244493862),false)
;
if(cljs.core.truth_(re_com.typeahead.event_updates_model_QMARK_.call(null,state,new cljs.core.Keyword(null,"input-text-changed","input-text-changed",-1906799535)))){
return re_com.typeahead.update_model.call(null,G__31305__$2,null);
} else {
return G__31305__$2;
}
});
/**
 * Update state when new suggestions are available
 */
re_com.typeahead.got_suggestions = (function re_com$typeahead$got_suggestions(state,suggestions){
return cljs.core.assoc.call(null,state,new cljs.core.Keyword(null,"suggestions","suggestions",-859472618),suggestions,new cljs.core.Keyword(null,"waiting?","waiting?",-2117257215),false,new cljs.core.Keyword(null,"suggestion-active-index","suggestion-active-index",-1593564728),null);
});
/**
 * Update state when the `input-text` is about to lose focus.
 */
re_com.typeahead.input_text_will_blur = (function re_com$typeahead$input_text_will_blur(p__31306){
var map__31310 = p__31306;
var map__31310__$1 = ((((!((map__31310 == null)))?((((map__31310.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31310.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31310):map__31310);
var state = map__31310__$1;
var input_text = cljs.core.get.call(null,map__31310__$1,new cljs.core.Keyword(null,"input-text","input-text",-1336297114));
var displaying_suggestion_QMARK_ = cljs.core.get.call(null,map__31310__$1,new cljs.core.Keyword(null,"displaying-suggestion?","displaying-suggestion?",1244493862));
var G__31312 = state;
if(cljs.core.truth_((function (){var and__25118__auto__ = cljs.core.not.call(null,displaying_suggestion_QMARK_);
if(and__25118__auto__){
return re_com.typeahead.event_updates_model_QMARK_.call(null,state,new cljs.core.Keyword(null,"input-text-blurred","input-text-blurred",-501892307));
} else {
return and__25118__auto__;
}
})())){
return re_com.typeahead.update_model.call(null,G__31312,input_text);
} else {
return G__31312;
}
});
/**
 * Update `state` given a new `data-source`. Resets the typeahead since any existing suggestions
 *   came from the old `data-source`.
 */
re_com.typeahead.change_data_source = (function re_com$typeahead$change_data_source(state,data_source){
return cljs.core.assoc.call(null,re_com.typeahead.reset_typeahead.call(null,state),new cljs.core.Keyword(null,"data-source","data-source",-658934676),data_source);
});
/**
 * Update state when the external model value has changed.
 */
re_com.typeahead.external_model_changed = (function re_com$typeahead$external_model_changed(state,new_value){
return re_com.typeahead.clear_suggestions.call(null,re_com.typeahead.display_suggestion.call(null,re_com.typeahead.update_model.call(null,state,new_value),new_value));
});
/**
 * Call the `data-source` fn with `text`, and then call `got-suggestions` with the result
 *   (asynchronously, if `data-source` does not return a truthy value).
 */
re_com.typeahead.search_data_source_BANG_ = (function re_com$typeahead$search_data_source_BANG_(data_source,state_atom,text){
var temp__4655__auto__ = data_source.call(null,text,(function (p1__31313_SHARP_){
return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.got_suggestions,p1__31313_SHARP_);
}));
if(cljs.core.truth_(temp__4655__auto__)){
var return_value = temp__4655__auto__;
return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.got_suggestions,return_value);
} else {
return cljs.core.swap_BANG_.call(null,state_atom,cljs.core.assoc,new cljs.core.Keyword(null,"waiting?","waiting?",-2117257215),true);
}
});
/**
 * For every value arriving on the `c-search` channel, call `search-data-source!`.
 */
re_com.typeahead.search_data_source_loop_BANG_ = (function re_com$typeahead$search_data_source_loop_BANG_(state_atom,c_search){
var c__28364__auto__ = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__28364__auto__){
return (function (){
var f__28365__auto__ = (function (){var switch__28252__auto__ = ((function (c__28364__auto__){
return (function (state_31363){
var state_val_31364 = (state_31363[(1)]);
if((state_val_31364 === (1))){
var state_31363__$1 = state_31363;
var statearr_31365_31380 = state_31363__$1;
(statearr_31365_31380[(2)] = null);

(statearr_31365_31380[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31364 === (2))){
var state_31363__$1 = state_31363;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31363__$1,(4),c_search);
} else {
if((state_val_31364 === (3))){
var inst_31361 = (state_31363[(2)]);
var state_31363__$1 = state_31363;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31363__$1,inst_31361);
} else {
if((state_val_31364 === (4))){
var inst_31349 = (state_31363[(7)]);
var inst_31349__$1 = (state_31363[(2)]);
var inst_31350 = cljs.core.deref.call(null,state_atom);
var inst_31351 = new cljs.core.Keyword(null,"data-source","data-source",-658934676).cljs$core$IFn$_invoke$arity$1(inst_31350);
var inst_31352 = cljs.core._EQ_.call(null,"",inst_31349__$1);
var state_31363__$1 = (function (){var statearr_31366 = state_31363;
(statearr_31366[(7)] = inst_31349__$1);

(statearr_31366[(8)] = inst_31351);

return statearr_31366;
})();
if(inst_31352){
var statearr_31367_31381 = state_31363__$1;
(statearr_31367_31381[(1)] = (5));

} else {
var statearr_31368_31382 = state_31363__$1;
(statearr_31368_31382[(1)] = (6));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31364 === (5))){
var inst_31354 = cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.reset_typeahead);
var state_31363__$1 = state_31363;
var statearr_31369_31383 = state_31363__$1;
(statearr_31369_31383[(2)] = inst_31354);

(statearr_31369_31383[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31364 === (6))){
var inst_31349 = (state_31363[(7)]);
var inst_31351 = (state_31363[(8)]);
var inst_31356 = re_com.typeahead.search_data_source_BANG_.call(null,inst_31351,state_atom,inst_31349);
var state_31363__$1 = state_31363;
var statearr_31370_31384 = state_31363__$1;
(statearr_31370_31384[(2)] = inst_31356);

(statearr_31370_31384[(1)] = (7));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31364 === (7))){
var inst_31358 = (state_31363[(2)]);
var state_31363__$1 = (function (){var statearr_31371 = state_31363;
(statearr_31371[(9)] = inst_31358);

return statearr_31371;
})();
var statearr_31372_31385 = state_31363__$1;
(statearr_31372_31385[(2)] = null);

(statearr_31372_31385[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
});})(c__28364__auto__))
;
return ((function (switch__28252__auto__,c__28364__auto__){
return (function() {
var re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto__ = null;
var re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto____0 = (function (){
var statearr_31376 = [null,null,null,null,null,null,null,null,null,null];
(statearr_31376[(0)] = re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto__);

(statearr_31376[(1)] = (1));

return statearr_31376;
});
var re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto____1 = (function (state_31363){
while(true){
var ret_value__28254__auto__ = (function (){try{while(true){
var result__28255__auto__ = switch__28252__auto__.call(null,state_31363);
if(cljs.core.keyword_identical_QMARK_.call(null,result__28255__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__28255__auto__;
}
break;
}
}catch (e31377){if((e31377 instanceof Object)){
var ex__28256__auto__ = e31377;
var statearr_31378_31386 = state_31363;
(statearr_31378_31386[(5)] = ex__28256__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_31363);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e31377;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__28254__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31387 = state_31363;
state_31363 = G__31387;
continue;
} else {
return ret_value__28254__auto__;
}
break;
}
});
re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto__ = function(state_31363){
switch(arguments.length){
case 0:
return re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto____0.call(this);
case 1:
return re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto____1.call(this,state_31363);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto__.cljs$core$IFn$_invoke$arity$0 = re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto____0;
re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto__.cljs$core$IFn$_invoke$arity$1 = re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto____1;
return re_com$typeahead$search_data_source_loop_BANG__$_state_machine__28253__auto__;
})()
;})(switch__28252__auto__,c__28364__auto__))
})();
var state__28366__auto__ = (function (){var statearr_31379 = f__28365__auto__.call(null);
(statearr_31379[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__28364__auto__);

return statearr_31379;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__28366__auto__);
});})(c__28364__auto__))
);

return c__28364__auto__;
});
/**
 * Update state in response to `input-text` `on-change`, and put text on the `c-input` channel
 */
re_com.typeahead.input_text_on_change_BANG_ = (function re_com$typeahead$input_text_on_change_BANG_(state_atom,new_text){
var map__31392 = cljs.core.deref.call(null,state_atom);
var map__31392__$1 = ((((!((map__31392 == null)))?((((map__31392.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31392.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31392):map__31392);
var state = map__31392__$1;
var input_text = cljs.core.get.call(null,map__31392__$1,new cljs.core.Keyword(null,"input-text","input-text",-1336297114));
var c_input = cljs.core.get.call(null,map__31392__$1,new cljs.core.Keyword(null,"c-input","c-input",-1821004232));
if(cljs.core._EQ_.call(null,new_text,input_text)){
return state;
} else {
if(clojure.string.blank_QMARK_.call(null,new_text)){
} else {
cljs.core.async.put_BANG_.call(null,c_input,new_text);
}

return cljs.core.swap_BANG_.call(null,state_atom,((function (map__31392,map__31392__$1,state,input_text,c_input){
return (function (p1__31388_SHARP_){
var G__31394 = p1__31388_SHARP_;
var G__31394__$1 = cljs.core.assoc.call(null,G__31394,new cljs.core.Keyword(null,"input-text","input-text",-1336297114),new_text,new cljs.core.Keyword(null,"displaying-suggestion?","displaying-suggestion?",1244493862),false)
;
if(cljs.core.truth_(re_com.typeahead.event_updates_model_QMARK_.call(null,state,new cljs.core.Keyword(null,"input-text-changed","input-text-changed",-1906799535)))){
return re_com.typeahead.update_model.call(null,G__31394__$1,new_text);
} else {
return G__31394__$1;
}
});})(map__31392,map__31392__$1,state,input_text,c_input))
);
}
});
re_com.typeahead.input_text_on_key_down_BANG_ = (function re_com$typeahead$input_text_on_key_down_BANG_(state_atom,event){
var pred__31398 = cljs.core._EQ_;
var expr__31399 = event.which;
if(cljs.core.truth_(pred__31398.call(null,goog.events.KeyCodes.UP,expr__31399))){
return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.activate_suggestion_prev);
} else {
if(cljs.core.truth_(pred__31398.call(null,goog.events.KeyCodes.DOWN,expr__31399))){
return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.activate_suggestion_next);
} else {
if(cljs.core.truth_(pred__31398.call(null,goog.events.KeyCodes.ENTER,expr__31399))){
return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.choose_suggestion_active);
} else {
if(cljs.core.truth_(pred__31398.call(null,goog.events.KeyCodes.ESC,expr__31399))){
return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.reset_typeahead);
} else {
if(cljs.core.truth_(pred__31398.call(null,goog.events.KeyCodes.TAB,expr__31399))){
if(cljs.core.truth_(cljs.core.not_empty.call(null,new cljs.core.Keyword(null,"suggestions","suggestions",-859472618).cljs$core$IFn$_invoke$arity$1(cljs.core.deref.call(null,state_atom))))){
cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.activate_suggestion_next);

return event.preventDefault();
} else {
return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.input_text_will_blur);
}
} else {
return true;
}
}
}
}
}
});
/**
 * typeahead reagent component
 */
re_com.typeahead.typeahead = (function re_com$typeahead$typeahead(var_args){
var args__26212__auto__ = [];
var len__26205__auto___31429 = arguments.length;
var i__26206__auto___31430 = (0);
while(true){
if((i__26206__auto___31430 < len__26205__auto___31429)){
args__26212__auto__.push((arguments[i__26206__auto___31430]));

var G__31431 = (i__26206__auto___31430 + (1));
i__26206__auto___31430 = G__31431;
continue;
} else {
}
break;
}

var argseq__26213__auto__ = ((((0) < args__26212__auto__.length))?(new cljs.core.IndexedSeq(args__26212__auto__.slice((0)),(0),null)):null);
return re_com.typeahead.typeahead.cljs$core$IFn$_invoke$arity$variadic(argseq__26213__auto__);
});

re_com.typeahead.typeahead.cljs$core$IFn$_invoke$arity$variadic = (function (p__31403){
var map__31404 = p__31403;
var map__31404__$1 = ((((!((map__31404 == null)))?((((map__31404.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31404.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31404):map__31404);
var args = map__31404__$1;
var data_source = cljs.core.get.call(null,map__31404__$1,new cljs.core.Keyword(null,"data-source","data-source",-658934676));
var on_change = cljs.core.get.call(null,map__31404__$1,new cljs.core.Keyword(null,"on-change","on-change",-732046149));
var rigid_QMARK_ = cljs.core.get.call(null,map__31404__$1,new cljs.core.Keyword(null,"rigid?","rigid?",-1498832118));
var change_on_blur_QMARK_ = cljs.core.get.call(null,map__31404__$1,new cljs.core.Keyword(null,"change-on-blur?","change-on-blur?",854283925));
if(cljs.core.truth_(((!(goog.DEBUG))?true:re_com.validate.validate_args.call(null,re_com.validate.extract_arg_data.call(null,re_com.typeahead.typeahead_args_desc),args,"typeahead")))){
} else {
throw (new Error("Assert failed: (validate-args-macro typeahead-args-desc args \"typeahead\")"));
}

var map__31406 = re_com.typeahead.make_typeahead_state.call(null,args);
var map__31406__$1 = ((((!((map__31406 == null)))?((((map__31406.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31406.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31406):map__31406);
var state = map__31406__$1;
var c_search = cljs.core.get.call(null,map__31406__$1,new cljs.core.Keyword(null,"c-search","c-search",1832536180));
var c_input = cljs.core.get.call(null,map__31406__$1,new cljs.core.Keyword(null,"c-input","c-input",-1821004232));
var state_atom = reagent.core.atom.call(null,state);
var input_text_model = reagent.core.cursor.call(null,state_atom,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"input-text","input-text",-1336297114)], null));
re_com.typeahead.search_data_source_loop_BANG_.call(null,state_atom,c_search);

return ((function (map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_){
return (function() { 
var G__31432__delegate = function (p__31408){
var map__31409 = p__31408;
var map__31409__$1 = ((((!((map__31409 == null)))?((((map__31409.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31409.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31409):map__31409);
var args__$1 = map__31409__$1;
var disabled_QMARK_ = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"disabled?","disabled?",-1523234181));
var status_icon_QMARK_ = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"status-icon?","status-icon?",1328423612));
var height = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"height","height",1025178622));
var status_tooltip = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"status-tooltip","status-tooltip",1912159007));
var model = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"model","model",331153215));
var suggestion_to_string = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"suggestion-to-string","suggestion-to-string",1991188962));
var placeholder = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"placeholder","placeholder",-104873083));
var render_suggestion = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"render-suggestion","render-suggestion",1472406503));
var rigid_QMARK___$1 = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"rigid?","rigid?",-1498832118));
var width = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"width","width",-384071477));
var data_source__$1 = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"data-source","data-source",-658934676));
var style = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"style","style",-496642736));
var status = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"status","status",-1997798413));
var class$ = cljs.core.get.call(null,map__31409__$1,new cljs.core.Keyword(null,"class","class",-2030961996));
if(cljs.core.truth_(((!(goog.DEBUG))?true:re_com.validate.validate_args.call(null,re_com.validate.extract_arg_data.call(null,re_com.typeahead.typeahead_args_desc),args__$1,"typeahead")))){
} else {
throw (new Error("Assert failed: (validate-args-macro typeahead-args-desc args \"typeahead\")"));
}

var map__31411 = cljs.core.deref.call(null,state_atom);
var map__31411__$1 = ((((!((map__31411 == null)))?((((map__31411.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31411.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31411):map__31411);
var state__$1 = map__31411__$1;
var suggestions = cljs.core.get.call(null,map__31411__$1,new cljs.core.Keyword(null,"suggestions","suggestions",-859472618));
var waiting_QMARK_ = cljs.core.get.call(null,map__31411__$1,new cljs.core.Keyword(null,"waiting?","waiting?",-2117257215));
var suggestion_active_index = cljs.core.get.call(null,map__31411__$1,new cljs.core.Keyword(null,"suggestion-active-index","suggestion-active-index",-1593564728));
var external_model = cljs.core.get.call(null,map__31411__$1,new cljs.core.Keyword(null,"external-model","external-model",506095421));
var last_data_source = new cljs.core.Keyword(null,"data-source","data-source",-658934676).cljs$core$IFn$_invoke$arity$1(state__$1);
var latest_external_model = re_com.util.deref_or_value.call(null,model);
var width__$1 = (function (){var or__25130__auto__ = width;
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return "250px";
}
})();
if(cljs.core.not_EQ_.call(null,last_data_source,data_source__$1)){
cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.change_data_source,data_source__$1);
} else {
}

if(cljs.core.not_EQ_.call(null,latest_external_model,external_model)){
cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.external_model_changed,latest_external_model);
} else {
}

return new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [re_com.box.v_box,new cljs.core.Keyword(null,"width","width",-384071477),width__$1,new cljs.core.Keyword(null,"children","children",-940561982),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentVector(null, 27, 5, cljs.core.PersistentVector.EMPTY_NODE, [re_com.misc.input_text,new cljs.core.Keyword(null,"model","model",331153215),input_text_model,new cljs.core.Keyword(null,"class","class",-2030961996),class$,new cljs.core.Keyword(null,"style","style",-496642736),style,new cljs.core.Keyword(null,"disabled?","disabled?",-1523234181),disabled_QMARK_,new cljs.core.Keyword(null,"status-icon?","status-icon?",1328423612),status_icon_QMARK_,new cljs.core.Keyword(null,"status","status",-1997798413),status,new cljs.core.Keyword(null,"status-tooltip","status-tooltip",1912159007),status_tooltip,new cljs.core.Keyword(null,"width","width",-384071477),width__$1,new cljs.core.Keyword(null,"height","height",1025178622),height,new cljs.core.Keyword(null,"placeholder","placeholder",-104873083),placeholder,new cljs.core.Keyword(null,"on-change","on-change",-732046149),cljs.core.partial.call(null,re_com.typeahead.input_text_on_change_BANG_,state_atom),new cljs.core.Keyword(null,"change-on-blur?","change-on-blur?",854283925),false,new cljs.core.Keyword(null,"attr","attr",-604132353),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"on-key-down","on-key-down",-1374733765),cljs.core.partial.call(null,re_com.typeahead.input_text_on_key_down_BANG_,state_atom)], null)], null),(cljs.core.truth_((function (){var or__25130__auto__ = cljs.core.not_empty.call(null,suggestions);
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return waiting_QMARK_;
}
})())?new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [re_com.box.v_box,new cljs.core.Keyword(null,"class","class",-2030961996),"rc-typeahead-suggestions-container",new cljs.core.Keyword(null,"children","children",-940561982),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(cljs.core.truth_(waiting_QMARK_)?new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [re_com.box.box,new cljs.core.Keyword(null,"align","align",1964212802),new cljs.core.Keyword(null,"center","center",-748944368),new cljs.core.Keyword(null,"child","child",623967545),new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [re_com.misc.throbber,new cljs.core.Keyword(null,"size","size",1098693007),new cljs.core.Keyword(null,"small","small",2133478704),new cljs.core.Keyword(null,"class","class",-2030961996),"rc-typeahead-throbber"], null)], null):null),(function (){var iter__25910__auto__ = ((function (map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_){
return (function re_com$typeahead$iter__31413(s__31414){
return (new cljs.core.LazySeq(null,((function (map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_){
return (function (){
var s__31414__$1 = s__31414;
while(true){
var temp__4657__auto__ = cljs.core.seq.call(null,s__31414__$1);
if(temp__4657__auto__){
var s__31414__$2 = temp__4657__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__31414__$2)){
var c__25908__auto__ = cljs.core.chunk_first.call(null,s__31414__$2);
var size__25909__auto__ = cljs.core.count.call(null,c__25908__auto__);
var b__31416 = cljs.core.chunk_buffer.call(null,size__25909__auto__);
if((function (){var i__31415 = (0);
while(true){
if((i__31415 < size__25909__auto__)){
var vec__31423 = cljs.core._nth.call(null,c__25908__auto__,i__31415);
var i = cljs.core.nth.call(null,vec__31423,(0),null);
var s = cljs.core.nth.call(null,vec__31423,(1),null);
var selected_QMARK_ = cljs.core._EQ_.call(null,suggestion_active_index,i);
cljs.core.chunk_append.call(null,b__31416,cljs.core.with_meta(new cljs.core.PersistentVector(null, 7, 5, cljs.core.PersistentVector.EMPTY_NODE, [re_com.box.box,new cljs.core.Keyword(null,"child","child",623967545),(cljs.core.truth_(render_suggestion)?render_suggestion.call(null,s):s),new cljs.core.Keyword(null,"class","class",-2030961996),[cljs.core.str("rc-typeahead-suggestion"),cljs.core.str(((selected_QMARK_)?" active":null))].join(''),new cljs.core.Keyword(null,"attr","attr",-604132353),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"on-mouse-over","on-mouse-over",-858472552),((function (i__31415,selected_QMARK_,vec__31423,i,s,c__25908__auto__,size__25909__auto__,b__31416,s__31414__$2,temp__4657__auto__,map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_){
return (function (){
return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.activate_suggestion_by_index,i);
});})(i__31415,selected_QMARK_,vec__31423,i,s,c__25908__auto__,size__25909__auto__,b__31416,s__31414__$2,temp__4657__auto__,map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_))
,new cljs.core.Keyword(null,"on-mouse-down","on-mouse-down",1147755470),((function (i__31415,selected_QMARK_,vec__31423,i,s,c__25908__auto__,size__25909__auto__,b__31416,s__31414__$2,temp__4657__auto__,map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_){
return (function (p1__31401_SHARP_){
p1__31401_SHARP_.preventDefault();

return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.choose_suggestion_by_index,i);
});})(i__31415,selected_QMARK_,vec__31423,i,s,c__25908__auto__,size__25909__auto__,b__31416,s__31414__$2,temp__4657__auto__,map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_))
], null)], null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"key","key",-1516042587),i], null)));

var G__31433 = (i__31415 + (1));
i__31415 = G__31433;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__31416),re_com$typeahead$iter__31413.call(null,cljs.core.chunk_rest.call(null,s__31414__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__31416),null);
}
} else {
var vec__31426 = cljs.core.first.call(null,s__31414__$2);
var i = cljs.core.nth.call(null,vec__31426,(0),null);
var s = cljs.core.nth.call(null,vec__31426,(1),null);
var selected_QMARK_ = cljs.core._EQ_.call(null,suggestion_active_index,i);
return cljs.core.cons.call(null,cljs.core.with_meta(new cljs.core.PersistentVector(null, 7, 5, cljs.core.PersistentVector.EMPTY_NODE, [re_com.box.box,new cljs.core.Keyword(null,"child","child",623967545),(cljs.core.truth_(render_suggestion)?render_suggestion.call(null,s):s),new cljs.core.Keyword(null,"class","class",-2030961996),[cljs.core.str("rc-typeahead-suggestion"),cljs.core.str(((selected_QMARK_)?" active":null))].join(''),new cljs.core.Keyword(null,"attr","attr",-604132353),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"on-mouse-over","on-mouse-over",-858472552),((function (selected_QMARK_,vec__31426,i,s,s__31414__$2,temp__4657__auto__,map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_){
return (function (){
return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.activate_suggestion_by_index,i);
});})(selected_QMARK_,vec__31426,i,s,s__31414__$2,temp__4657__auto__,map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_))
,new cljs.core.Keyword(null,"on-mouse-down","on-mouse-down",1147755470),((function (selected_QMARK_,vec__31426,i,s,s__31414__$2,temp__4657__auto__,map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_){
return (function (p1__31401_SHARP_){
p1__31401_SHARP_.preventDefault();

return cljs.core.swap_BANG_.call(null,state_atom,re_com.typeahead.choose_suggestion_by_index,i);
});})(selected_QMARK_,vec__31426,i,s,s__31414__$2,temp__4657__auto__,map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_))
], null)], null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"key","key",-1516042587),i], null)),re_com$typeahead$iter__31413.call(null,cljs.core.rest.call(null,s__31414__$2)));
}
} else {
return null;
}
break;
}
});})(map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_))
,null,null));
});})(map__31411,map__31411__$1,state__$1,suggestions,waiting_QMARK_,suggestion_active_index,external_model,last_data_source,latest_external_model,width__$1,map__31409,map__31409__$1,args__$1,disabled_QMARK_,status_icon_QMARK_,height,status_tooltip,model,suggestion_to_string,placeholder,render_suggestion,rigid_QMARK___$1,width,data_source__$1,style,status,class$,map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_))
;
return iter__25910__auto__.call(null,cljs.core.map.call(null,cljs.core.vector,cljs.core.range.call(null),suggestions));
})()], null)], null):null)], null)], null);
};
var G__31432 = function (var_args){
var p__31408 = null;
if (arguments.length > 0) {
var G__31434__i = 0, G__31434__a = new Array(arguments.length -  0);
while (G__31434__i < G__31434__a.length) {G__31434__a[G__31434__i] = arguments[G__31434__i + 0]; ++G__31434__i;}
  p__31408 = new cljs.core.IndexedSeq(G__31434__a,0);
} 
return G__31432__delegate.call(this,p__31408);};
G__31432.cljs$lang$maxFixedArity = 0;
G__31432.cljs$lang$applyTo = (function (arglist__31435){
var p__31408 = cljs.core.seq(arglist__31435);
return G__31432__delegate(p__31408);
});
G__31432.cljs$core$IFn$_invoke$arity$variadic = G__31432__delegate;
return G__31432;
})()
;
;})(map__31406,map__31406__$1,state,c_search,c_input,state_atom,input_text_model,map__31404,map__31404__$1,args,data_source,on_change,rigid_QMARK_,change_on_blur_QMARK_))
});

re_com.typeahead.typeahead.cljs$lang$maxFixedArity = (0);

re_com.typeahead.typeahead.cljs$lang$applyTo = (function (seq31402){
return re_com.typeahead.typeahead.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq31402));
});

/**
 * Return a channel which will receive a value from the `in` channel only
 *   if no further value is received on the `in` channel in the next `ms` milliseconds.
 */
re_com.typeahead.debounce = (function re_com$typeahead$debounce(in$,ms){
var out = cljs.core.async.chan.call(null);
var c__28364__auto___31602 = cljs.core.async.chan.call(null,(1));
cljs.core.async.impl.dispatch.run.call(null,((function (c__28364__auto___31602,out){
return (function (){
var f__28365__auto__ = (function (){var switch__28252__auto__ = ((function (c__28364__auto___31602,out){
return (function (state_31569){
var state_val_31570 = (state_31569[(1)]);
if((state_val_31570 === (7))){
var inst_31524 = (state_31569[(2)]);
var state_31569__$1 = state_31569;
var statearr_31571_31603 = state_31569__$1;
(statearr_31571_31603[(2)] = inst_31524);

(statearr_31571_31603[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (1))){
var inst_31519 = null;
var state_31569__$1 = (function (){var statearr_31572 = state_31569;
(statearr_31572[(7)] = inst_31519);

return statearr_31572;
})();
var statearr_31573_31604 = state_31569__$1;
(statearr_31573_31604[(2)] = null);

(statearr_31573_31604[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (4))){
var state_31569__$1 = state_31569;
return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_31569__$1,(7),in$);
} else {
if((state_val_31570 === (15))){
var inst_31554 = (state_31569[(2)]);
var state_31569__$1 = (function (){var statearr_31574 = state_31569;
(statearr_31574[(8)] = inst_31554);

return statearr_31574;
})();
var statearr_31575_31605 = state_31569__$1;
(statearr_31575_31605[(2)] = null);

(statearr_31575_31605[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (13))){
var inst_31542 = (state_31569[(9)]);
var inst_31556 = cljs.core._EQ_.call(null,inst_31542,new cljs.core.Keyword(null,"default","default",-1987822328));
var state_31569__$1 = state_31569;
if(inst_31556){
var statearr_31576_31606 = state_31569__$1;
(statearr_31576_31606[(1)] = (16));

} else {
var statearr_31577_31607 = state_31569__$1;
(statearr_31577_31607[(1)] = (17));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (6))){
var inst_31528 = (state_31569[(10)]);
var inst_31527 = (state_31569[(2)]);
var inst_31528__$1 = cljs.core.async.timeout.call(null,ms);
var inst_31536 = cljs.core.PersistentVector.EMPTY_NODE;
var inst_31537 = [in$,inst_31528__$1];
var inst_31538 = (new cljs.core.PersistentVector(null,2,(5),inst_31536,inst_31537,null));
var state_31569__$1 = (function (){var statearr_31578 = state_31569;
(statearr_31578[(10)] = inst_31528__$1);

(statearr_31578[(11)] = inst_31527);

return statearr_31578;
})();
return cljs.core.async.ioc_alts_BANG_.call(null,state_31569__$1,(8),inst_31538);
} else {
if((state_val_31570 === (17))){
var state_31569__$1 = state_31569;
var statearr_31579_31608 = state_31569__$1;
(statearr_31579_31608[(2)] = null);

(statearr_31579_31608[(1)] = (18));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (3))){
var inst_31567 = (state_31569[(2)]);
var state_31569__$1 = state_31569;
return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_31569__$1,inst_31567);
} else {
if((state_val_31570 === (12))){
var inst_31527 = (state_31569[(11)]);
var state_31569__$1 = state_31569;
return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_31569__$1,(15),out,inst_31527);
} else {
if((state_val_31570 === (2))){
var inst_31519 = (state_31569[(7)]);
var inst_31521 = (inst_31519 == null);
var state_31569__$1 = state_31569;
if(cljs.core.truth_(inst_31521)){
var statearr_31580_31609 = state_31569__$1;
(statearr_31580_31609[(1)] = (4));

} else {
var statearr_31581_31610 = state_31569__$1;
(statearr_31581_31610[(1)] = (5));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (11))){
var inst_31564 = (state_31569[(2)]);
var inst_31519 = inst_31564;
var state_31569__$1 = (function (){var statearr_31582 = state_31569;
(statearr_31582[(7)] = inst_31519);

return statearr_31582;
})();
var statearr_31583_31611 = state_31569__$1;
(statearr_31583_31611[(2)] = null);

(statearr_31583_31611[(1)] = (2));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (9))){
var inst_31540 = (state_31569[(12)]);
var inst_31548 = cljs.core.nth.call(null,inst_31540,(0),null);
var inst_31549 = cljs.core.nth.call(null,inst_31540,(1),null);
var state_31569__$1 = (function (){var statearr_31584 = state_31569;
(statearr_31584[(13)] = inst_31549);

return statearr_31584;
})();
var statearr_31585_31612 = state_31569__$1;
(statearr_31585_31612[(2)] = inst_31548);

(statearr_31585_31612[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (5))){
var inst_31519 = (state_31569[(7)]);
var state_31569__$1 = state_31569;
var statearr_31586_31613 = state_31569__$1;
(statearr_31586_31613[(2)] = inst_31519);

(statearr_31586_31613[(1)] = (6));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (14))){
var inst_31562 = (state_31569[(2)]);
var state_31569__$1 = state_31569;
var statearr_31587_31614 = state_31569__$1;
(statearr_31587_31614[(2)] = inst_31562);

(statearr_31587_31614[(1)] = (11));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (16))){
var inst_31541 = (state_31569[(14)]);
var state_31569__$1 = state_31569;
var statearr_31588_31615 = state_31569__$1;
(statearr_31588_31615[(2)] = inst_31541);

(statearr_31588_31615[(1)] = (18));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (10))){
var inst_31528 = (state_31569[(10)]);
var inst_31542 = (state_31569[(9)]);
var inst_31551 = cljs.core._EQ_.call(null,inst_31542,inst_31528);
var state_31569__$1 = state_31569;
if(inst_31551){
var statearr_31589_31616 = state_31569__$1;
(statearr_31589_31616[(1)] = (12));

} else {
var statearr_31590_31617 = state_31569__$1;
(statearr_31590_31617[(1)] = (13));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (18))){
var inst_31560 = (state_31569[(2)]);
var state_31569__$1 = state_31569;
var statearr_31591_31618 = state_31569__$1;
(statearr_31591_31618[(2)] = inst_31560);

(statearr_31591_31618[(1)] = (14));


return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
if((state_val_31570 === (8))){
var inst_31540 = (state_31569[(12)]);
var inst_31542 = (state_31569[(9)]);
var inst_31540__$1 = (state_31569[(2)]);
var inst_31541 = cljs.core.nth.call(null,inst_31540__$1,(0),null);
var inst_31542__$1 = cljs.core.nth.call(null,inst_31540__$1,(1),null);
var inst_31543 = cljs.core._EQ_.call(null,inst_31542__$1,in$);
var state_31569__$1 = (function (){var statearr_31592 = state_31569;
(statearr_31592[(12)] = inst_31540__$1);

(statearr_31592[(14)] = inst_31541);

(statearr_31592[(9)] = inst_31542__$1);

return statearr_31592;
})();
if(inst_31543){
var statearr_31593_31619 = state_31569__$1;
(statearr_31593_31619[(1)] = (9));

} else {
var statearr_31594_31620 = state_31569__$1;
(statearr_31594_31620[(1)] = (10));

}

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
});})(c__28364__auto___31602,out))
;
return ((function (switch__28252__auto__,c__28364__auto___31602,out){
return (function() {
var re_com$typeahead$debounce_$_state_machine__28253__auto__ = null;
var re_com$typeahead$debounce_$_state_machine__28253__auto____0 = (function (){
var statearr_31598 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(statearr_31598[(0)] = re_com$typeahead$debounce_$_state_machine__28253__auto__);

(statearr_31598[(1)] = (1));

return statearr_31598;
});
var re_com$typeahead$debounce_$_state_machine__28253__auto____1 = (function (state_31569){
while(true){
var ret_value__28254__auto__ = (function (){try{while(true){
var result__28255__auto__ = switch__28252__auto__.call(null,state_31569);
if(cljs.core.keyword_identical_QMARK_.call(null,result__28255__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
continue;
} else {
return result__28255__auto__;
}
break;
}
}catch (e31599){if((e31599 instanceof Object)){
var ex__28256__auto__ = e31599;
var statearr_31600_31621 = state_31569;
(statearr_31600_31621[(5)] = ex__28256__auto__);


cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_31569);

return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
throw e31599;

}
}})();
if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__28254__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){
var G__31622 = state_31569;
state_31569 = G__31622;
continue;
} else {
return ret_value__28254__auto__;
}
break;
}
});
re_com$typeahead$debounce_$_state_machine__28253__auto__ = function(state_31569){
switch(arguments.length){
case 0:
return re_com$typeahead$debounce_$_state_machine__28253__auto____0.call(this);
case 1:
return re_com$typeahead$debounce_$_state_machine__28253__auto____1.call(this,state_31569);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
re_com$typeahead$debounce_$_state_machine__28253__auto__.cljs$core$IFn$_invoke$arity$0 = re_com$typeahead$debounce_$_state_machine__28253__auto____0;
re_com$typeahead$debounce_$_state_machine__28253__auto__.cljs$core$IFn$_invoke$arity$1 = re_com$typeahead$debounce_$_state_machine__28253__auto____1;
return re_com$typeahead$debounce_$_state_machine__28253__auto__;
})()
;})(switch__28252__auto__,c__28364__auto___31602,out))
})();
var state__28366__auto__ = (function (){var statearr_31601 = f__28365__auto__.call(null);
(statearr_31601[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__28364__auto___31602);

return statearr_31601;
})();
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__28366__auto__);
});})(c__28364__auto___31602,out))
);


return out;
});

//# sourceMappingURL=typeahead.js.map?rel=1603199194022