// Compiled by ClojureScript 1.10.520 {}
goog.provide('hoplon.jquery');
goog.require('cljs.core');
goog.require('hoplon.core');
hoplon.jquery.set_attributes_BANG_ = (function hoplon$jquery$set_attributes_BANG_(var_args){
var G__30746 = arguments.length;
switch (G__30746) {
case 2:
return hoplon.jquery.set_attributes_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
var args_arr__4751__auto__ = [];
var len__4730__auto___30766 = arguments.length;
var i__4731__auto___30767 = (0);
while(true){
if((i__4731__auto___30767 < len__4730__auto___30766)){
args_arr__4751__auto__.push((arguments[i__4731__auto___30767]));

var G__30768 = (i__4731__auto___30767 + (1));
i__4731__auto___30767 = G__30768;
continue;
} else {
}
break;
}

var argseq__4752__auto__ = (new cljs.core.IndexedSeq(args_arr__4751__auto__.slice((3)),(0),null));
return hoplon.jquery.set_attributes_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),argseq__4752__auto__);

}
});

hoplon.jquery.set_attributes_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (this$,kvs){
var e = jQuery(this$);
var seq__30747 = cljs.core.seq.call(null,kvs);
var chunk__30749 = null;
var count__30750 = (0);
var i__30751 = (0);
while(true){
if((i__30751 < count__30750)){
var vec__30759 = cljs.core._nth.call(null,chunk__30749,i__30751);
var k = cljs.core.nth.call(null,vec__30759,(0),null);
var v = cljs.core.nth.call(null,vec__30759,(1),null);
var k_30769__$1 = cljs.core.name.call(null,k);
if(cljs.core._EQ_.call(null,false,v)){
e.removeAttr(k_30769__$1);
} else {
e.attr(k_30769__$1,((cljs.core._EQ_.call(null,true,v))?k_30769__$1:v));
}


var G__30770 = seq__30747;
var G__30771 = chunk__30749;
var G__30772 = count__30750;
var G__30773 = (i__30751 + (1));
seq__30747 = G__30770;
chunk__30749 = G__30771;
count__30750 = G__30772;
i__30751 = G__30773;
continue;
} else {
var temp__5720__auto__ = cljs.core.seq.call(null,seq__30747);
if(temp__5720__auto__){
var seq__30747__$1 = temp__5720__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__30747__$1)){
var c__4550__auto__ = cljs.core.chunk_first.call(null,seq__30747__$1);
var G__30774 = cljs.core.chunk_rest.call(null,seq__30747__$1);
var G__30775 = c__4550__auto__;
var G__30776 = cljs.core.count.call(null,c__4550__auto__);
var G__30777 = (0);
seq__30747 = G__30774;
chunk__30749 = G__30775;
count__30750 = G__30776;
i__30751 = G__30777;
continue;
} else {
var vec__30762 = cljs.core.first.call(null,seq__30747__$1);
var k = cljs.core.nth.call(null,vec__30762,(0),null);
var v = cljs.core.nth.call(null,vec__30762,(1),null);
var k_30778__$1 = cljs.core.name.call(null,k);
if(cljs.core._EQ_.call(null,false,v)){
e.removeAttr(k_30778__$1);
} else {
e.attr(k_30778__$1,((cljs.core._EQ_.call(null,true,v))?k_30778__$1:v));
}


var G__30779 = cljs.core.next.call(null,seq__30747__$1);
var G__30780 = null;
var G__30781 = (0);
var G__30782 = (0);
seq__30747 = G__30779;
chunk__30749 = G__30780;
count__30750 = G__30781;
i__30751 = G__30782;
continue;
}
} else {
return null;
}
}
break;
}
});

hoplon.jquery.set_attributes_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (this$,k,v,kvs){
return hoplon.jquery.set_attributes_BANG_.call(null,this$,cljs.core.apply.call(null,cljs.core.hash_map,k,v,kvs));
});

/** @this {Function} */
hoplon.jquery.set_attributes_BANG_.cljs$lang$applyTo = (function (seq30742){
var G__30743 = cljs.core.first.call(null,seq30742);
var seq30742__$1 = cljs.core.next.call(null,seq30742);
var G__30744 = cljs.core.first.call(null,seq30742__$1);
var seq30742__$2 = cljs.core.next.call(null,seq30742__$1);
var G__30745 = cljs.core.first.call(null,seq30742__$2);
var seq30742__$3 = cljs.core.next.call(null,seq30742__$2);
var self__4717__auto__ = this;
return self__4717__auto__.cljs$core$IFn$_invoke$arity$variadic(G__30743,G__30744,G__30745,seq30742__$3);
});

