// Compiled by ClojureScript 1.9.562 {:target :nodejs}
goog.provide('weathergen.util');
goog.require('cljs.core');
/**
 * Convert a string to a long. Returns nil when it can't be parsed.
 */
weathergen.util.str__GT_long = (function weathergen$util$str__GT_long(s){
var n = (new Number(s)).valueOf();
if(cljs.core.int_QMARK_.call(null,n)){
return cljs.core.long$.call(null,n);
} else {
return null;
}
});
/**
 * Concatenates `colls` into a vector. Order of elements is preserved.
 */
weathergen.util.concatv = (function weathergen$util$concatv(var_args){
var args__24566__auto__ = [];
var len__24559__auto___28992 = arguments.length;
var i__24560__auto___28993 = (0);
while(true){
if((i__24560__auto___28993 < len__24559__auto___28992)){
args__24566__auto__.push((arguments[i__24560__auto___28993]));

var G__28996 = (i__24560__auto___28993 + (1));
i__24560__auto___28993 = G__28996;
continue;
} else {
}
break;
}

var argseq__24567__auto__ = ((((0) < args__24566__auto__.length))?(new cljs.core.IndexedSeq(args__24566__auto__.slice((0)),(0),null)):null);
return weathergen.util.concatv.cljs$core$IFn$_invoke$arity$variadic(argseq__24567__auto__);
});

weathergen.util.concatv.cljs$core$IFn$_invoke$arity$variadic = (function (colls){
return cljs.core.reduce.call(null,cljs.core.into,cljs.core.PersistentVector.EMPTY,colls);
});

weathergen.util.concatv.cljs$lang$maxFixedArity = (0);

weathergen.util.concatv.cljs$lang$applyTo = (function (seq28990){
return weathergen.util.concatv.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq28990));
});

/**
 * Filters `coll` for an x where `(f x)` is equal to `val`
 */
weathergen.util.filter_EQ_ = (function weathergen$util$filter_EQ_(f,val,coll){
return cljs.core.filter.call(null,(function (p1__29001_SHARP_){
return cljs.core._EQ_.call(null,f.call(null,p1__29001_SHARP_),val);
}),coll);
});
/**
 * Returns the first element of a sequence, or nil if it's empty, or
 *   throws an exception if there is more than one element.
 */
weathergen.util.only = (function weathergen$util$only(coll){
if(cljs.core.empty_QMARK_.call(null,coll)){
return null;
} else {
if(cljs.core.empty_QMARK_.call(null,cljs.core.rest.call(null,coll))){
return cljs.core.first.call(null,coll);
} else {
throw cljs.core.ex_info.call(null,"Sequence had more than one item",new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"reason","reason",-2070751759),new cljs.core.Keyword(null,"not-singular","not-singular",1360522305),new cljs.core.Keyword(null,"coll","coll",1647737163),coll], null));

}
}
});
/**
 * Like take-while, but also includes the first item where `pred`
 *   returns true.
 */
weathergen.util.take_until = (function weathergen$util$take_until(pred,coll){
if(cljs.core.empty_QMARK_.call(null,coll)){
return coll;
} else {
if(cljs.core.truth_(pred.call(null,cljs.core.first.call(null,coll)))){
return cljs.core.take.call(null,(1),coll);
} else {
var vec__29013 = cljs.core.partition_by.call(null,pred,coll);
var head = cljs.core.nth.call(null,vec__29013,(0),null);
var next = cljs.core.nth.call(null,vec__29013,(1),null);
return cljs.core.concat.call(null,head,cljs.core.take.call(null,(1),next));

}
}
});
/**
 * If `x` is a member of `s`, remove it. Otherwise, add it.
 */
weathergen.util.toggle_set_membership = (function weathergen$util$toggle_set_membership(s,x){
var op = ((cljs.core.contains_QMARK_.call(null,s,x))?cljs.core.disj:cljs.core.conj);
return op.call(null,s,x);
});
/**
 * Returns true if all of the bits set in `mask` are also set in `x`.
 */
weathergen.util.has_flag_QMARK_ = (function weathergen$util$has_flag_QMARK_(x,mask){
return cljs.core._EQ_.call(null,(x & mask),mask);
});
