goog.provide('emptyhead.idea.property');
/**
 * Returns a set of all properties associated with `idea`.
 */
emptyhead.idea.property.properties = (function emptyhead$idea$property$properties(idea){
return emptyhead.idea.protocol.val_fn((function (p1__19868_SHARP_){
return cljs.core.get_in.cljs$core$IFn$_invoke$arity$2(p1__19868_SHARP_,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"_meta","_meta",937543236),new cljs.core.Keyword(null,"_properties","_properties",-1501471594)], null));
}),idea);
});
/**
 * Returns a set of all ideas with `property`.
 */
emptyhead.idea.property.with_property = (function emptyhead$idea$property$with_property(property){
return cljs.core.get_in.cljs$core$IFn$_invoke$arity$2(cljs.core.deref(emptyhead.idea.state.state),cljs.core.concat.cljs$core$IFn$_invoke$arity$variadic(new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"_properties","_properties",-1501471594)], null),property,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"_node","_node",-620154476)], null)], 0)));
});
/**
 * Returns the single idea with `property`.
 */
emptyhead.idea.property.just_property = (function emptyhead$idea$property$just_property(property){
return cljs.core.first(emptyhead.idea.property.with_property(property));
});
/**
 * Returns true if and only if `property` is associated with `idea`.
 */
emptyhead.idea.property.has_property_QMARK_ = (function emptyhead$idea$property$has_property_QMARK_(idea,property){
return cljs.core.contains_QMARK_(emptyhead.idea.property.properties(idea),property);
});
/**
 * Associate one or more `properties` to an `idea`.
 */
emptyhead.idea.property.register_property_BANG_ = (function emptyhead$idea$property$register_property_BANG_(var_args){
var args__5732__auto__ = [];
var len__5726__auto___19890 = arguments.length;
var i__5727__auto___19891 = (0);
while(true){
if((i__5727__auto___19891 < len__5726__auto___19890)){
args__5732__auto__.push((arguments[i__5727__auto___19891]));

var G__19892 = (i__5727__auto___19891 + (1));
i__5727__auto___19891 = G__19892;
continue;
} else {
}
break;
}

var argseq__5733__auto__ = ((((1) < args__5732__auto__.length))?(new cljs.core.IndexedSeq(args__5732__auto__.slice((1)),(0),null)):null);
return emptyhead.idea.property.register_property_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5733__auto__);
});

(emptyhead.idea.property.register_property_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (idea,properties){
var property = cljs.core.first(properties);
var tail = cljs.core.rest(properties);
var iref = emptyhead.idea.protocol.reference(idea);
if(cljs.core.truth_(property)){
cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (acc,property__$1){
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$variadic(emptyhead.idea.state.state,cljs.core.update_in,cljs.core.conj.cljs$core$IFn$_invoke$arity$variadic(acc,property__$1,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.Keyword(null,"_node","_node",-620154476)], 0)),cljs.core.fnil.cljs$core$IFn$_invoke$arity$2(cljs.core.conj,cljs.core.PersistentHashSet.EMPTY),cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([iref], 0));

cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$variadic(emptyhead.idea.state.state,cljs.core.update_in,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [iref,new cljs.core.Keyword(null,"_meta","_meta",937543236),new cljs.core.Keyword(null,"_properties","_properties",-1501471594)], null),cljs.core.fnil.cljs$core$IFn$_invoke$arity$2(cljs.core.conj,cljs.core.PersistentHashSet.EMPTY),cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([cljs.core.conj.cljs$core$IFn$_invoke$arity$2(cljs.core.vec(cljs.core.rest(acc)),property__$1)], 0));

return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(acc,property__$1);
}),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"_properties","_properties",-1501471594)], null),property);
} else {
}

if(tail){
cljs.core.run_BANG_((function (p1__19871_SHARP_){
return emptyhead.idea.property.register_property_BANG_.cljs$core$IFn$_invoke$arity$variadic(idea,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([p1__19871_SHARP_], 0));
}),tail);
} else {
}

return iref;
}));

(emptyhead.idea.property.register_property_BANG_.cljs$lang$maxFixedArity = (1));

/** @this {Function} */
(emptyhead.idea.property.register_property_BANG_.cljs$lang$applyTo = (function (seq19874){
var G__19875 = cljs.core.first(seq19874);
var seq19874__$1 = cljs.core.next(seq19874);
var self__5711__auto__ = this;
return self__5711__auto__.cljs$core$IFn$_invoke$arity$variadic(G__19875,seq19874__$1);
}));