hoplon.jquery.set_attributes_BANG_.cljs$lang$maxFixedArity = (3);

hoplon.jquery.set_styles_BANG_ = (function hoplon$jquery$set_styles_BANG_(var_args){
var G__30788 = arguments.length;
switch (G__30788) {
case 2:
return hoplon.jquery.set_styles_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
var args_arr__4751__auto__ = [];
var len__4730__auto___30806 = arguments.length;
var i__4731__auto___30807 = (0);
while(true){
if((i__4731__auto___30807 < len__4730__auto___30806)){
args_arr__4751__auto__.push((arguments[i__4731__auto___30807]));

var G__30808 = (i__4731__auto___30807 + (1));
i__4731__auto___30807 = G__30808;
continue;
} else {
}
break;
}

var argseq__4752__auto__ = (new cljs.core.IndexedSeq(args_arr__4751__auto__.slice((3)),(0),null));
return hoplon.jquery.set_styles_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),argseq__4752__auto__);

}
});

hoplon.jquery.set_styles_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (this$,kvs){
var e = jQuery(this$);
var seq__30789 = cljs.core.seq.call(null,kvs);
var chunk__30790 = null;
var count__30791 = (0);
var i__30792 = (0);
while(true){
if((i__30792 < count__30791)){
var vec__30799 = cljs.core._nth.call(null,chunk__30790,i__30792);
var k = cljs.core.nth.call(null,vec__30799,(0),null);
var v = cljs.core.nth.call(null,vec__30799,(1),null);
e.css(cljs.core.name.call(null,k),cljs.core.str.cljs$core$IFn$_invoke$arity$1(v));


var G__30809 = seq__30789;
var G__30810 = chunk__30790;
var G__30811 = count__30791;
var G__30812 = (i__30792 + (1));
seq__30789 = G__30809;
chunk__30790 = G__30810;
count__30791 = G__30811;
i__30792 = G__30812;
continue;
} else {
var temp__5720__auto__ = cljs.core.seq.call(null,seq__30789);
if(temp__5720__auto__){
var seq__30789__$1 = temp__5720__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__30789__$1)){
var c__4550__auto__ = cljs.core.chunk_first.call(null,seq__30789__$1);
var G__30813 = cljs.core.chunk_rest.call(null,seq__30789__$1);
var G__30814 = c__4550__auto__;
var G__30815 = cljs.core.count.call(null,c__4550__auto__);
var G__30816 = (0);
seq__30789 = G__30813;
chunk__30790 = G__30814;
count__30791 = G__30815;
i__30792 = G__30816;
continue;
} else {
var vec__30802 = cljs.core.first.call(null,seq__30789__$1);
var k = cljs.core.nth.call(null,vec__30802,(0),null);
var v = cljs.core.nth.call(null,vec__30802,(1),null);
e.css(cljs.core.name.call(null,k),cljs.core.str.cljs$core$IFn$_invoke$arity$1(v));


var G__30817 = cljs.core.next.call(null,seq__30789__$1);
var G__30818 = null;
var G__30819 = (0);
var G__30820 = (0);
seq__30789 = G__30817;
chunk__30790 = G__30818;
count__30791 = G__30819;
i__30792 = G__30820;
continue;
}
} else {
return null;
}
}
break;
}
});

hoplon.jquery.set_styles_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (this$,k,v,kvs){
return hoplon.jquery.set_styles_BANG_.call(null,this$,cljs.core.apply.call(null,cljs.core.hash_map,k,v,kvs));
});

/** @this {Function} */
hoplon.jquery.set_styles_BANG_.cljs$lang$applyTo = (function (seq30784){
var G__30785 = cljs.core.first.call(null,seq30784);
var seq30784__$1 = cljs.core.next.call(null,seq30784);
var G__30786 = cljs.core.first.call(null,seq30784__$1);
var seq30784__$2 = cljs.core.next.call(null,seq30784__$1);
var G__30787 = cljs.core.first.call(null,seq30784__$2);
var seq30784__$3 = cljs.core.next.call(null,seq30784__$2);
var self__4717__auto__ = this;
return self__4717__auto__.cljs$core$IFn$_invoke$arity$variadic(G__30785,G__30786,G__30787,seq30784__$3);
});

hoplon.jquery.set_styles_BANG_.cljs$lang$maxFixedArity = (3);

