// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('reagent.session');
goog.require('cljs.core');
goog.require('cljs.core.constants');
goog.require('reagent.core');
reagent.session.state = reagent.core.atom.cljs$core$IFn$_invoke$arity$1(cljs.core.PersistentArrayMap.EMPTY);
/**
 * Get the key's value from the session, returns nil if it doesn't exist.
 */
reagent.session.get = (function reagent$session$get(var_args){
var args__5775__auto__ = [];
var len__5769__auto___7528 = arguments.length;
var i__5770__auto___7529 = (0);
while(true){
if((i__5770__auto___7529 < len__5769__auto___7528)){
args__5775__auto__.push((arguments[i__5770__auto___7529]));

var G__7530 = (i__5770__auto___7529 + (1));
i__5770__auto___7529 = G__7530;
continue;
} else {
}
break;
}

var argseq__5776__auto__ = ((((1) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((1)),(0),null)):null);
return reagent.session.get.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5776__auto__);
});

(reagent.session.get.cljs$core$IFn$_invoke$arity$variadic = (function (k,p__7524){
var vec__7525 = p__7524;
var default$ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__7525,(0),null);
return cljs.core.get.cljs$core$IFn$_invoke$arity$3(cljs.core.deref(reagent.session.state),k,default$);
}));

(reagent.session.get.cljs$lang$maxFixedArity = (1));

/** @this {Function} */
(reagent.session.get.cljs$lang$applyTo = (function (seq7522){
var G__7523 = cljs.core.first(seq7522);
var seq7522__$1 = cljs.core.next(seq7522);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__7523,seq7522__$1);
}));

reagent.session.put_BANG_ = (function reagent$session$put_BANG_(k,v){
return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$4(reagent.session.state,cljs.core.assoc,k,v);
});
/**
 * Gets the value at the path specified by the vector ks from the session,
 *   returns nil if it doesn't exist.
 */
reagent.session.get_in = (function reagent$session$get_in(var_args){
var args__5775__auto__ = [];
var len__5769__auto___7537 = arguments.length;
var i__5770__auto___7538 = (0);
while(true){
if((i__5770__auto___7538 < len__5769__auto___7537)){
args__5775__auto__.push((arguments[i__5770__auto___7538]));

var G__7539 = (i__5770__auto___7538 + (1));
i__5770__auto___7538 = G__7539;
continue;
} else {
}
break;
}

var argseq__5776__auto__ = ((((1) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((1)),(0),null)):null);
return reagent.session.get_in.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5776__auto__);
});

(reagent.session.get_in.cljs$core$IFn$_invoke$arity$variadic = (function (ks,p__7533){
var vec__7534 = p__7533;
var default$ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__7534,(0),null);
return cljs.core.get_in.cljs$core$IFn$_invoke$arity$3(cljs.core.deref(reagent.session.state),ks,default$);
}));

(reagent.session.get_in.cljs$lang$maxFixedArity = (1));

/** @this {Function} */
(reagent.session.get_in.cljs$lang$applyTo = (function (seq7531){
var G__7532 = cljs.core.first(seq7531);
var seq7531__$1 = cljs.core.next(seq7531);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__7532,seq7531__$1);
}));

/**
 * Replace the current session's value with the result of executing f with
 *   the current value and args.
 */
reagent.session.swap_BANG_ = (function reagent$session$swap_BANG_(var_args){
var args__5775__auto__ = [];
var len__5769__auto___7542 = arguments.length;
var i__5770__auto___7543 = (0);
while(true){
if((i__5770__auto___7543 < len__5769__auto___7542)){
args__5775__auto__.push((arguments[i__5770__auto___7543]));

var G__7544 = (i__5770__auto___7543 + (1));
i__5770__auto___7543 = G__7544;
continue;
} else {
}
break;
}

var argseq__5776__auto__ = ((((1) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((1)),(0),null)):null);
return reagent.session.swap_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5776__auto__);
});