emptyhead.idea.property.remove_property_node_BANG_ = (function emptyhead$idea$property$remove_property_node_BANG_(idea,property){
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$variadic(emptyhead.idea.state.state,cljs.core.update_in,cljs.core.concat.cljs$core$IFn$_invoke$arity$variadic(new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"_properties","_properties",-1501471594)], null),property,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"_node","_node",-620154476)], null)], 0)),cljs.core.disj,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([emptyhead.idea.protocol.reference(idea)], 0));

return emptyhead.idea.protocol.reference(idea);
});
emptyhead.idea.property.child_properties = (function emptyhead$idea$property$child_properties(property){
return cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (p1__19885_SHARP_){
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(property,p1__19885_SHARP_);
}),cljs.core.disj.cljs$core$IFn$_invoke$arity$2(cljs.core.set(cljs.core.keys(cljs.core.get_in.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"_properties","_properties",-1501471594).cljs$core$IFn$_invoke$arity$1(cljs.core.deref(emptyhead.idea.state.state)),property))),new cljs.core.Keyword(null,"_node","_node",-620154476)));
});
emptyhead.idea.property.rm_prop_BANG_ = (function emptyhead$idea$property$rm_prop_BANG_(idea,property){
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$variadic(emptyhead.idea.state.state,cljs.core.update_in,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [idea,new cljs.core.Keyword(null,"_meta","_meta",937543236),new cljs.core.Keyword(null,"_properties","_properties",-1501471594)], null),cljs.core.disj,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([property], 0));

emptyhead.idea.property.remove_property_node_BANG_(idea,property);

var children = clojure.set.intersection.cljs$core$IFn$_invoke$arity$2(cljs.core.set(emptyhead.idea.property.child_properties(property)),emptyhead.idea.property.properties(idea));
return cljs.core.run_BANG_((function (p1__19886_SHARP_){
return (emptyhead.idea.property.rm_prop_BANG_.cljs$core$IFn$_invoke$arity$2 ? emptyhead.idea.property.rm_prop_BANG_.cljs$core$IFn$_invoke$arity$2(idea,p1__19886_SHARP_) : emptyhead.idea.property.rm_prop_BANG_.call(null, idea,p1__19886_SHARP_));
}),children);
});
/**
 * Dissociate one or more `properties` from `idea`.
 */
emptyhead.idea.property.remove_property_BANG_ = (function emptyhead$idea$property$remove_property_BANG_(var_args){
var args__5732__auto__ = [];
var len__5726__auto___19895 = arguments.length;
var i__5727__auto___19896 = (0);
while(true){
if((i__5727__auto___19896 < len__5726__auto___19895)){
args__5732__auto__.push((arguments[i__5727__auto___19896]));

var G__19897 = (i__5727__auto___19896 + (1));
i__5727__auto___19896 = G__19897;
continue;
} else {
}
break;
}

var argseq__5733__auto__ = ((((1) < args__5732__auto__.length))?(new cljs.core.IndexedSeq(args__5732__auto__.slice((1)),(0),null)):null);
return emptyhead.idea.property.remove_property_BANG_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__5733__auto__);
});

(emptyhead.idea.property.remove_property_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (idea,properties){
cljs.core.run_BANG_((function (p1__19887_SHARP_){
return emptyhead.idea.protocol.ref_fn.cljs$core$IFn$_invoke$arity$variadic(emptyhead.idea.property.rm_prop_BANG_,idea,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([p1__19887_SHARP_], 0));
}),properties);

return emptyhead.idea.protocol.reference(idea);
}));

(emptyhead.idea.property.remove_property_BANG_.cljs$lang$maxFixedArity = (1));

/** @this {Function} */
(emptyhead.idea.property.remove_property_BANG_.cljs$lang$applyTo = (function (seq19888){
var G__19889 = cljs.core.first(seq19888);
var seq19888__$1 = cljs.core.next(seq19888);
var self__5711__auto__ = this;
return self__5711__auto__.cljs$core$IFn$_invoke$arity$variadic(G__19889,seq19888__$1);
}));


//# sourceMappingURL=emptyhead.idea.property.js.map