hoplon.jquery.text_val_BANG_ = (function hoplon$jquery$text_val_BANG_(var_args){
var G__30822 = arguments.length;
switch (G__30822) {
case 1:
return hoplon.jquery.text_val_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return hoplon.jquery.text_val_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

hoplon.jquery.text_val_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (e){
return e.val();
});

hoplon.jquery.text_val_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (e,v){
var v__$1 = cljs.core.str.cljs$core$IFn$_invoke$arity$1(v);
if(cljs.core.not_EQ_.call(null,v__$1,hoplon.jquery.text_val_BANG_.call(null,e))){
return e.val(v__$1);
} else {
return null;
}
});

hoplon.jquery.text_val_BANG_.cljs$lang$maxFixedArity = 2;

hoplon.jquery.check_val_BANG_ = (function hoplon$jquery$check_val_BANG_(var_args){
var G__30825 = arguments.length;
switch (G__30825) {
case 1:
return hoplon.jquery.check_val_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));

break;
case 2:
return hoplon.jquery.check_val_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));

}
});

hoplon.jquery.check_val_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (e){
return e.is(":checked");
});

hoplon.jquery.check_val_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (e,v){
return e.prop("checked",cljs.core.boolean$.call(null,v));
});

hoplon.jquery.check_val_BANG_.cljs$lang$maxFixedArity = 2;

cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("hoplon.core","default","hoplon.core/default",-778824365),(function (elem,key,val){
return hoplon.core.do_BANG_.call(null,elem,new cljs.core.Keyword(null,"attr","attr",-604132353),cljs.core.PersistentArrayMap.createAsIfByAssoc([key,val]));
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("css","*","css/*",-1295355419),(function (elem,key,val){
return hoplon.jquery.set_styles_BANG_.call(null,elem,key,val);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("html","*","html/*",-1283138243),(function (elem,key,val){
return hoplon.jquery.set_attributes_BANG_.call(null,elem,key,val);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("svg","*","svg/*",-1295405562),(function (elem,key,val){
return hoplon.jquery.set_attributes_BANG_.call(null,elem,key,val);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("attr","*","attr/*",-1283077225),(function (elem,_,kvs){
return hoplon.jquery.set_attributes_BANG_.call(null,elem,kvs);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("prop","*","prop/*",-1283942139),(function (elem,key,val){
var e = jQuery(elem);
return e.prop(cljs.core.name.call(null,key),val);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword("data","*","data/*",-1283013312),(function (elem,key,val){
var e = jQuery(elem);
return e.data(cljs.core.name.call(null,key),val);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"attr","attr",-604132353),(function (elem,_,kvs){
return hoplon.jquery.set_attributes_BANG_.call(null,elem,kvs);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"css","css",1135045163),(function (elem,_,kvs){
return hoplon.jquery.set_styles_BANG_.call(null,elem,kvs);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"value","value",305978217),(function() { 
var G__30827__delegate = function (elem,_,args){
var e = jQuery(elem);
return cljs.core.apply.call(null,((cljs.core._EQ_.call(null,"checkbox",e.attr("type")))?hoplon.jquery.check_val_BANG_:hoplon.jquery.text_val_BANG_),e,args);
};
var G__30827 = function (elem,_,var_args){
var args = null;
if (arguments.length > 2) {
var G__30828__i = 0, G__30828__a = new Array(arguments.length -  2);
while (G__30828__i < G__30828__a.length) {G__30828__a[G__30828__i] = arguments[G__30828__i + 2]; ++G__30828__i;}
  args = new cljs.core.IndexedSeq(G__30828__a,0,null);
} 
return G__30827__delegate.call(this,elem,_,args);};
G__30827.cljs$lang$maxFixedArity = 2;
G__30827.cljs$lang$applyTo = (function (arglist__30829){
var elem = cljs.core.first(arglist__30829);
arglist__30829 = cljs.core.next(arglist__30829);
var _ = cljs.core.first(arglist__30829);
var args = cljs.core.rest(arglist__30829);
return G__30827__delegate(elem,_,args);
});
G__30827.cljs$core$IFn$_invoke$arity$variadic = G__30827__delegate;
return G__30827;
})()
);
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"class","class",-2030961996),(function (elem,_,kvs){
var elem__$1 = jQuery(elem);
var clmap = hoplon.core.normalize_class.call(null,kvs);
var seq__30830 = cljs.core.seq.call(null,clmap);
var chunk__30831 = null;
var count__30832 = (0);
var i__30833 = (0);
while(true){
if((i__30833 < count__30832)){
var vec__30840 = cljs.core._nth.call(null,chunk__30831,i__30833);
var c = cljs.core.nth.call(null,vec__30840,(0),null);
var p_QMARK_ = cljs.core.nth.call(null,vec__30840,(1),null);
elem__$1.toggleClass(cljs.core.name.call(null,c),cljs.core.boolean$.call(null,p_QMARK_));


var G__30846 = seq__30830;
var G__30847 = chunk__30831;
var G__30848 = count__30832;
var G__30849 = (i__30833 + (1));
seq__30830 = G__30846;
chunk__30831 = G__30847;
count__30832 = G__30848;
i__30833 = G__30849;
continue;
} else {
var temp__5720__auto__ = cljs.core.seq.call(null,seq__30830);
if(temp__5720__auto__){
var seq__30830__$1 = temp__5720__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__30830__$1)){
var c__4550__auto__ = cljs.core.chunk_first.call(null,seq__30830__$1);
var G__30850 = cljs.core.chunk_rest.call(null,seq__30830__$1);
var G__30851 = c__4550__auto__;
var G__30852 = cljs.core.count.call(null,c__4550__auto__);
var G__30853 = (0);
seq__30830 = G__30850;
chunk__30831 = G__30851;
count__30832 = G__30852;
i__30833 = G__30853;
continue;
} else {
var vec__30843 = cljs.core.first.call(null,seq__30830__$1);
var c = cljs.core.nth.call(null,vec__30843,(0),null);
var p_QMARK_ = cljs.core.nth.call(null,vec__30843,(1),null);
elem__$1.toggleClass(cljs.core.name.call(null,c),cljs.core.boolean$.call(null,p_QMARK_));


var G__30854 = cljs.core.next.call(null,seq__30830__$1);
var G__30855 = null;
var G__30856 = (0);
var G__30857 = (0);
seq__30830 = G__30854;
chunk__30831 = G__30855;
count__30832 = G__30856;
i__30833 = G__30857;
continue;
}
} else {
return null;
}
}
break;
}
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"toggle","toggle",1291842030),(function (elem,_,v){
return jQuery(elem).toggle(cljs.core.boolean$.call(null,v));
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"slide-toggle","slide-toggle",968641513),(function (elem,_,v){
if(cljs.core.truth_(v)){
return jQuery(elem).hide().slideDown("fast");
} else {
return jQuery(elem).slideUp("fast");
}
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"fade-toggle","fade-toggle",-1468421852),(function (elem,_,v){
if(cljs.core.truth_(v)){
return jQuery(elem).hide().fadeIn("fast");
} else {
return jQuery(elem).fadeOut("fast");
}
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"focus","focus",234677911),(function (elem,_,v){
return setTimeout((function (){
if(cljs.core.truth_(v)){
return jQuery(elem).focus();
} else {
return jQuery(elem).focusout();
}
}),(0));
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"select","select",1147833503),(function (elem,_,___$1){
return jQuery(elem).select();
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"focus-select","focus-select",1107982934),(function (elem,_,v){
if(cljs.core.truth_(v)){
hoplon.core.do_BANG_.call(null,elem,new cljs.core.Keyword(null,"focus","focus",234677911),v);

return hoplon.core.do_BANG_.call(null,elem,new cljs.core.Keyword(null,"select","select",1147833503),v);
} else {
return null;
}
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"text","text",-1790561697),(function (elem,_,v){
return jQuery(elem).text(cljs.core.str.cljs$core$IFn$_invoke$arity$1(v));
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"html","html",-998796897),(function (elem,_,v){
return jQuery(elem).html(v);
}));
cljs.core._add_method.call(null,hoplon.core.do_BANG_,new cljs.core.Keyword(null,"scroll-to","scroll-to",-34957602),(function (elem,_,v){
if(cljs.core.truth_(v)){
var body = jQuery("body,html");
var elem__$1 = jQuery(elem);
return body.animate(cljs.core.clj__GT_js.call(null,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"scrollTop","scrollTop",-1143661921),elem__$1.offset().top], null)));
} else {
return null;
}
}));
jQuery.Event.prototype.cljs$core$IDeref$ = cljs.core.PROTOCOL_SENTINEL;

jQuery.Event.prototype.cljs$core$IDeref$_deref$arity$1 = (function (this$){
var this$__$1 = this;
return jQuery(this$__$1.target).val();
});
cljs.core._add_method.call(null,hoplon.core.on_BANG_,new cljs.core.Keyword("hoplon.core","default","hoplon.core/default",-778824365),(function (elem,event,callback){
return hoplon.core.when_dom.call(null,elem,(function (){
return jQuery(elem).on(cljs.core.name.call(null,event),callback);
}));
}));
cljs.core._add_method.call(null,hoplon.core.on_BANG_,new cljs.core.Keyword("html","*","html/*",-1283138243),(function (elem,event,callback){
return hoplon.core.when_dom.call(null,elem,(function (){
return jQuery(elem).on(cljs.core.name.call(null,event),callback);
}));
}));