(reagent.session.swap_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (f,args){
return cljs.core.apply.cljs$core$IFn$_invoke$arity$4(cljs.core.swap_BANG_,reagent.session.state,f,args);
}));

(reagent.session.swap_BANG_.cljs$lang$maxFixedArity = (1));

/** @this {Function} */
(reagent.session.swap_BANG_.cljs$lang$applyTo = (function (seq7540){
var G__7541 = cljs.core.first(seq7540);
var seq7540__$1 = cljs.core.next(seq7540);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__7541,seq7540__$1);
}));

/**
 * Remove all data from the session and start over cleanly.
 */
reagent.session.clear_BANG_ = (function reagent$session$clear_BANG_(){
return cljs.core.reset_BANG_(reagent.session.state,cljs.core.PersistentArrayMap.EMPTY);
});
reagent.session.reset_BANG_ = (function reagent$session$reset_BANG_(m){
return cljs.core.reset_BANG_(reagent.session.state,m);
});
/**
 * Remove a key from the session
 */
reagent.session.remove_BANG_ = (function reagent$session$remove_BANG_(k){
return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$3(reagent.session.state,cljs.core.dissoc,k);
});
/**
 * Associates a value in the session, where ks is a
 * sequence of keys and v is the new value and returns
 * a new nested structure. If any levels do not exist,
 * hash-maps will be created.
 */
reagent.session.assoc_in_BANG_ = (function reagent$session$assoc_in_BANG_(ks,v){
return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(reagent.session.state,(function (p1__7545_SHARP_){
return cljs.core.assoc_in(p1__7545_SHARP_,ks,v);
}));
});
/**
 * Destructive get from the session. This returns the current value of the key
 *   and then removes it from the session.
 */
reagent.session.get_BANG_ = (function reagent$session$get_BANG_(var_args){
var args__5775__auto__ = [];
var len__5769__auto___7552 = arguments.length;
var i__5770__auto___7553 = (0);
while(true){
if((i__5770__auto___7553 < len__5769__auto___7552)){
args__5775__auto__.push((arguments[i__5770__auto___7553]));

var G__7554 = (i__5770__auto___7553 + (1));
i__5770__auto___7553 = G__7554;
continue;
} else {
}
break;
}

var argseq__5776__auto__ = ((((1) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((1)),(0),null)):null);
return reagent.session.get_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5776__auto__);
});

(reagent.session.get_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (k,p__7548){
var vec__7549 = p__7548;
var default$ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__7549,(0),null);
var cur = reagent.session.get.cljs$core$IFn$_invoke$arity$variadic(k,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([default$], 0));
reagent.session.remove_BANG_(k);

return cur;
}));

(reagent.session.get_BANG_.cljs$lang$maxFixedArity = (1));

/** @this {Function} */
(reagent.session.get_BANG_.cljs$lang$applyTo = (function (seq7546){
var G__7547 = cljs.core.first(seq7546);
var seq7546__$1 = cljs.core.next(seq7546);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__7547,seq7546__$1);
}));

/**
 * Destructive get from the session. This returns the current value of the path
 *   specified by the vector ks and then removes it from the session.
 */
reagent.session.get_in_BANG_ = (function reagent$session$get_in_BANG_(var_args){
var args__5775__auto__ = [];
var len__5769__auto___7561 = arguments.length;
var i__5770__auto___7562 = (0);
while(true){
if((i__5770__auto___7562 < len__5769__auto___7561)){
args__5775__auto__.push((arguments[i__5770__auto___7562]));

var G__7563 = (i__5770__auto___7562 + (1));
i__5770__auto___7562 = G__7563;
continue;
} else {
}
break;
}

var argseq__5776__auto__ = ((((1) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((1)),(0),null)):null);
return reagent.session.get_in_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5776__auto__);
});

(reagent.session.get_in_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (ks,p__7557){
var vec__7558 = p__7557;
var default$ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__7558,(0),null);
var cur = cljs.core.get_in.cljs$core$IFn$_invoke$arity$3(cljs.core.deref(reagent.session.state),ks,default$);
reagent.session.assoc_in_BANG_(ks,null);

return cur;
}));

(reagent.session.get_in_BANG_.cljs$lang$maxFixedArity = (1));

/** @this {Function} */
(reagent.session.get_in_BANG_.cljs$lang$applyTo = (function (seq7555){
var G__7556 = cljs.core.first(seq7555);
var seq7555__$1 = cljs.core.next(seq7555);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__7556,seq7555__$1);
}));

/**
 * Updates a value in session where k is a key and f
 * is the function that takes the old value along with any
 * supplied args and return the new value. If key is not
 * present it will be added.
 */
reagent.session.update_BANG_ = (function reagent$session$update_BANG_(var_args){
var args__5775__auto__ = [];
var len__5769__auto___7568 = arguments.length;
var i__5770__auto___7569 = (0);
while(true){
if((i__5770__auto___7569 < len__5769__auto___7568)){
args__5775__auto__.push((arguments[i__5770__auto___7569]));

var G__7570 = (i__5770__auto___7569 + (1));
i__5770__auto___7569 = G__7570;
continue;
} else {
}
break;
}

var argseq__5776__auto__ = ((((2) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((2)),(0),null)):null);
return reagent.session.update_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__5776__auto__);
});

(reagent.session.update_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (k,f,args){
return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(reagent.session.state,(function (p1__7564_SHARP_){
return cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.partial.cljs$core$IFn$_invoke$arity$4(cljs.core.update,p1__7564_SHARP_,k,f),args);
}));
}));

(reagent.session.update_BANG_.cljs$lang$maxFixedArity = (2));

/** @this {Function} */
(reagent.session.update_BANG_.cljs$lang$applyTo = (function (seq7565){
var G__7566 = cljs.core.first(seq7565);
var seq7565__$1 = cljs.core.next(seq7565);
var G__7567 = cljs.core.first(seq7565__$1);
var seq7565__$2 = cljs.core.next(seq7565__$1);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__7566,G__7567,seq7565__$2);
}));

/**
 * 'Updates a value in the session, where ks is a
 * sequence of keys and f is a function that will
 * take the old value along with any supplied args and return
 * the new value. If any levels do not exist, hash-maps
 * will be created.
 */
reagent.session.update_in_BANG_ = (function reagent$session$update_in_BANG_(var_args){
var args__5775__auto__ = [];
var len__5769__auto___7575 = arguments.length;
var i__5770__auto___7576 = (0);
while(true){
if((i__5770__auto___7576 < len__5769__auto___7575)){
args__5775__auto__.push((arguments[i__5770__auto___7576]));

var G__7577 = (i__5770__auto___7576 + (1));
i__5770__auto___7576 = G__7577;
continue;
} else {
}
break;
}

var argseq__5776__auto__ = ((((2) < args__5775__auto__.length))?(new cljs.core.IndexedSeq(args__5775__auto__.slice((2)),(0),null)):null);
return reagent.session.update_in_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__5776__auto__);
});

(reagent.session.update_in_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (ks,f,args){
return cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2(reagent.session.state,(function (p1__7571_SHARP_){
return cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.partial.cljs$core$IFn$_invoke$arity$4(cljs.core.update_in,p1__7571_SHARP_,ks,f),args);
}));
}));

(reagent.session.update_in_BANG_.cljs$lang$maxFixedArity = (2));

/** @this {Function} */
(reagent.session.update_in_BANG_.cljs$lang$applyTo = (function (seq7572){
var G__7573 = cljs.core.first(seq7572);
var seq7572__$1 = cljs.core.next(seq7572);
var G__7574 = cljs.core.first(seq7572__$1);
var seq7572__$2 = cljs.core.next(seq7572__$1);
var self__5754__auto__ = this;
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__7573,G__7574,seq7572__$2);
}));

