remove old clojurescript stuff
This commit is contained in:
parent
9f47292e1b
commit
2818de4494
|
@ -1,201 +0,0 @@
|
|||
goog.provide('cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection');
|
||||
goog.scope(function(){
|
||||
cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.goog$module$goog$object = goog.module.get('goog.object');
|
||||
});
|
||||
cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.own_property_descriptors = (cljs.core.truth_("getOwnPropertyDescriptors" in Object)?(function (obj){
|
||||
return Object.getOwnPropertyDescriptors(obj);
|
||||
}):(function (obj){
|
||||
return cljs.core.clj__GT_js(cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (key){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [key,Object.getOwnPropertyDescriptor(obj,key)], null);
|
||||
}),Object.getOwnPropertyNames(obj))));
|
||||
}));
|
||||
/**
|
||||
*
|
||||
*/
|
||||
cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.properties_by_prototype = (function cider$nrepl$inlined$deps$suitable$v0v4v1$suitable$js_introspection$properties_by_prototype(obj){
|
||||
var obj__$1 = obj;
|
||||
var protos = cljs.core.PersistentVector.EMPTY;
|
||||
while(true){
|
||||
if(cljs.core.truth_(obj__$1)){
|
||||
var G__18156 = Object.getPrototypeOf(obj__$1);
|
||||
var G__18157 = cljs.core.conj.cljs$core$IFn$_invoke$arity$2(protos,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"obj","obj",981763962),obj__$1,new cljs.core.Keyword(null,"props","props",453281727),cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.own_property_descriptors(obj__$1)], null));
|
||||
obj__$1 = G__18156;
|
||||
protos = G__18157;
|
||||
continue;
|
||||
} else {
|
||||
return protos;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.property_names_and_types = (function cider$nrepl$inlined$deps$suitable$v0v4v1$suitable$js_introspection$property_names_and_types(var_args){
|
||||
var G__18143 = arguments.length;
|
||||
switch (G__18143) {
|
||||
case 1:
|
||||
return cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.property_names_and_types.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
break;
|
||||
case 2:
|
||||
return cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.property_names_and_types.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('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.property_names_and_types.cljs$core$IFn$_invoke$arity$1 = (function (js_obj){
|
||||
return cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.property_names_and_types.cljs$core$IFn$_invoke$arity$2(js_obj,null);
|
||||
}));
|
||||
|
||||
(cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.property_names_and_types.cljs$core$IFn$_invoke$arity$2 = (function (js_obj,prefix){
|
||||
var seen = cljs.core.transient$(cljs.core.PersistentHashSet.EMPTY);
|
||||
var iter__5523__auto__ = (function cider$nrepl$inlined$deps$suitable$v0v4v1$suitable$js_introspection$iter__18144(s__18145){
|
||||
return (new cljs.core.LazySeq(null,(function (){
|
||||
var s__18145__$1 = s__18145;
|
||||
while(true){
|
||||
var temp__5804__auto__ = cljs.core.seq(s__18145__$1);
|
||||
if(temp__5804__auto__){
|
||||
var xs__6360__auto__ = temp__5804__auto__;
|
||||
var vec__18150 = cljs.core.first(xs__6360__auto__);
|
||||
var i = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18150,(0),null);
|
||||
var map__18153 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18150,(1),null);
|
||||
var map__18153__$1 = cljs.core.__destructure_map(map__18153);
|
||||
var _obj = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18153__$1,new cljs.core.Keyword(null,"_obj","_obj",-592966725));
|
||||
var props = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18153__$1,new cljs.core.Keyword(null,"props","props",453281727));
|
||||
var iterys__5519__auto__ = ((function (s__18145__$1,vec__18150,i,map__18153,map__18153__$1,_obj,props,xs__6360__auto__,temp__5804__auto__,seen){
|
||||
return (function cider$nrepl$inlined$deps$suitable$v0v4v1$suitable$js_introspection$iter__18144_$_iter__18146(s__18147){
|
||||
return (new cljs.core.LazySeq(null,((function (s__18145__$1,vec__18150,i,map__18153,map__18153__$1,_obj,props,xs__6360__auto__,temp__5804__auto__,seen){
|
||||
return (function (){
|
||||
var s__18147__$1 = s__18147;
|
||||
while(true){
|
||||
var temp__5804__auto____$1 = cljs.core.seq(s__18147__$1);
|
||||
if(temp__5804__auto____$1){
|
||||
var s__18147__$2 = temp__5804__auto____$1;
|
||||
if(cljs.core.chunked_seq_QMARK_(s__18147__$2)){
|
||||
var c__5521__auto__ = cljs.core.chunk_first(s__18147__$2);
|
||||
var size__5522__auto__ = cljs.core.count(c__5521__auto__);
|
||||
var b__18149 = cljs.core.chunk_buffer(size__5522__auto__);
|
||||
if((function (){var i__18148 = (0);
|
||||
while(true){
|
||||
if((i__18148 < size__5522__auto__)){
|
||||
var key = cljs.core._nth(c__5521__auto__,i__18148);
|
||||
if(((cljs.core.not(cljs.core.get.cljs$core$IFn$_invoke$arity$2(seen,key))) && (((cljs.core.empty_QMARK_(prefix)) || (clojure.string.starts_with_QMARK_(key,prefix)))))){
|
||||
cljs.core.chunk_append(b__18149,(function (){var prop = cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.goog$module$goog$object.get(props,key);
|
||||
cljs.core.conj_BANG_.cljs$core$IFn$_invoke$arity$2(seen,key);
|
||||
|
||||
return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"name","name",1843675177),key,new cljs.core.Keyword(null,"hierarchy","hierarchy",-1053470341),i,new cljs.core.Keyword(null,"type","type",1174270348),(function (){try{var temp__5802__auto__ = (function (){var or__5045__auto__ = cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.goog$module$goog$object.get(prop,"value");
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
return cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.goog$module$goog$object.get(prop,"get"),cljs.core.PersistentVector.EMPTY);
|
||||
}
|
||||
})();
|
||||
if(cljs.core.truth_(temp__5802__auto__)){
|
||||
var value = temp__5802__auto__;
|
||||
if(cljs.core.fn_QMARK_(value)){
|
||||
return "function";
|
||||
} else {
|
||||
return "var";
|
||||
}
|
||||
} else {
|
||||
return "var";
|
||||
}
|
||||
}catch (e18154){if((e18154 instanceof Error)){
|
||||
var _e = e18154;
|
||||
return "var";
|
||||
} else {
|
||||
throw e18154;
|
||||
|
||||
}
|
||||
}})()], null);
|
||||
})());
|
||||
|
||||
var G__18159 = (i__18148 + (1));
|
||||
i__18148 = G__18159;
|
||||
continue;
|
||||
} else {
|
||||
var G__18160 = (i__18148 + (1));
|
||||
i__18148 = G__18160;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
})()){
|
||||
return cljs.core.chunk_cons(cljs.core.chunk(b__18149),cider$nrepl$inlined$deps$suitable$v0v4v1$suitable$js_introspection$iter__18144_$_iter__18146(cljs.core.chunk_rest(s__18147__$2)));
|
||||
} else {
|
||||
return cljs.core.chunk_cons(cljs.core.chunk(b__18149),null);
|
||||
}
|
||||
} else {
|
||||
var key = cljs.core.first(s__18147__$2);
|
||||
if(((cljs.core.not(cljs.core.get.cljs$core$IFn$_invoke$arity$2(seen,key))) && (((cljs.core.empty_QMARK_(prefix)) || (clojure.string.starts_with_QMARK_(key,prefix)))))){
|
||||
return cljs.core.cons((function (){var prop = cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.goog$module$goog$object.get(props,key);
|
||||
cljs.core.conj_BANG_.cljs$core$IFn$_invoke$arity$2(seen,key);
|
||||
|
||||
return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"name","name",1843675177),key,new cljs.core.Keyword(null,"hierarchy","hierarchy",-1053470341),i,new cljs.core.Keyword(null,"type","type",1174270348),(function (){try{var temp__5802__auto__ = (function (){var or__5045__auto__ = cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.goog$module$goog$object.get(prop,"value");
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
return cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.goog$module$goog$object.get(prop,"get"),cljs.core.PersistentVector.EMPTY);
|
||||
}
|
||||
})();
|
||||
if(cljs.core.truth_(temp__5802__auto__)){
|
||||
var value = temp__5802__auto__;
|
||||
if(cljs.core.fn_QMARK_(value)){
|
||||
return "function";
|
||||
} else {
|
||||
return "var";
|
||||
}
|
||||
} else {
|
||||
return "var";
|
||||
}
|
||||
}catch (e18155){if((e18155 instanceof Error)){
|
||||
var _e = e18155;
|
||||
return "var";
|
||||
} else {
|
||||
throw e18155;
|
||||
|
||||
}
|
||||
}})()], null);
|
||||
})(),cider$nrepl$inlined$deps$suitable$v0v4v1$suitable$js_introspection$iter__18144_$_iter__18146(cljs.core.rest(s__18147__$2)));
|
||||
} else {
|
||||
var G__18161 = cljs.core.rest(s__18147__$2);
|
||||
s__18147__$1 = G__18161;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});})(s__18145__$1,vec__18150,i,map__18153,map__18153__$1,_obj,props,xs__6360__auto__,temp__5804__auto__,seen))
|
||||
,null,null));
|
||||
});})(s__18145__$1,vec__18150,i,map__18153,map__18153__$1,_obj,props,xs__6360__auto__,temp__5804__auto__,seen))
|
||||
;
|
||||
var fs__5520__auto__ = cljs.core.seq(iterys__5519__auto__(cljs.core.js_keys(props)));
|
||||
if(fs__5520__auto__){
|
||||
return cljs.core.concat.cljs$core$IFn$_invoke$arity$2(fs__5520__auto__,cider$nrepl$inlined$deps$suitable$v0v4v1$suitable$js_introspection$iter__18144(cljs.core.rest(s__18145__$1)));
|
||||
} else {
|
||||
var G__18162 = cljs.core.rest(s__18145__$1);
|
||||
s__18145__$1 = G__18162;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}),null,null));
|
||||
});
|
||||
return iter__5523__auto__(cljs.core.map_indexed.cljs$core$IFn$_invoke$arity$2(cljs.core.vector,cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.properties_by_prototype(js_obj)));
|
||||
}));
|
||||
|
||||
(cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.property_names_and_types.cljs$lang$maxFixedArity = 2);
|
||||
|
||||
|
||||
//# sourceMappingURL=cider.nrepl.inlined.deps.suitable.v0v4v1.suitable.js_introspection.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,462 +0,0 @@
|
|||
goog.provide('cljs.core.async.impl.buffers');
|
||||
cljs.core.async.impl.buffers.acopy = (function cljs$core$async$impl$buffers$acopy(src,src_start,dest,dest_start,len){
|
||||
var cnt = (0);
|
||||
while(true){
|
||||
if((cnt < len)){
|
||||
(dest[(dest_start + cnt)] = (src[(src_start + cnt)]));
|
||||
|
||||
var G__12457 = (cnt + (1));
|
||||
cnt = G__12457;
|
||||
continue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
cljs.core.async.impl.buffers.RingBuffer = (function (head,tail,length,arr){
|
||||
this.head = head;
|
||||
this.tail = tail;
|
||||
this.length = length;
|
||||
this.arr = arr;
|
||||
});
|
||||
(cljs.core.async.impl.buffers.RingBuffer.prototype.pop = (function (){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
if((self__.length === (0))){
|
||||
return null;
|
||||
} else {
|
||||
var x = (self__.arr[self__.tail]);
|
||||
(self__.arr[self__.tail] = null);
|
||||
|
||||
(self__.tail = ((self__.tail + (1)) % self__.arr.length));
|
||||
|
||||
(self__.length = (self__.length - (1)));
|
||||
|
||||
return x;
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.RingBuffer.prototype.unshift = (function (x){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
(self__.arr[self__.head] = x);
|
||||
|
||||
(self__.head = ((self__.head + (1)) % self__.arr.length));
|
||||
|
||||
(self__.length = (self__.length + (1)));
|
||||
|
||||
return null;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.RingBuffer.prototype.unbounded_unshift = (function (x){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
if(((self__.length + (1)) === self__.arr.length)){
|
||||
this$.resize();
|
||||
} else {
|
||||
}
|
||||
|
||||
return this$.unshift(x);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.RingBuffer.prototype.resize = (function (){
|
||||
var self__ = this;
|
||||
var _ = this;
|
||||
var new_arr_size = (self__.arr.length * (2));
|
||||
var new_arr = (new Array(new_arr_size));
|
||||
if((self__.tail < self__.head)){
|
||||
cljs.core.async.impl.buffers.acopy(self__.arr,self__.tail,new_arr,(0),self__.length);
|
||||
|
||||
(self__.tail = (0));
|
||||
|
||||
(self__.head = self__.length);
|
||||
|
||||
return (self__.arr = new_arr);
|
||||
} else {
|
||||
if((self__.tail > self__.head)){
|
||||
cljs.core.async.impl.buffers.acopy(self__.arr,self__.tail,new_arr,(0),(self__.arr.length - self__.tail));
|
||||
|
||||
cljs.core.async.impl.buffers.acopy(self__.arr,(0),new_arr,(self__.arr.length - self__.tail),self__.head);
|
||||
|
||||
(self__.tail = (0));
|
||||
|
||||
(self__.head = self__.length);
|
||||
|
||||
return (self__.arr = new_arr);
|
||||
} else {
|
||||
if((self__.tail === self__.head)){
|
||||
(self__.tail = (0));
|
||||
|
||||
(self__.head = (0));
|
||||
|
||||
return (self__.arr = new_arr);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.RingBuffer.prototype.cleanup = (function (keep_QMARK_){
|
||||
var self__ = this;
|
||||
var this$ = this;
|
||||
var n__5636__auto__ = self__.length;
|
||||
var x = (0);
|
||||
while(true){
|
||||
if((x < n__5636__auto__)){
|
||||
var v_12464 = this$.pop();
|
||||
if((keep_QMARK_.cljs$core$IFn$_invoke$arity$1 ? keep_QMARK_.cljs$core$IFn$_invoke$arity$1(v_12464) : keep_QMARK_.call(null,v_12464))){
|
||||
this$.unshift(v_12464);
|
||||
} else {
|
||||
}
|
||||
|
||||
var G__12465 = (x + (1));
|
||||
x = G__12465;
|
||||
continue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.RingBuffer.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"head","head",869147608,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"tail","tail",494507963,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"length","length",-2065447907,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"arr","arr",2115492975,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.RingBuffer.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.buffers.RingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/RingBuffer");
|
||||
|
||||
(cljs.core.async.impl.buffers.RingBuffer.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.buffers/RingBuffer");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.buffers/RingBuffer.
|
||||
*/
|
||||
cljs.core.async.impl.buffers.__GT_RingBuffer = (function cljs$core$async$impl$buffers$__GT_RingBuffer(head,tail,length,arr){
|
||||
return (new cljs.core.async.impl.buffers.RingBuffer(head,tail,length,arr));
|
||||
});
|
||||
|
||||
cljs.core.async.impl.buffers.ring_buffer = (function cljs$core$async$impl$buffers$ring_buffer(n){
|
||||
if((n > (0))){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ","Can't create a ring buffer of size 0","\n","(> n 0)"].join('')));
|
||||
}
|
||||
|
||||
return (new cljs.core.async.impl.buffers.RingBuffer((0),(0),(0),(new Array(n))));
|
||||
});
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {cljs.core.ICounted}
|
||||
* @implements {cljs.core.async.impl.protocols.Buffer}
|
||||
*/
|
||||
cljs.core.async.impl.buffers.FixedBuffer = (function (buf,n){
|
||||
this.buf = buf;
|
||||
this.n = n;
|
||||
this.cljs$lang$protocol_mask$partition0$ = 2;
|
||||
this.cljs$lang$protocol_mask$partition1$ = 0;
|
||||
});
|
||||
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return (self__.buf.length >= self__.n);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return self__.buf.pop();
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
self__.buf.unbounded_unshift(itm);
|
||||
|
||||
return this$__$1;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return null;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return self__.buf.length;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.FixedBuffer.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.Symbol(null,"n","n",-2092305744,null)], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/FixedBuffer");
|
||||
|
||||
(cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.buffers/FixedBuffer");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.buffers/FixedBuffer.
|
||||
*/
|
||||
cljs.core.async.impl.buffers.__GT_FixedBuffer = (function cljs$core$async$impl$buffers$__GT_FixedBuffer(buf,n){
|
||||
return (new cljs.core.async.impl.buffers.FixedBuffer(buf,n));
|
||||
});
|
||||
|
||||
cljs.core.async.impl.buffers.fixed_buffer = (function cljs$core$async$impl$buffers$fixed_buffer(n){
|
||||
return (new cljs.core.async.impl.buffers.FixedBuffer(cljs.core.async.impl.buffers.ring_buffer(n),n));
|
||||
});
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {cljs.core.ICounted}
|
||||
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
|
||||
* @implements {cljs.core.async.impl.protocols.Buffer}
|
||||
*/
|
||||
cljs.core.async.impl.buffers.DroppingBuffer = (function (buf,n){
|
||||
this.buf = buf;
|
||||
this.n = n;
|
||||
this.cljs$lang$protocol_mask$partition0$ = 2;
|
||||
this.cljs$lang$protocol_mask$partition1$ = 0;
|
||||
});
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return false;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return self__.buf.pop();
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
if((self__.buf.length === self__.n)){
|
||||
} else {
|
||||
self__.buf.unshift(itm);
|
||||
}
|
||||
|
||||
return this$__$1;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return null;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return self__.buf.length;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.Symbol(null,"n","n",-2092305744,null)], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/DroppingBuffer");
|
||||
|
||||
(cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.buffers/DroppingBuffer");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.buffers/DroppingBuffer.
|
||||
*/
|
||||
cljs.core.async.impl.buffers.__GT_DroppingBuffer = (function cljs$core$async$impl$buffers$__GT_DroppingBuffer(buf,n){
|
||||
return (new cljs.core.async.impl.buffers.DroppingBuffer(buf,n));
|
||||
});
|
||||
|
||||
cljs.core.async.impl.buffers.dropping_buffer = (function cljs$core$async$impl$buffers$dropping_buffer(n){
|
||||
return (new cljs.core.async.impl.buffers.DroppingBuffer(cljs.core.async.impl.buffers.ring_buffer(n),n));
|
||||
});
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {cljs.core.ICounted}
|
||||
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
|
||||
* @implements {cljs.core.async.impl.protocols.Buffer}
|
||||
*/
|
||||
cljs.core.async.impl.buffers.SlidingBuffer = (function (buf,n){
|
||||
this.buf = buf;
|
||||
this.n = n;
|
||||
this.cljs$lang$protocol_mask$partition0$ = 2;
|
||||
this.cljs$lang$protocol_mask$partition1$ = 0;
|
||||
});
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return false;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return self__.buf.pop();
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
if((self__.buf.length === self__.n)){
|
||||
this$__$1.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null);
|
||||
} else {
|
||||
}
|
||||
|
||||
self__.buf.unshift(itm);
|
||||
|
||||
return this$__$1;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return null;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
return self__.buf.length;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.Symbol(null,"n","n",-2092305744,null)], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/SlidingBuffer");
|
||||
|
||||
(cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.buffers/SlidingBuffer");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.buffers/SlidingBuffer.
|
||||
*/
|
||||
cljs.core.async.impl.buffers.__GT_SlidingBuffer = (function cljs$core$async$impl$buffers$__GT_SlidingBuffer(buf,n){
|
||||
return (new cljs.core.async.impl.buffers.SlidingBuffer(buf,n));
|
||||
});
|
||||
|
||||
cljs.core.async.impl.buffers.sliding_buffer = (function cljs$core$async$impl$buffers$sliding_buffer(n){
|
||||
return (new cljs.core.async.impl.buffers.SlidingBuffer(cljs.core.async.impl.buffers.ring_buffer(n),n));
|
||||
});
|
||||
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.impl !== 'undefined') && (typeof cljs.core.async.impl.buffers !== 'undefined') && (typeof cljs.core.async.impl.buffers.NO_VAL !== 'undefined')){
|
||||
} else {
|
||||
cljs.core.async.impl.buffers.NO_VAL = (new Object());
|
||||
}
|
||||
cljs.core.async.impl.buffers.undelivered_QMARK_ = (function cljs$core$async$impl$buffers$undelivered_QMARK_(val){
|
||||
return (cljs.core.async.impl.buffers.NO_VAL === val);
|
||||
});
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {cljs.core.ICounted}
|
||||
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
|
||||
* @implements {cljs.core.async.impl.protocols.Buffer}
|
||||
*/
|
||||
cljs.core.async.impl.buffers.PromiseBuffer = (function (val){
|
||||
this.val = val;
|
||||
this.cljs$lang$protocol_mask$partition0$ = 2;
|
||||
this.cljs$lang$protocol_mask$partition1$ = 0;
|
||||
});
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (_){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
return false;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (_){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
return self__.val;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
if(cljs.core.async.impl.buffers.undelivered_QMARK_(self__.val)){
|
||||
(self__.val = itm);
|
||||
} else {
|
||||
}
|
||||
|
||||
return this$__$1;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (_){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
if(cljs.core.async.impl.buffers.undelivered_QMARK_(self__.val)){
|
||||
return (self__.val = null);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (_){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
if(cljs.core.async.impl.buffers.undelivered_QMARK_(self__.val)){
|
||||
return (0);
|
||||
} else {
|
||||
return (1);
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"val","val",1769233139,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/PromiseBuffer");
|
||||
|
||||
(cljs.core.async.impl.buffers.PromiseBuffer.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.buffers/PromiseBuffer");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.buffers/PromiseBuffer.
|
||||
*/
|
||||
cljs.core.async.impl.buffers.__GT_PromiseBuffer = (function cljs$core$async$impl$buffers$__GT_PromiseBuffer(val){
|
||||
return (new cljs.core.async.impl.buffers.PromiseBuffer(val));
|
||||
});
|
||||
|
||||
cljs.core.async.impl.buffers.promise_buffer = (function cljs$core$async$impl$buffers$promise_buffer(){
|
||||
return (new cljs.core.async.impl.buffers.PromiseBuffer(cljs.core.async.impl.buffers.NO_VAL));
|
||||
});
|
||||
|
||||
//# sourceMappingURL=cljs.core.async.impl.buffers.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,682 +0,0 @@
|
|||
goog.provide('cljs.core.async.impl.channels');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {cljs.core.IMeta}
|
||||
* @implements {cljs.core.IDeref}
|
||||
* @implements {cljs.core.IWithMeta}
|
||||
*/
|
||||
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475 = (function (val,meta12476){
|
||||
this.val = val;
|
||||
this.meta12476 = meta12476;
|
||||
this.cljs$lang$protocol_mask$partition0$ = 425984;
|
||||
this.cljs$lang$protocol_mask$partition1$ = 0;
|
||||
});
|
||||
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_12477,meta12476__$1){
|
||||
var self__ = this;
|
||||
var _12477__$1 = this;
|
||||
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475(self__.val,meta12476__$1));
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_12477){
|
||||
var self__ = this;
|
||||
var _12477__$1 = this;
|
||||
return self__.meta12476;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475.prototype.cljs$core$IDeref$_deref$arity$1 = (function (_){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
return self__.val;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"val","val",1769233139,null),new cljs.core.Symbol(null,"meta12476","meta12476",1202178637,null)], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475.cljs$lang$ctorStr = "cljs.core.async.impl.channels/t_cljs$core$async$impl$channels12475");
|
||||
|
||||
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.channels/t_cljs$core$async$impl$channels12475");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.channels/t_cljs$core$async$impl$channels12475.
|
||||
*/
|
||||
cljs.core.async.impl.channels.__GT_t_cljs$core$async$impl$channels12475 = (function cljs$core$async$impl$channels$__GT_t_cljs$core$async$impl$channels12475(val,meta12476){
|
||||
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475(val,meta12476));
|
||||
});
|
||||
|
||||
|
||||
cljs.core.async.impl.channels.box = (function cljs$core$async$impl$channels$box(val){
|
||||
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels12475(val,cljs.core.PersistentArrayMap.EMPTY));
|
||||
});
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
cljs.core.async.impl.channels.PutBox = (function (handler,val){
|
||||
this.handler = handler;
|
||||
this.val = val;
|
||||
});
|
||||
|
||||
(cljs.core.async.impl.channels.PutBox.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"handler","handler",1444934915,null),new cljs.core.Symbol(null,"val","val",1769233139,null)], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.PutBox.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.channels.PutBox.cljs$lang$ctorStr = "cljs.core.async.impl.channels/PutBox");
|
||||
|
||||
(cljs.core.async.impl.channels.PutBox.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.channels/PutBox");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.channels/PutBox.
|
||||
*/
|
||||
cljs.core.async.impl.channels.__GT_PutBox = (function cljs$core$async$impl$channels$__GT_PutBox(handler,val){
|
||||
return (new cljs.core.async.impl.channels.PutBox(handler,val));
|
||||
});
|
||||
|
||||
cljs.core.async.impl.channels.put_active_QMARK_ = (function cljs$core$async$impl$channels$put_active_QMARK_(box){
|
||||
return cljs.core.async.impl.protocols.active_QMARK_(box.handler);
|
||||
});
|
||||
cljs.core.async.impl.channels.MAX_DIRTY = (64);
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
cljs.core.async.impl.channels.MMC = function(){};
|
||||
|
||||
var cljs$core$async$impl$channels$MMC$abort$dyn_12538 = (function (this$){
|
||||
var x__5393__auto__ = (((this$ == null))?null:this$);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.channels.abort[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__5394__auto__.call(null,this$));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.channels.abort["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__5392__auto__.call(null,this$));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("MMC.abort",this$);
|
||||
}
|
||||
}
|
||||
});
|
||||
cljs.core.async.impl.channels.abort = (function cljs$core$async$impl$channels$abort(this$){
|
||||
if((((!((this$ == null)))) && ((!((this$.cljs$core$async$impl$channels$MMC$abort$arity$1 == null)))))){
|
||||
return this$.cljs$core$async$impl$channels$MMC$abort$arity$1(this$);
|
||||
} else {
|
||||
return cljs$core$async$impl$channels$MMC$abort$dyn_12538(this$);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {cljs.core.async.impl.channels.MMC}
|
||||
* @implements {cljs.core.async.impl.protocols.Channel}
|
||||
* @implements {cljs.core.async.impl.protocols.WritePort}
|
||||
* @implements {cljs.core.async.impl.protocols.ReadPort}
|
||||
*/
|
||||
cljs.core.async.impl.channels.ManyToManyChannel = (function (takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_){
|
||||
this.takes = takes;
|
||||
this.dirty_takes = dirty_takes;
|
||||
this.puts = puts;
|
||||
this.dirty_puts = dirty_puts;
|
||||
this.buf = buf;
|
||||
this.closed = closed;
|
||||
this.add_BANG_ = add_BANG_;
|
||||
});
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$channels$MMC$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$channels$MMC$abort$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
while(true){
|
||||
var putter_12539 = self__.puts.pop();
|
||||
if((putter_12539 == null)){
|
||||
} else {
|
||||
var put_handler_12540 = putter_12539.handler;
|
||||
var val_12541 = putter_12539.val;
|
||||
if(put_handler_12540.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)){
|
||||
var put_cb_12542 = put_handler_12540.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
cljs.core.async.impl.dispatch.run(((function (put_cb_12542,put_handler_12540,val_12541,putter_12539,this$__$1){
|
||||
return (function (){
|
||||
return (put_cb_12542.cljs$core$IFn$_invoke$arity$1 ? put_cb_12542.cljs$core$IFn$_invoke$arity$1(true) : put_cb_12542.call(null,true));
|
||||
});})(put_cb_12542,put_handler_12540,val_12541,putter_12539,this$__$1))
|
||||
);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
self__.puts.cleanup(cljs.core.constantly(false));
|
||||
|
||||
return this$__$1.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (this$,val,handler){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
if((!((val == null)))){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ","Can't put nil on a channel","\n","(not (nil? val))"].join('')));
|
||||
}
|
||||
|
||||
var closed__$1 = self__.closed;
|
||||
if((!(handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)))){
|
||||
return cljs.core.async.impl.channels.box((!(closed__$1)));
|
||||
} else {
|
||||
if(closed__$1){
|
||||
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
|
||||
return cljs.core.async.impl.channels.box(false);
|
||||
} else {
|
||||
if(cljs.core.truth_((function (){var and__5043__auto__ = self__.buf;
|
||||
if(cljs.core.truth_(and__5043__auto__)){
|
||||
return cljs.core.not(self__.buf.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(null));
|
||||
} else {
|
||||
return and__5043__auto__;
|
||||
}
|
||||
})())){
|
||||
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
|
||||
var done_QMARK_ = cljs.core.reduced_QMARK_((self__.add_BANG_.cljs$core$IFn$_invoke$arity$2 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$2(self__.buf,val) : self__.add_BANG_.call(null,self__.buf,val)));
|
||||
var take_cbs = (function (){var takers = cljs.core.PersistentVector.EMPTY;
|
||||
while(true){
|
||||
if((((self__.takes.length > (0))) && ((cljs.core.count(self__.buf) > (0))))){
|
||||
var taker = self__.takes.pop();
|
||||
if(taker.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)){
|
||||
var ret = taker.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
var val__$1 = self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null);
|
||||
var G__12547 = cljs.core.conj.cljs$core$IFn$_invoke$arity$2(takers,((function (takers,ret,val__$1,taker,done_QMARK_,closed__$1,this$__$1){
|
||||
return (function (){
|
||||
return (ret.cljs$core$IFn$_invoke$arity$1 ? ret.cljs$core$IFn$_invoke$arity$1(val__$1) : ret.call(null,val__$1));
|
||||
});})(takers,ret,val__$1,taker,done_QMARK_,closed__$1,this$__$1))
|
||||
);
|
||||
takers = G__12547;
|
||||
continue;
|
||||
} else {
|
||||
var G__12548 = takers;
|
||||
takers = G__12548;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
return takers;
|
||||
}
|
||||
break;
|
||||
}
|
||||
})();
|
||||
if(done_QMARK_){
|
||||
this$__$1.cljs$core$async$impl$channels$MMC$abort$arity$1(null);
|
||||
} else {
|
||||
}
|
||||
|
||||
if(cljs.core.seq(take_cbs)){
|
||||
var seq__12513_12549 = cljs.core.seq(take_cbs);
|
||||
var chunk__12514_12550 = null;
|
||||
var count__12515_12551 = (0);
|
||||
var i__12516_12552 = (0);
|
||||
while(true){
|
||||
if((i__12516_12552 < count__12515_12551)){
|
||||
var f_12553 = chunk__12514_12550.cljs$core$IIndexed$_nth$arity$2(null,i__12516_12552);
|
||||
cljs.core.async.impl.dispatch.run(f_12553);
|
||||
|
||||
|
||||
var G__12554 = seq__12513_12549;
|
||||
var G__12555 = chunk__12514_12550;
|
||||
var G__12556 = count__12515_12551;
|
||||
var G__12557 = (i__12516_12552 + (1));
|
||||
seq__12513_12549 = G__12554;
|
||||
chunk__12514_12550 = G__12555;
|
||||
count__12515_12551 = G__12556;
|
||||
i__12516_12552 = G__12557;
|
||||
continue;
|
||||
} else {
|
||||
var temp__5804__auto___12558 = cljs.core.seq(seq__12513_12549);
|
||||
if(temp__5804__auto___12558){
|
||||
var seq__12513_12559__$1 = temp__5804__auto___12558;
|
||||
if(cljs.core.chunked_seq_QMARK_(seq__12513_12559__$1)){
|
||||
var c__5568__auto___12560 = cljs.core.chunk_first(seq__12513_12559__$1);
|
||||
var G__12561 = cljs.core.chunk_rest(seq__12513_12559__$1);
|
||||
var G__12562 = c__5568__auto___12560;
|
||||
var G__12563 = cljs.core.count(c__5568__auto___12560);
|
||||
var G__12564 = (0);
|
||||
seq__12513_12549 = G__12561;
|
||||
chunk__12514_12550 = G__12562;
|
||||
count__12515_12551 = G__12563;
|
||||
i__12516_12552 = G__12564;
|
||||
continue;
|
||||
} else {
|
||||
var f_12565 = cljs.core.first(seq__12513_12559__$1);
|
||||
cljs.core.async.impl.dispatch.run(f_12565);
|
||||
|
||||
|
||||
var G__12566 = cljs.core.next(seq__12513_12559__$1);
|
||||
var G__12567 = null;
|
||||
var G__12568 = (0);
|
||||
var G__12569 = (0);
|
||||
seq__12513_12549 = G__12566;
|
||||
chunk__12514_12550 = G__12567;
|
||||
count__12515_12551 = G__12568;
|
||||
i__12516_12552 = G__12569;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
return cljs.core.async.impl.channels.box(true);
|
||||
} else {
|
||||
var taker = (function (){while(true){
|
||||
var taker = self__.takes.pop();
|
||||
if(cljs.core.truth_(taker)){
|
||||
if(cljs.core.truth_(taker.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null))){
|
||||
return taker;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
})();
|
||||
if(cljs.core.truth_(taker)){
|
||||
var take_cb = taker.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
|
||||
cljs.core.async.impl.dispatch.run((function (){
|
||||
return (take_cb.cljs$core$IFn$_invoke$arity$1 ? take_cb.cljs$core$IFn$_invoke$arity$1(val) : take_cb.call(null,val));
|
||||
}));
|
||||
|
||||
return cljs.core.async.impl.channels.box(true);
|
||||
} else {
|
||||
if((self__.dirty_puts > (64))){
|
||||
(self__.dirty_puts = (0));
|
||||
|
||||
self__.puts.cleanup(cljs.core.async.impl.channels.put_active_QMARK_);
|
||||
} else {
|
||||
(self__.dirty_puts = (self__.dirty_puts + (1)));
|
||||
}
|
||||
|
||||
if(cljs.core.truth_(handler.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1(null))){
|
||||
if((self__.puts.length < (1024))){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",["No more than ",cljs.core.str.cljs$core$IFn$_invoke$arity$1((1024))," pending puts are allowed on a single channel."," Consider using a windowed buffer."].join(''),"\n","(< (.-length puts) impl/MAX-QUEUE-SIZE)"].join('')));
|
||||
}
|
||||
|
||||
self__.puts.unbounded_unshift((new cljs.core.async.impl.channels.PutBox(handler,val)));
|
||||
} else {
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (this$,handler){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
if((!(handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)))){
|
||||
return null;
|
||||
} else {
|
||||
if((((!((self__.buf == null)))) && ((cljs.core.count(self__.buf) > (0))))){
|
||||
var temp__5802__auto__ = handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
if(cljs.core.truth_(temp__5802__auto__)){
|
||||
var take_cb = temp__5802__auto__;
|
||||
var val = self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null);
|
||||
var vec__12519 = ((((cljs.core.not(self__.buf.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(null))) && ((self__.puts.length > (0)))))?(function (){var cbs = cljs.core.PersistentVector.EMPTY;
|
||||
while(true){
|
||||
var putter = self__.puts.pop();
|
||||
var put_handler = putter.handler;
|
||||
var val__$1 = putter.val;
|
||||
var cb = (function (){var and__5043__auto__ = put_handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null);
|
||||
if(and__5043__auto__){
|
||||
return put_handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
} else {
|
||||
return and__5043__auto__;
|
||||
}
|
||||
})();
|
||||
var cbs__$1 = (cljs.core.truth_(cb)?cljs.core.conj.cljs$core$IFn$_invoke$arity$2(cbs,cb):cbs);
|
||||
var done_QMARK_ = (cljs.core.truth_(cb)?cljs.core.reduced_QMARK_((self__.add_BANG_.cljs$core$IFn$_invoke$arity$2 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$2(self__.buf,val__$1) : self__.add_BANG_.call(null,self__.buf,val__$1))):null);
|
||||
if(((cljs.core.not(done_QMARK_)) && (((cljs.core.not(self__.buf.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(null))) && ((self__.puts.length > (0))))))){
|
||||
var G__12572 = cbs__$1;
|
||||
cbs = G__12572;
|
||||
continue;
|
||||
} else {
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [done_QMARK_,cbs__$1], null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
})():null);
|
||||
var done_QMARK_ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__12519,(0),null);
|
||||
var cbs = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__12519,(1),null);
|
||||
if(cljs.core.truth_(done_QMARK_)){
|
||||
this$__$1.cljs$core$async$impl$channels$MMC$abort$arity$1(null);
|
||||
} else {
|
||||
}
|
||||
|
||||
var seq__12525_12573 = cljs.core.seq(cbs);
|
||||
var chunk__12526_12574 = null;
|
||||
var count__12527_12575 = (0);
|
||||
var i__12528_12576 = (0);
|
||||
while(true){
|
||||
if((i__12528_12576 < count__12527_12575)){
|
||||
var cb_12577 = chunk__12526_12574.cljs$core$IIndexed$_nth$arity$2(null,i__12528_12576);
|
||||
cljs.core.async.impl.dispatch.run(((function (seq__12525_12573,chunk__12526_12574,count__12527_12575,i__12528_12576,cb_12577,val,vec__12519,done_QMARK_,cbs,take_cb,temp__5802__auto__,this$__$1){
|
||||
return (function (){
|
||||
return (cb_12577.cljs$core$IFn$_invoke$arity$1 ? cb_12577.cljs$core$IFn$_invoke$arity$1(true) : cb_12577.call(null,true));
|
||||
});})(seq__12525_12573,chunk__12526_12574,count__12527_12575,i__12528_12576,cb_12577,val,vec__12519,done_QMARK_,cbs,take_cb,temp__5802__auto__,this$__$1))
|
||||
);
|
||||
|
||||
|
||||
var G__12578 = seq__12525_12573;
|
||||
var G__12579 = chunk__12526_12574;
|
||||
var G__12580 = count__12527_12575;
|
||||
var G__12581 = (i__12528_12576 + (1));
|
||||
seq__12525_12573 = G__12578;
|
||||
chunk__12526_12574 = G__12579;
|
||||
count__12527_12575 = G__12580;
|
||||
i__12528_12576 = G__12581;
|
||||
continue;
|
||||
} else {
|
||||
var temp__5804__auto___12582 = cljs.core.seq(seq__12525_12573);
|
||||
if(temp__5804__auto___12582){
|
||||
var seq__12525_12583__$1 = temp__5804__auto___12582;
|
||||
if(cljs.core.chunked_seq_QMARK_(seq__12525_12583__$1)){
|
||||
var c__5568__auto___12584 = cljs.core.chunk_first(seq__12525_12583__$1);
|
||||
var G__12585 = cljs.core.chunk_rest(seq__12525_12583__$1);
|
||||
var G__12586 = c__5568__auto___12584;
|
||||
var G__12587 = cljs.core.count(c__5568__auto___12584);
|
||||
var G__12588 = (0);
|
||||
seq__12525_12573 = G__12585;
|
||||
chunk__12526_12574 = G__12586;
|
||||
count__12527_12575 = G__12587;
|
||||
i__12528_12576 = G__12588;
|
||||
continue;
|
||||
} else {
|
||||
var cb_12589 = cljs.core.first(seq__12525_12583__$1);
|
||||
cljs.core.async.impl.dispatch.run(((function (seq__12525_12573,chunk__12526_12574,count__12527_12575,i__12528_12576,cb_12589,seq__12525_12583__$1,temp__5804__auto___12582,val,vec__12519,done_QMARK_,cbs,take_cb,temp__5802__auto__,this$__$1){
|
||||
return (function (){
|
||||
return (cb_12589.cljs$core$IFn$_invoke$arity$1 ? cb_12589.cljs$core$IFn$_invoke$arity$1(true) : cb_12589.call(null,true));
|
||||
});})(seq__12525_12573,chunk__12526_12574,count__12527_12575,i__12528_12576,cb_12589,seq__12525_12583__$1,temp__5804__auto___12582,val,vec__12519,done_QMARK_,cbs,take_cb,temp__5802__auto__,this$__$1))
|
||||
);
|
||||
|
||||
|
||||
var G__12590 = cljs.core.next(seq__12525_12583__$1);
|
||||
var G__12591 = null;
|
||||
var G__12592 = (0);
|
||||
var G__12593 = (0);
|
||||
seq__12525_12573 = G__12590;
|
||||
chunk__12526_12574 = G__12591;
|
||||
count__12527_12575 = G__12592;
|
||||
i__12528_12576 = G__12593;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return cljs.core.async.impl.channels.box(val);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
var putter = (function (){while(true){
|
||||
var putter = self__.puts.pop();
|
||||
if(cljs.core.truth_(putter)){
|
||||
if(cljs.core.async.impl.protocols.active_QMARK_(putter.handler)){
|
||||
return putter;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
})();
|
||||
if(cljs.core.truth_(putter)){
|
||||
var put_cb = cljs.core.async.impl.protocols.commit(putter.handler);
|
||||
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
|
||||
cljs.core.async.impl.dispatch.run((function (){
|
||||
return (put_cb.cljs$core$IFn$_invoke$arity$1 ? put_cb.cljs$core$IFn$_invoke$arity$1(true) : put_cb.call(null,true));
|
||||
}));
|
||||
|
||||
return cljs.core.async.impl.channels.box(putter.val);
|
||||
} else {
|
||||
if(cljs.core.truth_(self__.closed)){
|
||||
if(cljs.core.truth_(self__.buf)){
|
||||
(self__.add_BANG_.cljs$core$IFn$_invoke$arity$1 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$1(self__.buf) : self__.add_BANG_.call(null,self__.buf));
|
||||
} else {
|
||||
}
|
||||
|
||||
if(cljs.core.truth_((function (){var and__5043__auto__ = handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null);
|
||||
if(cljs.core.truth_(and__5043__auto__)){
|
||||
return handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
} else {
|
||||
return and__5043__auto__;
|
||||
}
|
||||
})())){
|
||||
var has_val = (function (){var and__5043__auto__ = self__.buf;
|
||||
if(cljs.core.truth_(and__5043__auto__)){
|
||||
return (cljs.core.count(self__.buf) > (0));
|
||||
} else {
|
||||
return and__5043__auto__;
|
||||
}
|
||||
})();
|
||||
var val = (cljs.core.truth_(has_val)?self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null):null);
|
||||
return cljs.core.async.impl.channels.box(val);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if((self__.dirty_takes > (64))){
|
||||
(self__.dirty_takes = (0));
|
||||
|
||||
self__.takes.cleanup(cljs.core.async.impl.protocols.active_QMARK_);
|
||||
} else {
|
||||
(self__.dirty_takes = (self__.dirty_takes + (1)));
|
||||
}
|
||||
|
||||
if(cljs.core.truth_(handler.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1(null))){
|
||||
if((self__.takes.length < (1024))){
|
||||
} else {
|
||||
throw (new Error(["Assert failed: ",["No more than ",cljs.core.str.cljs$core$IFn$_invoke$arity$1((1024))," pending takes are allowed on a single channel."].join(''),"\n","(< (.-length takes) impl/MAX-QUEUE-SIZE)"].join('')));
|
||||
}
|
||||
|
||||
self__.takes.unbounded_unshift(handler);
|
||||
} else {
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
return self__.closed;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (this$){
|
||||
var self__ = this;
|
||||
var this$__$1 = this;
|
||||
if(self__.closed){
|
||||
return null;
|
||||
} else {
|
||||
(self__.closed = true);
|
||||
|
||||
if(cljs.core.truth_((function (){var and__5043__auto__ = self__.buf;
|
||||
if(cljs.core.truth_(and__5043__auto__)){
|
||||
return (self__.puts.length === (0));
|
||||
} else {
|
||||
return and__5043__auto__;
|
||||
}
|
||||
})())){
|
||||
(self__.add_BANG_.cljs$core$IFn$_invoke$arity$1 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$1(self__.buf) : self__.add_BANG_.call(null,self__.buf));
|
||||
} else {
|
||||
}
|
||||
|
||||
while(true){
|
||||
var taker_12594 = self__.takes.pop();
|
||||
if((taker_12594 == null)){
|
||||
} else {
|
||||
if(taker_12594.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)){
|
||||
var take_cb_12595 = taker_12594.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
|
||||
var val_12596 = (cljs.core.truth_((function (){var and__5043__auto__ = self__.buf;
|
||||
if(cljs.core.truth_(and__5043__auto__)){
|
||||
return (cljs.core.count(self__.buf) > (0));
|
||||
} else {
|
||||
return and__5043__auto__;
|
||||
}
|
||||
})())?self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null):null);
|
||||
cljs.core.async.impl.dispatch.run(((function (take_cb_12595,val_12596,taker_12594,this$__$1){
|
||||
return (function (){
|
||||
return (take_cb_12595.cljs$core$IFn$_invoke$arity$1 ? take_cb_12595.cljs$core$IFn$_invoke$arity$1(val_12596) : take_cb_12595.call(null,val_12596));
|
||||
});})(take_cb_12595,val_12596,taker_12594,this$__$1))
|
||||
);
|
||||
} else {
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(cljs.core.truth_(self__.buf)){
|
||||
self__.buf.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1(null);
|
||||
} else {
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 7, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"takes","takes",298247964,null),cljs.core.with_meta(new cljs.core.Symbol(null,"dirty-takes","dirty-takes",575642138,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),new cljs.core.Symbol(null,"puts","puts",-1883877054,null),cljs.core.with_meta(new cljs.core.Symbol(null,"dirty-puts","dirty-puts",57041148,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"tag","tag",-1290361223),new cljs.core.Symbol(null,"not-native","not-native",-236392494,null)], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"closed","closed",720856168,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),new cljs.core.Symbol(null,"add!","add!",2046056845,null)], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$ctorStr = "cljs.core.async.impl.channels/ManyToManyChannel");
|
||||
|
||||
(cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.channels/ManyToManyChannel");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.channels/ManyToManyChannel.
|
||||
*/
|
||||
cljs.core.async.impl.channels.__GT_ManyToManyChannel = (function cljs$core$async$impl$channels$__GT_ManyToManyChannel(takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_){
|
||||
return (new cljs.core.async.impl.channels.ManyToManyChannel(takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_));
|
||||
});
|
||||
|
||||
cljs.core.async.impl.channels.ex_handler = (function cljs$core$async$impl$channels$ex_handler(ex){
|
||||
console.log(ex);
|
||||
|
||||
return null;
|
||||
});
|
||||
cljs.core.async.impl.channels.handle = (function cljs$core$async$impl$channels$handle(buf,exh,t){
|
||||
var else$ = (function (){var fexpr__12531 = (function (){var or__5045__auto__ = exh;
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
return cljs.core.async.impl.channels.ex_handler;
|
||||
}
|
||||
})();
|
||||
return (fexpr__12531.cljs$core$IFn$_invoke$arity$1 ? fexpr__12531.cljs$core$IFn$_invoke$arity$1(t) : fexpr__12531.call(null,t));
|
||||
})();
|
||||
if((else$ == null)){
|
||||
return buf;
|
||||
} else {
|
||||
return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2(buf,else$);
|
||||
}
|
||||
});
|
||||
cljs.core.async.impl.channels.chan = (function cljs$core$async$impl$channels$chan(var_args){
|
||||
var G__12534 = arguments.length;
|
||||
switch (G__12534) {
|
||||
case 1:
|
||||
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
break;
|
||||
case 2:
|
||||
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1 = (function (buf){
|
||||
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2(buf,null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2 = (function (buf,xform){
|
||||
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3(buf,xform,null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3 = (function (buf,xform,exh){
|
||||
return (new cljs.core.async.impl.channels.ManyToManyChannel(cljs.core.async.impl.buffers.ring_buffer((32)),(0),cljs.core.async.impl.buffers.ring_buffer((32)),(0),buf,false,(function (){var add_BANG_ = (cljs.core.truth_(xform)?(xform.cljs$core$IFn$_invoke$arity$1 ? xform.cljs$core$IFn$_invoke$arity$1(cljs.core.async.impl.protocols.add_BANG_) : xform.call(null,cljs.core.async.impl.protocols.add_BANG_)):cljs.core.async.impl.protocols.add_BANG_);
|
||||
return (function() {
|
||||
var G__12598 = null;
|
||||
var G__12598__1 = (function (buf__$1){
|
||||
try{return (add_BANG_.cljs$core$IFn$_invoke$arity$1 ? add_BANG_.cljs$core$IFn$_invoke$arity$1(buf__$1) : add_BANG_.call(null,buf__$1));
|
||||
}catch (e12536){var t = e12536;
|
||||
return cljs.core.async.impl.channels.handle(buf__$1,exh,t);
|
||||
}});
|
||||
var G__12598__2 = (function (buf__$1,val){
|
||||
try{return (add_BANG_.cljs$core$IFn$_invoke$arity$2 ? add_BANG_.cljs$core$IFn$_invoke$arity$2(buf__$1,val) : add_BANG_.call(null,buf__$1,val));
|
||||
}catch (e12537){var t = e12537;
|
||||
return cljs.core.async.impl.channels.handle(buf__$1,exh,t);
|
||||
}});
|
||||
G__12598 = function(buf__$1,val){
|
||||
switch(arguments.length){
|
||||
case 1:
|
||||
return G__12598__1.call(this,buf__$1);
|
||||
case 2:
|
||||
return G__12598__2.call(this,buf__$1,val);
|
||||
}
|
||||
throw(new Error('Invalid arity: ' + arguments.length));
|
||||
};
|
||||
G__12598.cljs$core$IFn$_invoke$arity$1 = G__12598__1;
|
||||
G__12598.cljs$core$IFn$_invoke$arity$2 = G__12598__2;
|
||||
return G__12598;
|
||||
})()
|
||||
})()));
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.channels.chan.cljs$lang$maxFixedArity = 3);
|
||||
|
||||
|
||||
//# sourceMappingURL=cljs.core.async.impl.channels.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,54 +0,0 @@
|
|||
goog.provide('cljs.core.async.impl.dispatch');
|
||||
cljs.core.async.impl.dispatch.tasks = cljs.core.async.impl.buffers.ring_buffer((32));
|
||||
cljs.core.async.impl.dispatch.running_QMARK_ = false;
|
||||
cljs.core.async.impl.dispatch.queued_QMARK_ = false;
|
||||
cljs.core.async.impl.dispatch.TASK_BATCH_SIZE = (1024);
|
||||
cljs.core.async.impl.dispatch.process_messages = (function cljs$core$async$impl$dispatch$process_messages(){
|
||||
(cljs.core.async.impl.dispatch.running_QMARK_ = true);
|
||||
|
||||
(cljs.core.async.impl.dispatch.queued_QMARK_ = false);
|
||||
|
||||
var count_12453 = (0);
|
||||
while(true){
|
||||
var m_12454 = cljs.core.async.impl.dispatch.tasks.pop();
|
||||
if((m_12454 == null)){
|
||||
} else {
|
||||
(m_12454.cljs$core$IFn$_invoke$arity$0 ? m_12454.cljs$core$IFn$_invoke$arity$0() : m_12454.call(null));
|
||||
|
||||
if((count_12453 < cljs.core.async.impl.dispatch.TASK_BATCH_SIZE)){
|
||||
var G__12455 = (count_12453 + (1));
|
||||
count_12453 = G__12455;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
(cljs.core.async.impl.dispatch.running_QMARK_ = false);
|
||||
|
||||
if((cljs.core.async.impl.dispatch.tasks.length > (0))){
|
||||
return (cljs.core.async.impl.dispatch.queue_dispatcher.cljs$core$IFn$_invoke$arity$0 ? cljs.core.async.impl.dispatch.queue_dispatcher.cljs$core$IFn$_invoke$arity$0() : cljs.core.async.impl.dispatch.queue_dispatcher.call(null));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
cljs.core.async.impl.dispatch.queue_dispatcher = (function cljs$core$async$impl$dispatch$queue_dispatcher(){
|
||||
if(((cljs.core.async.impl.dispatch.queued_QMARK_) && (cljs.core.async.impl.dispatch.running_QMARK_))){
|
||||
return null;
|
||||
} else {
|
||||
(cljs.core.async.impl.dispatch.queued_QMARK_ = true);
|
||||
|
||||
return goog.async.nextTick(cljs.core.async.impl.dispatch.process_messages);
|
||||
}
|
||||
});
|
||||
cljs.core.async.impl.dispatch.run = (function cljs$core$async$impl$dispatch$run(f){
|
||||
cljs.core.async.impl.dispatch.tasks.unbounded_unshift(f);
|
||||
|
||||
return cljs.core.async.impl.dispatch.queue_dispatcher();
|
||||
});
|
||||
cljs.core.async.impl.dispatch.queue_delay = (function cljs$core$async$impl$dispatch$queue_delay(f,delay){
|
||||
return setTimeout(f,delay);
|
||||
});
|
||||
|
||||
//# sourceMappingURL=cljs.core.async.impl.dispatch.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["cljs/core/async/impl/dispatch.cljs"],"mappings":";AAYA,AAAKA,sCAAM,yCAAA,zCAACC;AACZ,+CAAA,/CAAKC;AACL,8CAAA,9CAAKC;AAEL,gDAAA,hDAAKC;AAEL,AAAA,AAEA,iDAAA,jDAAMC;AAAN,AACE,gDAAA,/CAAMH;;AACN,+CAAA,9CAAMC;;AACN,kBAAA,dAAOG;;AAAP,AACE,IAAMC,UAAE,AAAMP;AAAd,AACE,GAAU,YAAA,XAAMO;AAAhB;AAAA,AACE,CAACA,wCAAAA,0CAAAA;;AACD,GAAM,CAAGD,cAAMF;AAAf,AACE,eAAO,eAAA,dAAKE;;;;AADd;;;;;AAEN,gDAAA,/CAAMJ;;AACN,GAAM,8CAAA,7CAAG,AAAUF;AAAnB,AACE,QAACQ,+EAAAA,iFAAAA;;AADH;;;AAGF,iDAAA,jDAAMA;AAAN,AACE,GAAU,EAAKL,iDAAQD;AAAvB;;AAAA,AACE,+CAAA,9CAAMC;;AACN,OAACM,oBAAoBJ;;;AAEzB,oCAAA,pCAAMK,gFAAKC;AAAX,AACE,AAAoBX,sDAAMW;;AAC1B,OAACH;;AAEH,4CAAA,5CAAMI,gGAAaD,EAAEE;AAArB,AACE,OAACC,WAAcH,EAAEE","names":["cljs.core.async.impl.dispatch/tasks","cljs.core.async.impl.buffers/ring-buffer","cljs.core.async.impl.dispatch/running?","cljs.core.async.impl.dispatch/queued?","cljs.core.async.impl.dispatch/TASK_BATCH_SIZE","cljs.core.async.impl.dispatch/process-messages","count","m","cljs.core.async.impl.dispatch/queue-dispatcher","js/goog.async.nextTick","cljs.core.async.impl.dispatch/run","f","cljs.core.async.impl.dispatch/queue-delay","delay","js/setTimeout"],"sourcesContent":[";; Copyright (c) Rich Hickey and contributors. All rights reserved.\n;; The use and distribution terms for this software are covered by the\n;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)\n;; which can be found in the file epl-v10.html at the root of this distribution.\n;; By using this software in any fashion, you are agreeing to be bound by\n;; the terms of this license.\n;; You must not remove this notice, or any other, from this software.\n\n(ns cljs.core.async.impl.dispatch\n (:require [cljs.core.async.impl.buffers :as buffers]\n [goog.async.nextTick]))\n\n(def tasks (buffers/ring-buffer 32))\n(def running? false)\n(def queued? false)\n\n(def TASK_BATCH_SIZE 1024)\n\n(declare queue-dispatcher)\n\n(defn process-messages []\n (set! running? true)\n (set! queued? false)\n (loop [count 0]\n (let [m (.pop tasks)]\n (when-not (nil? m)\n (m)\n (when (< count TASK_BATCH_SIZE)\n (recur (inc count))))))\n (set! running? false)\n (when (> (.-length tasks) 0)\n (queue-dispatcher)))\n\n(defn queue-dispatcher []\n (when-not (and queued? running?)\n (set! queued? true)\n (goog.async.nextTick process-messages)))\n\n(defn run [f]\n (.unbounded-unshift tasks f)\n (queue-dispatcher))\n\n(defn queue-delay [f delay]\n (js/setTimeout f delay))\n\n"],"x_google_ignoreList":[0]}
|
|
@ -1,165 +0,0 @@
|
|||
goog.provide('cljs.core.async.impl.ioc_helpers');
|
||||
cljs.core.async.impl.ioc_helpers.FN_IDX = (0);
|
||||
cljs.core.async.impl.ioc_helpers.STATE_IDX = (1);
|
||||
cljs.core.async.impl.ioc_helpers.VALUE_IDX = (2);
|
||||
cljs.core.async.impl.ioc_helpers.BINDINGS_IDX = (3);
|
||||
cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES = (4);
|
||||
cljs.core.async.impl.ioc_helpers.CURRENT_EXCEPTION = (5);
|
||||
cljs.core.async.impl.ioc_helpers.USER_START_IDX = (6);
|
||||
cljs.core.async.impl.ioc_helpers.aset_object = (function cljs$core$async$impl$ioc_helpers$aset_object(arr,idx,o){
|
||||
return (arr[idx][o]);
|
||||
});
|
||||
cljs.core.async.impl.ioc_helpers.aget_object = (function cljs$core$async$impl$ioc_helpers$aget_object(arr,idx){
|
||||
return (arr[idx]);
|
||||
});
|
||||
/**
|
||||
* Returns true if the machine is in a finished state
|
||||
*/
|
||||
cljs.core.async.impl.ioc_helpers.finished_QMARK_ = (function cljs$core$async$impl$ioc_helpers$finished_QMARK_(state_array){
|
||||
return cljs.core.keyword_identical_QMARK_((state_array[(1)]),new cljs.core.Keyword(null,"finished","finished",-1018867731));
|
||||
});
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {cljs.core.async.impl.protocols.Handler}
|
||||
* @implements {cljs.core.IMeta}
|
||||
* @implements {cljs.core.IWithMeta}
|
||||
*/
|
||||
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379 = (function (f,meta14380){
|
||||
this.f = f;
|
||||
this.meta14380 = meta14380;
|
||||
this.cljs$lang$protocol_mask$partition0$ = 393216;
|
||||
this.cljs$lang$protocol_mask$partition1$ = 0;
|
||||
});
|
||||
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_14381,meta14380__$1){
|
||||
var self__ = this;
|
||||
var _14381__$1 = this;
|
||||
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379(self__.f,meta14380__$1));
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_14381){
|
||||
var self__ = this;
|
||||
var _14381__$1 = this;
|
||||
return self__.meta14380;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = (function (_){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
return true;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = (function (_){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
return true;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
|
||||
var self__ = this;
|
||||
var ___$1 = this;
|
||||
return self__.f;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"meta14380","meta14380",-841796527,null)], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379.cljs$lang$ctorStr = "cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers14379");
|
||||
|
||||
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers14379");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers14379.
|
||||
*/
|
||||
cljs.core.async.impl.ioc_helpers.__GT_t_cljs$core$async$impl$ioc_helpers14379 = (function cljs$core$async$impl$ioc_helpers$__GT_t_cljs$core$async$impl$ioc_helpers14379(f,meta14380){
|
||||
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379(f,meta14380));
|
||||
});
|
||||
|
||||
|
||||
cljs.core.async.impl.ioc_helpers.fn_handler = (function cljs$core$async$impl$ioc_helpers$fn_handler(f){
|
||||
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14379(f,cljs.core.PersistentArrayMap.EMPTY));
|
||||
});
|
||||
cljs.core.async.impl.ioc_helpers.run_state_machine = (function cljs$core$async$impl$ioc_helpers$run_state_machine(state){
|
||||
var fexpr__14390 = cljs.core.async.impl.ioc_helpers.aget_object(state,(0));
|
||||
return (fexpr__14390.cljs$core$IFn$_invoke$arity$1 ? fexpr__14390.cljs$core$IFn$_invoke$arity$1(state) : fexpr__14390.call(null,state));
|
||||
});
|
||||
cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped = (function cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped(state){
|
||||
try{return cljs.core.async.impl.ioc_helpers.run_state_machine(state);
|
||||
}catch (e14391){if((e14391 instanceof Object)){
|
||||
var ex = e14391;
|
||||
cljs.core.async.impl.ioc_helpers.aget_object(state,(6)).cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(null);
|
||||
|
||||
throw ex;
|
||||
} else {
|
||||
throw e14391;
|
||||
|
||||
}
|
||||
}});
|
||||
cljs.core.async.impl.ioc_helpers.take_BANG_ = (function cljs$core$async$impl$ioc_helpers$take_BANG_(state,blk,c){
|
||||
var temp__5802__auto__ = c.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2(null,cljs.core.async.impl.ioc_helpers.fn_handler((function (x){
|
||||
var statearr_14392_14429 = state;
|
||||
(statearr_14392_14429[(2)] = x);
|
||||
|
||||
(statearr_14392_14429[(1)] = blk);
|
||||
|
||||
|
||||
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state);
|
||||
})));
|
||||
if(cljs.core.truth_(temp__5802__auto__)){
|
||||
var cb = temp__5802__auto__;
|
||||
var statearr_14393_14430 = state;
|
||||
(statearr_14393_14430[(2)] = cljs.core.deref(cb));
|
||||
|
||||
(statearr_14393_14430[(1)] = blk);
|
||||
|
||||
|
||||
return new cljs.core.Keyword(null,"recur","recur",-437573268);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
cljs.core.async.impl.ioc_helpers.put_BANG_ = (function cljs$core$async$impl$ioc_helpers$put_BANG_(state,blk,c,val){
|
||||
var temp__5802__auto__ = c.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(null,val,cljs.core.async.impl.ioc_helpers.fn_handler((function (ret_val){
|
||||
var statearr_14394_14431 = state;
|
||||
(statearr_14394_14431[(2)] = ret_val);
|
||||
|
||||
(statearr_14394_14431[(1)] = blk);
|
||||
|
||||
|
||||
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state);
|
||||
})));
|
||||
if(cljs.core.truth_(temp__5802__auto__)){
|
||||
var cb = temp__5802__auto__;
|
||||
var statearr_14395_14432 = state;
|
||||
(statearr_14395_14432[(2)] = cljs.core.deref(cb));
|
||||
|
||||
(statearr_14395_14432[(1)] = blk);
|
||||
|
||||
|
||||
return new cljs.core.Keyword(null,"recur","recur",-437573268);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
cljs.core.async.impl.ioc_helpers.return_chan = (function cljs$core$async$impl$ioc_helpers$return_chan(state,value){
|
||||
var c = (state[(6)]);
|
||||
if((value == null)){
|
||||
} else {
|
||||
c.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(null,value,cljs.core.async.impl.ioc_helpers.fn_handler((function (_){
|
||||
return null;
|
||||
})));
|
||||
}
|
||||
|
||||
c.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(null);
|
||||
|
||||
return c;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=cljs.core.async.impl.ioc_helpers.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,342 +0,0 @@
|
|||
goog.provide('cljs.core.async.impl.protocols');
|
||||
cljs.core.async.impl.protocols.MAX_QUEUE_SIZE = (1024);
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
cljs.core.async.impl.protocols.ReadPort = function(){};
|
||||
|
||||
var cljs$core$async$impl$protocols$ReadPort$take_BANG_$dyn_12349 = (function (port,fn1_handler){
|
||||
var x__5393__auto__ = (((port == null))?null:port);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.take_BANG_[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$2(port,fn1_handler) : m__5394__auto__.call(null,port,fn1_handler));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.take_BANG_["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$2(port,fn1_handler) : m__5392__auto__.call(null,port,fn1_handler));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("ReadPort.take!",port);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* derefable val if taken, nil if take was enqueued
|
||||
*/
|
||||
cljs.core.async.impl.protocols.take_BANG_ = (function cljs$core$async$impl$protocols$take_BANG_(port,fn1_handler){
|
||||
if((((!((port == null)))) && ((!((port.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 == null)))))){
|
||||
return port.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2(port,fn1_handler);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$ReadPort$take_BANG_$dyn_12349(port,fn1_handler);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
cljs.core.async.impl.protocols.WritePort = function(){};
|
||||
|
||||
var cljs$core$async$impl$protocols$WritePort$put_BANG_$dyn_12350 = (function (port,val,fn1_handler){
|
||||
var x__5393__auto__ = (((port == null))?null:port);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.put_BANG_[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$3(port,val,fn1_handler) : m__5394__auto__.call(null,port,val,fn1_handler));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.put_BANG_["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$3(port,val,fn1_handler) : m__5392__auto__.call(null,port,val,fn1_handler));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("WritePort.put!",port);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* derefable boolean (false if already closed) if handled, nil if put was enqueued.
|
||||
* Must throw on nil val.
|
||||
*/
|
||||
cljs.core.async.impl.protocols.put_BANG_ = (function cljs$core$async$impl$protocols$put_BANG_(port,val,fn1_handler){
|
||||
if((((!((port == null)))) && ((!((port.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 == null)))))){
|
||||
return port.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(port,val,fn1_handler);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$WritePort$put_BANG_$dyn_12350(port,val,fn1_handler);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
cljs.core.async.impl.protocols.Channel = function(){};
|
||||
|
||||
var cljs$core$async$impl$protocols$Channel$close_BANG_$dyn_12351 = (function (chan){
|
||||
var x__5393__auto__ = (((chan == null))?null:chan);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.close_BANG_[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5394__auto__.call(null,chan));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.close_BANG_["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5392__auto__.call(null,chan));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Channel.close!",chan);
|
||||
}
|
||||
}
|
||||
});
|
||||
cljs.core.async.impl.protocols.close_BANG_ = (function cljs$core$async$impl$protocols$close_BANG_(chan){
|
||||
if((((!((chan == null)))) && ((!((chan.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 == null)))))){
|
||||
return chan.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(chan);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$Channel$close_BANG_$dyn_12351(chan);
|
||||
}
|
||||
});
|
||||
|
||||
var cljs$core$async$impl$protocols$Channel$closed_QMARK_$dyn_12352 = (function (chan){
|
||||
var x__5393__auto__ = (((chan == null))?null:chan);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.closed_QMARK_[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5394__auto__.call(null,chan));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.closed_QMARK_["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5392__auto__.call(null,chan));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Channel.closed?",chan);
|
||||
}
|
||||
}
|
||||
});
|
||||
cljs.core.async.impl.protocols.closed_QMARK_ = (function cljs$core$async$impl$protocols$closed_QMARK_(chan){
|
||||
if((((!((chan == null)))) && ((!((chan.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 == null)))))){
|
||||
return chan.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1(chan);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$Channel$closed_QMARK_$dyn_12352(chan);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
cljs.core.async.impl.protocols.Handler = function(){};
|
||||
|
||||
var cljs$core$async$impl$protocols$Handler$active_QMARK_$dyn_12354 = (function (h){
|
||||
var x__5393__auto__ = (((h == null))?null:h);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.active_QMARK_[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5394__auto__.call(null,h));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.active_QMARK_["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5392__auto__.call(null,h));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Handler.active?",h);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* returns true if has callback. Must work w/o lock
|
||||
*/
|
||||
cljs.core.async.impl.protocols.active_QMARK_ = (function cljs$core$async$impl$protocols$active_QMARK_(h){
|
||||
if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 == null)))))){
|
||||
return h.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(h);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$Handler$active_QMARK_$dyn_12354(h);
|
||||
}
|
||||
});
|
||||
|
||||
var cljs$core$async$impl$protocols$Handler$blockable_QMARK_$dyn_12356 = (function (h){
|
||||
var x__5393__auto__ = (((h == null))?null:h);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.blockable_QMARK_[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5394__auto__.call(null,h));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.blockable_QMARK_["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5392__auto__.call(null,h));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Handler.blockable?",h);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* returns true if this handler may be blocked, otherwise it must not block
|
||||
*/
|
||||
cljs.core.async.impl.protocols.blockable_QMARK_ = (function cljs$core$async$impl$protocols$blockable_QMARK_(h){
|
||||
if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 == null)))))){
|
||||
return h.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1(h);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$Handler$blockable_QMARK_$dyn_12356(h);
|
||||
}
|
||||
});
|
||||
|
||||
var cljs$core$async$impl$protocols$Handler$commit$dyn_12358 = (function (h){
|
||||
var x__5393__auto__ = (((h == null))?null:h);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.commit[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5394__auto__.call(null,h));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.commit["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5392__auto__.call(null,h));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Handler.commit",h);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* commit to fulfilling its end of the transfer, returns cb. Must be called within lock
|
||||
*/
|
||||
cljs.core.async.impl.protocols.commit = (function cljs$core$async$impl$protocols$commit(h){
|
||||
if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$commit$arity$1 == null)))))){
|
||||
return h.cljs$core$async$impl$protocols$Handler$commit$arity$1(h);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$Handler$commit$dyn_12358(h);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
cljs.core.async.impl.protocols.Buffer = function(){};
|
||||
|
||||
var cljs$core$async$impl$protocols$Buffer$full_QMARK_$dyn_12360 = (function (b){
|
||||
var x__5393__auto__ = (((b == null))?null:b);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.full_QMARK_[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5394__auto__.call(null,b));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.full_QMARK_["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5392__auto__.call(null,b));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Buffer.full?",b);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* returns true if buffer cannot accept put
|
||||
*/
|
||||
cljs.core.async.impl.protocols.full_QMARK_ = (function cljs$core$async$impl$protocols$full_QMARK_(b){
|
||||
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 == null)))))){
|
||||
return b.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(b);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$Buffer$full_QMARK_$dyn_12360(b);
|
||||
}
|
||||
});
|
||||
|
||||
var cljs$core$async$impl$protocols$Buffer$remove_BANG_$dyn_12362 = (function (b){
|
||||
var x__5393__auto__ = (((b == null))?null:b);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.remove_BANG_[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5394__auto__.call(null,b));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.remove_BANG_["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5392__auto__.call(null,b));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Buffer.remove!",b);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* remove and return next item from buffer, called under chan mutex
|
||||
*/
|
||||
cljs.core.async.impl.protocols.remove_BANG_ = (function cljs$core$async$impl$protocols$remove_BANG_(b){
|
||||
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 == null)))))){
|
||||
return b.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(b);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$Buffer$remove_BANG_$dyn_12362(b);
|
||||
}
|
||||
});
|
||||
|
||||
var cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$dyn_12364 = (function (b,itm){
|
||||
var x__5393__auto__ = (((b == null))?null:b);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.add_BANG__STAR_[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$2(b,itm) : m__5394__auto__.call(null,b,itm));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.add_BANG__STAR_["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$2(b,itm) : m__5392__auto__.call(null,b,itm));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Buffer.add!*",b);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* if room, add item to the buffer, returns b, called under chan mutex
|
||||
*/
|
||||
cljs.core.async.impl.protocols.add_BANG__STAR_ = (function cljs$core$async$impl$protocols$add_BANG__STAR_(b,itm){
|
||||
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 == null)))))){
|
||||
return b.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2(b,itm);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$dyn_12364(b,itm);
|
||||
}
|
||||
});
|
||||
|
||||
var cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$dyn_12365 = (function (b){
|
||||
var x__5393__auto__ = (((b == null))?null:b);
|
||||
var m__5394__auto__ = (cljs.core.async.impl.protocols.close_buf_BANG_[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5394__auto__.call(null,b));
|
||||
} else {
|
||||
var m__5392__auto__ = (cljs.core.async.impl.protocols.close_buf_BANG_["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5392__auto__.call(null,b));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Buffer.close-buf!",b);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* called on chan closed under chan mutex, return ignored
|
||||
*/
|
||||
cljs.core.async.impl.protocols.close_buf_BANG_ = (function cljs$core$async$impl$protocols$close_buf_BANG_(b){
|
||||
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 == null)))))){
|
||||
return b.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1(b);
|
||||
} else {
|
||||
return cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$dyn_12365(b);
|
||||
}
|
||||
});
|
||||
|
||||
cljs.core.async.impl.protocols.add_BANG_ = (function cljs$core$async$impl$protocols$add_BANG_(var_args){
|
||||
var G__12348 = arguments.length;
|
||||
switch (G__12348) {
|
||||
case 1:
|
||||
return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
break;
|
||||
case 2:
|
||||
return cljs.core.async.impl.protocols.add_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('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (b){
|
||||
return b;
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (b,itm){
|
||||
if((!((itm == null)))){
|
||||
} else {
|
||||
throw (new Error("Assert failed: (not (nil? itm))"));
|
||||
}
|
||||
|
||||
return cljs.core.async.impl.protocols.add_BANG__STAR_(b,itm);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.protocols.add_BANG_.cljs$lang$maxFixedArity = 2);
|
||||
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
cljs.core.async.impl.protocols.UnblockingBuffer = function(){};
|
||||
|
||||
|
||||
//# sourceMappingURL=cljs.core.async.impl.protocols.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,481 +0,0 @@
|
|||
goog.provide('cljs.core.async.impl.timers');
|
||||
cljs.core.async.impl.timers.MAX_LEVEL = (15);
|
||||
cljs.core.async.impl.timers.P = ((1) / (2));
|
||||
cljs.core.async.impl.timers.random_level = (function cljs$core$async$impl$timers$random_level(var_args){
|
||||
var G__12544 = arguments.length;
|
||||
switch (G__12544) {
|
||||
case 0:
|
||||
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0();
|
||||
|
||||
break;
|
||||
case 1:
|
||||
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0 = (function (){
|
||||
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1((0));
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1 = (function (level){
|
||||
while(true){
|
||||
if((((Math.random() < cljs.core.async.impl.timers.P)) && ((level < cljs.core.async.impl.timers.MAX_LEVEL)))){
|
||||
var G__12654 = (level + (1));
|
||||
level = G__12654;
|
||||
continue;
|
||||
} else {
|
||||
return level;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.random_level.cljs$lang$maxFixedArity = 1);
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {cljs.core.ISeqable}
|
||||
* @implements {cljs.core.IPrintWithWriter}
|
||||
*/
|
||||
cljs.core.async.impl.timers.SkipListNode = (function (key,val,forward){
|
||||
this.key = key;
|
||||
this.val = val;
|
||||
this.forward = forward;
|
||||
this.cljs$lang$protocol_mask$partition0$ = 2155872256;
|
||||
this.cljs$lang$protocol_mask$partition1$ = 0;
|
||||
});
|
||||
(cljs.core.async.impl.timers.SkipListNode.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (coll){
|
||||
var self__ = this;
|
||||
var coll__$1 = this;
|
||||
return (new cljs.core.List(null,self__.key,(new cljs.core.List(null,self__.val,null,(1),null)),(2),null));
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.SkipListNode.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (coll,writer,opts){
|
||||
var self__ = this;
|
||||
var coll__$1 = this;
|
||||
return cljs.core.pr_sequential_writer(writer,cljs.core.pr_writer,"["," ","]",opts,coll__$1);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.SkipListNode.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"key","key",124488940,null),cljs.core.with_meta(new cljs.core.Symbol(null,"val","val",1769233139,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),new cljs.core.Symbol(null,"forward","forward",1083186224,null)], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.SkipListNode.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.timers.SkipListNode.cljs$lang$ctorStr = "cljs.core.async.impl.timers/SkipListNode");
|
||||
|
||||
(cljs.core.async.impl.timers.SkipListNode.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.timers/SkipListNode");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.timers/SkipListNode.
|
||||
*/
|
||||
cljs.core.async.impl.timers.__GT_SkipListNode = (function cljs$core$async$impl$timers$__GT_SkipListNode(key,val,forward){
|
||||
return (new cljs.core.async.impl.timers.SkipListNode(key,val,forward));
|
||||
});
|
||||
|
||||
cljs.core.async.impl.timers.skip_list_node = (function cljs$core$async$impl$timers$skip_list_node(var_args){
|
||||
var G__12546 = arguments.length;
|
||||
switch (G__12546) {
|
||||
case 1:
|
||||
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1 = (function (level){
|
||||
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3(null,null,level);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3 = (function (k,v,level){
|
||||
var arr = (new Array((level + (1))));
|
||||
var i_12662 = (0);
|
||||
while(true){
|
||||
if((i_12662 < arr.length)){
|
||||
(arr[i_12662] = null);
|
||||
|
||||
var G__12663 = (i_12662 + (1));
|
||||
i_12662 = G__12663;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (new cljs.core.async.impl.timers.SkipListNode(k,v,arr));
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.skip_list_node.cljs$lang$maxFixedArity = 3);
|
||||
|
||||
cljs.core.async.impl.timers.least_greater_node = (function cljs$core$async$impl$timers$least_greater_node(var_args){
|
||||
var G__12571 = arguments.length;
|
||||
switch (G__12571) {
|
||||
case 3:
|
||||
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
|
||||
|
||||
break;
|
||||
case 4:
|
||||
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$3 = (function (x,k,level){
|
||||
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4(x,k,level,null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4 = (function (x,k,level,update){
|
||||
while(true){
|
||||
if((!((level < (0))))){
|
||||
var x__$1 = (function (){var x__$1 = x;
|
||||
while(true){
|
||||
var temp__5802__auto__ = (((level < x__$1.forward.length))?(x__$1.forward[level]):null);
|
||||
if(cljs.core.truth_(temp__5802__auto__)){
|
||||
var x_SINGLEQUOTE_ = temp__5802__auto__;
|
||||
if((x_SINGLEQUOTE_.key < k)){
|
||||
var G__12700 = x_SINGLEQUOTE_;
|
||||
x__$1 = G__12700;
|
||||
continue;
|
||||
} else {
|
||||
return x__$1;
|
||||
}
|
||||
} else {
|
||||
return x__$1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
})();
|
||||
if((update == null)){
|
||||
} else {
|
||||
(update[level] = x__$1);
|
||||
}
|
||||
|
||||
var G__12701 = x__$1;
|
||||
var G__12702 = k;
|
||||
var G__12703 = (level - (1));
|
||||
var G__12704 = update;
|
||||
x = G__12701;
|
||||
k = G__12702;
|
||||
level = G__12703;
|
||||
update = G__12704;
|
||||
continue;
|
||||
} else {
|
||||
return x;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.least_greater_node.cljs$lang$maxFixedArity = 4);
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {cljs.core.ISeqable}
|
||||
* @implements {cljs.core.IPrintWithWriter}
|
||||
*/
|
||||
cljs.core.async.impl.timers.SkipList = (function (header,level){
|
||||
this.header = header;
|
||||
this.level = level;
|
||||
this.cljs$lang$protocol_mask$partition0$ = 2155872256;
|
||||
this.cljs$lang$protocol_mask$partition1$ = 0;
|
||||
});
|
||||
(cljs.core.async.impl.timers.SkipList.prototype.put = (function (k,v){
|
||||
var self__ = this;
|
||||
var coll = this;
|
||||
var update = (new Array(cljs.core.async.impl.timers.MAX_LEVEL));
|
||||
var x = cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4(self__.header,k,self__.level,update);
|
||||
var x__$1 = (x.forward[(0)]);
|
||||
if((((!((x__$1 == null)))) && ((x__$1.key === k)))){
|
||||
return (x__$1.val = v);
|
||||
} else {
|
||||
var new_level = cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0();
|
||||
if((new_level > self__.level)){
|
||||
var i_12706 = (self__.level + (1));
|
||||
while(true){
|
||||
if((i_12706 <= (new_level + (1)))){
|
||||
(update[i_12706] = self__.header);
|
||||
|
||||
var G__12708 = (i_12706 + (1));
|
||||
i_12706 = G__12708;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
(self__.level = new_level);
|
||||
} else {
|
||||
}
|
||||
|
||||
var x__$2 = cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3(k,v,(new Array(new_level)));
|
||||
var i = (0);
|
||||
while(true){
|
||||
if((i <= self__.level)){
|
||||
var links_12709 = (update[i]).forward;
|
||||
if((i < x__$2.forward.length)){
|
||||
(x__$2.forward[i] = (links_12709[i]));
|
||||
} else {
|
||||
x__$2.forward.push((((i < links_12709.length))?(links_12709[i]):null));
|
||||
}
|
||||
|
||||
if((i < links_12709.length)){
|
||||
(links_12709[i] = x__$2);
|
||||
} else {
|
||||
links_12709.push(x__$2);
|
||||
}
|
||||
|
||||
var G__12710 = (i + (1));
|
||||
i = G__12710;
|
||||
continue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.SkipList.prototype.remove = (function (k){
|
||||
var self__ = this;
|
||||
var coll = this;
|
||||
var update = (new Array(cljs.core.async.impl.timers.MAX_LEVEL));
|
||||
var x = cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4(self__.header,k,self__.level,update);
|
||||
var x__$1 = (((x.forward.length === (0)))?null:(x.forward[(0)]));
|
||||
if((((!((x__$1 == null)))) && ((x__$1.key === k)))){
|
||||
var i_12711 = (0);
|
||||
while(true){
|
||||
if((i_12711 <= self__.level)){
|
||||
var links_12712 = (update[i_12711]).forward;
|
||||
if((x__$1 === (((i_12711 < links_12712.length))?(links_12712[i_12711]):null))){
|
||||
(links_12712[i_12711] = (x__$1.forward[i_12711]));
|
||||
|
||||
var G__12713 = (i_12711 + (1));
|
||||
i_12711 = G__12713;
|
||||
continue;
|
||||
} else {
|
||||
var G__12714 = (i_12711 + (1));
|
||||
i_12711 = G__12714;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
while(true){
|
||||
if(((((((0) < self__.level)) && ((self__.level < self__.header.forward.length)))) && (((self__.header.forward[self__.level]) == null)))){
|
||||
(self__.level = (self__.level - (1)));
|
||||
|
||||
continue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.SkipList.prototype.ceilingEntry = (function (k){
|
||||
var self__ = this;
|
||||
var coll = this;
|
||||
var x = self__.header;
|
||||
var level__$1 = self__.level;
|
||||
while(true){
|
||||
if((!((level__$1 < (0))))){
|
||||
var nx = (function (){var x__$1 = x;
|
||||
while(true){
|
||||
var x_SINGLEQUOTE_ = (((level__$1 < x__$1.forward.length))?(x__$1.forward[level__$1]):null);
|
||||
if((!((x_SINGLEQUOTE_ == null)))){
|
||||
if((x_SINGLEQUOTE_.key > k)){
|
||||
return x__$1;
|
||||
} else {
|
||||
var G__12715 = x_SINGLEQUOTE_;
|
||||
x__$1 = G__12715;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if((level__$1 === (0))){
|
||||
return x__$1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
})();
|
||||
if(cljs.core.truth_(nx)){
|
||||
var G__12716 = nx;
|
||||
var G__12717 = (level__$1 - (1));
|
||||
x = G__12716;
|
||||
level__$1 = G__12717;
|
||||
continue;
|
||||
} else {
|
||||
var G__12718 = x;
|
||||
var G__12719 = (level__$1 - (1));
|
||||
x = G__12718;
|
||||
level__$1 = G__12719;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(x.key,k)){
|
||||
return x;
|
||||
} else {
|
||||
return (x.forward[(0)]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.SkipList.prototype.floorEntry = (function (k){
|
||||
var self__ = this;
|
||||
var coll = this;
|
||||
var x = self__.header;
|
||||
var level__$1 = self__.level;
|
||||
while(true){
|
||||
if((!((level__$1 < (0))))){
|
||||
var nx = (function (){var x__$1 = x;
|
||||
while(true){
|
||||
var x_SINGLEQUOTE_ = (((level__$1 < x__$1.forward.length))?(x__$1.forward[level__$1]):null);
|
||||
if((!((x_SINGLEQUOTE_ == null)))){
|
||||
if((x_SINGLEQUOTE_.key > k)){
|
||||
return x__$1;
|
||||
} else {
|
||||
var G__12720 = x_SINGLEQUOTE_;
|
||||
x__$1 = G__12720;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if((level__$1 === (0))){
|
||||
return x__$1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
})();
|
||||
if(cljs.core.truth_(nx)){
|
||||
var G__12721 = nx;
|
||||
var G__12722 = (level__$1 - (1));
|
||||
x = G__12721;
|
||||
level__$1 = G__12722;
|
||||
continue;
|
||||
} else {
|
||||
var G__12723 = x;
|
||||
var G__12724 = (level__$1 - (1));
|
||||
x = G__12723;
|
||||
level__$1 = G__12724;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if((x === self__.header)){
|
||||
return null;
|
||||
} else {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.SkipList.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (coll){
|
||||
var self__ = this;
|
||||
var coll__$1 = this;
|
||||
var iter = (function cljs$core$async$impl$timers$iter(node){
|
||||
return (new cljs.core.LazySeq(null,(function (){
|
||||
if((node == null)){
|
||||
return null;
|
||||
} else {
|
||||
return cljs.core.cons(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [node.key,node.val], null),cljs$core$async$impl$timers$iter((node.forward[(0)])));
|
||||
}
|
||||
}),null,null));
|
||||
});
|
||||
return iter((self__.header.forward[(0)]));
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.SkipList.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (coll,writer,opts){
|
||||
var self__ = this;
|
||||
var coll__$1 = this;
|
||||
var pr_pair = (function (keyval){
|
||||
return cljs.core.pr_sequential_writer(writer,cljs.core.pr_writer,""," ","",opts,keyval);
|
||||
});
|
||||
return cljs.core.pr_sequential_writer(writer,pr_pair,"{",", ","}",opts,coll__$1);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.SkipList.getBasis = (function (){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"header","header",1759972661,null),cljs.core.with_meta(new cljs.core.Symbol(null,"level","level",-1363938217,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null);
|
||||
}));
|
||||
|
||||
(cljs.core.async.impl.timers.SkipList.cljs$lang$type = true);
|
||||
|
||||
(cljs.core.async.impl.timers.SkipList.cljs$lang$ctorStr = "cljs.core.async.impl.timers/SkipList");
|
||||
|
||||
(cljs.core.async.impl.timers.SkipList.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
|
||||
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.timers/SkipList");
|
||||
}));
|
||||
|
||||
/**
|
||||
* Positional factory function for cljs.core.async.impl.timers/SkipList.
|
||||
*/
|
||||
cljs.core.async.impl.timers.__GT_SkipList = (function cljs$core$async$impl$timers$__GT_SkipList(header,level){
|
||||
return (new cljs.core.async.impl.timers.SkipList(header,level));
|
||||
});
|
||||
|
||||
cljs.core.async.impl.timers.skip_list = (function cljs$core$async$impl$timers$skip_list(){
|
||||
return (new cljs.core.async.impl.timers.SkipList(cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1((0)),(0)));
|
||||
});
|
||||
cljs.core.async.impl.timers.timeouts_map = cljs.core.async.impl.timers.skip_list();
|
||||
cljs.core.async.impl.timers.TIMEOUT_RESOLUTION_MS = (10);
|
||||
/**
|
||||
* returns a channel that will close after msecs
|
||||
*/
|
||||
cljs.core.async.impl.timers.timeout = (function cljs$core$async$impl$timers$timeout(msecs){
|
||||
var timeout = ((new Date()).valueOf() + msecs);
|
||||
var me = cljs.core.async.impl.timers.timeouts_map.ceilingEntry(timeout);
|
||||
var or__5045__auto__ = (cljs.core.truth_((function (){var and__5043__auto__ = me;
|
||||
if(cljs.core.truth_(and__5043__auto__)){
|
||||
return (me.key < (timeout + cljs.core.async.impl.timers.TIMEOUT_RESOLUTION_MS));
|
||||
} else {
|
||||
return and__5043__auto__;
|
||||
}
|
||||
})())?me.val:null);
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
var timeout_channel = cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1(null);
|
||||
cljs.core.async.impl.timers.timeouts_map.put(timeout,timeout_channel);
|
||||
|
||||
cljs.core.async.impl.dispatch.queue_delay((function (){
|
||||
cljs.core.async.impl.timers.timeouts_map.remove(timeout);
|
||||
|
||||
return cljs.core.async.impl.protocols.close_BANG_(timeout_channel);
|
||||
}),msecs);
|
||||
|
||||
return timeout_channel;
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=cljs.core.async.impl.timers.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -1,684 +0,0 @@
|
|||
goog.provide('cljs.repl');
|
||||
cljs.repl.print_doc = (function cljs$repl$print_doc(p__20270){
|
||||
var map__20271 = p__20270;
|
||||
var map__20271__$1 = cljs.core.__destructure_map(map__20271);
|
||||
var m = map__20271__$1;
|
||||
var n = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20271__$1,new cljs.core.Keyword(null,"ns","ns",441598760));
|
||||
var nm = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20271__$1,new cljs.core.Keyword(null,"name","name",1843675177));
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["-------------------------"], 0));
|
||||
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([(function (){var or__5045__auto__ = new cljs.core.Keyword(null,"spec","spec",347520401).cljs$core$IFn$_invoke$arity$1(m);
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
return [(function (){var temp__5804__auto__ = new cljs.core.Keyword(null,"ns","ns",441598760).cljs$core$IFn$_invoke$arity$1(m);
|
||||
if(cljs.core.truth_(temp__5804__auto__)){
|
||||
var ns = temp__5804__auto__;
|
||||
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(ns),"/"].join('');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})(),cljs.core.str.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(m))].join('');
|
||||
}
|
||||
})()], 0));
|
||||
|
||||
if(cljs.core.truth_(new cljs.core.Keyword(null,"protocol","protocol",652470118).cljs$core$IFn$_invoke$arity$1(m))){
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Protocol"], 0));
|
||||
} else {
|
||||
}
|
||||
|
||||
if(cljs.core.truth_(new cljs.core.Keyword(null,"forms","forms",2045992350).cljs$core$IFn$_invoke$arity$1(m))){
|
||||
var seq__20272_20550 = cljs.core.seq(new cljs.core.Keyword(null,"forms","forms",2045992350).cljs$core$IFn$_invoke$arity$1(m));
|
||||
var chunk__20273_20551 = null;
|
||||
var count__20274_20552 = (0);
|
||||
var i__20275_20553 = (0);
|
||||
while(true){
|
||||
if((i__20275_20553 < count__20274_20552)){
|
||||
var f_20554 = chunk__20273_20551.cljs$core$IIndexed$_nth$arity$2(null,i__20275_20553);
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",f_20554], 0));
|
||||
|
||||
|
||||
var G__20555 = seq__20272_20550;
|
||||
var G__20556 = chunk__20273_20551;
|
||||
var G__20557 = count__20274_20552;
|
||||
var G__20558 = (i__20275_20553 + (1));
|
||||
seq__20272_20550 = G__20555;
|
||||
chunk__20273_20551 = G__20556;
|
||||
count__20274_20552 = G__20557;
|
||||
i__20275_20553 = G__20558;
|
||||
continue;
|
||||
} else {
|
||||
var temp__5804__auto___20559 = cljs.core.seq(seq__20272_20550);
|
||||
if(temp__5804__auto___20559){
|
||||
var seq__20272_20560__$1 = temp__5804__auto___20559;
|
||||
if(cljs.core.chunked_seq_QMARK_(seq__20272_20560__$1)){
|
||||
var c__5568__auto___20561 = cljs.core.chunk_first(seq__20272_20560__$1);
|
||||
var G__20562 = cljs.core.chunk_rest(seq__20272_20560__$1);
|
||||
var G__20563 = c__5568__auto___20561;
|
||||
var G__20564 = cljs.core.count(c__5568__auto___20561);
|
||||
var G__20565 = (0);
|
||||
seq__20272_20550 = G__20562;
|
||||
chunk__20273_20551 = G__20563;
|
||||
count__20274_20552 = G__20564;
|
||||
i__20275_20553 = G__20565;
|
||||
continue;
|
||||
} else {
|
||||
var f_20566 = cljs.core.first(seq__20272_20560__$1);
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",f_20566], 0));
|
||||
|
||||
|
||||
var G__20567 = cljs.core.next(seq__20272_20560__$1);
|
||||
var G__20568 = null;
|
||||
var G__20569 = (0);
|
||||
var G__20570 = (0);
|
||||
seq__20272_20550 = G__20567;
|
||||
chunk__20273_20551 = G__20568;
|
||||
count__20274_20552 = G__20569;
|
||||
i__20275_20553 = G__20570;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if(cljs.core.truth_(new cljs.core.Keyword(null,"arglists","arglists",1661989754).cljs$core$IFn$_invoke$arity$1(m))){
|
||||
var arglists_20571 = new cljs.core.Keyword(null,"arglists","arglists",1661989754).cljs$core$IFn$_invoke$arity$1(m);
|
||||
if(cljs.core.truth_((function (){var or__5045__auto__ = new cljs.core.Keyword(null,"macro","macro",-867863404).cljs$core$IFn$_invoke$arity$1(m);
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
return new cljs.core.Keyword(null,"repl-special-function","repl-special-function",1262603725).cljs$core$IFn$_invoke$arity$1(m);
|
||||
}
|
||||
})())){
|
||||
cljs.core.prn.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([arglists_20571], 0));
|
||||
} else {
|
||||
cljs.core.prn.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(new cljs.core.Symbol(null,"quote","quote",1377916282,null),cljs.core.first(arglists_20571)))?cljs.core.second(arglists_20571):arglists_20571)], 0));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
if(cljs.core.truth_(new cljs.core.Keyword(null,"special-form","special-form",-1326536374).cljs$core$IFn$_invoke$arity$1(m))){
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Special Form"], 0));
|
||||
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",new cljs.core.Keyword(null,"doc","doc",1913296891).cljs$core$IFn$_invoke$arity$1(m)], 0));
|
||||
|
||||
if(cljs.core.contains_QMARK_(m,new cljs.core.Keyword(null,"url","url",276297046))){
|
||||
if(cljs.core.truth_(new cljs.core.Keyword(null,"url","url",276297046).cljs$core$IFn$_invoke$arity$1(m))){
|
||||
return cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([["\n Please see http://clojure.org/",cljs.core.str.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"url","url",276297046).cljs$core$IFn$_invoke$arity$1(m))].join('')], 0));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([["\n Please see http://clojure.org/special_forms#",cljs.core.str.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(m))].join('')], 0));
|
||||
}
|
||||
} else {
|
||||
if(cljs.core.truth_(new cljs.core.Keyword(null,"macro","macro",-867863404).cljs$core$IFn$_invoke$arity$1(m))){
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Macro"], 0));
|
||||
} else {
|
||||
}
|
||||
|
||||
if(cljs.core.truth_(new cljs.core.Keyword(null,"spec","spec",347520401).cljs$core$IFn$_invoke$arity$1(m))){
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Spec"], 0));
|
||||
} else {
|
||||
}
|
||||
|
||||
if(cljs.core.truth_(new cljs.core.Keyword(null,"repl-special-function","repl-special-function",1262603725).cljs$core$IFn$_invoke$arity$1(m))){
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["REPL Special Function"], 0));
|
||||
} else {
|
||||
}
|
||||
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",new cljs.core.Keyword(null,"doc","doc",1913296891).cljs$core$IFn$_invoke$arity$1(m)], 0));
|
||||
|
||||
if(cljs.core.truth_(new cljs.core.Keyword(null,"protocol","protocol",652470118).cljs$core$IFn$_invoke$arity$1(m))){
|
||||
var seq__20289_20576 = cljs.core.seq(new cljs.core.Keyword(null,"methods","methods",453930866).cljs$core$IFn$_invoke$arity$1(m));
|
||||
var chunk__20290_20577 = null;
|
||||
var count__20291_20578 = (0);
|
||||
var i__20292_20579 = (0);
|
||||
while(true){
|
||||
if((i__20292_20579 < count__20291_20578)){
|
||||
var vec__20301_20580 = chunk__20290_20577.cljs$core$IIndexed$_nth$arity$2(null,i__20292_20579);
|
||||
var name_20581 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20301_20580,(0),null);
|
||||
var map__20304_20582 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20301_20580,(1),null);
|
||||
var map__20304_20583__$1 = cljs.core.__destructure_map(map__20304_20582);
|
||||
var doc_20584 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20304_20583__$1,new cljs.core.Keyword(null,"doc","doc",1913296891));
|
||||
var arglists_20585 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20304_20583__$1,new cljs.core.Keyword(null,"arglists","arglists",1661989754));
|
||||
cljs.core.println();
|
||||
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",name_20581], 0));
|
||||
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",arglists_20585], 0));
|
||||
|
||||
if(cljs.core.truth_(doc_20584)){
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",doc_20584], 0));
|
||||
} else {
|
||||
}
|
||||
|
||||
|
||||
var G__20589 = seq__20289_20576;
|
||||
var G__20590 = chunk__20290_20577;
|
||||
var G__20591 = count__20291_20578;
|
||||
var G__20592 = (i__20292_20579 + (1));
|
||||
seq__20289_20576 = G__20589;
|
||||
chunk__20290_20577 = G__20590;
|
||||
count__20291_20578 = G__20591;
|
||||
i__20292_20579 = G__20592;
|
||||
continue;
|
||||
} else {
|
||||
var temp__5804__auto___20593 = cljs.core.seq(seq__20289_20576);
|
||||
if(temp__5804__auto___20593){
|
||||
var seq__20289_20594__$1 = temp__5804__auto___20593;
|
||||
if(cljs.core.chunked_seq_QMARK_(seq__20289_20594__$1)){
|
||||
var c__5568__auto___20595 = cljs.core.chunk_first(seq__20289_20594__$1);
|
||||
var G__20596 = cljs.core.chunk_rest(seq__20289_20594__$1);
|
||||
var G__20597 = c__5568__auto___20595;
|
||||
var G__20598 = cljs.core.count(c__5568__auto___20595);
|
||||
var G__20599 = (0);
|
||||
seq__20289_20576 = G__20596;
|
||||
chunk__20290_20577 = G__20597;
|
||||
count__20291_20578 = G__20598;
|
||||
i__20292_20579 = G__20599;
|
||||
continue;
|
||||
} else {
|
||||
var vec__20305_20600 = cljs.core.first(seq__20289_20594__$1);
|
||||
var name_20601 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20305_20600,(0),null);
|
||||
var map__20308_20602 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20305_20600,(1),null);
|
||||
var map__20308_20603__$1 = cljs.core.__destructure_map(map__20308_20602);
|
||||
var doc_20604 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20308_20603__$1,new cljs.core.Keyword(null,"doc","doc",1913296891));
|
||||
var arglists_20605 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20308_20603__$1,new cljs.core.Keyword(null,"arglists","arglists",1661989754));
|
||||
cljs.core.println();
|
||||
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",name_20601], 0));
|
||||
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",arglists_20605], 0));
|
||||
|
||||
if(cljs.core.truth_(doc_20604)){
|
||||
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",doc_20604], 0));
|
||||
} else {
|
||||
}
|
||||
|
||||
|
||||
var G__20606 = cljs.core.next(seq__20289_20594__$1);
|
||||
var G__20607 = null;
|
||||
var G__20608 = (0);
|
||||
var G__20609 = (0);
|
||||
seq__20289_20576 = G__20606;
|
||||
chunk__20290_20577 = G__20607;
|
||||
count__20291_20578 = G__20608;
|
||||
i__20292_20579 = G__20609;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if(cljs.core.truth_(n)){
|
||||
var temp__5804__auto__ = cljs.spec.alpha.get_spec(cljs.core.symbol.cljs$core$IFn$_invoke$arity$2(cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.ns_name(n)),cljs.core.name(nm)));
|
||||
if(cljs.core.truth_(temp__5804__auto__)){
|
||||
var fnspec = temp__5804__auto__;
|
||||
cljs.core.print.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Spec"], 0));
|
||||
|
||||
var seq__20309 = cljs.core.seq(new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"args","args",1315556576),new cljs.core.Keyword(null,"ret","ret",-468222814),new cljs.core.Keyword(null,"fn","fn",-1175266204)], null));
|
||||
var chunk__20310 = null;
|
||||
var count__20311 = (0);
|
||||
var i__20312 = (0);
|
||||
while(true){
|
||||
if((i__20312 < count__20311)){
|
||||
var role = chunk__20310.cljs$core$IIndexed$_nth$arity$2(null,i__20312);
|
||||
var temp__5804__auto___20610__$1 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(fnspec,role);
|
||||
if(cljs.core.truth_(temp__5804__auto___20610__$1)){
|
||||
var spec_20611 = temp__5804__auto___20610__$1;
|
||||
cljs.core.print.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([["\n ",cljs.core.name(role),":"].join(''),cljs.spec.alpha.describe(spec_20611)], 0));
|
||||
} else {
|
||||
}
|
||||
|
||||
|
||||
var G__20612 = seq__20309;
|
||||
var G__20613 = chunk__20310;
|
||||
var G__20614 = count__20311;
|
||||
var G__20615 = (i__20312 + (1));
|
||||
seq__20309 = G__20612;
|
||||
chunk__20310 = G__20613;
|
||||
count__20311 = G__20614;
|
||||
i__20312 = G__20615;
|
||||
continue;
|
||||
} else {
|
||||
var temp__5804__auto____$1 = cljs.core.seq(seq__20309);
|
||||
if(temp__5804__auto____$1){
|
||||
var seq__20309__$1 = temp__5804__auto____$1;
|
||||
if(cljs.core.chunked_seq_QMARK_(seq__20309__$1)){
|
||||
var c__5568__auto__ = cljs.core.chunk_first(seq__20309__$1);
|
||||
var G__20616 = cljs.core.chunk_rest(seq__20309__$1);
|
||||
var G__20617 = c__5568__auto__;
|
||||
var G__20618 = cljs.core.count(c__5568__auto__);
|
||||
var G__20619 = (0);
|
||||
seq__20309 = G__20616;
|
||||
chunk__20310 = G__20617;
|
||||
count__20311 = G__20618;
|
||||
i__20312 = G__20619;
|
||||
continue;
|
||||
} else {
|
||||
var role = cljs.core.first(seq__20309__$1);
|
||||
var temp__5804__auto___20621__$2 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(fnspec,role);
|
||||
if(cljs.core.truth_(temp__5804__auto___20621__$2)){
|
||||
var spec_20622 = temp__5804__auto___20621__$2;
|
||||
cljs.core.print.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([["\n ",cljs.core.name(role),":"].join(''),cljs.spec.alpha.describe(spec_20622)], 0));
|
||||
} else {
|
||||
}
|
||||
|
||||
|
||||
var G__20623 = cljs.core.next(seq__20309__$1);
|
||||
var G__20624 = null;
|
||||
var G__20625 = (0);
|
||||
var G__20626 = (0);
|
||||
seq__20309 = G__20623;
|
||||
chunk__20310 = G__20624;
|
||||
count__20311 = G__20625;
|
||||
i__20312 = G__20626;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Constructs a data representation for a Error with keys:
|
||||
* :cause - root cause message
|
||||
* :phase - error phase
|
||||
* :via - cause chain, with cause keys:
|
||||
* :type - exception class symbol
|
||||
* :message - exception message
|
||||
* :data - ex-data
|
||||
* :at - top stack element
|
||||
* :trace - root cause stack elements
|
||||
*/
|
||||
cljs.repl.Error__GT_map = (function cljs$repl$Error__GT_map(o){
|
||||
var base = (function (t){
|
||||
return cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"type","type",1174270348),(((t instanceof cljs.core.ExceptionInfo))?new cljs.core.Symbol("cljs.core","ExceptionInfo","cljs.core/ExceptionInfo",701839050,null):(((t instanceof Error))?cljs.core.symbol.cljs$core$IFn$_invoke$arity$2("js",t.name):null
|
||||
))], null),(function (){var temp__5804__auto__ = cljs.core.ex_message(t);
|
||||
if(cljs.core.truth_(temp__5804__auto__)){
|
||||
var msg = temp__5804__auto__;
|
||||
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"message","message",-406056002),msg], null);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})(),(function (){var temp__5804__auto__ = cljs.core.ex_data(t);
|
||||
if(cljs.core.truth_(temp__5804__auto__)){
|
||||
var ed = temp__5804__auto__;
|
||||
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"data","data",-232669377),ed], null);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})()], 0));
|
||||
});
|
||||
var via = (function (){var via = cljs.core.PersistentVector.EMPTY;
|
||||
var t = o;
|
||||
while(true){
|
||||
if(cljs.core.truth_(t)){
|
||||
var G__20627 = cljs.core.conj.cljs$core$IFn$_invoke$arity$2(via,t);
|
||||
var G__20628 = cljs.core.ex_cause(t);
|
||||
via = G__20627;
|
||||
t = G__20628;
|
||||
continue;
|
||||
} else {
|
||||
return via;
|
||||
}
|
||||
break;
|
||||
}
|
||||
})();
|
||||
var root = cljs.core.peek(via);
|
||||
return cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"via","via",-1904457336),cljs.core.vec(cljs.core.map.cljs$core$IFn$_invoke$arity$2(base,via)),new cljs.core.Keyword(null,"trace","trace",-1082747415),null], null),(function (){var temp__5804__auto__ = cljs.core.ex_message(root);
|
||||
if(cljs.core.truth_(temp__5804__auto__)){
|
||||
var root_msg = temp__5804__auto__;
|
||||
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"cause","cause",231901252),root_msg], null);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})(),(function (){var temp__5804__auto__ = cljs.core.ex_data(root);
|
||||
if(cljs.core.truth_(temp__5804__auto__)){
|
||||
var data = temp__5804__auto__;
|
||||
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"data","data",-232669377),data], null);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})(),(function (){var temp__5804__auto__ = new cljs.core.Keyword("clojure.error","phase","clojure.error/phase",275140358).cljs$core$IFn$_invoke$arity$1(cljs.core.ex_data(o));
|
||||
if(cljs.core.truth_(temp__5804__auto__)){
|
||||
var phase = temp__5804__auto__;
|
||||
return new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"phase","phase",575722892),phase], null);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})()], 0));
|
||||
});
|
||||
/**
|
||||
* Returns an analysis of the phase, error, cause, and location of an error that occurred
|
||||
* based on Throwable data, as returned by Throwable->map. All attributes other than phase
|
||||
* are optional:
|
||||
* :clojure.error/phase - keyword phase indicator, one of:
|
||||
* :read-source :compile-syntax-check :compilation :macro-syntax-check :macroexpansion
|
||||
* :execution :read-eval-result :print-eval-result
|
||||
* :clojure.error/source - file name (no path)
|
||||
* :clojure.error/line - integer line number
|
||||
* :clojure.error/column - integer column number
|
||||
* :clojure.error/symbol - symbol being expanded/compiled/invoked
|
||||
* :clojure.error/class - cause exception class symbol
|
||||
* :clojure.error/cause - cause exception message
|
||||
* :clojure.error/spec - explain-data for spec error
|
||||
*/
|
||||
cljs.repl.ex_triage = (function cljs$repl$ex_triage(datafied_throwable){
|
||||
var map__20351 = datafied_throwable;
|
||||
var map__20351__$1 = cljs.core.__destructure_map(map__20351);
|
||||
var via = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20351__$1,new cljs.core.Keyword(null,"via","via",-1904457336));
|
||||
var trace = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20351__$1,new cljs.core.Keyword(null,"trace","trace",-1082747415));
|
||||
var phase = cljs.core.get.cljs$core$IFn$_invoke$arity$3(map__20351__$1,new cljs.core.Keyword(null,"phase","phase",575722892),new cljs.core.Keyword(null,"execution","execution",253283524));
|
||||
var map__20352 = cljs.core.last(via);
|
||||
var map__20352__$1 = cljs.core.__destructure_map(map__20352);
|
||||
var type = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20352__$1,new cljs.core.Keyword(null,"type","type",1174270348));
|
||||
var message = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20352__$1,new cljs.core.Keyword(null,"message","message",-406056002));
|
||||
var data = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20352__$1,new cljs.core.Keyword(null,"data","data",-232669377));
|
||||
var map__20353 = data;
|
||||
var map__20353__$1 = cljs.core.__destructure_map(map__20353);
|
||||
var problems = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20353__$1,new cljs.core.Keyword("cljs.spec.alpha","problems","cljs.spec.alpha/problems",447400814));
|
||||
var fn = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20353__$1,new cljs.core.Keyword("cljs.spec.alpha","fn","cljs.spec.alpha/fn",408600443));
|
||||
var caller = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20353__$1,new cljs.core.Keyword("cljs.spec.test.alpha","caller","cljs.spec.test.alpha/caller",-398302390));
|
||||
var map__20354 = new cljs.core.Keyword(null,"data","data",-232669377).cljs$core$IFn$_invoke$arity$1(cljs.core.first(via));
|
||||
var map__20354__$1 = cljs.core.__destructure_map(map__20354);
|
||||
var top_data = map__20354__$1;
|
||||
var source = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20354__$1,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397));
|
||||
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3((function (){var G__20355 = phase;
|
||||
var G__20355__$1 = (((G__20355 instanceof cljs.core.Keyword))?G__20355.fqn:null);
|
||||
switch (G__20355__$1) {
|
||||
case "read-source":
|
||||
var map__20357 = data;
|
||||
var map__20357__$1 = cljs.core.__destructure_map(map__20357);
|
||||
var line = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20357__$1,new cljs.core.Keyword("clojure.error","line","clojure.error/line",-1816287471));
|
||||
var column = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20357__$1,new cljs.core.Keyword("clojure.error","column","clojure.error/column",304721553));
|
||||
var G__20358 = cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.Keyword(null,"data","data",-232669377).cljs$core$IFn$_invoke$arity$1(cljs.core.second(via)),top_data], 0));
|
||||
var G__20358__$1 = (cljs.core.truth_(source)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20358,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397),source):G__20358);
|
||||
var G__20358__$2 = (cljs.core.truth_((function (){var fexpr__20360 = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, ["NO_SOURCE_PATH",null,"NO_SOURCE_FILE",null], null), null);
|
||||
return (fexpr__20360.cljs$core$IFn$_invoke$arity$1 ? fexpr__20360.cljs$core$IFn$_invoke$arity$1(source) : fexpr__20360.call(null,source));
|
||||
})())?cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(G__20358__$1,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397)):G__20358__$1);
|
||||
if(cljs.core.truth_(message)){
|
||||
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20358__$2,new cljs.core.Keyword("clojure.error","cause","clojure.error/cause",-1879175742),message);
|
||||
} else {
|
||||
return G__20358__$2;
|
||||
}
|
||||
|
||||
break;
|
||||
case "compile-syntax-check":
|
||||
case "compilation":
|
||||
case "macro-syntax-check":
|
||||
case "macroexpansion":
|
||||
var G__20361 = top_data;
|
||||
var G__20361__$1 = (cljs.core.truth_(source)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20361,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397),source):G__20361);
|
||||
var G__20361__$2 = (cljs.core.truth_((function (){var fexpr__20362 = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, ["NO_SOURCE_PATH",null,"NO_SOURCE_FILE",null], null), null);
|
||||
return (fexpr__20362.cljs$core$IFn$_invoke$arity$1 ? fexpr__20362.cljs$core$IFn$_invoke$arity$1(source) : fexpr__20362.call(null,source));
|
||||
})())?cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(G__20361__$1,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397)):G__20361__$1);
|
||||
var G__20361__$3 = (cljs.core.truth_(type)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20361__$2,new cljs.core.Keyword("clojure.error","class","clojure.error/class",278435890),type):G__20361__$2);
|
||||
var G__20361__$4 = (cljs.core.truth_(message)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20361__$3,new cljs.core.Keyword("clojure.error","cause","clojure.error/cause",-1879175742),message):G__20361__$3);
|
||||
if(cljs.core.truth_(problems)){
|
||||
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20361__$4,new cljs.core.Keyword("clojure.error","spec","clojure.error/spec",2055032595),data);
|
||||
} else {
|
||||
return G__20361__$4;
|
||||
}
|
||||
|
||||
break;
|
||||
case "read-eval-result":
|
||||
case "print-eval-result":
|
||||
var vec__20363 = cljs.core.first(trace);
|
||||
var source__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20363,(0),null);
|
||||
var method = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20363,(1),null);
|
||||
var file = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20363,(2),null);
|
||||
var line = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20363,(3),null);
|
||||
var G__20366 = top_data;
|
||||
var G__20366__$1 = (cljs.core.truth_(line)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20366,new cljs.core.Keyword("clojure.error","line","clojure.error/line",-1816287471),line):G__20366);
|
||||
var G__20366__$2 = (cljs.core.truth_(file)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20366__$1,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397),file):G__20366__$1);
|
||||
var G__20366__$3 = (cljs.core.truth_((function (){var and__5043__auto__ = source__$1;
|
||||
if(cljs.core.truth_(and__5043__auto__)){
|
||||
return method;
|
||||
} else {
|
||||
return and__5043__auto__;
|
||||
}
|
||||
})())?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20366__$2,new cljs.core.Keyword("clojure.error","symbol","clojure.error/symbol",1544821994),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[source__$1,method],null))):G__20366__$2);
|
||||
var G__20366__$4 = (cljs.core.truth_(type)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20366__$3,new cljs.core.Keyword("clojure.error","class","clojure.error/class",278435890),type):G__20366__$3);
|
||||
if(cljs.core.truth_(message)){
|
||||
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20366__$4,new cljs.core.Keyword("clojure.error","cause","clojure.error/cause",-1879175742),message);
|
||||
} else {
|
||||
return G__20366__$4;
|
||||
}
|
||||
|
||||
break;
|
||||
case "execution":
|
||||
var vec__20471 = cljs.core.first(trace);
|
||||
var source__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20471,(0),null);
|
||||
var method = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20471,(1),null);
|
||||
var file = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20471,(2),null);
|
||||
var line = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__20471,(3),null);
|
||||
var file__$1 = cljs.core.first(cljs.core.remove.cljs$core$IFn$_invoke$arity$2((function (p1__20346_SHARP_){
|
||||
var or__5045__auto__ = (p1__20346_SHARP_ == null);
|
||||
if(or__5045__auto__){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
var fexpr__20474 = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, ["NO_SOURCE_PATH",null,"NO_SOURCE_FILE",null], null), null);
|
||||
return (fexpr__20474.cljs$core$IFn$_invoke$arity$1 ? fexpr__20474.cljs$core$IFn$_invoke$arity$1(p1__20346_SHARP_) : fexpr__20474.call(null,p1__20346_SHARP_));
|
||||
}
|
||||
}),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"file","file",-1269645878).cljs$core$IFn$_invoke$arity$1(caller),file], null)));
|
||||
var err_line = (function (){var or__5045__auto__ = new cljs.core.Keyword(null,"line","line",212345235).cljs$core$IFn$_invoke$arity$1(caller);
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
return line;
|
||||
}
|
||||
})();
|
||||
var G__20476 = new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword("clojure.error","class","clojure.error/class",278435890),type], null);
|
||||
var G__20476__$1 = (cljs.core.truth_(err_line)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20476,new cljs.core.Keyword("clojure.error","line","clojure.error/line",-1816287471),err_line):G__20476);
|
||||
var G__20476__$2 = (cljs.core.truth_(message)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20476__$1,new cljs.core.Keyword("clojure.error","cause","clojure.error/cause",-1879175742),message):G__20476__$1);
|
||||
var G__20476__$3 = (cljs.core.truth_((function (){var or__5045__auto__ = fn;
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
var and__5043__auto__ = source__$1;
|
||||
if(cljs.core.truth_(and__5043__auto__)){
|
||||
return method;
|
||||
} else {
|
||||
return and__5043__auto__;
|
||||
}
|
||||
}
|
||||
})())?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20476__$2,new cljs.core.Keyword("clojure.error","symbol","clojure.error/symbol",1544821994),(function (){var or__5045__auto__ = fn;
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[source__$1,method],null));
|
||||
}
|
||||
})()):G__20476__$2);
|
||||
var G__20476__$4 = (cljs.core.truth_(file__$1)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20476__$3,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397),file__$1):G__20476__$3);
|
||||
if(cljs.core.truth_(problems)){
|
||||
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__20476__$4,new cljs.core.Keyword("clojure.error","spec","clojure.error/spec",2055032595),data);
|
||||
} else {
|
||||
return G__20476__$4;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["No matching clause: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__20355__$1)].join('')));
|
||||
|
||||
}
|
||||
})(),new cljs.core.Keyword("clojure.error","phase","clojure.error/phase",275140358),phase);
|
||||
});
|
||||
/**
|
||||
* Returns a string from exception data, as produced by ex-triage.
|
||||
* The first line summarizes the exception phase and location.
|
||||
* The subsequent lines describe the cause.
|
||||
*/
|
||||
cljs.repl.ex_str = (function cljs$repl$ex_str(p__20481){
|
||||
var map__20482 = p__20481;
|
||||
var map__20482__$1 = cljs.core.__destructure_map(map__20482);
|
||||
var triage_data = map__20482__$1;
|
||||
var phase = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20482__$1,new cljs.core.Keyword("clojure.error","phase","clojure.error/phase",275140358));
|
||||
var source = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20482__$1,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397));
|
||||
var line = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20482__$1,new cljs.core.Keyword("clojure.error","line","clojure.error/line",-1816287471));
|
||||
var column = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20482__$1,new cljs.core.Keyword("clojure.error","column","clojure.error/column",304721553));
|
||||
var symbol = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20482__$1,new cljs.core.Keyword("clojure.error","symbol","clojure.error/symbol",1544821994));
|
||||
var class$ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20482__$1,new cljs.core.Keyword("clojure.error","class","clojure.error/class",278435890));
|
||||
var cause = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20482__$1,new cljs.core.Keyword("clojure.error","cause","clojure.error/cause",-1879175742));
|
||||
var spec = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__20482__$1,new cljs.core.Keyword("clojure.error","spec","clojure.error/spec",2055032595));
|
||||
var loc = [cljs.core.str.cljs$core$IFn$_invoke$arity$1((function (){var or__5045__auto__ = source;
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
return "<cljs repl>";
|
||||
}
|
||||
})()),":",cljs.core.str.cljs$core$IFn$_invoke$arity$1((function (){var or__5045__auto__ = line;
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
return (1);
|
||||
}
|
||||
})()),(cljs.core.truth_(column)?[":",cljs.core.str.cljs$core$IFn$_invoke$arity$1(column)].join(''):"")].join('');
|
||||
var class_name = cljs.core.name((function (){var or__5045__auto__ = class$;
|
||||
if(cljs.core.truth_(or__5045__auto__)){
|
||||
return or__5045__auto__;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
})());
|
||||
var simple_class = class_name;
|
||||
var cause_type = ((cljs.core.contains_QMARK_(new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, ["RuntimeException",null,"Exception",null], null), null),simple_class))?"":[" (",simple_class,")"].join(''));
|
||||
var format = goog.string.format;
|
||||
var G__20503 = phase;
|
||||
var G__20503__$1 = (((G__20503 instanceof cljs.core.Keyword))?G__20503.fqn:null);
|
||||
switch (G__20503__$1) {
|
||||
case "read-source":
|
||||
return (format.cljs$core$IFn$_invoke$arity$3 ? format.cljs$core$IFn$_invoke$arity$3("Syntax error reading source at (%s).\n%s\n",loc,cause) : format.call(null,"Syntax error reading source at (%s).\n%s\n",loc,cause));
|
||||
|
||||
break;
|
||||
case "macro-syntax-check":
|
||||
var G__20504 = "Syntax error macroexpanding %sat (%s).\n%s";
|
||||
var G__20505 = (cljs.core.truth_(symbol)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(symbol)," "].join(''):"");
|
||||
var G__20506 = loc;
|
||||
var G__20507 = (cljs.core.truth_(spec)?(function (){var sb__5690__auto__ = (new goog.string.StringBuffer());
|
||||
var _STAR_print_newline_STAR__orig_val__20508_20646 = cljs.core._STAR_print_newline_STAR_;
|
||||
var _STAR_print_fn_STAR__orig_val__20509_20647 = cljs.core._STAR_print_fn_STAR_;
|
||||
var _STAR_print_newline_STAR__temp_val__20510_20648 = true;
|
||||
var _STAR_print_fn_STAR__temp_val__20511_20649 = (function (x__5691__auto__){
|
||||
return sb__5690__auto__.append(x__5691__auto__);
|
||||
});
|
||||
(cljs.core._STAR_print_newline_STAR_ = _STAR_print_newline_STAR__temp_val__20510_20648);
|
||||
|
||||
(cljs.core._STAR_print_fn_STAR_ = _STAR_print_fn_STAR__temp_val__20511_20649);
|
||||
|
||||
try{cljs.spec.alpha.explain_out(cljs.core.update.cljs$core$IFn$_invoke$arity$3(spec,new cljs.core.Keyword("cljs.spec.alpha","problems","cljs.spec.alpha/problems",447400814),(function (probs){
|
||||
return cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (p1__20478_SHARP_){
|
||||
return cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(p1__20478_SHARP_,new cljs.core.Keyword(null,"in","in",-1531184865));
|
||||
}),probs);
|
||||
}))
|
||||
);
|
||||
}finally {(cljs.core._STAR_print_fn_STAR_ = _STAR_print_fn_STAR__orig_val__20509_20647);
|
||||
|
||||
(cljs.core._STAR_print_newline_STAR_ = _STAR_print_newline_STAR__orig_val__20508_20646);
|
||||
}
|
||||
return cljs.core.str.cljs$core$IFn$_invoke$arity$1(sb__5690__auto__);
|
||||
})():(format.cljs$core$IFn$_invoke$arity$2 ? format.cljs$core$IFn$_invoke$arity$2("%s\n",cause) : format.call(null,"%s\n",cause)));
|
||||
return (format.cljs$core$IFn$_invoke$arity$4 ? format.cljs$core$IFn$_invoke$arity$4(G__20504,G__20505,G__20506,G__20507) : format.call(null,G__20504,G__20505,G__20506,G__20507));
|
||||
|
||||
break;
|
||||
case "macroexpansion":
|
||||
var G__20512 = "Unexpected error%s macroexpanding %sat (%s).\n%s\n";
|
||||
var G__20513 = cause_type;
|
||||
var G__20514 = (cljs.core.truth_(symbol)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(symbol)," "].join(''):"");
|
||||
var G__20515 = loc;
|
||||
var G__20516 = cause;
|
||||
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5(G__20512,G__20513,G__20514,G__20515,G__20516) : format.call(null,G__20512,G__20513,G__20514,G__20515,G__20516));
|
||||
|
||||
break;
|
||||
case "compile-syntax-check":
|
||||
var G__20517 = "Syntax error%s compiling %sat (%s).\n%s\n";
|
||||
var G__20518 = cause_type;
|
||||
var G__20519 = (cljs.core.truth_(symbol)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(symbol)," "].join(''):"");
|
||||
var G__20520 = loc;
|
||||
var G__20521 = cause;
|
||||
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5(G__20517,G__20518,G__20519,G__20520,G__20521) : format.call(null,G__20517,G__20518,G__20519,G__20520,G__20521));
|
||||
|
||||
break;
|
||||
case "compilation":
|
||||
var G__20522 = "Unexpected error%s compiling %sat (%s).\n%s\n";
|
||||
var G__20523 = cause_type;
|
||||
var G__20524 = (cljs.core.truth_(symbol)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(symbol)," "].join(''):"");
|
||||
var G__20525 = loc;
|
||||
var G__20526 = cause;
|
||||
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5(G__20522,G__20523,G__20524,G__20525,G__20526) : format.call(null,G__20522,G__20523,G__20524,G__20525,G__20526));
|
||||
|
||||
break;
|
||||
case "read-eval-result":
|
||||
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5("Error reading eval result%s at %s (%s).\n%s\n",cause_type,symbol,loc,cause) : format.call(null,"Error reading eval result%s at %s (%s).\n%s\n",cause_type,symbol,loc,cause));
|
||||
|
||||
break;
|
||||
case "print-eval-result":
|
||||
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5("Error printing return value%s at %s (%s).\n%s\n",cause_type,symbol,loc,cause) : format.call(null,"Error printing return value%s at %s (%s).\n%s\n",cause_type,symbol,loc,cause));
|
||||
|
||||
break;
|
||||
case "execution":
|
||||
if(cljs.core.truth_(spec)){
|
||||
var G__20527 = "Execution error - invalid arguments to %s at (%s).\n%s";
|
||||
var G__20528 = symbol;
|
||||
var G__20529 = loc;
|
||||
var G__20530 = (function (){var sb__5690__auto__ = (new goog.string.StringBuffer());
|
||||
var _STAR_print_newline_STAR__orig_val__20531_20650 = cljs.core._STAR_print_newline_STAR_;
|
||||
var _STAR_print_fn_STAR__orig_val__20532_20651 = cljs.core._STAR_print_fn_STAR_;
|
||||
var _STAR_print_newline_STAR__temp_val__20533_20652 = true;
|
||||
var _STAR_print_fn_STAR__temp_val__20534_20653 = (function (x__5691__auto__){
|
||||
return sb__5690__auto__.append(x__5691__auto__);
|
||||
});
|
||||
(cljs.core._STAR_print_newline_STAR_ = _STAR_print_newline_STAR__temp_val__20533_20652);
|
||||
|
||||
(cljs.core._STAR_print_fn_STAR_ = _STAR_print_fn_STAR__temp_val__20534_20653);
|
||||
|
||||
try{cljs.spec.alpha.explain_out(cljs.core.update.cljs$core$IFn$_invoke$arity$3(spec,new cljs.core.Keyword("cljs.spec.alpha","problems","cljs.spec.alpha/problems",447400814),(function (probs){
|
||||
return cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (p1__20479_SHARP_){
|
||||
return cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(p1__20479_SHARP_,new cljs.core.Keyword(null,"in","in",-1531184865));
|
||||
}),probs);
|
||||
}))
|
||||
);
|
||||
}finally {(cljs.core._STAR_print_fn_STAR_ = _STAR_print_fn_STAR__orig_val__20532_20651);
|
||||
|
||||
(cljs.core._STAR_print_newline_STAR_ = _STAR_print_newline_STAR__orig_val__20531_20650);
|
||||
}
|
||||
return cljs.core.str.cljs$core$IFn$_invoke$arity$1(sb__5690__auto__);
|
||||
})();
|
||||
return (format.cljs$core$IFn$_invoke$arity$4 ? format.cljs$core$IFn$_invoke$arity$4(G__20527,G__20528,G__20529,G__20530) : format.call(null,G__20527,G__20528,G__20529,G__20530));
|
||||
} else {
|
||||
var G__20537 = "Execution error%s at %s(%s).\n%s\n";
|
||||
var G__20538 = cause_type;
|
||||
var G__20539 = (cljs.core.truth_(symbol)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(symbol)," "].join(''):"");
|
||||
var G__20540 = loc;
|
||||
var G__20541 = cause;
|
||||
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5(G__20537,G__20538,G__20539,G__20540,G__20541) : format.call(null,G__20537,G__20538,G__20539,G__20540,G__20541));
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["No matching clause: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__20503__$1)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
cljs.repl.error__GT_str = (function cljs$repl$error__GT_str(error){
|
||||
return cljs.repl.ex_str(cljs.repl.ex_triage(cljs.repl.Error__GT_map(error)));
|
||||
});
|
||||
|
||||
//# sourceMappingURL=cljs.repl.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,3 +0,0 @@
|
|||
goog.provide('cljs.user');
|
||||
|
||||
//# sourceMappingURL=cljs.user.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["cljs/user.cljs"],"mappings":"","names":[],"sourcesContent":["[(ns cljs.user (:require [cljs.repl :refer (doc find-doc source apropos pst dir)]))]"],"x_google_ignoreList":[0]}
|
|
@ -1,94 +0,0 @@
|
|||
goog.provide('clojure.core.protocols');
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
clojure.core.protocols.Datafiable = function(){};
|
||||
|
||||
var clojure$core$protocols$Datafiable$datafy$dyn_18645 = (function (o){
|
||||
var x__5393__auto__ = (((o == null))?null:o);
|
||||
var m__5394__auto__ = (clojure.core.protocols.datafy[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(o) : m__5394__auto__.call(null,o));
|
||||
} else {
|
||||
var m__5392__auto__ = (clojure.core.protocols.datafy["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(o) : m__5392__auto__.call(null,o));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Datafiable.datafy",o);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* return a representation of o as data (default identity)
|
||||
*/
|
||||
clojure.core.protocols.datafy = (function clojure$core$protocols$datafy(o){
|
||||
var temp__5802__auto__ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.meta(o),cljs.core.with_meta(new cljs.core.Symbol("clojure.core.protocols","datafy","clojure.core.protocols/datafy",707534751,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword("cljs.analyzer","no-resolve","cljs.analyzer/no-resolve",-1872351017),true], null)));
|
||||
if(temp__5802__auto__){
|
||||
var meta_impl__5395__auto__ = temp__5802__auto__;
|
||||
return (meta_impl__5395__auto__.cljs$core$IFn$_invoke$arity$1 ? meta_impl__5395__auto__.cljs$core$IFn$_invoke$arity$1(o) : meta_impl__5395__auto__.call(null,o));
|
||||
} else {
|
||||
if((((!((o == null)))) && ((!((o.clojure$core$protocols$Datafiable$datafy$arity$1 == null)))))){
|
||||
return o.clojure$core$protocols$Datafiable$datafy$arity$1(o);
|
||||
} else {
|
||||
return clojure$core$protocols$Datafiable$datafy$dyn_18645(o);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.core.protocols.Datafiable["null"] = true);
|
||||
|
||||
(clojure.core.protocols.datafy["null"] = (function (_){
|
||||
return null;
|
||||
}));
|
||||
|
||||
(clojure.core.protocols.Datafiable["_"] = true);
|
||||
|
||||
(clojure.core.protocols.datafy["_"] = (function (o){
|
||||
return o;
|
||||
}));
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
clojure.core.protocols.Navigable = function(){};
|
||||
|
||||
var clojure$core$protocols$Navigable$nav$dyn_18646 = (function (coll,k,v){
|
||||
var x__5393__auto__ = (((coll == null))?null:coll);
|
||||
var m__5394__auto__ = (clojure.core.protocols.nav[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$3(coll,k,v) : m__5394__auto__.call(null,coll,k,v));
|
||||
} else {
|
||||
var m__5392__auto__ = (clojure.core.protocols.nav["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$3(coll,k,v) : m__5392__auto__.call(null,coll,k,v));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Navigable.nav",coll);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* return (possibly transformed) v in the context of coll and k (a key/index or nil),
|
||||
* defaults to returning v.
|
||||
*/
|
||||
clojure.core.protocols.nav = (function clojure$core$protocols$nav(coll,k,v){
|
||||
var temp__5802__auto__ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.meta(coll),cljs.core.with_meta(new cljs.core.Symbol("clojure.core.protocols","nav","clojure.core.protocols/nav",298936762,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword("cljs.analyzer","no-resolve","cljs.analyzer/no-resolve",-1872351017),true], null)));
|
||||
if(temp__5802__auto__){
|
||||
var meta_impl__5395__auto__ = temp__5802__auto__;
|
||||
return (meta_impl__5395__auto__.cljs$core$IFn$_invoke$arity$3 ? meta_impl__5395__auto__.cljs$core$IFn$_invoke$arity$3(coll,k,v) : meta_impl__5395__auto__.call(null,coll,k,v));
|
||||
} else {
|
||||
if((((!((coll == null)))) && ((!((coll.clojure$core$protocols$Navigable$nav$arity$3 == null)))))){
|
||||
return coll.clojure$core$protocols$Navigable$nav$arity$3(coll,k,v);
|
||||
} else {
|
||||
return clojure$core$protocols$Navigable$nav$dyn_18646(coll,k,v);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.core.protocols.Navigable["_"] = true);
|
||||
|
||||
(clojure.core.protocols.nav["_"] = (function (_,___$1,x){
|
||||
return x;
|
||||
}));
|
||||
|
||||
//# sourceMappingURL=clojure.core.protocols.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["clojure/core/protocols.cljs"],"mappings":";AAUA,AAAA;AAAA;;;oCAAA,pCAAaW;;AAAb,IAAAX,qDAAA,WAEWY;AAFX,AAAA,IAAAX,kBAAA,EAAA,MAAA,OAAA,ZAEWW,iBAAAA;IAFXV,kBAAA,CAAAC,8BAAA,AAAAC,YAAAH;AAAA,AAAA,GAAA,GAAA,CAAAC,mBAAA;AAAA,QAAAA,gDAAAA,mDAAAA,LAEWU,+BAAAA;;AAFX,IAAAP,kBAAA,CAAAF,8BAAA;AAAA,AAAA,GAAA,GAAA,CAAAE,mBAAA;AAAA,QAAAA,gDAAAA,mDAAAA,LAEWO,+BAAAA;;AAFX,MAAA,AAAAN,2BAAA,oBAEWM;;;;AAFX,AAAA;;;gCAAA,hCAEGT,wEAAQS;AAFX,AAAA,IAAAL,qBAAA,AAAAC,4CAAA,AAAAC,kBAAA,AAAA,HAEWG;AAFX,AAAA,GAAAL;AAAA,IAAAG,0BAAAH;AAAA,AAAA,QAAAG,wDAAAA,2DAAAA,LAEWE,uCAAAA;;AAFX,GAAA,EAAA,GAAA,MAAA,aAAA,GAAA,CAAA,sDAAA,5EAEWA,sBAAAA;AAFX,OAEWA,mDAAAA;;AAFX,OAAAZ,mDAEWY;;;;;AAFX,AAIA,AAAA,AAAA,CAAAD,kCAAA,UAAA;;AAAA,CAAAR,8BAAA,UAEE,WAASU;AAAT,AAAA;;;AAFF,AAAA,CAAAF,kCAAA,OAAA;;AAAA,CAAAR,8BAAA,OAKE,WAASS;AAAT,AAAYA;;AAEd,AAAA;AAAA;;;mCAAA,nCAAaI;;AAAb,IAAAF,iDAAA,WAEQG,KAAKC,EAAEC;AAFf,AAAA,IAAAlB,kBAAA,EAAA,SAAA,OAAA,fAEQgB,oBAAAA;IAFRf,kBAAA,CAAAa,2BAAA,AAAAX,YAAAH;AAAA,AAAA,GAAA,GAAA,CAAAC,mBAAA;AAAA,QAAAA,gDAAAA,0DAAAA,ZAEQe,sCAAAA,jCAAKC,sCAAAA,pCAAEC,sCAAAA;;AAFf,IAAAd,kBAAA,CAAAU,2BAAA;AAAA,AAAA,GAAA,GAAA,CAAAV,mBAAA;AAAA,QAAAA,gDAAAA,0DAAAA,ZAEQY,sCAAAA,jCAAKC,sCAAAA,pCAAEC,sCAAAA;;AAFf,MAAA,AAAAb,2BAAA,gBAEQW;;;;AAFR,AAAA;;;;6BAAA,7BAEGF,kEAAKE,KAAKC,EAAEC;AAFf,AAAA,IAAAZ,qBAAA,AAAAC,4CAAA,AAAAC,qBAAA,AAAA,NAEQQ;AAFR,AAAA,GAAAV;AAAA,IAAAG,0BAAAH;AAAA,AAAA,QAAAG,wDAAAA,kEAAAA,ZAEQO,8CAAAA,zCAAKC,8CAAAA,5CAAEC,8CAAAA;;AAFf,GAAA,EAAA,GAAA,SAAA,aAAA,GAAA,CAAA,qDAAA,9EAEQF,yBAAAA;AAFR,OAEQA,kDAAAA,KAAKC,EAAEC;;AAFf,OAAAL,+CAEQG,KAAKC,EAAEC;;;;;AAFf,AAKA,AAAA,AAAA,CAAAH,iCAAA,OAAA;;AAAA,CAAAD,2BAAA,OAEE,WAAMF,EAAEA,MAAEO;AAAV,AAAaA","names":["clojure$core$protocols$Datafiable$datafy$dyn","x__5393__auto__","m__5394__auto__","clojure.core.protocols/datafy","goog/typeOf","m__5392__auto__","cljs.core/missing-protocol","temp__5802__auto__","cljs.core.get","cljs.core/meta","meta-impl__5395__auto__","clojure.core.protocols/Datafiable","o","_","clojure$core$protocols$Navigable$nav$dyn","clojure.core.protocols/nav","clojure.core.protocols/Navigable","coll","k","v","x"],"sourcesContent":["; Copyright (c) Rich Hickey. All rights reserved.\n; The use and distribution terms for this software are covered by the\n; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)\n; which can be found in the file epl-v10.html at the root of this distribution.\n; By using this software in any fashion, you are agreeing to be bound by\n; the terms of this license.\n; You must not remove this notice, or any other, from this software.\n\n(ns clojure.core.protocols)\n\n(defprotocol Datafiable\n :extend-via-metadata true\n (datafy [o] \"return a representation of o as data (default identity)\"))\n\n(extend-protocol Datafiable\n nil\n (datafy [_] nil)\n\n default\n (datafy [o] o))\n\n(defprotocol Navigable\n :extend-via-metadata true\n (nav [coll k v] \"return (possibly transformed) v in the context of coll and k (a key/index or nil),\ndefaults to returning v.\"))\n\n(extend-protocol Navigable\n default\n (nav [_ _ x] x))\n"],"x_google_ignoreList":[0]}
|
|
@ -1,292 +0,0 @@
|
|||
goog.provide('clojure.data');
|
||||
/**
|
||||
* Internal helper for diff.
|
||||
*/
|
||||
clojure.data.atom_diff = (function clojure$data$atom_diff(a,b){
|
||||
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(a,b)){
|
||||
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,null,a], null);
|
||||
} else {
|
||||
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,b,null], null);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Convert an associative-by-numeric-index collection into
|
||||
* an equivalent vector, with nil for any missing keys
|
||||
*/
|
||||
clojure.data.vectorize = (function clojure$data$vectorize(m){
|
||||
if(cljs.core.seq(m)){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (result,p__14553){
|
||||
var vec__14555 = p__14553;
|
||||
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14555,(0),null);
|
||||
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14555,(1),null);
|
||||
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(result,k,v);
|
||||
}),cljs.core.vec(cljs.core.repeat.cljs$core$IFn$_invoke$arity$2(cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.max,cljs.core.keys(m)),null)),m);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Diff associative things a and b, comparing only the key k.
|
||||
*/
|
||||
clojure.data.diff_associative_key = (function clojure$data$diff_associative_key(a,b,k){
|
||||
var va = cljs.core.get.cljs$core$IFn$_invoke$arity$2(a,k);
|
||||
var vb = cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,k);
|
||||
var vec__14559 = clojure.data.diff(va,vb);
|
||||
var a_STAR_ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14559,(0),null);
|
||||
var b_STAR_ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14559,(1),null);
|
||||
var ab = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14559,(2),null);
|
||||
var in_a = cljs.core.contains_QMARK_(a,k);
|
||||
var in_b = cljs.core.contains_QMARK_(b,k);
|
||||
var same = ((in_a) && (((in_b) && ((((!((ab == null)))) || ((((va == null)) && ((vb == null)))))))));
|
||||
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [((((in_a) && ((((!((a_STAR_ == null)))) || ((!(same)))))))?cljs.core.PersistentArrayMap.createAsIfByAssoc([k,a_STAR_]):null),((((in_b) && ((((!((b_STAR_ == null)))) || ((!(same)))))))?cljs.core.PersistentArrayMap.createAsIfByAssoc([k,b_STAR_]):null),((same)?cljs.core.PersistentArrayMap.createAsIfByAssoc([k,ab]):null)], null);
|
||||
});
|
||||
/**
|
||||
* Diff associative things a and b, comparing only keys in ks (if supplied).
|
||||
*/
|
||||
clojure.data.diff_associative = (function clojure$data$diff_associative(var_args){
|
||||
var G__14581 = arguments.length;
|
||||
switch (G__14581) {
|
||||
case 2:
|
||||
return clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
return clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$2 = (function (a,b){
|
||||
return clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$3(a,b,clojure.set.union.cljs$core$IFn$_invoke$arity$2(cljs.core.keys(a),cljs.core.keys(b)));
|
||||
}));
|
||||
|
||||
(clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$3 = (function (a,b,ks){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (diff1,diff2){
|
||||
return cljs.core.doall.cljs$core$IFn$_invoke$arity$1(cljs.core.map.cljs$core$IFn$_invoke$arity$3(cljs.core.merge,diff1,diff2));
|
||||
}),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,null,null], null),cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.partial.cljs$core$IFn$_invoke$arity$3(clojure.data.diff_associative_key,a,b),ks));
|
||||
}));
|
||||
|
||||
(clojure.data.diff_associative.cljs$lang$maxFixedArity = 3);
|
||||
|
||||
clojure.data.diff_sequential = (function clojure$data$diff_sequential(a,b){
|
||||
return cljs.core.vec(cljs.core.map.cljs$core$IFn$_invoke$arity$2(clojure.data.vectorize,clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$3(((cljs.core.vector_QMARK_(a))?a:cljs.core.vec(a)),((cljs.core.vector_QMARK_(b))?b:cljs.core.vec(b)),cljs.core.range.cljs$core$IFn$_invoke$arity$1((function (){var x__5130__auto__ = cljs.core.count(a);
|
||||
var y__5131__auto__ = cljs.core.count(b);
|
||||
return ((x__5130__auto__ > y__5131__auto__) ? x__5130__auto__ : y__5131__auto__);
|
||||
})()))));
|
||||
});
|
||||
clojure.data.diff_set = (function clojure$data$diff_set(a,b){
|
||||
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.not_empty(clojure.set.difference.cljs$core$IFn$_invoke$arity$2(a,b)),cljs.core.not_empty(clojure.set.difference.cljs$core$IFn$_invoke$arity$2(b,a)),cljs.core.not_empty(clojure.set.intersection.cljs$core$IFn$_invoke$arity$2(a,b))], null);
|
||||
});
|
||||
|
||||
/**
|
||||
* Implementation detail. Subject to change.
|
||||
* @interface
|
||||
*/
|
||||
clojure.data.EqualityPartition = function(){};
|
||||
|
||||
var clojure$data$EqualityPartition$equality_partition$dyn_14650 = (function (x){
|
||||
var x__5393__auto__ = (((x == null))?null:x);
|
||||
var m__5394__auto__ = (clojure.data.equality_partition[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(x) : m__5394__auto__.call(null,x));
|
||||
} else {
|
||||
var m__5392__auto__ = (clojure.data.equality_partition["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(x) : m__5392__auto__.call(null,x));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("EqualityPartition.equality-partition",x);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Implementation detail. Subject to change.
|
||||
*/
|
||||
clojure.data.equality_partition = (function clojure$data$equality_partition(x){
|
||||
if((((!((x == null)))) && ((!((x.clojure$data$EqualityPartition$equality_partition$arity$1 == null)))))){
|
||||
return x.clojure$data$EqualityPartition$equality_partition$arity$1(x);
|
||||
} else {
|
||||
return clojure$data$EqualityPartition$equality_partition$dyn_14650(x);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Implementation detail. Subject to change.
|
||||
* @interface
|
||||
*/
|
||||
clojure.data.Diff = function(){};
|
||||
|
||||
var clojure$data$Diff$diff_similar$dyn_14652 = (function (a,b){
|
||||
var x__5393__auto__ = (((a == null))?null:a);
|
||||
var m__5394__auto__ = (clojure.data.diff_similar[goog.typeOf(x__5393__auto__)]);
|
||||
if((!((m__5394__auto__ == null)))){
|
||||
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$2(a,b) : m__5394__auto__.call(null,a,b));
|
||||
} else {
|
||||
var m__5392__auto__ = (clojure.data.diff_similar["_"]);
|
||||
if((!((m__5392__auto__ == null)))){
|
||||
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$2(a,b) : m__5392__auto__.call(null,a,b));
|
||||
} else {
|
||||
throw cljs.core.missing_protocol("Diff.diff-similar",a);
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Implementation detail. Subject to change.
|
||||
*/
|
||||
clojure.data.diff_similar = (function clojure$data$diff_similar(a,b){
|
||||
if((((!((a == null)))) && ((!((a.clojure$data$Diff$diff_similar$arity$2 == null)))))){
|
||||
return a.clojure$data$Diff$diff_similar$arity$2(a,b);
|
||||
} else {
|
||||
return clojure$data$Diff$diff_similar$dyn_14652(a,b);
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.data.EqualityPartition["null"] = true);
|
||||
|
||||
(clojure.data.equality_partition["null"] = (function (x){
|
||||
return new cljs.core.Keyword(null,"atom","atom",-397043653);
|
||||
}));
|
||||
|
||||
(clojure.data.EqualityPartition["string"] = true);
|
||||
|
||||
(clojure.data.equality_partition["string"] = (function (x){
|
||||
return new cljs.core.Keyword(null,"atom","atom",-397043653);
|
||||
}));
|
||||
|
||||
(clojure.data.EqualityPartition["number"] = true);
|
||||
|
||||
(clojure.data.equality_partition["number"] = (function (x){
|
||||
return new cljs.core.Keyword(null,"atom","atom",-397043653);
|
||||
}));
|
||||
|
||||
(clojure.data.EqualityPartition["array"] = true);
|
||||
|
||||
(clojure.data.equality_partition["array"] = (function (x){
|
||||
return new cljs.core.Keyword(null,"sequential","sequential",-1082983960);
|
||||
}));
|
||||
|
||||
(clojure.data.EqualityPartition["function"] = true);
|
||||
|
||||
(clojure.data.equality_partition["function"] = (function (x){
|
||||
return new cljs.core.Keyword(null,"atom","atom",-397043653);
|
||||
}));
|
||||
|
||||
(clojure.data.EqualityPartition["boolean"] = true);
|
||||
|
||||
(clojure.data.equality_partition["boolean"] = (function (x){
|
||||
return new cljs.core.Keyword(null,"atom","atom",-397043653);
|
||||
}));
|
||||
|
||||
(clojure.data.EqualityPartition["_"] = true);
|
||||
|
||||
(clojure.data.equality_partition["_"] = (function (x){
|
||||
if((((!((x == null))))?(((((x.cljs$lang$protocol_mask$partition0$ & (1024))) || ((cljs.core.PROTOCOL_SENTINEL === x.cljs$core$IMap$))))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_(cljs.core.IMap,x):false)):cljs.core.native_satisfies_QMARK_(cljs.core.IMap,x))){
|
||||
return new cljs.core.Keyword(null,"map","map",1371690461);
|
||||
} else {
|
||||
if((((!((x == null))))?(((((x.cljs$lang$protocol_mask$partition0$ & (4096))) || ((cljs.core.PROTOCOL_SENTINEL === x.cljs$core$ISet$))))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_(cljs.core.ISet,x):false)):cljs.core.native_satisfies_QMARK_(cljs.core.ISet,x))){
|
||||
return new cljs.core.Keyword(null,"set","set",304602554);
|
||||
} else {
|
||||
if((((!((x == null))))?(((((x.cljs$lang$protocol_mask$partition0$ & (16777216))) || ((cljs.core.PROTOCOL_SENTINEL === x.cljs$core$ISequential$))))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_(cljs.core.ISequential,x):false)):cljs.core.native_satisfies_QMARK_(cljs.core.ISequential,x))){
|
||||
return new cljs.core.Keyword(null,"sequential","sequential",-1082983960);
|
||||
} else {
|
||||
return new cljs.core.Keyword(null,"atom","atom",-397043653);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
(clojure.data.Diff["null"] = true);
|
||||
|
||||
(clojure.data.diff_similar["null"] = (function (a,b){
|
||||
return clojure.data.atom_diff(a,b);
|
||||
}));
|
||||
|
||||
(clojure.data.Diff["string"] = true);
|
||||
|
||||
(clojure.data.diff_similar["string"] = (function (a,b){
|
||||
return clojure.data.atom_diff(a,b);
|
||||
}));
|
||||
|
||||
(clojure.data.Diff["number"] = true);
|
||||
|
||||
(clojure.data.diff_similar["number"] = (function (a,b){
|
||||
return clojure.data.atom_diff(a,b);
|
||||
}));
|
||||
|
||||
(clojure.data.Diff["array"] = true);
|
||||
|
||||
(clojure.data.diff_similar["array"] = (function (a,b){
|
||||
return clojure.data.diff_sequential(a,b);
|
||||
}));
|
||||
|
||||
(clojure.data.Diff["function"] = true);
|
||||
|
||||
(clojure.data.diff_similar["function"] = (function (a,b){
|
||||
return clojure.data.atom_diff(a,b);
|
||||
}));
|
||||
|
||||
(clojure.data.Diff["boolean"] = true);
|
||||
|
||||
(clojure.data.diff_similar["boolean"] = (function (a,b){
|
||||
return clojure.data.atom_diff(a,b);
|
||||
}));
|
||||
|
||||
(clojure.data.Diff["_"] = true);
|
||||
|
||||
(clojure.data.diff_similar["_"] = (function (a,b){
|
||||
var fexpr__14623 = (function (){var G__14624 = clojure.data.equality_partition(a);
|
||||
var G__14624__$1 = (((G__14624 instanceof cljs.core.Keyword))?G__14624.fqn:null);
|
||||
switch (G__14624__$1) {
|
||||
case "atom":
|
||||
return clojure.data.atom_diff;
|
||||
|
||||
break;
|
||||
case "set":
|
||||
return clojure.data.diff_set;
|
||||
|
||||
break;
|
||||
case "sequential":
|
||||
return clojure.data.diff_sequential;
|
||||
|
||||
break;
|
||||
case "map":
|
||||
return clojure.data.diff_associative;
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["No matching clause: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__14624__$1)].join('')));
|
||||
|
||||
}
|
||||
})();
|
||||
return (fexpr__14623.cljs$core$IFn$_invoke$arity$2 ? fexpr__14623.cljs$core$IFn$_invoke$arity$2(a,b) : fexpr__14623.call(null,a,b));
|
||||
}));
|
||||
/**
|
||||
* Recursively compares a and b, returning a tuple of
|
||||
* [things-only-in-a things-only-in-b things-in-both].
|
||||
* Comparison rules:
|
||||
*
|
||||
* * For equal a and b, return [nil nil a].
|
||||
* * Maps are subdiffed where keys match and values differ.
|
||||
* * Sets are never subdiffed.
|
||||
* * All sequential things are treated as associative collections
|
||||
* by their indexes, with results returned as vectors.
|
||||
* * Everything else (including strings!) is treated as
|
||||
* an atom and compared for equality.
|
||||
*/
|
||||
clojure.data.diff = (function clojure$data$diff(a,b){
|
||||
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(a,b)){
|
||||
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,null,a], null);
|
||||
} else {
|
||||
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(clojure.data.equality_partition(a),clojure.data.equality_partition(b))){
|
||||
return clojure.data.diff_similar(a,b);
|
||||
} else {
|
||||
return clojure.data.atom_diff(a,b);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=clojure.data.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,69 +0,0 @@
|
|||
goog.provide('clojure.datafy');
|
||||
/**
|
||||
* Attempts to return x as data.
|
||||
* datafy will return the value of clojure.protocols/datafy. If
|
||||
* the value has been transformed and the result supports
|
||||
* metadata, :clojure.datafy/obj will be set on the metadata to the
|
||||
* original value of x.
|
||||
*/
|
||||
clojure.datafy.datafy = (function clojure$datafy$datafy(x){
|
||||
var v = clojure.core.protocols.datafy(x);
|
||||
if((v === x)){
|
||||
return v;
|
||||
} else {
|
||||
if((((!((v == null))))?(((((v.cljs$lang$protocol_mask$partition0$ & (262144))) || ((cljs.core.PROTOCOL_SENTINEL === v.cljs$core$IWithMeta$))))?true:false):false)){
|
||||
return cljs.core.vary_meta.cljs$core$IFn$_invoke$arity$4(v,cljs.core.assoc,new cljs.core.Keyword("clojure.datafy","obj","clojure.datafy/obj",-330079421),x);
|
||||
} else {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Returns (possibly transformed) v in the context of coll and k (a
|
||||
* key/index or nil). Callers should attempt to provide the key/index
|
||||
* context k for Indexed/Associative/ILookup colls if possible, but not
|
||||
* to fabricate one e.g. for sequences (pass nil). nav will return the
|
||||
* value of clojure.core.protocols/nav.
|
||||
*/
|
||||
clojure.datafy.nav = (function clojure$datafy$nav(coll,k,v){
|
||||
return clojure.core.protocols.nav(coll,k,v);
|
||||
});
|
||||
clojure.datafy.datify_ref = (function clojure$datafy$datify_ref(r){
|
||||
return cljs.core.with_meta(new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.deref(r)], null),cljs.core.meta(r));
|
||||
});
|
||||
(cljs.core.Var.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.Var.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (r){
|
||||
var r__$1 = this;
|
||||
return clojure.datafy.datify_ref(r__$1);
|
||||
}));
|
||||
|
||||
(cljs.core.Reduced.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.Reduced.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (r){
|
||||
var r__$1 = this;
|
||||
return clojure.datafy.datify_ref(r__$1);
|
||||
}));
|
||||
|
||||
(cljs.core.Atom.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.Atom.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (r){
|
||||
var r__$1 = this;
|
||||
return clojure.datafy.datify_ref(r__$1);
|
||||
}));
|
||||
|
||||
(cljs.core.Volatile.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.Volatile.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (r){
|
||||
var r__$1 = this;
|
||||
return clojure.datafy.datify_ref(r__$1);
|
||||
}));
|
||||
|
||||
(cljs.core.Delay.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
|
||||
|
||||
(cljs.core.Delay.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (r){
|
||||
var r__$1 = this;
|
||||
return clojure.datafy.datify_ref(r__$1);
|
||||
}));
|
||||
|
||||
//# sourceMappingURL=clojure.datafy.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["clojure/datafy.cljs"],"mappings":";AAaA;;;;;;;wBAAA,xBAAMA,wDAMHC;AANH,AAOE,IAAMC,IAAE,AAACC,8BAASF;AAAlB,AACE,GAAI,CAAYC,MAAED;AAChBC;;AACA,GAAI,EAAA,GAAA,MAAA,SAAA,EAAA,EAAA,CAAA,wCAAA,eAAA,CAAAE,gCAAA,2BAAA,KAAA,OAAA,lJAAuBF,mBAAAA,wFAAAA;AACzB,2EAAA,pEAACG,kDAAUH,EAAEI,8FAAYL;;AAIzBC;;;;AAER;;;;;;;qBAAA,rBAAMK,kDAMHC,KAAKC,EAAEP;AANV,AAOE,OAACQ,2BAAMF,KAAKC,EAAEP;;AAEhB,4BAAA,5BAAOS,gEAAYC;AAAnB,AACE,2BAAA,pBAACC,uGAAW,AAACC,gBAAMF,WAAI,AAACG,eAAKH;;AAE/B,AAAA,AAAA,CAAA,AAAA,6DAAAR,7DACEY;;AADF,CAAA,AAAA,AACEA,2EACA,WAASJ;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACD,0BAAWC;;;AAF1B,AAAA,CAAA,AAAA,iEAAAR,jEAIEa;;AAJF,CAAA,AAAA,AAIEA,+EACA,WAASL;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACD,0BAAWC;;;AAL1B,AAAA,CAAA,AAAA,8DAAAR,9DAOEc;;AAPF,CAAA,AAAA,AAOEA,4EACA,WAASN;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACD,0BAAWC;;;AAR1B,AAAA,CAAA,AAAA,kEAAAR,lEAUEe;;AAVF,CAAA,AAAA,AAUEA,gFACA,WAASP;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACD,0BAAWC;;;AAX1B,AAAA,CAAA,AAAA,+DAAAR,/DAaEgB;;AAbF,CAAA,AAAA,AAaEA,6EACA,WAASR;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACD,0BAAWC","names":["clojure.datafy/datafy","x","v","clojure.core.protocols/datafy","cljs.core/PROTOCOL_SENTINEL","cljs.core.vary_meta","cljs.core/assoc","clojure.datafy/nav","coll","k","clojure.core.protocols/nav","clojure.datafy/datify-ref","r","cljs.core/with-meta","cljs.core/deref","cljs.core/meta","cljs.core/Var","cljs.core/Reduced","cljs.core/Atom","cljs.core/Volatile","cljs.core/Delay"],"sourcesContent":["; Copyright (c) Rich Hickey. All rights reserved.\n; The use and distribution terms for this software are covered by the\n; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)\n; which can be found in the file epl-v10.html at the root of this distribution.\n; By using this software in any fashion, you are agreeing to be bound by\n; the terms of this license.\n; You must not remove this notice, or any other, from this software.\n\n(ns\n ^{:doc \"Functions to turn objects into data. Alpha, subject to change\"}\n clojure.datafy\n (:require [clojure.core.protocols :as p]))\n\n(defn datafy\n \"Attempts to return x as data.\n datafy will return the value of clojure.protocols/datafy. If\n the value has been transformed and the result supports\n metadata, :clojure.datafy/obj will be set on the metadata to the\n original value of x.\"\n [x]\n (let [v (p/datafy x)]\n (if (identical? v x)\n v\n (if (implements? IWithMeta v)\n (vary-meta v assoc ::obj x\n ;; Circling back to this at a later date per @dnolen\n ;; ::class (-> x .-constructor .-name symbol)\n )\n v))))\n\n(defn nav\n \"Returns (possibly transformed) v in the context of coll and k (a\n key/index or nil). Callers should attempt to provide the key/index\n context k for Indexed/Associative/ILookup colls if possible, but not\n to fabricate one e.g. for sequences (pass nil). nav will return the\n value of clojure.core.protocols/nav.\"\n [coll k v]\n (p/nav coll k v))\n\n(defn- datify-ref [r]\n (with-meta [(deref r)] (meta r)))\n\n(extend-protocol p/Datafiable\n Var\n (datafy [r] (datify-ref r))\n\n Reduced\n (datafy [r] (datify-ref r))\n\n Atom\n (datafy [r] (datify-ref r))\n\n Volatile\n (datafy [r] (datify-ref r))\n\n Delay\n (datafy [r] (datify-ref r)))\n"],"x_google_ignoreList":[0]}
|
|
@ -1,380 +0,0 @@
|
|||
goog.provide('clojure.set');
|
||||
clojure.set.bubble_max_key = (function clojure$set$bubble_max_key(k,coll){
|
||||
|
||||
var max = cljs.core.apply.cljs$core$IFn$_invoke$arity$3(cljs.core.max_key,k,coll);
|
||||
return cljs.core.cons(max,cljs.core.remove.cljs$core$IFn$_invoke$arity$2((function (p1__12169_SHARP_){
|
||||
return (max === p1__12169_SHARP_);
|
||||
}),coll));
|
||||
});
|
||||
/**
|
||||
* Return a set that is the union of the input sets
|
||||
*/
|
||||
clojure.set.union = (function clojure$set$union(var_args){
|
||||
var G__12174 = arguments.length;
|
||||
switch (G__12174) {
|
||||
case 0:
|
||||
return clojure.set.union.cljs$core$IFn$_invoke$arity$0();
|
||||
|
||||
break;
|
||||
case 1:
|
||||
return clojure.set.union.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
break;
|
||||
case 2:
|
||||
return clojure.set.union.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
var args_arr__5794__auto__ = [];
|
||||
var len__5769__auto___12289 = arguments.length;
|
||||
var i__5770__auto___12290 = (0);
|
||||
while(true){
|
||||
if((i__5770__auto___12290 < len__5769__auto___12289)){
|
||||
args_arr__5794__auto__.push((arguments[i__5770__auto___12290]));
|
||||
|
||||
var G__12291 = (i__5770__auto___12290 + (1));
|
||||
i__5770__auto___12290 = G__12291;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__5795__auto__ = (new cljs.core.IndexedSeq(args_arr__5794__auto__.slice((2)),(0),null));
|
||||
return clojure.set.union.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__5795__auto__);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.set.union.cljs$core$IFn$_invoke$arity$0 = (function (){
|
||||
return cljs.core.PersistentHashSet.EMPTY;
|
||||
}));
|
||||
|
||||
(clojure.set.union.cljs$core$IFn$_invoke$arity$1 = (function (s1){
|
||||
return s1;
|
||||
}));
|
||||
|
||||
(clojure.set.union.cljs$core$IFn$_invoke$arity$2 = (function (s1,s2){
|
||||
if((cljs.core.count(s1) < cljs.core.count(s2))){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core.conj,s2,s1);
|
||||
} else {
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core.conj,s1,s2);
|
||||
}
|
||||
}));
|
||||
|
||||
(clojure.set.union.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,sets){
|
||||
var bubbled_sets = clojure.set.bubble_max_key(cljs.core.count,cljs.core.conj.cljs$core$IFn$_invoke$arity$variadic(sets,s2,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([s1], 0)));
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core.into,cljs.core.first(bubbled_sets),cljs.core.rest(bubbled_sets));
|
||||
}));
|
||||
|
||||
/** @this {Function} */
|
||||
(clojure.set.union.cljs$lang$applyTo = (function (seq12171){
|
||||
var G__12172 = cljs.core.first(seq12171);
|
||||
var seq12171__$1 = cljs.core.next(seq12171);
|
||||
var G__12173 = cljs.core.first(seq12171__$1);
|
||||
var seq12171__$2 = cljs.core.next(seq12171__$1);
|
||||
var self__5754__auto__ = this;
|
||||
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__12172,G__12173,seq12171__$2);
|
||||
}));
|
||||
|
||||
(clojure.set.union.cljs$lang$maxFixedArity = (2));
|
||||
|
||||
/**
|
||||
* Return a set that is the intersection of the input sets
|
||||
*/
|
||||
clojure.set.intersection = (function clojure$set$intersection(var_args){
|
||||
var G__12204 = arguments.length;
|
||||
switch (G__12204) {
|
||||
case 1:
|
||||
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
break;
|
||||
case 2:
|
||||
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
var args_arr__5794__auto__ = [];
|
||||
var len__5769__auto___12295 = arguments.length;
|
||||
var i__5770__auto___12296 = (0);
|
||||
while(true){
|
||||
if((i__5770__auto___12296 < len__5769__auto___12295)){
|
||||
args_arr__5794__auto__.push((arguments[i__5770__auto___12296]));
|
||||
|
||||
var G__12297 = (i__5770__auto___12296 + (1));
|
||||
i__5770__auto___12296 = G__12297;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__5795__auto__ = (new cljs.core.IndexedSeq(args_arr__5794__auto__.slice((2)),(0),null));
|
||||
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__5795__auto__);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.set.intersection.cljs$core$IFn$_invoke$arity$1 = (function (s1){
|
||||
return s1;
|
||||
}));
|
||||
|
||||
(clojure.set.intersection.cljs$core$IFn$_invoke$arity$2 = (function (s1,s2){
|
||||
while(true){
|
||||
if((cljs.core.count(s2) < cljs.core.count(s1))){
|
||||
var G__12298 = s2;
|
||||
var G__12299 = s1;
|
||||
s1 = G__12298;
|
||||
s2 = G__12299;
|
||||
continue;
|
||||
} else {
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(((function (s1,s2){
|
||||
return (function (result,item){
|
||||
if(cljs.core.contains_QMARK_(s2,item)){
|
||||
return result;
|
||||
} else {
|
||||
return cljs.core.disj.cljs$core$IFn$_invoke$arity$2(result,item);
|
||||
}
|
||||
});})(s1,s2))
|
||||
,s1,s1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}));
|
||||
|
||||
(clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,sets){
|
||||
var bubbled_sets = clojure.set.bubble_max_key((function (p1__12190_SHARP_){
|
||||
return (- cljs.core.count(p1__12190_SHARP_));
|
||||
}),cljs.core.conj.cljs$core$IFn$_invoke$arity$variadic(sets,s2,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([s1], 0)));
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(clojure.set.intersection,cljs.core.first(bubbled_sets),cljs.core.rest(bubbled_sets));
|
||||
}));
|
||||
|
||||
/** @this {Function} */
|
||||
(clojure.set.intersection.cljs$lang$applyTo = (function (seq12201){
|
||||
var G__12202 = cljs.core.first(seq12201);
|
||||
var seq12201__$1 = cljs.core.next(seq12201);
|
||||
var G__12203 = cljs.core.first(seq12201__$1);
|
||||
var seq12201__$2 = cljs.core.next(seq12201__$1);
|
||||
var self__5754__auto__ = this;
|
||||
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__12202,G__12203,seq12201__$2);
|
||||
}));
|
||||
|
||||
(clojure.set.intersection.cljs$lang$maxFixedArity = (2));
|
||||
|
||||
/**
|
||||
* Return a set that is the first set without elements of the remaining sets
|
||||
*/
|
||||
clojure.set.difference = (function clojure$set$difference(var_args){
|
||||
var G__12221 = arguments.length;
|
||||
switch (G__12221) {
|
||||
case 1:
|
||||
return clojure.set.difference.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
break;
|
||||
case 2:
|
||||
return clojure.set.difference.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
var args_arr__5794__auto__ = [];
|
||||
var len__5769__auto___12301 = arguments.length;
|
||||
var i__5770__auto___12302 = (0);
|
||||
while(true){
|
||||
if((i__5770__auto___12302 < len__5769__auto___12301)){
|
||||
args_arr__5794__auto__.push((arguments[i__5770__auto___12302]));
|
||||
|
||||
var G__12303 = (i__5770__auto___12302 + (1));
|
||||
i__5770__auto___12302 = G__12303;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__5795__auto__ = (new cljs.core.IndexedSeq(args_arr__5794__auto__.slice((2)),(0),null));
|
||||
return clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__5795__auto__);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.set.difference.cljs$core$IFn$_invoke$arity$1 = (function (s1){
|
||||
return s1;
|
||||
}));
|
||||
|
||||
(clojure.set.difference.cljs$core$IFn$_invoke$arity$2 = (function (s1,s2){
|
||||
if((cljs.core.count(s1) < cljs.core.count(s2))){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (result,item){
|
||||
if(cljs.core.contains_QMARK_(s2,item)){
|
||||
return cljs.core.disj.cljs$core$IFn$_invoke$arity$2(result,item);
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}),s1,s1);
|
||||
} else {
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core.disj,s1,s2);
|
||||
}
|
||||
}));
|
||||
|
||||
(clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,sets){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(clojure.set.difference,s1,cljs.core.conj.cljs$core$IFn$_invoke$arity$2(sets,s2));
|
||||
}));
|
||||
|
||||
/** @this {Function} */
|
||||
(clojure.set.difference.cljs$lang$applyTo = (function (seq12218){
|
||||
var G__12219 = cljs.core.first(seq12218);
|
||||
var seq12218__$1 = cljs.core.next(seq12218);
|
||||
var G__12220 = cljs.core.first(seq12218__$1);
|
||||
var seq12218__$2 = cljs.core.next(seq12218__$1);
|
||||
var self__5754__auto__ = this;
|
||||
return self__5754__auto__.cljs$core$IFn$_invoke$arity$variadic(G__12219,G__12220,seq12218__$2);
|
||||
}));
|
||||
|
||||
(clojure.set.difference.cljs$lang$maxFixedArity = (2));
|
||||
|
||||
/**
|
||||
* Returns a set of the elements for which pred is true
|
||||
*/
|
||||
clojure.set.select = (function clojure$set$select(pred,xset){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (s,k){
|
||||
if(cljs.core.truth_((pred.cljs$core$IFn$_invoke$arity$1 ? pred.cljs$core$IFn$_invoke$arity$1(k) : pred.call(null,k)))){
|
||||
return s;
|
||||
} else {
|
||||
return cljs.core.disj.cljs$core$IFn$_invoke$arity$2(s,k);
|
||||
}
|
||||
}),xset,xset);
|
||||
});
|
||||
/**
|
||||
* Returns a rel of the elements of xrel with only the keys in ks
|
||||
*/
|
||||
clojure.set.project = (function clojure$set$project(xrel,ks){
|
||||
return cljs.core.set(cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (p1__12231_SHARP_){
|
||||
return cljs.core.select_keys(p1__12231_SHARP_,ks);
|
||||
}),xrel));
|
||||
});
|
||||
/**
|
||||
* Returns the map with the keys in kmap renamed to the vals in kmap
|
||||
*/
|
||||
clojure.set.rename_keys = (function clojure$set$rename_keys(map,kmap){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (m,p__12239){
|
||||
var vec__12240 = p__12239;
|
||||
var old = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__12240,(0),null);
|
||||
var new$ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__12240,(1),null);
|
||||
if(cljs.core.contains_QMARK_(map,old)){
|
||||
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(m,new$,cljs.core.get.cljs$core$IFn$_invoke$arity$2(map,old));
|
||||
} else {
|
||||
return m;
|
||||
}
|
||||
}),cljs.core.apply.cljs$core$IFn$_invoke$arity$3(cljs.core.dissoc,map,cljs.core.keys(kmap)),kmap);
|
||||
});
|
||||
/**
|
||||
* Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap
|
||||
*/
|
||||
clojure.set.rename = (function clojure$set$rename(xrel,kmap){
|
||||
return cljs.core.set(cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (p1__12244_SHARP_){
|
||||
return clojure.set.rename_keys(p1__12244_SHARP_,kmap);
|
||||
}),xrel));
|
||||
});
|
||||
/**
|
||||
* Returns a map of the distinct values of ks in the xrel mapped to a
|
||||
* set of the maps in xrel with the corresponding values of ks.
|
||||
*/
|
||||
clojure.set.index = (function clojure$set$index(xrel,ks){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (m,x){
|
||||
var ik = cljs.core.select_keys(x,ks);
|
||||
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(m,ik,cljs.core.conj.cljs$core$IFn$_invoke$arity$2(cljs.core.get.cljs$core$IFn$_invoke$arity$3(m,ik,cljs.core.PersistentHashSet.EMPTY),x));
|
||||
}),cljs.core.PersistentArrayMap.EMPTY,xrel);
|
||||
});
|
||||
/**
|
||||
* Returns the map with the vals mapped to the keys.
|
||||
*/
|
||||
clojure.set.map_invert = (function clojure$set$map_invert(m){
|
||||
return cljs.core.persistent_BANG_(cljs.core.reduce_kv((function (m__$1,k,v){
|
||||
return cljs.core.assoc_BANG_.cljs$core$IFn$_invoke$arity$3(m__$1,v,k);
|
||||
}),cljs.core.transient$(cljs.core.PersistentArrayMap.EMPTY),m));
|
||||
});
|
||||
/**
|
||||
* When passed 2 rels, returns the rel corresponding to the natural
|
||||
* join. When passed an additional keymap, joins on the corresponding
|
||||
* keys.
|
||||
*/
|
||||
clojure.set.join = (function clojure$set$join(var_args){
|
||||
var G__12262 = arguments.length;
|
||||
switch (G__12262) {
|
||||
case 2:
|
||||
return clojure.set.join.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
return clojure.set.join.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.set.join.cljs$core$IFn$_invoke$arity$2 = (function (xrel,yrel){
|
||||
if(((cljs.core.seq(xrel)) && (cljs.core.seq(yrel)))){
|
||||
var ks = clojure.set.intersection.cljs$core$IFn$_invoke$arity$2(cljs.core.set(cljs.core.keys(cljs.core.first(xrel))),cljs.core.set(cljs.core.keys(cljs.core.first(yrel))));
|
||||
var vec__12278 = (((cljs.core.count(xrel) <= cljs.core.count(yrel)))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [xrel,yrel], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [yrel,xrel], null));
|
||||
var r = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__12278,(0),null);
|
||||
var s = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__12278,(1),null);
|
||||
var idx = clojure.set.index(r,ks);
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (ret,x){
|
||||
var found = (function (){var G__12281 = cljs.core.select_keys(x,ks);
|
||||
return (idx.cljs$core$IFn$_invoke$arity$1 ? idx.cljs$core$IFn$_invoke$arity$1(G__12281) : idx.call(null,G__12281));
|
||||
})();
|
||||
if(cljs.core.truth_(found)){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (p1__12257_SHARP_,p2__12258_SHARP_){
|
||||
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(p1__12257_SHARP_,cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([p2__12258_SHARP_,x], 0)));
|
||||
}),ret,found);
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
}),cljs.core.PersistentHashSet.EMPTY,s);
|
||||
} else {
|
||||
return cljs.core.PersistentHashSet.EMPTY;
|
||||
}
|
||||
}));
|
||||
|
||||
(clojure.set.join.cljs$core$IFn$_invoke$arity$3 = (function (xrel,yrel,km){
|
||||
var vec__12282 = (((cljs.core.count(xrel) <= cljs.core.count(yrel)))?new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [xrel,yrel,clojure.set.map_invert(km)], null):new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [yrel,xrel,km], null));
|
||||
var r = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__12282,(0),null);
|
||||
var s = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__12282,(1),null);
|
||||
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__12282,(2),null);
|
||||
var idx = clojure.set.index(r,cljs.core.vals(k));
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (ret,x){
|
||||
var found = (function (){var G__12285 = clojure.set.rename_keys(cljs.core.select_keys(x,cljs.core.keys(k)),k);
|
||||
return (idx.cljs$core$IFn$_invoke$arity$1 ? idx.cljs$core$IFn$_invoke$arity$1(G__12285) : idx.call(null,G__12285));
|
||||
})();
|
||||
if(cljs.core.truth_(found)){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (p1__12259_SHARP_,p2__12260_SHARP_){
|
||||
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(p1__12259_SHARP_,cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([p2__12260_SHARP_,x], 0)));
|
||||
}),ret,found);
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
}),cljs.core.PersistentHashSet.EMPTY,s);
|
||||
}));
|
||||
|
||||
(clojure.set.join.cljs$lang$maxFixedArity = 3);
|
||||
|
||||
/**
|
||||
* Is set1 a subset of set2?
|
||||
*/
|
||||
clojure.set.subset_QMARK_ = (function clojure$set$subset_QMARK_(set1,set2){
|
||||
return (((cljs.core.count(set1) <= cljs.core.count(set2))) && (cljs.core.every_QMARK_((function (p1__12286_SHARP_){
|
||||
return cljs.core.contains_QMARK_(set2,p1__12286_SHARP_);
|
||||
}),set1)));
|
||||
});
|
||||
/**
|
||||
* Is set1 a superset of set2?
|
||||
*/
|
||||
clojure.set.superset_QMARK_ = (function clojure$set$superset_QMARK_(set1,set2){
|
||||
return (((cljs.core.count(set1) >= cljs.core.count(set2))) && (cljs.core.every_QMARK_((function (p1__12287_SHARP_){
|
||||
return cljs.core.contains_QMARK_(set1,p1__12287_SHARP_);
|
||||
}),set2)));
|
||||
});
|
||||
|
||||
//# sourceMappingURL=clojure.set.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,476 +0,0 @@
|
|||
goog.provide('clojure.string');
|
||||
clojure.string.seq_reverse = (function clojure$string$seq_reverse(coll){
|
||||
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core.conj,cljs.core.List.EMPTY,coll);
|
||||
});
|
||||
clojure.string.re_surrogate_pair = (new RegExp("([\\uD800-\\uDBFF])([\\uDC00-\\uDFFF])","g"));
|
||||
/**
|
||||
* Returns s with its characters reversed.
|
||||
*/
|
||||
clojure.string.reverse = (function clojure$string$reverse(s){
|
||||
return s.replace(clojure.string.re_surrogate_pair,"$2$1").split("").reverse().join("");
|
||||
});
|
||||
clojure.string.replace_all = (function clojure$string$replace_all(s,re,replacement){
|
||||
var r = (new RegExp(re.source,(function (){var G__12150 = "g";
|
||||
var G__12150__$1 = (cljs.core.truth_(re.ignoreCase)?[G__12150,"i"].join(''):G__12150);
|
||||
var G__12150__$2 = (cljs.core.truth_(re.multiline)?[G__12150__$1,"m"].join(''):G__12150__$1);
|
||||
if(cljs.core.truth_(re.unicode)){
|
||||
return [G__12150__$2,"u"].join('');
|
||||
} else {
|
||||
return G__12150__$2;
|
||||
}
|
||||
})()));
|
||||
return s.replace(r,replacement);
|
||||
});
|
||||
clojure.string.replace_with = (function clojure$string$replace_with(f){
|
||||
return (function() {
|
||||
var G__12182__delegate = function (args){
|
||||
var matches = cljs.core.drop_last.cljs$core$IFn$_invoke$arity$2((2),args);
|
||||
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(cljs.core.count(matches),(1))){
|
||||
var G__12151 = cljs.core.first(matches);
|
||||
return (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(G__12151) : f.call(null,G__12151));
|
||||
} else {
|
||||
var G__12152 = cljs.core.vec(matches);
|
||||
return (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(G__12152) : f.call(null,G__12152));
|
||||
}
|
||||
};
|
||||
var G__12182 = function (var_args){
|
||||
var args = null;
|
||||
if (arguments.length > 0) {
|
||||
var G__12183__i = 0, G__12183__a = new Array(arguments.length - 0);
|
||||
while (G__12183__i < G__12183__a.length) {G__12183__a[G__12183__i] = arguments[G__12183__i + 0]; ++G__12183__i;}
|
||||
args = new cljs.core.IndexedSeq(G__12183__a,0,null);
|
||||
}
|
||||
return G__12182__delegate.call(this,args);};
|
||||
G__12182.cljs$lang$maxFixedArity = 0;
|
||||
G__12182.cljs$lang$applyTo = (function (arglist__12184){
|
||||
var args = cljs.core.seq(arglist__12184);
|
||||
return G__12182__delegate(args);
|
||||
});
|
||||
G__12182.cljs$core$IFn$_invoke$arity$variadic = G__12182__delegate;
|
||||
return G__12182;
|
||||
})()
|
||||
;
|
||||
});
|
||||
/**
|
||||
* Replaces all instance of match with replacement in s.
|
||||
*
|
||||
* match/replacement can be:
|
||||
*
|
||||
* string / string
|
||||
* pattern / (string or function of match).
|
||||
*
|
||||
* See also replace-first.
|
||||
*
|
||||
* The replacement is literal (i.e. none of its characters are treated
|
||||
* specially) for all cases above except pattern / string.
|
||||
*
|
||||
* For pattern / string, $1, $2, etc. in the replacement string are
|
||||
* substituted with the string that matched the corresponding
|
||||
* parenthesized group in the pattern.
|
||||
*
|
||||
* Example:
|
||||
* (clojure.string/replace "Almost Pig Latin" #"\b(\w)(\w+)\b" "$2$1ay")
|
||||
* -> "lmostAay igPay atinLay"
|
||||
*/
|
||||
clojure.string.replace = (function clojure$string$replace(s,match,replacement){
|
||||
if(typeof match === 'string'){
|
||||
return s.replace((new RegExp(goog.string.regExpEscape(match),"g")),replacement);
|
||||
} else {
|
||||
if((match instanceof RegExp)){
|
||||
if(typeof replacement === 'string'){
|
||||
return clojure.string.replace_all(s,match,replacement);
|
||||
} else {
|
||||
return clojure.string.replace_all(s,match,clojure.string.replace_with(replacement));
|
||||
}
|
||||
} else {
|
||||
throw ["Invalid match arg: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(match)].join('');
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Replaces the first instance of match with replacement in s.
|
||||
*
|
||||
* match/replacement can be:
|
||||
*
|
||||
* string / string
|
||||
* pattern / (string or function of match).
|
||||
*
|
||||
* See also replace.
|
||||
*
|
||||
* The replacement is literal (i.e. none of its characters are treated
|
||||
* specially) for all cases above except pattern / string.
|
||||
*
|
||||
* For pattern / string, $1, $2, etc. in the replacement string are
|
||||
* substituted with the string that matched the corresponding
|
||||
* parenthesized group in the pattern.
|
||||
*
|
||||
* Example:
|
||||
* (clojure.string/replace-first "swap first two words"
|
||||
* #"(\w+)(\s+)(\w+)" "$3$2$1")
|
||||
* -> "first swap two words"
|
||||
*/
|
||||
clojure.string.replace_first = (function clojure$string$replace_first(s,match,replacement){
|
||||
return s.replace(match,replacement);
|
||||
});
|
||||
/**
|
||||
* Returns a string of all elements in coll, as returned by (seq coll),
|
||||
* separated by an optional separator.
|
||||
*/
|
||||
clojure.string.join = (function clojure$string$join(var_args){
|
||||
var G__12155 = arguments.length;
|
||||
switch (G__12155) {
|
||||
case 1:
|
||||
return clojure.string.join.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
break;
|
||||
case 2:
|
||||
return clojure.string.join.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('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.string.join.cljs$core$IFn$_invoke$arity$1 = (function (coll){
|
||||
var sb = (new goog.string.StringBuffer());
|
||||
var coll__$1 = cljs.core.seq(coll);
|
||||
while(true){
|
||||
if((!((coll__$1 == null)))){
|
||||
var G__12191 = sb.append(cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.first(coll__$1)));
|
||||
var G__12192 = cljs.core.next(coll__$1);
|
||||
sb = G__12191;
|
||||
coll__$1 = G__12192;
|
||||
continue;
|
||||
} else {
|
||||
return sb.toString();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}));
|
||||
|
||||
(clojure.string.join.cljs$core$IFn$_invoke$arity$2 = (function (separator,coll){
|
||||
var sb = (new goog.string.StringBuffer());
|
||||
var coll__$1 = cljs.core.seq(coll);
|
||||
while(true){
|
||||
if((!((coll__$1 == null)))){
|
||||
sb.append(cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.first(coll__$1)));
|
||||
|
||||
var coll__$2 = cljs.core.next(coll__$1);
|
||||
if((coll__$2 == null)){
|
||||
} else {
|
||||
sb.append(separator);
|
||||
}
|
||||
|
||||
var G__12193 = sb;
|
||||
var G__12194 = coll__$2;
|
||||
sb = G__12193;
|
||||
coll__$1 = G__12194;
|
||||
continue;
|
||||
} else {
|
||||
return sb.toString();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}));
|
||||
|
||||
(clojure.string.join.cljs$lang$maxFixedArity = 2);
|
||||
|
||||
/**
|
||||
* Converts string to all upper-case.
|
||||
*/
|
||||
clojure.string.upper_case = (function clojure$string$upper_case(s){
|
||||
return s.toUpperCase();
|
||||
});
|
||||
/**
|
||||
* Converts string to all lower-case.
|
||||
*/
|
||||
clojure.string.lower_case = (function clojure$string$lower_case(s){
|
||||
return s.toLowerCase();
|
||||
});
|
||||
/**
|
||||
* Converts first character of the string to upper-case, all other
|
||||
* characters to lower-case.
|
||||
*/
|
||||
clojure.string.capitalize = (function clojure$string$capitalize(s){
|
||||
return goog.string.capitalize(s);
|
||||
});
|
||||
clojure.string.pop_last_while_empty = (function clojure$string$pop_last_while_empty(v){
|
||||
var v__$1 = v;
|
||||
while(true){
|
||||
if(("" === cljs.core.peek(v__$1))){
|
||||
var G__12195 = cljs.core.pop(v__$1);
|
||||
v__$1 = G__12195;
|
||||
continue;
|
||||
} else {
|
||||
return v__$1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
clojure.string.discard_trailing_if_needed = (function clojure$string$discard_trailing_if_needed(limit,v){
|
||||
if(((((0) === limit)) && (((1) < cljs.core.count(v))))){
|
||||
return clojure.string.pop_last_while_empty(v);
|
||||
} else {
|
||||
return v;
|
||||
}
|
||||
});
|
||||
clojure.string.split_with_empty_regex = (function clojure$string$split_with_empty_regex(s,limit){
|
||||
if((((limit <= (0))) || ((limit >= ((2) + cljs.core.count(s)))))){
|
||||
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(cljs.core.vec(cljs.core.cons("",cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.str,cljs.core.seq(s)))),"");
|
||||
} else {
|
||||
var pred__12156 = cljs.core._EQ__EQ_;
|
||||
var expr__12157 = limit;
|
||||
if(cljs.core.truth_((pred__12156.cljs$core$IFn$_invoke$arity$2 ? pred__12156.cljs$core$IFn$_invoke$arity$2((1),expr__12157) : pred__12156.call(null,(1),expr__12157)))){
|
||||
return (new cljs.core.PersistentVector(null,1,(5),cljs.core.PersistentVector.EMPTY_NODE,[s],null));
|
||||
} else {
|
||||
if(cljs.core.truth_((pred__12156.cljs$core$IFn$_invoke$arity$2 ? pred__12156.cljs$core$IFn$_invoke$arity$2((2),expr__12157) : pred__12156.call(null,(2),expr__12157)))){
|
||||
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,["",s],null));
|
||||
} else {
|
||||
var c = (limit - (2));
|
||||
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(cljs.core.vec(cljs.core.cons("",cljs.core.subvec.cljs$core$IFn$_invoke$arity$3(cljs.core.vec(cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.str,cljs.core.seq(s))),(0),c))),cljs.core.subs.cljs$core$IFn$_invoke$arity$2(s,c));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Splits string on a regular expression. Optional argument limit is
|
||||
* the maximum number of parts. Not lazy. Returns vector of the parts.
|
||||
* Trailing empty strings are not returned - pass limit of -1 to return all.
|
||||
*/
|
||||
clojure.string.split = (function clojure$string$split(var_args){
|
||||
var G__12160 = arguments.length;
|
||||
switch (G__12160) {
|
||||
case 2:
|
||||
return clojure.string.split.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
return clojure.string.split.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.string.split.cljs$core$IFn$_invoke$arity$2 = (function (s,re){
|
||||
return clojure.string.split.cljs$core$IFn$_invoke$arity$3(s,re,(0));
|
||||
}));
|
||||
|
||||
(clojure.string.split.cljs$core$IFn$_invoke$arity$3 = (function (s,re,limit){
|
||||
return clojure.string.discard_trailing_if_needed(limit,((("/(?:)/" === cljs.core.str.cljs$core$IFn$_invoke$arity$1(re)))?clojure.string.split_with_empty_regex(s,limit):(((limit < (1)))?cljs.core.vec(cljs.core.str.cljs$core$IFn$_invoke$arity$1(s).split(re)):(function (){var s__$1 = s;
|
||||
var limit__$1 = limit;
|
||||
var parts = cljs.core.PersistentVector.EMPTY;
|
||||
while(true){
|
||||
if(((1) === limit__$1)){
|
||||
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(parts,s__$1);
|
||||
} else {
|
||||
var m = cljs.core.re_find(re,s__$1);
|
||||
if((!((m == null)))){
|
||||
var index = s__$1.indexOf(m);
|
||||
var G__12206 = s__$1.substring((index + cljs.core.count(m)));
|
||||
var G__12207 = (limit__$1 - (1));
|
||||
var G__12208 = cljs.core.conj.cljs$core$IFn$_invoke$arity$2(parts,s__$1.substring((0),index));
|
||||
s__$1 = G__12206;
|
||||
limit__$1 = G__12207;
|
||||
parts = G__12208;
|
||||
continue;
|
||||
} else {
|
||||
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(parts,s__$1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
})())));
|
||||
}));
|
||||
|
||||
(clojure.string.split.cljs$lang$maxFixedArity = 3);
|
||||
|
||||
/**
|
||||
* Splits s on \n or \r\n. Trailing empty lines are not returned.
|
||||
*/
|
||||
clojure.string.split_lines = (function clojure$string$split_lines(s){
|
||||
return clojure.string.split.cljs$core$IFn$_invoke$arity$2(s,/\n|\r\n/);
|
||||
});
|
||||
/**
|
||||
* Removes whitespace from both ends of string.
|
||||
*/
|
||||
clojure.string.trim = (function clojure$string$trim(s){
|
||||
return goog.string.trim(s);
|
||||
});
|
||||
/**
|
||||
* Removes whitespace from the left side of string.
|
||||
*/
|
||||
clojure.string.triml = (function clojure$string$triml(s){
|
||||
return goog.string.trimLeft(s);
|
||||
});
|
||||
/**
|
||||
* Removes whitespace from the right side of string.
|
||||
*/
|
||||
clojure.string.trimr = (function clojure$string$trimr(s){
|
||||
return goog.string.trimRight(s);
|
||||
});
|
||||
/**
|
||||
* Removes all trailing newline \n or return \r characters from
|
||||
* string. Similar to Perl's chomp.
|
||||
*/
|
||||
clojure.string.trim_newline = (function clojure$string$trim_newline(s){
|
||||
var index = s.length;
|
||||
while(true){
|
||||
if((index === (0))){
|
||||
return "";
|
||||
} else {
|
||||
var ch = cljs.core.get.cljs$core$IFn$_invoke$arity$2(s,(index - (1)));
|
||||
if(((("\n" === ch)) || (("\r" === ch)))){
|
||||
var G__12209 = (index - (1));
|
||||
index = G__12209;
|
||||
continue;
|
||||
} else {
|
||||
return s.substring((0),index);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
/**
|
||||
* True is s is nil, empty, or contains only whitespace.
|
||||
*/
|
||||
clojure.string.blank_QMARK_ = (function clojure$string$blank_QMARK_(s){
|
||||
return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(s));
|
||||
});
|
||||
/**
|
||||
* Return a new string, using cmap to escape each character ch
|
||||
* from s as follows:
|
||||
*
|
||||
* If (cmap ch) is nil, append ch to the new string.
|
||||
* If (cmap ch) is non-nil, append (str (cmap ch)) instead.
|
||||
*/
|
||||
clojure.string.escape = (function clojure$string$escape(s,cmap){
|
||||
var buffer = (new goog.string.StringBuffer());
|
||||
var length = s.length;
|
||||
var index = (0);
|
||||
while(true){
|
||||
if((length === index)){
|
||||
return buffer.toString();
|
||||
} else {
|
||||
var ch = s.charAt(index);
|
||||
var replacement = cljs.core.get.cljs$core$IFn$_invoke$arity$2(cmap,ch);
|
||||
if((!((replacement == null)))){
|
||||
buffer.append(cljs.core.str.cljs$core$IFn$_invoke$arity$1(replacement));
|
||||
} else {
|
||||
buffer.append(ch);
|
||||
}
|
||||
|
||||
var G__12236 = (index + (1));
|
||||
index = G__12236;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Return index of value (string or char) in s, optionally searching
|
||||
* forward from from-index or nil if not found.
|
||||
*/
|
||||
clojure.string.index_of = (function clojure$string$index_of(var_args){
|
||||
var G__12162 = arguments.length;
|
||||
switch (G__12162) {
|
||||
case 2:
|
||||
return clojure.string.index_of.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
return clojure.string.index_of.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.string.index_of.cljs$core$IFn$_invoke$arity$2 = (function (s,value){
|
||||
var result = s.indexOf(value);
|
||||
if((result < (0))){
|
||||
return null;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}));
|
||||
|
||||
(clojure.string.index_of.cljs$core$IFn$_invoke$arity$3 = (function (s,value,from_index){
|
||||
var result = s.indexOf(value,from_index);
|
||||
if((result < (0))){
|
||||
return null;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}));
|
||||
|
||||
(clojure.string.index_of.cljs$lang$maxFixedArity = 3);
|
||||
|
||||
/**
|
||||
* Return last index of value (string or char) in s, optionally
|
||||
* searching backward from from-index or nil if not found.
|
||||
*/
|
||||
clojure.string.last_index_of = (function clojure$string$last_index_of(var_args){
|
||||
var G__12164 = arguments.length;
|
||||
switch (G__12164) {
|
||||
case 2:
|
||||
return clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
return clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
(clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$2 = (function (s,value){
|
||||
var result = s.lastIndexOf(value);
|
||||
if((result < (0))){
|
||||
return null;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}));
|
||||
|
||||
(clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$3 = (function (s,value,from_index){
|
||||
var result = s.lastIndexOf(value,from_index);
|
||||
if((result < (0))){
|
||||
return null;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}));
|
||||
|
||||
(clojure.string.last_index_of.cljs$lang$maxFixedArity = 3);
|
||||
|
||||
/**
|
||||
* True if s starts with substr.
|
||||
*/
|
||||
clojure.string.starts_with_QMARK_ = (function clojure$string$starts_with_QMARK_(s,substr){
|
||||
return goog.string.startsWith(s,substr);
|
||||
});
|
||||
/**
|
||||
* True if s ends with substr.
|
||||
*/
|
||||
clojure.string.ends_with_QMARK_ = (function clojure$string$ends_with_QMARK_(s,substr){
|
||||
return goog.string.endsWith(s,substr);
|
||||
});
|
||||
/**
|
||||
* True if s includes substr.
|
||||
*/
|
||||
clojure.string.includes_QMARK_ = (function clojure$string$includes_QMARK_(s,substr){
|
||||
return goog.string.contains(s,substr);
|
||||
});
|
||||
|
||||
//# sourceMappingURL=clojure.string.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,130 +0,0 @@
|
|||
goog.provide('clojure.walk');
|
||||
/**
|
||||
* Traverses form, an arbitrary data structure. inner and outer are
|
||||
* functions. Applies inner to each element of form, building up a
|
||||
* data structure of the same type, then applies outer to the result.
|
||||
* Recognizes all Clojure data structures. Consumes seqs as with doall.
|
||||
*/
|
||||
clojure.walk.walk = (function clojure$walk$walk(inner,outer,form){
|
||||
if(cljs.core.list_QMARK_(form)){
|
||||
var G__18736 = cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.list,cljs.core.map.cljs$core$IFn$_invoke$arity$2(inner,form));
|
||||
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(G__18736) : outer.call(null,G__18736));
|
||||
} else {
|
||||
if(cljs.core.map_entry_QMARK_(form)){
|
||||
var G__18737 = (new cljs.core.MapEntry((function (){var G__18739 = cljs.core.key(form);
|
||||
return (inner.cljs$core$IFn$_invoke$arity$1 ? inner.cljs$core$IFn$_invoke$arity$1(G__18739) : inner.call(null,G__18739));
|
||||
})(),(function (){var G__18741 = cljs.core.val(form);
|
||||
return (inner.cljs$core$IFn$_invoke$arity$1 ? inner.cljs$core$IFn$_invoke$arity$1(G__18741) : inner.call(null,G__18741));
|
||||
})(),null));
|
||||
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(G__18737) : outer.call(null,G__18737));
|
||||
} else {
|
||||
if(cljs.core.seq_QMARK_(form)){
|
||||
var G__18742 = cljs.core.doall.cljs$core$IFn$_invoke$arity$1(cljs.core.map.cljs$core$IFn$_invoke$arity$2(inner,form));
|
||||
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(G__18742) : outer.call(null,G__18742));
|
||||
} else {
|
||||
if(cljs.core.record_QMARK_(form)){
|
||||
var G__18743 = cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (r,x){
|
||||
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(r,(inner.cljs$core$IFn$_invoke$arity$1 ? inner.cljs$core$IFn$_invoke$arity$1(x) : inner.call(null,x)));
|
||||
}),form,form);
|
||||
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(G__18743) : outer.call(null,G__18743));
|
||||
} else {
|
||||
if(cljs.core.coll_QMARK_(form)){
|
||||
var G__18744 = cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.empty(form),cljs.core.map.cljs$core$IFn$_invoke$arity$2(inner,form));
|
||||
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(G__18744) : outer.call(null,G__18744));
|
||||
} else {
|
||||
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(form) : outer.call(null,form));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Performs a depth-first, post-order traversal of form. Calls f on
|
||||
* each sub-form, uses f's return value in place of the original.
|
||||
* Recognizes all Clojure data structures. Consumes seqs as with doall.
|
||||
*/
|
||||
clojure.walk.postwalk = (function clojure$walk$postwalk(f,form){
|
||||
return clojure.walk.walk(cljs.core.partial.cljs$core$IFn$_invoke$arity$2(clojure.walk.postwalk,f),f,form);
|
||||
});
|
||||
/**
|
||||
* Like postwalk, but does pre-order traversal.
|
||||
*/
|
||||
clojure.walk.prewalk = (function clojure$walk$prewalk(f,form){
|
||||
return clojure.walk.walk(cljs.core.partial.cljs$core$IFn$_invoke$arity$2(clojure.walk.prewalk,f),cljs.core.identity,(f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(form) : f.call(null,form)));
|
||||
});
|
||||
/**
|
||||
* Recursively transforms all map keys from strings to keywords.
|
||||
*/
|
||||
clojure.walk.keywordize_keys = (function clojure$walk$keywordize_keys(m){
|
||||
var f = (function (p__18745){
|
||||
var vec__18746 = p__18745;
|
||||
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18746,(0),null);
|
||||
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18746,(1),null);
|
||||
if(typeof k === 'string'){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.keyword.cljs$core$IFn$_invoke$arity$1(k),v], null);
|
||||
} else {
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,v], null);
|
||||
}
|
||||
});
|
||||
return clojure.walk.postwalk((function (x){
|
||||
if(cljs.core.map_QMARK_(x)){
|
||||
return cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.cljs$core$IFn$_invoke$arity$2(f,x));
|
||||
} else {
|
||||
return x;
|
||||
}
|
||||
}),m);
|
||||
});
|
||||
/**
|
||||
* Recursively transforms all map keys from keywords to strings.
|
||||
*/
|
||||
clojure.walk.stringify_keys = (function clojure$walk$stringify_keys(m){
|
||||
var f = (function (p__18756){
|
||||
var vec__18758 = p__18756;
|
||||
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18758,(0),null);
|
||||
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18758,(1),null);
|
||||
if((k instanceof cljs.core.Keyword)){
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.name(k),v], null);
|
||||
} else {
|
||||
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,v], null);
|
||||
}
|
||||
});
|
||||
return clojure.walk.postwalk((function (x){
|
||||
if(cljs.core.map_QMARK_(x)){
|
||||
return cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.cljs$core$IFn$_invoke$arity$2(f,x));
|
||||
} else {
|
||||
return x;
|
||||
}
|
||||
}),m);
|
||||
});
|
||||
/**
|
||||
* Recursively transforms form by replacing keys in smap with their
|
||||
* values. Like clojure/replace but works on any data structure. Does
|
||||
* replacement at the root of the tree first.
|
||||
*/
|
||||
clojure.walk.prewalk_replace = (function clojure$walk$prewalk_replace(smap,form){
|
||||
return clojure.walk.prewalk((function (x){
|
||||
if(cljs.core.contains_QMARK_(smap,x)){
|
||||
return (smap.cljs$core$IFn$_invoke$arity$1 ? smap.cljs$core$IFn$_invoke$arity$1(x) : smap.call(null,x));
|
||||
} else {
|
||||
return x;
|
||||
}
|
||||
}),form);
|
||||
});
|
||||
/**
|
||||
* Recursively transforms form by replacing keys in smap with their
|
||||
* values. Like clojure/replace but works on any data structure. Does
|
||||
* replacement at the leaves of the tree first.
|
||||
*/
|
||||
clojure.walk.postwalk_replace = (function clojure$walk$postwalk_replace(smap,form){
|
||||
return clojure.walk.postwalk((function (x){
|
||||
if(cljs.core.contains_QMARK_(smap,x)){
|
||||
return (smap.cljs$core$IFn$_invoke$arity$1 ? smap.cljs$core$IFn$_invoke$arity$1(x) : smap.call(null,x));
|
||||
} else {
|
||||
return x;
|
||||
}
|
||||
}),form);
|
||||
});
|
||||
|
||||
//# sourceMappingURL=clojure.walk.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -1,107 +0,0 @@
|
|||
goog.provide("com.cognitect.transit.caching");
|
||||
goog.require("com.cognitect.transit.delimiters");
|
||||
goog.scope(function() {
|
||||
var caching = com.cognitect.transit.caching, d = com.cognitect.transit.delimiters;
|
||||
caching.MIN_SIZE_CACHEABLE = 3;
|
||||
caching.BASE_CHAR_IDX = 48;
|
||||
caching.CACHE_CODE_DIGITS = 44;
|
||||
caching.MAX_CACHE_ENTRIES = caching.CACHE_CODE_DIGITS * caching.CACHE_CODE_DIGITS;
|
||||
caching.MAX_CACHE_SIZE = 4096;
|
||||
caching.isCacheable = function(string, asMapKey) {
|
||||
if (string.length > caching.MIN_SIZE_CACHEABLE) {
|
||||
if (asMapKey) {
|
||||
return true;
|
||||
} else {
|
||||
var c0 = string.charAt(0), c1 = string.charAt(1);
|
||||
if (c0 === d.ESC) {
|
||||
return c1 === ":" || c1 === "$" || c1 === "#";
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
caching.idxToCode = function(idx) {
|
||||
var hi = Math.floor(idx / caching.CACHE_CODE_DIGITS), lo = idx % caching.CACHE_CODE_DIGITS, loc = String.fromCharCode(lo + caching.BASE_CHAR_IDX);
|
||||
if (hi === 0) {
|
||||
return d.SUB + loc;
|
||||
} else {
|
||||
return d.SUB + String.fromCharCode(hi + caching.BASE_CHAR_IDX) + loc;
|
||||
}
|
||||
};
|
||||
caching.WriteCache = function() {
|
||||
this.idx = 0;
|
||||
this.gen = 0;
|
||||
this.cacheSize = 0;
|
||||
this.cache = {};
|
||||
};
|
||||
caching.WriteCache.prototype.write = function(string, asMapKey) {
|
||||
if (caching.isCacheable(string, asMapKey)) {
|
||||
if (this.cacheSize === caching.MAX_CACHE_SIZE) {
|
||||
this.clear();
|
||||
this.gen = 0;
|
||||
this.cache = {};
|
||||
} else if (this.idx === caching.MAX_CACHE_ENTRIES) {
|
||||
this.clear();
|
||||
}
|
||||
var entry = this.cache[string];
|
||||
if (entry == null) {
|
||||
this.cache[string] = [caching.idxToCode(this.idx), this.gen];
|
||||
this.idx++;
|
||||
return string;
|
||||
} else if (entry[1] != this.gen) {
|
||||
entry[1] = this.gen;
|
||||
entry[0] = caching.idxToCode(this.idx);
|
||||
this.idx++;
|
||||
return string;
|
||||
} else {
|
||||
return entry[0];
|
||||
}
|
||||
} else {
|
||||
return string;
|
||||
}
|
||||
};
|
||||
caching.WriteCache.prototype.clear = function Transit$WriteCache() {
|
||||
this.idx = 0;
|
||||
this.gen++;
|
||||
};
|
||||
caching.writeCache = function() {
|
||||
return new caching.WriteCache();
|
||||
};
|
||||
caching.isCacheCode = function(string) {
|
||||
return string.charAt(0) === d.SUB && string.charAt(1) !== " ";
|
||||
};
|
||||
caching.codeToIdx = function(code) {
|
||||
if (code.length === 2) {
|
||||
return code.charCodeAt(1) - caching.BASE_CHAR_IDX;
|
||||
} else {
|
||||
var hi = (code.charCodeAt(1) - caching.BASE_CHAR_IDX) * caching.CACHE_CODE_DIGITS, lo = code.charCodeAt(2) - caching.BASE_CHAR_IDX;
|
||||
return hi + lo;
|
||||
}
|
||||
};
|
||||
caching.ReadCache = function Transit$ReadCache() {
|
||||
this.idx = 0;
|
||||
this.cache = [];
|
||||
};
|
||||
caching.ReadCache.prototype.write = function(obj, asMapKey) {
|
||||
if (this.idx == caching.MAX_CACHE_ENTRIES) {
|
||||
this.idx = 0;
|
||||
}
|
||||
this.cache[this.idx] = obj;
|
||||
this.idx++;
|
||||
return obj;
|
||||
};
|
||||
caching.ReadCache.prototype.read = function(string, asMapKey) {
|
||||
return this.cache[caching.codeToIdx(string)];
|
||||
};
|
||||
caching.ReadCache.prototype.clear = function() {
|
||||
this.idx = 0;
|
||||
};
|
||||
caching.readCache = function() {
|
||||
return new caching.ReadCache();
|
||||
};
|
||||
});
|
||||
|
||||
//# sourceMappingURL=com.cognitect.transit.caching.js.map
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"version":3,
|
||||
"file":"com.cognitect.transit.caching.js",
|
||||
"lineCount":106,
|
||||
"mappings":"AAcAA,IAAKC,CAAAA,OAAL,CAAa,+BAAb,CAAA;AACAD,IAAKE,CAAAA,OAAL,CAAa,kCAAb,CAAA;AAEAF,IAAKG,CAAAA,KAAL,CAAW,QAAQ,EAAG;AAEtB,MAAIC,UAAUC,GAAIC,CAAAA,SAAUC,CAAAA,OAAQH,CAAAA,OAApC,EACII,IAAUH,GAAIC,CAAAA,SAAUC,CAAAA,OAAQE,CAAAA,UADpC;AAOAL,SAAQM,CAAAA,kBAAR,GAA6B,CAA7B;AAMAN,SAAQO,CAAAA,aAAR,GAAwB,EAAxB;AAMAP,SAAQQ,CAAAA,iBAAR,GAA4B,EAA5B;AAMAR,SAAQS,CAAAA,iBAAR,GAA4BT,OAAQQ,CAAAA,iBAApC,GAAsDR,OAAQQ,CAAAA,iBAA9D;AAMAR,SAAQU,CAAAA,cAAR,GAAyB,IAAzB;AAEAV,SAAQW,CAAAA,WAAR,GAAsBC,QAAQ,CAACC,MAAD,EAASC,QAAT,CAAmB;AAC7C,QAAGD,MAAOE,CAAAA,MAAV,GAAmBf,OAAQM,CAAAA,kBAA3B;AACI,UAAGQ,QAAH;AACI,eAAO,IAAP;AADJ,YAEO;AACH,YAAIE,KAAKH,MAAOI,CAAAA,MAAP,CAAc,CAAd,CAAT,EACIC,KAAKL,MAAOI,CAAAA,MAAP,CAAc,CAAd,CADT;AAEA,YAAGD,EAAH,KAAUZ,CAAEe,CAAAA,GAAZ;AACI,iBAAOD,EAAP,KAAc,GAAd,IAAqBA,EAArB,KAA4B,GAA5B,IAAmCA,EAAnC,KAA0C,GAA1C;AADJ;AAGI,iBAAO,KAAP;AAHJ;AAHG;AAHX;AAaI,aAAO,KAAP;AAbJ;AAD6C,GAAjD;AAqBAlB,SAAQoB,CAAAA,SAAR,GAAoBC,QAAQ,CAACC,GAAD,CAAM;AAC9B,QAAIC,KAAMC,IAAKC,CAAAA,KAAL,CAAWH,GAAX,GAAiBtB,OAAQQ,CAAAA,iBAAzB,CAAV,EACIkB,KAAMJ,GAANI,GAAY1B,OAAQQ,CAAAA,iBADxB,EAEImB,MAAMC,MAAOC,CAAAA,YAAP,CAAoBH,EAApB,GAAyB1B,OAAQO,CAAAA,aAAjC,CAFV;AAGA,QAAGgB,EAAH,KAAU,CAAV;AACI,aAAOnB,CAAE0B,CAAAA,GAAT,GAAeH,GAAf;AADJ;AAGI,aAAOvB,CAAE0B,CAAAA,GAAT,GAAeF,MAAOC,CAAAA,YAAP,CAAoBN,EAApB,GAAyBvB,OAAQO,CAAAA,aAAjC,CAAf,GAAiEoB,GAAjE;AAHJ;AAJ8B,GAAlC;AAcA3B,SAAQ+B,CAAAA,UAAR,GAAqBC,QAAQ,EAAG;AAC5B,QAAKV,CAAAA,GAAL,GAAW,CAAX;AACA,QAAKW,CAAAA,GAAL,GAAW,CAAX;AACA,QAAKC,CAAAA,SAAL,GAAiB,CAAjB;AACA,QAAKC,CAAAA,KAAL,GAAa,EAAb;AAJ4B,GAAhC;AAOAnC,SAAQ+B,CAAAA,UAAWK,CAAAA,SAAUC,CAAAA,KAA7B,GAAqCC,QAAQ,CAACzB,MAAD,EAASC,QAAT,CAAmB;AAC5D,QAAGd,OAAQW,CAAAA,WAAR,CAAoBE,MAApB,EAA4BC,QAA5B,CAAH,CAA0C;AACtC,UAAG,IAAKoB,CAAAA,SAAR,KAAsBlC,OAAQU,CAAAA,cAA9B,CAA8C;AAC1C,YAAK6B,CAAAA,KAAL,EAAA;AACA,YAAKN,CAAAA,GAAL,GAAW,CAAX;AACA,YAAKE,CAAAA,KAAL,GAAa,EAAb;AAH0C,OAA9C,KAIO,KAAG,IAAKb,CAAAA,GAAR,KAAgBtB,OAAQS,CAAAA,iBAAxB;AACH,YAAK8B,CAAAA,KAAL,EAAA;AADG;AAGP,UAAIC,QAAQ,IAAKL,CAAAA,KAAL,CAAWtB,MAAX,CAAZ;AACA,UAAG2B,KAAH,IAAY,IAAZ,CAAkB;AACd,YAAKL,CAAAA,KAAL,CAAWtB,MAAX,CAAA,GAAqB,CAACb,OAAQoB,CAAAA,SAAR,CAAkB,IAAKE,CAAAA,GAAvB,CAAD,EAA8B,IAAKW,CAAAA,GAAnC,CAArB;AACA,YAAKX,CAAAA,GAAL,EAAA;AACA,eAAOT,MAAP;AAHc,OAAlB,KAIO,KAAG2B,KAAA,CAAM,CAAN,CAAH,IAAe,IAAKP,CAAAA,GAApB,CAAyB;AAC5BO,aAAA,CAAM,CAAN,CAAA,GAAW,IAAKP,CAAAA,GAAhB;AACAO,aAAA,CAAM,CAAN,CAAA,GAAWxC,OAAQoB,CAAAA,SAAR,CAAkB,IAAKE,CAAAA,GAAvB,CAAX;AACA,YAAKA,CAAAA,GAAL,EAAA;AACA,eAAOT,MAAP;AAJ4B,OAAzB;AAMH,eAAO2B,KAAA,CAAM,CAAN,CAAP;AANG;AAb+B,KAA1C;AAsBI,aAAO3B,MAAP;AAtBJ;AAD4D,GAAhE;AA2BAb,SAAQ+B,CAAAA,UAAWK,CAAAA,SAAUG,CAAAA,KAA7B,GAAqCE,QAASC,mBAAkB,EAAG;AAC/D,QAAKpB,CAAAA,GAAL,GAAW,CAAX;AACA,QAAKW,CAAAA,GAAL,EAAA;AAF+D,GAAnE;AAKAjC,SAAQ2C,CAAAA,UAAR,GAAqBC,QAAQ,EAAG;AAC5B,WAAO,IAAI5C,OAAQ+B,CAAAA,UAAZ,EAAP;AAD4B,GAAhC;AAOA/B,SAAQ6C,CAAAA,WAAR,GAAsBC,QAAQ,CAACjC,MAAD,CAAS;AACnC,WAAQA,MAAOI,CAAAA,MAAP,CAAc,CAAd,CAAR,KAA6Bb,CAAE0B,CAAAA,GAA/B,IAAwCjB,MAAOI,CAAAA,MAAP,CAAc,CAAd,CAAxC,KAA6D,GAA7D;AADmC,GAAvC;AAIAjB,SAAQ+C,CAAAA,SAAR,GAAoBC,QAAQ,CAACC,IAAD,CAAO;AAC/B,QAAGA,IAAKlC,CAAAA,MAAR,KAAmB,CAAnB;AACI,aAAOkC,IAAKC,CAAAA,UAAL,CAAgB,CAAhB,CAAP,GAA4BlD,OAAQO,CAAAA,aAApC;AADJ,UAEO;AACH,UAAIgB,MAAM0B,IAAKC,CAAAA,UAAL,CAAgB,CAAhB,CAAN3B,GAA2BvB,OAAQO,CAAAA,aAAnCgB,IAAoDvB,OAAQQ,CAAAA,iBAAhE,EACIkB,KAAMuB,IAAKC,CAAAA,UAAL,CAAgB,CAAhB,CAANxB,GAA2B1B,OAAQO,CAAAA,aADvC;AAEA,aAAOgB,EAAP,GAAYG,EAAZ;AAHG;AAHwB,GAAnC;AAaA1B,SAAQmD,CAAAA,SAAR,GAAoBC,QAASC,kBAAiB,EAAG;AAC7C,QAAK/B,CAAAA,GAAL,GAAW,CAAX;AACA,QAAKa,CAAAA,KAAL,GAAa,EAAb;AAF6C,GAAjD;AAKAnC,SAAQmD,CAAAA,SAAUf,CAAAA,SAAUC,CAAAA,KAA5B,GAAoCiB,QAAQ,CAACC,GAAD,EAAMzC,QAAN,CAAgB;AACxD,QAAG,IAAKQ,CAAAA,GAAR,IAAetB,OAAQS,CAAAA,iBAAvB;AACI,UAAKa,CAAAA,GAAL,GAAW,CAAX;AADJ;AAGA,QAAKa,CAAAA,KAAL,CAAW,IAAKb,CAAAA,GAAhB,CAAA,GAAuBiC,GAAvB;AACA,QAAKjC,CAAAA,GAAL,EAAA;AACA,WAAOiC,GAAP;AANwD,GAA5D;AASAvD,SAAQmD,CAAAA,SAAUf,CAAAA,SAAUoB,CAAAA,IAA5B,GAAmCC,QAAQ,CAAC5C,MAAD,EAASC,QAAT,CAAmB;AAC1D,WAAO,IAAKqB,CAAAA,KAAL,CAAWnC,OAAQ+C,CAAAA,SAAR,CAAkBlC,MAAlB,CAAX,CAAP;AAD0D,GAA9D;AAIAb,SAAQmD,CAAAA,SAAUf,CAAAA,SAAUG,CAAAA,KAA5B,GAAoCmB,QAAQ,EAAG;AAC3C,QAAKpC,CAAAA,GAAL,GAAW,CAAX;AAD2C,GAA/C;AAIAtB,SAAQ2D,CAAAA,SAAR,GAAoBC,QAAQ,EAAG;AAC3B,WAAO,IAAI5D,OAAQmD,CAAAA,SAAZ,EAAP;AAD2B,GAA/B;AA3JsB,CAAtB,CAAA;;",
|
||||
"sources":["com/cognitect/transit/caching.js"],
|
||||
"sourcesContent":["// Copyright 2014 Cognitect. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ngoog.provide(\"com.cognitect.transit.caching\");\ngoog.require(\"com.cognitect.transit.delimiters\");\n\ngoog.scope(function() {\n\nvar caching = com.cognitect.transit.caching,\n d = com.cognitect.transit.delimiters;\n\n/**\n * @const\n * @type {number}\n */\ncaching.MIN_SIZE_CACHEABLE = 3;\n\n/**\n * @const\n * @type {number}\n */\ncaching.BASE_CHAR_IDX = 48;\n\n/**\n * @const\n * @type {number}\n */\ncaching.CACHE_CODE_DIGITS = 44;\n\n/**\n * @const\n * @type {number}\n */\ncaching.MAX_CACHE_ENTRIES = caching.CACHE_CODE_DIGITS*caching.CACHE_CODE_DIGITS;\n\n/**\n * @const\n * @type {number}\n */\ncaching.MAX_CACHE_SIZE = 4096;\n\ncaching.isCacheable = function(string, asMapKey) {\n if(string.length > caching.MIN_SIZE_CACHEABLE) {\n if(asMapKey) {\n return true;\n } else {\n var c0 = string.charAt(0),\n c1 = string.charAt(1);\n if(c0 === d.ESC) {\n return c1 === \":\" || c1 === \"$\" || c1 === \"#\";\n } else {\n return false;\n }\n }\n } else {\n return false;\n }\n};\n\n// =============================================================================\n// WriteCache\n\ncaching.idxToCode = function(idx) {\n var hi = Math.floor(idx / caching.CACHE_CODE_DIGITS),\n lo = idx % caching.CACHE_CODE_DIGITS,\n loc = String.fromCharCode(lo + caching.BASE_CHAR_IDX)\n if(hi === 0) {\n return d.SUB + loc;\n } else {\n return d.SUB + String.fromCharCode(hi + caching.BASE_CHAR_IDX) + loc;\n }\n};\n\n/**\n * @constructor\n */\ncaching.WriteCache = function() {\n this.idx = 0;\n this.gen = 0;\n this.cacheSize = 0;\n this.cache = {};\n};\n\ncaching.WriteCache.prototype.write = function(string, asMapKey) {\n if(caching.isCacheable(string, asMapKey)) {\n if(this.cacheSize === caching.MAX_CACHE_SIZE) {\n this.clear();\n this.gen = 0;\n this.cache = {};\n } else if(this.idx === caching.MAX_CACHE_ENTRIES) {\n this.clear();\n }\n var entry = this.cache[string];\n if(entry == null) {\n this.cache[string] = [caching.idxToCode(this.idx), this.gen];\n this.idx++;\n return string;\n } else if(entry[1] != this.gen) {\n entry[1] = this.gen;\n entry[0] = caching.idxToCode(this.idx);\n this.idx++;\n return string;\n } else {\n return entry[0];\n }\n } else {\n return string;\n }\n};\n\ncaching.WriteCache.prototype.clear = function Transit$WriteCache() {\n this.idx = 0;\n this.gen++;\n};\n\ncaching.writeCache = function() {\n return new caching.WriteCache();\n};\n\n// =============================================================================\n// ReadCache\n\ncaching.isCacheCode = function(string) {\n return (string.charAt(0) === d.SUB) && (string.charAt(1) !== \" \");\n};\n\ncaching.codeToIdx = function(code) {\n if(code.length === 2) {\n return code.charCodeAt(1) - caching.BASE_CHAR_IDX; \n } else {\n var hi = (code.charCodeAt(1) - caching.BASE_CHAR_IDX) * caching.CACHE_CODE_DIGITS,\n lo = (code.charCodeAt(2) - caching.BASE_CHAR_IDX);\n return hi + lo; \n }\n};\n\n/**\n * @constructor\n */\ncaching.ReadCache = function Transit$ReadCache() {\n this.idx = 0;\n this.cache = [];\n};\n\ncaching.ReadCache.prototype.write = function(obj, asMapKey) {\n if(this.idx == caching.MAX_CACHE_ENTRIES) {\n this.idx = 0;\n }\n this.cache[this.idx] = obj;\n this.idx++;\n return obj;\n};\n\ncaching.ReadCache.prototype.read = function(string, asMapKey) {\n return this.cache[caching.codeToIdx(string)];\n};\n\ncaching.ReadCache.prototype.clear = function() {\n this.idx = 0;\n};\n\ncaching.readCache = function() {\n return new caching.ReadCache();\n};\n\n}); \n"],
|
||||
"names":["goog","provide","require","scope","caching","com","cognitect","transit","d","delimiters","MIN_SIZE_CACHEABLE","BASE_CHAR_IDX","CACHE_CODE_DIGITS","MAX_CACHE_ENTRIES","MAX_CACHE_SIZE","isCacheable","caching.isCacheable","string","asMapKey","length","c0","charAt","c1","ESC","idxToCode","caching.idxToCode","idx","hi","Math","floor","lo","loc","String","fromCharCode","SUB","WriteCache","caching.WriteCache","gen","cacheSize","cache","prototype","write","caching.WriteCache.prototype.write","clear","entry","caching.WriteCache.prototype.clear","Transit$WriteCache","writeCache","caching.writeCache","isCacheCode","caching.isCacheCode","codeToIdx","caching.codeToIdx","code","charCodeAt","ReadCache","caching.ReadCache","Transit$ReadCache","caching.ReadCache.prototype.write","obj","read","caching.ReadCache.prototype.read","caching.ReadCache.prototype.clear","readCache","caching.readCache"]
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
goog.provide("com.cognitect.transit.delimiters");
|
||||
goog.scope(function() {
|
||||
var delimiters = com.cognitect.transit.delimiters;
|
||||
delimiters.ESC = "~";
|
||||
delimiters.TAG = "#";
|
||||
delimiters.SUB = "^";
|
||||
delimiters.RES = "`";
|
||||
delimiters.ESC_TAG = "~#";
|
||||
});
|
||||
|
||||
//# sourceMappingURL=com.cognitect.transit.delimiters.js.map
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"version":3,
|
||||
"file":"com.cognitect.transit.delimiters.js",
|
||||
"lineCount":10,
|
||||
"mappings":"AAcAA,IAAKC,CAAAA,OAAL,CAAa,kCAAb,CAAA;AAEAD,IAAKE,CAAAA,KAAL,CAAW,QAAQ,EAAG;AAEtB,MAAIC,aAAaC,GAAIC,CAAAA,SAAUC,CAAAA,OAAQH,CAAAA,UAAvC;AAMAA,YAAWI,CAAAA,GAAX,GAAqB,GAArB;AAMAJ,YAAWK,CAAAA,GAAX,GAAqB,GAArB;AAMAL,YAAWM,CAAAA,GAAX,GAAqB,GAArB;AAMAN,YAAWO,CAAAA,GAAX,GAAqB,GAArB;AAMAP,YAAWQ,CAAAA,OAAX,GAAqB,IAArB;AAhCsB,CAAtB,CAAA;;",
|
||||
"sources":["com/cognitect/transit/delimiters.js"],
|
||||
"sourcesContent":["// Copyright 2014 Cognitect. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ngoog.provide(\"com.cognitect.transit.delimiters\");\n\ngoog.scope(function() {\n\nvar delimiters = com.cognitect.transit.delimiters;\n \n/**\n * @const\n * @type {string}\n */\ndelimiters.ESC = \"~\";\n\n/**\n * @const\n * @type {string}\n */\ndelimiters.TAG = \"#\";\n\n/**\n * @const\n * @type {string}\n */\ndelimiters.SUB = \"^\";\n\n/**\n * @const\n * @type {string}\n */\ndelimiters.RES = \"`\";\n\n/**\n * @const\n * @type {string}\n */\ndelimiters.ESC_TAG = \"~#\";\n\n});\n"],
|
||||
"names":["goog","provide","scope","delimiters","com","cognitect","transit","ESC","TAG","SUB","RES","ESC_TAG"]
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
goog.provide("com.cognitect.transit.eq");
|
||||
goog.require("com.cognitect.transit.util");
|
||||
goog.scope(function() {
|
||||
var eq = com.cognitect.transit.eq, util = com.cognitect.transit.util;
|
||||
eq.hashCodeProperty = "transit$hashCode$";
|
||||
eq.hashCodeCounter = 1;
|
||||
eq.equals = function(x, y) {
|
||||
if (x == null) {
|
||||
return y == null;
|
||||
} else if (x === y) {
|
||||
return true;
|
||||
} else if (typeof x === "object") {
|
||||
if (util.isArray(x)) {
|
||||
if (util.isArray(y)) {
|
||||
if (x.length === y.length) {
|
||||
for (var i = 0; i < x.length; i++) {
|
||||
if (!eq.equals(x[i], y[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (x.com$cognitect$transit$equals) {
|
||||
return x.com$cognitect$transit$equals(y);
|
||||
} else if (y != null && typeof y === "object") {
|
||||
if (y.com$cognitect$transit$equals) {
|
||||
return y.com$cognitect$transit$equals(x);
|
||||
} else {
|
||||
var xklen = 0, yklen = util.objectKeys(y).length;
|
||||
for (var p in x) {
|
||||
if (!x.hasOwnProperty(p)) {
|
||||
continue;
|
||||
}
|
||||
xklen++;
|
||||
if (!y.hasOwnProperty(p)) {
|
||||
return false;
|
||||
} else {
|
||||
if (!eq.equals(x[p], y[p])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return xklen === yklen;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
eq.hashCombine = function(seed, hash) {
|
||||
return seed ^ hash + 2654435769 + (seed << 6) + (seed >> 2);
|
||||
};
|
||||
eq.stringCodeCache = {};
|
||||
eq.stringCodeCacheSize = 0;
|
||||
eq.STR_CACHE_MAX = 256;
|
||||
eq.hashString = function(str) {
|
||||
var cached = eq.stringCodeCache[str];
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
var code = 0;
|
||||
for (var i = 0; i < str.length; ++i) {
|
||||
code = 31 * code + str.charCodeAt(i);
|
||||
code %= 4294967296;
|
||||
}
|
||||
eq.stringCodeCacheSize++;
|
||||
if (eq.stringCodeCacheSize >= eq.STR_CACHE_MAX) {
|
||||
eq.stringCodeCache = {};
|
||||
eq.stringCodeCacheSize = 1;
|
||||
}
|
||||
eq.stringCodeCache[str] = code;
|
||||
return code;
|
||||
};
|
||||
eq.hashMapLike = function(m) {
|
||||
var code = 0;
|
||||
if (m.forEach != null) {
|
||||
m.forEach(function(val, key, m) {
|
||||
code = (code + (eq.hashCode(key) ^ eq.hashCode(val))) % 4503599627370496;
|
||||
});
|
||||
} else {
|
||||
var keys = util.objectKeys(m);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var val = m[key];
|
||||
code = (code + (eq.hashCode(key) ^ eq.hashCode(val))) % 4503599627370496;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
};
|
||||
eq.hashArrayLike = function(arr) {
|
||||
var code = 0;
|
||||
if (util.isArray(arr)) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
code = eq.hashCombine(code, eq.hashCode(arr[i]));
|
||||
}
|
||||
} else if (arr.forEach) {
|
||||
arr.forEach(function(x, i) {
|
||||
code = eq.hashCombine(code, eq.hashCode(x));
|
||||
});
|
||||
}
|
||||
return code;
|
||||
};
|
||||
eq.hashCode = function(x) {
|
||||
if (x == null) {
|
||||
return 0;
|
||||
} else {
|
||||
switch(typeof x) {
|
||||
case "number":
|
||||
return x;
|
||||
break;
|
||||
case "boolean":
|
||||
return x === true ? 1 : 0;
|
||||
break;
|
||||
case "string":
|
||||
return eq.hashString(x);
|
||||
break;
|
||||
case "function":
|
||||
var code = x[eq.hashCodeProperty];
|
||||
if (code) {
|
||||
return code;
|
||||
} else {
|
||||
code = eq.hashCodeCounter;
|
||||
if (typeof Object.defineProperty != "undefined") {
|
||||
Object.defineProperty(x, eq.hashCodeProperty, {value:code, enumerable:false});
|
||||
} else {
|
||||
x[eq.hashCodeProperty] = code;
|
||||
}
|
||||
eq.hashCodeCounter++;
|
||||
return code;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (x instanceof Date) {
|
||||
return x.valueOf();
|
||||
} else if (util.isArray(x)) {
|
||||
return eq.hashArrayLike(x);
|
||||
}
|
||||
if (x.com$cognitect$transit$hashCode) {
|
||||
return x.com$cognitect$transit$hashCode();
|
||||
} else {
|
||||
return eq.hashMapLike(x);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
eq.extendToEQ = function(obj, opts) {
|
||||
obj.com$cognitect$transit$hashCode = opts["hashCode"];
|
||||
obj.com$cognitect$transit$equals = opts["equals"];
|
||||
return obj;
|
||||
};
|
||||
});
|
||||
|
||||
//# sourceMappingURL=com.cognitect.transit.eq.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,324 +0,0 @@
|
|||
goog.provide("com.cognitect.transit.handlers");
|
||||
goog.require("com.cognitect.transit.util");
|
||||
goog.require("com.cognitect.transit.types");
|
||||
goog.require("goog.math.Long");
|
||||
goog.scope(function() {
|
||||
var handlers = com.cognitect.transit.handlers, util = com.cognitect.transit.util, types = com.cognitect.transit.types, Long = goog.math.Long;
|
||||
handlers.ctorGuid = 0;
|
||||
handlers.ctorGuidProperty = "transit$guid$" + util.randomUUID();
|
||||
handlers.typeTag = function(ctor) {
|
||||
if (ctor == null) {
|
||||
return "null";
|
||||
} else if (ctor === String) {
|
||||
return "string";
|
||||
} else if (ctor === Boolean) {
|
||||
return "boolean";
|
||||
} else if (ctor === Number) {
|
||||
return "number";
|
||||
} else if (ctor === Array) {
|
||||
return "array";
|
||||
} else if (ctor === Object) {
|
||||
return "map";
|
||||
} else {
|
||||
var tag = ctor[handlers.ctorGuidProperty];
|
||||
if (tag == null) {
|
||||
if (typeof Object.defineProperty != "undefined") {
|
||||
tag = ++handlers.ctorGuid;
|
||||
Object.defineProperty(ctor, handlers.ctorGuidProperty, {value:tag, enumerable:false});
|
||||
} else {
|
||||
ctor[handlers.ctorGuidProperty] = tag = ++handlers.ctorGuid;
|
||||
}
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
};
|
||||
handlers.constructor = function(x) {
|
||||
if (x == null) {
|
||||
return null;
|
||||
} else {
|
||||
return x.constructor;
|
||||
}
|
||||
};
|
||||
handlers.padZeros = function(n, m) {
|
||||
var s = n.toString();
|
||||
for (var i = s.length; i < m; i++) {
|
||||
s = "0" + s;
|
||||
}
|
||||
return s;
|
||||
};
|
||||
handlers.stringableKeys = function(m) {
|
||||
var stringable = false, ks = util.objectKeys(m);
|
||||
for (var i = 0; i < ks.length; i++) {
|
||||
}
|
||||
return true;
|
||||
};
|
||||
handlers.NilHandler = function Transit$NilHandler() {
|
||||
};
|
||||
handlers.NilHandler.prototype.tag = function(v) {
|
||||
return "_";
|
||||
};
|
||||
handlers.NilHandler.prototype.rep = function(v) {
|
||||
return null;
|
||||
};
|
||||
handlers.NilHandler.prototype.stringRep = function(v) {
|
||||
return "null";
|
||||
};
|
||||
handlers.StringHandler = function Transit$StringHandler() {
|
||||
};
|
||||
handlers.StringHandler.prototype.tag = function(v) {
|
||||
return "s";
|
||||
};
|
||||
handlers.StringHandler.prototype.rep = function(v) {
|
||||
return v;
|
||||
};
|
||||
handlers.StringHandler.prototype.stringRep = function(v) {
|
||||
return v;
|
||||
};
|
||||
handlers.NumberHandler = function Transit$NumberHandler() {
|
||||
};
|
||||
handlers.NumberHandler.prototype.tag = function(v) {
|
||||
return "i";
|
||||
};
|
||||
handlers.NumberHandler.prototype.rep = function(v) {
|
||||
return v;
|
||||
};
|
||||
handlers.NumberHandler.prototype.stringRep = function(v) {
|
||||
return v.toString();
|
||||
};
|
||||
handlers.IntegerHandler = function Transit$IntegerHandler() {
|
||||
};
|
||||
handlers.IntegerHandler.prototype.tag = function(v) {
|
||||
return "i";
|
||||
};
|
||||
handlers.IntegerHandler.prototype.rep = function(v) {
|
||||
return v.toString();
|
||||
};
|
||||
handlers.IntegerHandler.prototype.stringRep = function(v) {
|
||||
return v.toString();
|
||||
};
|
||||
handlers.BooleanHandler = function Transit$BooleanHandler() {
|
||||
};
|
||||
handlers.BooleanHandler.prototype.tag = function(v) {
|
||||
return "?";
|
||||
};
|
||||
handlers.BooleanHandler.prototype.rep = function(v) {
|
||||
return v;
|
||||
};
|
||||
handlers.BooleanHandler.prototype.stringRep = function(v) {
|
||||
return v.toString();
|
||||
};
|
||||
handlers.ArrayHandler = function Transit$ArrayHandler() {
|
||||
};
|
||||
handlers.ArrayHandler.prototype.tag = function(v) {
|
||||
return "array";
|
||||
};
|
||||
handlers.ArrayHandler.prototype.rep = function(v) {
|
||||
return v;
|
||||
};
|
||||
handlers.ArrayHandler.prototype.stringRep = function(v) {
|
||||
return null;
|
||||
};
|
||||
handlers.MapHandler = function Transit$MapHandler() {
|
||||
};
|
||||
handlers.MapHandler.prototype.tag = function(v) {
|
||||
return "map";
|
||||
};
|
||||
handlers.MapHandler.prototype.rep = function(v) {
|
||||
return v;
|
||||
};
|
||||
handlers.MapHandler.prototype.stringRep = function(v) {
|
||||
return null;
|
||||
};
|
||||
handlers.VerboseDateHandler = function Transit$VerboseDateHandler() {
|
||||
};
|
||||
handlers.VerboseDateHandler.prototype.tag = function(v) {
|
||||
return "t";
|
||||
};
|
||||
handlers.VerboseDateHandler.prototype.rep = function(v) {
|
||||
return v.getUTCFullYear() + "-" + handlers.padZeros(v.getUTCMonth() + 1, 2) + "-" + handlers.padZeros(v.getUTCDate(), 2) + "T" + handlers.padZeros(v.getUTCHours(), 2) + ":" + handlers.padZeros(v.getUTCMinutes(), 2) + ":" + handlers.padZeros(v.getUTCSeconds(), 2) + "." + handlers.padZeros(v.getUTCMilliseconds(), 3) + "Z";
|
||||
};
|
||||
handlers.VerboseDateHandler.prototype.stringRep = function(v, h) {
|
||||
return h.rep(v);
|
||||
};
|
||||
handlers.DateHandler = function Transit$DateHandler() {
|
||||
};
|
||||
handlers.DateHandler.prototype.tag = function(v) {
|
||||
return "m";
|
||||
};
|
||||
handlers.DateHandler.prototype.rep = function(v) {
|
||||
return v.valueOf();
|
||||
};
|
||||
handlers.DateHandler.prototype.stringRep = function(v) {
|
||||
return v.valueOf().toString();
|
||||
};
|
||||
handlers.DateHandler.prototype.getVerboseHandler = function(v) {
|
||||
return new handlers.VerboseDateHandler();
|
||||
};
|
||||
handlers.UUIDHandler = function Transit$UUIDHandler() {
|
||||
};
|
||||
handlers.UUIDHandler.prototype.tag = function(v) {
|
||||
return "u";
|
||||
};
|
||||
handlers.UUIDHandler.prototype.rep = function(v) {
|
||||
return v.toString();
|
||||
};
|
||||
handlers.UUIDHandler.prototype.stringRep = function(v) {
|
||||
return v.toString();
|
||||
};
|
||||
handlers.KeywordHandler = function Transit$KeywordHandler() {
|
||||
};
|
||||
handlers.KeywordHandler.prototype.tag = function(v) {
|
||||
return ":";
|
||||
};
|
||||
handlers.KeywordHandler.prototype.rep = function(v) {
|
||||
return v._name;
|
||||
};
|
||||
handlers.KeywordHandler.prototype.stringRep = function(v, h) {
|
||||
return h.rep(v);
|
||||
};
|
||||
handlers.SymbolHandler = function Transit$SymbolHandler() {
|
||||
};
|
||||
handlers.SymbolHandler.prototype.tag = function(v) {
|
||||
return "$";
|
||||
};
|
||||
handlers.SymbolHandler.prototype.rep = function(v) {
|
||||
return v._name;
|
||||
};
|
||||
handlers.SymbolHandler.prototype.stringRep = function(v, h) {
|
||||
return h.rep(v);
|
||||
};
|
||||
handlers.TaggedHandler = function Transit$TaggedHandler() {
|
||||
};
|
||||
handlers.TaggedHandler.prototype.tag = function(v) {
|
||||
return v.tag;
|
||||
};
|
||||
handlers.TaggedHandler.prototype.rep = function(v) {
|
||||
return v.rep;
|
||||
};
|
||||
handlers.TaggedHandler.prototype.stringRep = function(v, h) {
|
||||
return null;
|
||||
};
|
||||
handlers.TransitSetHandler = function Transit$TransitSetHandler() {
|
||||
};
|
||||
handlers.TransitSetHandler.prototype.tag = function(v) {
|
||||
return "set";
|
||||
};
|
||||
handlers.TransitSetHandler.prototype.rep = function(v) {
|
||||
var arr = [];
|
||||
v.forEach(function(key, set) {
|
||||
arr.push(key);
|
||||
});
|
||||
return types.taggedValue("array", arr);
|
||||
};
|
||||
handlers.TransitSetHandler.prototype.stringRep = function(v, h) {
|
||||
return null;
|
||||
};
|
||||
handlers.TransitArrayMapHandler = function Transit$ArrayMapHandler() {
|
||||
};
|
||||
handlers.TransitArrayMapHandler.prototype.tag = function(v) {
|
||||
return "map";
|
||||
};
|
||||
handlers.TransitArrayMapHandler.prototype.rep = function(v) {
|
||||
return v;
|
||||
};
|
||||
handlers.TransitArrayMapHandler.prototype.stringRep = function(v, h) {
|
||||
return null;
|
||||
};
|
||||
handlers.TransitMapHandler = function Transit$MapHandler() {
|
||||
};
|
||||
handlers.TransitMapHandler.prototype.tag = function(v) {
|
||||
return "map";
|
||||
};
|
||||
handlers.TransitMapHandler.prototype.rep = function(v) {
|
||||
return v;
|
||||
};
|
||||
handlers.TransitMapHandler.prototype.stringRep = function(v, h) {
|
||||
return null;
|
||||
};
|
||||
handlers.BufferHandler = function Transit$BufferHandler() {
|
||||
};
|
||||
handlers.BufferHandler.prototype.tag = function(v) {
|
||||
return "b";
|
||||
};
|
||||
handlers.BufferHandler.prototype.rep = function(v) {
|
||||
return v.toString("base64");
|
||||
};
|
||||
handlers.BufferHandler.prototype.stringRep = function(v, h) {
|
||||
return null;
|
||||
};
|
||||
handlers.Uint8ArrayHandler = function Transit$Uint8ArrayHandler() {
|
||||
};
|
||||
handlers.Uint8ArrayHandler.prototype.tag = function(v) {
|
||||
return "b";
|
||||
};
|
||||
handlers.Uint8ArrayHandler.prototype.rep = function(v) {
|
||||
return util.Uint8ToBase64(v);
|
||||
};
|
||||
handlers.Uint8ArrayHandler.prototype.stringRep = function(v, h) {
|
||||
return null;
|
||||
};
|
||||
handlers.defaultHandlers = function(hs) {
|
||||
hs.set(null, new handlers.NilHandler());
|
||||
hs.set(String, new handlers.StringHandler());
|
||||
hs.set(Number, new handlers.NumberHandler());
|
||||
hs.set(Long, new handlers.IntegerHandler());
|
||||
hs.set(Boolean, new handlers.BooleanHandler());
|
||||
hs.set(Array, new handlers.ArrayHandler());
|
||||
hs.set(Object, new handlers.MapHandler());
|
||||
hs.set(Date, new handlers.DateHandler());
|
||||
hs.set(types.UUID, new handlers.UUIDHandler());
|
||||
hs.set(types.Keyword, new handlers.KeywordHandler());
|
||||
hs.set(types.Symbol, new handlers.SymbolHandler());
|
||||
hs.set(types.TaggedValue, new handlers.TaggedHandler());
|
||||
hs.set(types.TransitSet, new handlers.TransitSetHandler());
|
||||
hs.set(types.TransitArrayMap, new handlers.TransitArrayMapHandler());
|
||||
hs.set(types.TransitMap, new handlers.TransitMapHandler());
|
||||
if (typeof goog.global.Buffer != "undefined") {
|
||||
hs.set(goog.global.Buffer, new handlers.BufferHandler());
|
||||
}
|
||||
if (typeof Uint8Array != "undefined") {
|
||||
hs.set(Uint8Array, new handlers.Uint8ArrayHandler());
|
||||
}
|
||||
return hs;
|
||||
};
|
||||
handlers.Handlers = function Transit$Handlers() {
|
||||
this.handlers = {};
|
||||
handlers.defaultHandlers(this);
|
||||
};
|
||||
handlers.Handlers.prototype.get = function(ctor) {
|
||||
var h = null;
|
||||
if (typeof ctor === "string") {
|
||||
h = this.handlers[ctor];
|
||||
} else {
|
||||
h = this.handlers[handlers.typeTag(ctor)];
|
||||
}
|
||||
if (h != null) {
|
||||
return h;
|
||||
} else {
|
||||
return this.handlers["default"];
|
||||
}
|
||||
};
|
||||
handlers.Handlers.prototype["get"] = handlers.Handlers.prototype.get;
|
||||
handlers.validTag = function(tag) {
|
||||
switch(tag) {
|
||||
case "null":
|
||||
case "string":
|
||||
case "boolean":
|
||||
case "number":
|
||||
case "array":
|
||||
case "map":
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
handlers.Handlers.prototype.set = function(ctor, handler) {
|
||||
if (typeof ctor === "string" && handlers.validTag(ctor)) {
|
||||
this.handlers[ctor] = handler;
|
||||
} else {
|
||||
this.handlers[handlers.typeTag(ctor)] = handler;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
//# sourceMappingURL=com.cognitect.transit.handlers.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,262 +0,0 @@
|
|||
goog.provide("com.cognitect.transit.impl.decoder");
|
||||
goog.require("com.cognitect.transit.util");
|
||||
goog.require("com.cognitect.transit.delimiters");
|
||||
goog.require("com.cognitect.transit.caching");
|
||||
goog.require("com.cognitect.transit.types");
|
||||
goog.scope(function() {
|
||||
var decoder = com.cognitect.transit.impl.decoder, util = com.cognitect.transit.util, d = com.cognitect.transit.delimiters, caching = com.cognitect.transit.caching, types = com.cognitect.transit.types;
|
||||
decoder.Tag = function Transit$Tag(s) {
|
||||
this.str = s;
|
||||
};
|
||||
decoder.tag = function(s) {
|
||||
return new decoder.Tag(s);
|
||||
};
|
||||
decoder.isTag = function(x) {
|
||||
return x && x instanceof decoder.Tag;
|
||||
};
|
||||
decoder.isGroundHandler = function(handler) {
|
||||
switch(handler) {
|
||||
case "_":
|
||||
case "s":
|
||||
case "?":
|
||||
case "i":
|
||||
case "d":
|
||||
case "b":
|
||||
case "'":
|
||||
case "array":
|
||||
case "map":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
decoder.Decoder = function Transit$Decoder(options) {
|
||||
this.options = options || {};
|
||||
this.handlers = {};
|
||||
for (var h in this.defaults.handlers) {
|
||||
this.handlers[h] = this.defaults.handlers[h];
|
||||
}
|
||||
for (var h in this.options["handlers"]) {
|
||||
if (decoder.isGroundHandler(h)) {
|
||||
throw new Error('Cannot override handler for ground type "' + h + '"');
|
||||
}
|
||||
this.handlers[h] = this.options["handlers"][h];
|
||||
}
|
||||
this.preferStrings = this.options["preferStrings"] != null ? this.options["preferStrings"] : this.defaults.preferStrings;
|
||||
this.preferBuffers = this.options["preferBuffers"] != null ? this.options["preferBuffers"] : this.defaults.preferBuffers;
|
||||
this.defaultHandler = this.options["defaultHandler"] || this.defaults.defaultHandler;
|
||||
this.mapBuilder = this.options["mapBuilder"];
|
||||
this.arrayBuilder = this.options["arrayBuilder"];
|
||||
};
|
||||
decoder.Decoder.prototype.defaults = {handlers:{"_":function(v, d) {
|
||||
return types.nullValue();
|
||||
}, "?":function(v, d) {
|
||||
return types.boolValue(v);
|
||||
}, "b":function(v, d) {
|
||||
return types.binary(v, d);
|
||||
}, "i":function(v, d) {
|
||||
return types.intValue(v);
|
||||
}, "n":function(v, d) {
|
||||
return types.bigInteger(v);
|
||||
}, "d":function(v, d) {
|
||||
return types.floatValue(v);
|
||||
}, "f":function(v, d) {
|
||||
return types.bigDecimalValue(v);
|
||||
}, "c":function(v, d) {
|
||||
return types.charValue(v);
|
||||
}, ":":function(v, d) {
|
||||
return types.keyword(v);
|
||||
}, "$":function(v, d) {
|
||||
return types.symbol(v);
|
||||
}, "r":function(v, d) {
|
||||
return types.uri(v);
|
||||
}, "z":function(v, d) {
|
||||
return types.specialDouble(v);
|
||||
}, "'":function(v, d) {
|
||||
return v;
|
||||
}, "m":function(v, d) {
|
||||
return types.date(v);
|
||||
}, "t":function(v, d) {
|
||||
return types.verboseDate(v);
|
||||
}, "u":function(v, d) {
|
||||
return types.uuid(v);
|
||||
}, "set":function(v, d) {
|
||||
return types.set(v);
|
||||
}, "list":function(v, d) {
|
||||
return types.list(v);
|
||||
}, "link":function(v, d) {
|
||||
return types.link(v);
|
||||
}, "cmap":function(v, d) {
|
||||
return types.map(v, false);
|
||||
}}, defaultHandler:function(c, val) {
|
||||
return types.taggedValue(c, val);
|
||||
}, preferStrings:true, preferBuffers:true};
|
||||
decoder.Decoder.prototype.decode = function(node, cache, asMapKey, tagValue) {
|
||||
if (node == null) {
|
||||
return null;
|
||||
}
|
||||
var t = typeof node;
|
||||
switch(t) {
|
||||
case "string":
|
||||
return this.decodeString(node, cache, asMapKey, tagValue);
|
||||
break;
|
||||
case "object":
|
||||
if (util.isArray(node)) {
|
||||
if (node[0] === "^ ") {
|
||||
return this.decodeArrayHash(node, cache, asMapKey, tagValue);
|
||||
} else {
|
||||
return this.decodeArray(node, cache, asMapKey, tagValue);
|
||||
}
|
||||
} else {
|
||||
return this.decodeHash(node, cache, asMapKey, tagValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return node;
|
||||
};
|
||||
decoder.Decoder.prototype["decode"] = decoder.Decoder.prototype.decode;
|
||||
decoder.Decoder.prototype.decodeString = function(string, cache, asMapKey, tagValue) {
|
||||
if (caching.isCacheable(string, asMapKey)) {
|
||||
var val = this.parseString(string, cache, false);
|
||||
if (cache) {
|
||||
cache.write(val, asMapKey);
|
||||
}
|
||||
return val;
|
||||
} else if (caching.isCacheCode(string)) {
|
||||
return cache.read(string, asMapKey);
|
||||
} else {
|
||||
return this.parseString(string, cache, asMapKey);
|
||||
}
|
||||
};
|
||||
decoder.Decoder.prototype.decodeHash = function(hash, cache, asMapKey, tagValue) {
|
||||
var ks = util.objectKeys(hash), key = ks[0], tag = ks.length == 1 ? this.decode(key, cache, false, false) : null;
|
||||
if (decoder.isTag(tag)) {
|
||||
var val = hash[key], handler = this.handlers[tag.str];
|
||||
if (handler != null) {
|
||||
return handler(this.decode(val, cache, false, true), this);
|
||||
} else {
|
||||
return types.taggedValue(tag.str, this.decode(val, cache, false, false));
|
||||
}
|
||||
} else if (this.mapBuilder) {
|
||||
if (ks.length < types.SMALL_ARRAY_MAP_THRESHOLD * 2 && this.mapBuilder.fromArray) {
|
||||
var nodep = [];
|
||||
for (var i = 0; i < ks.length; i++) {
|
||||
var strKey = ks[i];
|
||||
nodep.push(this.decode(strKey, cache, true, false));
|
||||
nodep.push(this.decode(hash[strKey], cache, false, false));
|
||||
}
|
||||
return this.mapBuilder.fromArray(nodep, hash);
|
||||
} else {
|
||||
var ret = this.mapBuilder.init(hash);
|
||||
for (var i = 0; i < ks.length; i++) {
|
||||
var strKey = ks[i];
|
||||
ret = this.mapBuilder.add(ret, this.decode(strKey, cache, true, false), this.decode(hash[strKey], cache, false, false), hash);
|
||||
}
|
||||
return this.mapBuilder.finalize(ret, hash);
|
||||
}
|
||||
} else {
|
||||
var nodep = [];
|
||||
for (var i = 0; i < ks.length; i++) {
|
||||
var strKey = ks[i];
|
||||
nodep.push(this.decode(strKey, cache, true, false));
|
||||
nodep.push(this.decode(hash[strKey], cache, false, false));
|
||||
}
|
||||
return types.map(nodep, false);
|
||||
}
|
||||
};
|
||||
decoder.Decoder.prototype.decodeArrayHash = function(node, cache, asMapKey, tagValue) {
|
||||
if (this.mapBuilder) {
|
||||
if (node.length < types.SMALL_ARRAY_MAP_THRESHOLD * 2 + 1 && this.mapBuilder.fromArray) {
|
||||
var nodep = [];
|
||||
for (var i = 1; i < node.length; i += 2) {
|
||||
nodep.push(this.decode(node[i], cache, true, false));
|
||||
nodep.push(this.decode(node[i + 1], cache, false, false));
|
||||
}
|
||||
return this.mapBuilder.fromArray(nodep, node);
|
||||
} else {
|
||||
var ret = this.mapBuilder.init(node);
|
||||
for (var i = 1; i < node.length; i += 2) {
|
||||
ret = this.mapBuilder.add(ret, this.decode(node[i], cache, true, false), this.decode(node[i + 1], cache, false, false), node);
|
||||
}
|
||||
return this.mapBuilder.finalize(ret, node);
|
||||
}
|
||||
} else {
|
||||
var nodep = [];
|
||||
for (var i = 1; i < node.length; i += 2) {
|
||||
nodep.push(this.decode(node[i], cache, true, false));
|
||||
nodep.push(this.decode(node[i + 1], cache, false, false));
|
||||
}
|
||||
return types.map(nodep, false);
|
||||
}
|
||||
};
|
||||
decoder.Decoder.prototype.decodeArray = function(node, cache, asMapKey, tagValue) {
|
||||
if (tagValue) {
|
||||
var ret = [];
|
||||
for (var i = 0; i < node.length; i++) {
|
||||
ret.push(this.decode(node[i], cache, asMapKey, false));
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
var cacheIdx = cache && cache.idx;
|
||||
if (node.length === 2 && typeof node[0] === "string") {
|
||||
var tag = this.decode(node[0], cache, false, false);
|
||||
if (decoder.isTag(tag)) {
|
||||
var val = node[1], handler = this.handlers[tag.str];
|
||||
if (handler != null) {
|
||||
var ret = handler(this.decode(val, cache, asMapKey, true), this);
|
||||
return ret;
|
||||
} else {
|
||||
return types.taggedValue(tag.str, this.decode(val, cache, asMapKey, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cache && cacheIdx != cache.idx) {
|
||||
cache.idx = cacheIdx;
|
||||
}
|
||||
if (this.arrayBuilder) {
|
||||
if (node.length <= 32 && this.arrayBuilder.fromArray) {
|
||||
var arr = [];
|
||||
for (var i = 0; i < node.length; i++) {
|
||||
arr.push(this.decode(node[i], cache, asMapKey, false));
|
||||
}
|
||||
return this.arrayBuilder.fromArray(arr, node);
|
||||
} else {
|
||||
var ret = this.arrayBuilder.init(node);
|
||||
for (var i = 0; i < node.length; i++) {
|
||||
ret = this.arrayBuilder.add(ret, this.decode(node[i], cache, asMapKey, false), node);
|
||||
}
|
||||
return this.arrayBuilder.finalize(ret, node);
|
||||
}
|
||||
} else {
|
||||
var ret = [];
|
||||
for (var i = 0; i < node.length; i++) {
|
||||
ret.push(this.decode(node[i], cache, asMapKey, false));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
};
|
||||
decoder.Decoder.prototype.parseString = function(string, cache, asMapKey) {
|
||||
if (string.charAt(0) === d.ESC) {
|
||||
var c = string.charAt(1);
|
||||
if (c === d.ESC || c === d.SUB || c === d.RES) {
|
||||
return string.substring(1);
|
||||
} else if (c === d.TAG) {
|
||||
return decoder.tag(string.substring(2));
|
||||
} else {
|
||||
var handler = this.handlers[c];
|
||||
if (handler == null) {
|
||||
return this.defaultHandler(c, string.substring(2));
|
||||
} else {
|
||||
return handler(string.substring(2), this);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return string;
|
||||
}
|
||||
};
|
||||
decoder.decoder = function(options) {
|
||||
return new decoder.Decoder(options);
|
||||
};
|
||||
});
|
||||
|
||||
//# sourceMappingURL=com.cognitect.transit.impl.decoder.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,25 +0,0 @@
|
|||
goog.provide("com.cognitect.transit.impl.reader");
|
||||
goog.require("com.cognitect.transit.impl.decoder");
|
||||
goog.require("com.cognitect.transit.caching");
|
||||
goog.scope(function() {
|
||||
var reader = com.cognitect.transit.impl.reader, decoder = com.cognitect.transit.impl.decoder, caching = com.cognitect.transit.caching;
|
||||
reader.JSONUnmarshaller = function Transit$JSONUnmarshaller(opts) {
|
||||
this.decoder = new decoder.Decoder(opts);
|
||||
};
|
||||
reader.JSONUnmarshaller.prototype.unmarshal = function(str, cache) {
|
||||
return this.decoder.decode(JSON.parse(str), cache);
|
||||
};
|
||||
reader.Reader = function Transit$Reader(unmarshaller, options) {
|
||||
this.unmarshaller = unmarshaller;
|
||||
this.options = options || {};
|
||||
this.cache = this.options["cache"] ? this.options["cache"] : new caching.ReadCache();
|
||||
};
|
||||
reader.Reader.prototype.read = function(str) {
|
||||
var ret = this.unmarshaller.unmarshal(str, this.cache);
|
||||
this.cache.clear();
|
||||
return ret;
|
||||
};
|
||||
reader.Reader.prototype["read"] = reader.Reader.prototype.read;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=com.cognitect.transit.impl.reader.js.map
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"version":3,
|
||||
"file":"com.cognitect.transit.impl.reader.js",
|
||||
"lineCount":24,
|
||||
"mappings":"AAcAA,IAAKC,CAAAA,OAAL,CAAa,mCAAb,CAAA;AACAD,IAAKE,CAAAA,OAAL,CAAa,oCAAb,CAAA;AACAF,IAAKE,CAAAA,OAAL,CAAa,+BAAb,CAAA;AAEAF,IAAKG,CAAAA,KAAL,CAAW,QAAS,EAAG;AAEnB,MAAIC,SAAUC,GAAIC,CAAAA,SAAUC,CAAAA,OAAQC,CAAAA,IAAKJ,CAAAA,MAAzC,EACIK,UAAUJ,GAAIC,CAAAA,SAAUC,CAAAA,OAAQC,CAAAA,IAAKC,CAAAA,OADzC,EAEIC,UAAUL,GAAIC,CAAAA,SAAUC,CAAAA,OAAQG,CAAAA,OAFpC;AAQAN,QAAOO,CAAAA,gBAAP,GAA0BC,QAASC,yBAAwB,CAACC,IAAD,CAAO;AAC9D,QAAKL,CAAAA,OAAL,GAAe,IAAIA,OAAQM,CAAAA,OAAZ,CAAoBD,IAApB,CAAf;AAD8D,GAAlE;AASAV,QAAOO,CAAAA,gBAAiBK,CAAAA,SAAUC,CAAAA,SAAlC,GAA8CC,QAAS,CAACC,GAAD,EAAMC,KAAN,CAAa;AAChE,WAAO,IAAKX,CAAAA,OAAQY,CAAAA,MAAb,CAAoBC,IAAKC,CAAAA,KAAL,CAAWJ,GAAX,CAApB,EAAqCC,KAArC,CAAP;AADgE,GAApE;AAUAhB,QAAOoB,CAAAA,MAAP,GAAgBC,QAASC,eAAc,CAACC,YAAD,EAAeC,OAAf,CAAwB;AAC3D,QAAKD,CAAAA,YAAL,GAAoBA,YAApB;AACA,QAAKC,CAAAA,OAAL,GAAeA,OAAf,IAA0B,EAA1B;AACA,QAAKR,CAAAA,KAAL,GAAa,IAAKQ,CAAAA,OAAL,CAAa,OAAb,CAAA,GAAwB,IAAKA,CAAAA,OAAL,CAAa,OAAb,CAAxB,GAAgD,IAAIlB,OAAQmB,CAAAA,SAAZ,EAA7D;AAH2D,GAA/D;AAUAzB,QAAOoB,CAAAA,MAAOR,CAAAA,SAAUc,CAAAA,IAAxB,GAA+BC,QAAS,CAACZ,GAAD,CAAM;AAC1C,QAAIa,MAAM,IAAKL,CAAAA,YAAaV,CAAAA,SAAlB,CAA4BE,GAA5B,EAAiC,IAAKC,CAAAA,KAAtC,CAAV;AACA,QAAKA,CAAAA,KAAMa,CAAAA,KAAX,EAAA;AACA,WAAOD,GAAP;AAH0C,GAA9C;AAKA5B,QAAOoB,CAAAA,MAAOR,CAAAA,SAAd,CAAwB,MAAxB,CAAA,GAAkCZ,MAAOoB,CAAAA,MAAOR,CAAAA,SAAUc,CAAAA,IAA1D;AA5CmB,CAAvB,CAAA;;",
|
||||
"sources":["com/cognitect/transit/impl/reader.js"],
|
||||
"sourcesContent":["// Copyright 2014 Cognitect. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ngoog.provide(\"com.cognitect.transit.impl.reader\");\ngoog.require(\"com.cognitect.transit.impl.decoder\");\ngoog.require(\"com.cognitect.transit.caching\");\n\ngoog.scope(function () {\n\n var reader = com.cognitect.transit.impl.reader,\n decoder = com.cognitect.transit.impl.decoder,\n caching = com.cognitect.transit.caching;\n\n /**\n * A JSON unmarshaller\n * @constructor\n */\n reader.JSONUnmarshaller = function Transit$JSONUnmarshaller(opts) {\n this.decoder = new decoder.Decoder(opts);\n };\n\n /**\n * @param {string} str a JSON string\n * @param {caching.ReadCache} cache a read cache\n * @returns {*}\n */\n reader.JSONUnmarshaller.prototype.unmarshal = function (str, cache) {\n return this.decoder.decode(JSON.parse(str), cache);\n };\n\n /**\n * A transit reader\n * @constructor\n * @param {reader.JSONUnmarshaller} unmarshaller\n * @param {Object=} options\n */\n reader.Reader = function Transit$Reader(unmarshaller, options) {\n this.unmarshaller = unmarshaller;\n this.options = options || {};\n this.cache = this.options[\"cache\"] ? this.options[\"cache\"] : new caching.ReadCache();\n };\n\n /**\n * @param {string} str a string to be read\n * @returns {*}\n */\n reader.Reader.prototype.read = function (str) {\n var ret = this.unmarshaller.unmarshal(str, this.cache)\n this.cache.clear();\n return ret;\n };\n reader.Reader.prototype[\"read\"] = reader.Reader.prototype.read;\n\n});\n"],
|
||||
"names":["goog","provide","require","scope","reader","com","cognitect","transit","impl","decoder","caching","JSONUnmarshaller","reader.JSONUnmarshaller","Transit$JSONUnmarshaller","opts","Decoder","prototype","unmarshal","reader.JSONUnmarshaller.prototype.unmarshal","str","cache","decode","JSON","parse","Reader","reader.Reader","Transit$Reader","unmarshaller","options","ReadCache","read","reader.Reader.prototype.read","ret","clear"]
|
||||
}
|
|
@ -1,417 +0,0 @@
|
|||
goog.provide("com.cognitect.transit.impl.writer");
|
||||
goog.require("com.cognitect.transit.util");
|
||||
goog.require("com.cognitect.transit.caching");
|
||||
goog.require("com.cognitect.transit.handlers");
|
||||
goog.require("com.cognitect.transit.types");
|
||||
goog.require("com.cognitect.transit.delimiters");
|
||||
goog.require("goog.math.Long");
|
||||
goog.scope(function() {
|
||||
var writer = com.cognitect.transit.impl.writer, util = com.cognitect.transit.util, caching = com.cognitect.transit.caching, handlers = com.cognitect.transit.handlers, types = com.cognitect.transit.types, d = com.cognitect.transit.delimiters, Long = goog.math.Long;
|
||||
writer.escape = function(string) {
|
||||
if (string.length > 0) {
|
||||
var c = string.charAt(0);
|
||||
if (c === d.ESC || c === d.SUB || c === d.RES) {
|
||||
return d.ESC + string;
|
||||
} else {
|
||||
return string;
|
||||
}
|
||||
} else {
|
||||
return string;
|
||||
}
|
||||
};
|
||||
writer.JSONMarshaller = function Transit$JSONMarshaller(opts) {
|
||||
this.opts = opts || {};
|
||||
this.preferStrings = this.opts["preferStrings"] != null ? this.opts["preferStrings"] : true;
|
||||
this.objectBuilder = this.opts["objectBuilder"] || null;
|
||||
this.transform = this.opts["transform"] || null;
|
||||
this.handlers = new handlers.Handlers();
|
||||
var optsHandlers = this.opts["handlers"];
|
||||
if (optsHandlers) {
|
||||
if (util.isArray(optsHandlers) || !optsHandlers.forEach) {
|
||||
throw new Error('transit writer "handlers" option must be a map');
|
||||
}
|
||||
var self = this;
|
||||
optsHandlers.forEach(function(v, k) {
|
||||
if (k !== undefined) {
|
||||
self.handlers.set(k, v);
|
||||
} else {
|
||||
throw new Error("Cannot create handler for JavaScript undefined");
|
||||
}
|
||||
});
|
||||
}
|
||||
this.handlerForForeign = this.opts["handlerForForeign"];
|
||||
this.unpack = this.opts["unpack"] || function(x) {
|
||||
if (types.isArrayMap(x) && x.backingMap === null) {
|
||||
return x._entries;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
this.verbose = this.opts && this.opts["verbose"] || false;
|
||||
};
|
||||
writer.JSONMarshaller.prototype.handler = function(obj) {
|
||||
var h = this.handlers.get(handlers.constructor(obj));
|
||||
if (h != null) {
|
||||
return h;
|
||||
} else {
|
||||
var tag = obj && obj["transitTag"];
|
||||
if (tag) {
|
||||
return this.handlers.get(tag);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
writer.JSONMarshaller.prototype.registerHandler = function(ctor, handler) {
|
||||
this.handlers.set(ctor, handler);
|
||||
};
|
||||
writer.JSONMarshaller.prototype.emitNil = function(asMapKey, cache) {
|
||||
if (asMapKey) {
|
||||
return this.emitString(d.ESC, "_", "", asMapKey, cache);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
writer.JSONMarshaller.prototype.emitString = function(prefix, tag, s, asMapKey, cache) {
|
||||
var string = prefix + tag + s;
|
||||
if (cache) {
|
||||
return cache.write(string, asMapKey);
|
||||
} else {
|
||||
return string;
|
||||
}
|
||||
};
|
||||
writer.JSONMarshaller.prototype.emitBoolean = function(b, asMapKey, cache) {
|
||||
if (asMapKey) {
|
||||
var s = b.toString();
|
||||
return this.emitString(d.ESC, "?", s[0], asMapKey, cache);
|
||||
} else {
|
||||
return b;
|
||||
}
|
||||
};
|
||||
writer.JSONMarshaller.prototype.emitInteger = function(i, asMapKey, cache) {
|
||||
if (i === Infinity) {
|
||||
return this.emitString(d.ESC, "z", "INF", asMapKey, cache);
|
||||
} else if (i === -Infinity) {
|
||||
return this.emitString(d.ESC, "z", "-INF", asMapKey, cache);
|
||||
} else if (isNaN(i)) {
|
||||
return this.emitString(d.ESC, "z", "NaN", asMapKey, cache);
|
||||
} else if (asMapKey || typeof i === "string" || i instanceof Long) {
|
||||
return this.emitString(d.ESC, "i", i.toString(), asMapKey, cache);
|
||||
} else {
|
||||
return i;
|
||||
}
|
||||
};
|
||||
writer.JSONMarshaller.prototype.emitDouble = function(d, asMapKey, cache) {
|
||||
if (asMapKey) {
|
||||
return this.emitString(d.ESC, "d", d, asMapKey, cache);
|
||||
} else {
|
||||
return d;
|
||||
}
|
||||
};
|
||||
writer.JSONMarshaller.prototype.emitBinary = function(b, asMapKey, cache) {
|
||||
return this.emitString(d.ESC, "b", b, asMapKey, cache);
|
||||
};
|
||||
writer.JSONMarshaller.prototype.emitQuoted = function(em, obj, cache) {
|
||||
if (em.verbose) {
|
||||
var ret = {}, k = this.emitString(d.ESC_TAG, "'", "", true, cache);
|
||||
ret[k] = writer.marshal(this, obj, false, cache);
|
||||
return ret;
|
||||
} else {
|
||||
return [this.emitString(d.ESC_TAG, "'", "", true, cache), writer.marshal(this, obj, false, cache)];
|
||||
}
|
||||
};
|
||||
writer.emitObjects = function(em, iterable, cache) {
|
||||
var ret = [];
|
||||
if (util.isArray(iterable)) {
|
||||
for (var i = 0; i < iterable.length; i++) {
|
||||
ret.push(writer.marshal(em, iterable[i], false, cache));
|
||||
}
|
||||
} else {
|
||||
iterable.forEach(function(v, i) {
|
||||
ret.push(writer.marshal(em, v, false, cache));
|
||||
});
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
writer.emitArray = function(em, iterable, skip, cache) {
|
||||
return writer.emitObjects(em, iterable, cache);
|
||||
};
|
||||
writer.isStringableKey = function(em, k) {
|
||||
if (typeof k !== "string") {
|
||||
var h = em.handler(k);
|
||||
return h && h.tag(k).length === 1;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
writer.stringableKeys = function(em, obj) {
|
||||
var arr = em.unpack(obj), stringableKeys = true;
|
||||
if (arr) {
|
||||
for (var i = 0; i < arr.length; i += 2) {
|
||||
stringableKeys = writer.isStringableKey(em, arr[i]);
|
||||
if (!stringableKeys) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return stringableKeys;
|
||||
} else if (obj.keys) {
|
||||
var iter = obj.keys(), step = null;
|
||||
if (iter.next) {
|
||||
step = iter.next();
|
||||
while (!step.done) {
|
||||
stringableKeys = writer.isStringableKey(em, step.value);
|
||||
if (!stringableKeys) {
|
||||
break;
|
||||
}
|
||||
step = iter.next();
|
||||
}
|
||||
return stringableKeys;
|
||||
}
|
||||
}
|
||||
if (obj.forEach) {
|
||||
obj.forEach(function(v, k) {
|
||||
stringableKeys = stringableKeys && writer.isStringableKey(em, k);
|
||||
});
|
||||
return stringableKeys;
|
||||
} else {
|
||||
throw new Error("Cannot walk keys of object type " + handlers.constructor(obj).name);
|
||||
}
|
||||
};
|
||||
writer.isForeignObject = function(x) {
|
||||
if (x.constructor["transit$isObject"]) {
|
||||
return true;
|
||||
}
|
||||
var ret = x.constructor.toString();
|
||||
ret = ret.substr("function ".length);
|
||||
ret = ret.substr(0, ret.indexOf("("));
|
||||
var isObject = ret == "Object";
|
||||
if (typeof Object.defineProperty != "undefined") {
|
||||
Object.defineProperty(x.constructor, "transit$isObject", {value:isObject, enumerable:false});
|
||||
} else {
|
||||
x.constructor["transit$isObject"] = isObject;
|
||||
}
|
||||
return isObject;
|
||||
};
|
||||
writer.emitMap = function(em, obj, skip, cache) {
|
||||
var arr = null, rep = null, tag = null, ks = null, i = 0;
|
||||
if (obj.constructor === Object || obj.forEach != null || em.handlerForForeign && writer.isForeignObject(obj)) {
|
||||
if (em.verbose) {
|
||||
if (obj.forEach != null) {
|
||||
if (writer.stringableKeys(em, obj)) {
|
||||
var ret = {};
|
||||
obj.forEach(function(v, k) {
|
||||
ret[writer.marshal(em, k, true, false)] = writer.marshal(em, v, false, cache);
|
||||
});
|
||||
return ret;
|
||||
} else {
|
||||
arr = em.unpack(obj);
|
||||
rep = [];
|
||||
tag = em.emitString(d.ESC_TAG, "cmap", "", true, cache);
|
||||
if (arr) {
|
||||
for (; i < arr.length; i += 2) {
|
||||
rep.push(writer.marshal(em, arr[i], false, false));
|
||||
rep.push(writer.marshal(em, arr[i + 1], false, cache));
|
||||
}
|
||||
} else {
|
||||
obj.forEach(function(v, k) {
|
||||
rep.push(writer.marshal(em, k, false, false));
|
||||
rep.push(writer.marshal(em, v, false, cache));
|
||||
});
|
||||
}
|
||||
ret = {};
|
||||
ret[tag] = rep;
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
ks = util.objectKeys(obj);
|
||||
ret = {};
|
||||
for (; i < ks.length; i++) {
|
||||
ret[writer.marshal(em, ks[i], true, false)] = writer.marshal(em, obj[ks[i]], false, cache);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
if (obj.forEach != null) {
|
||||
if (writer.stringableKeys(em, obj)) {
|
||||
arr = em.unpack(obj);
|
||||
ret = ["^ "];
|
||||
if (arr) {
|
||||
for (; i < arr.length; i += 2) {
|
||||
ret.push(writer.marshal(em, arr[i], true, cache));
|
||||
ret.push(writer.marshal(em, arr[i + 1], false, cache));
|
||||
}
|
||||
} else {
|
||||
obj.forEach(function(v, k) {
|
||||
ret.push(writer.marshal(em, k, true, cache));
|
||||
ret.push(writer.marshal(em, v, false, cache));
|
||||
});
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
arr = em.unpack(obj);
|
||||
rep = [];
|
||||
tag = em.emitString(d.ESC_TAG, "cmap", "", true, cache);
|
||||
if (arr) {
|
||||
for (; i < arr.length; i += 2) {
|
||||
rep.push(writer.marshal(em, arr[i], false, cache));
|
||||
rep.push(writer.marshal(em, arr[i + 1], false, cache));
|
||||
}
|
||||
} else {
|
||||
obj.forEach(function(v, k) {
|
||||
rep.push(writer.marshal(em, k, false, cache));
|
||||
rep.push(writer.marshal(em, v, false, cache));
|
||||
});
|
||||
}
|
||||
return [tag, rep];
|
||||
}
|
||||
} else {
|
||||
ret = ["^ "];
|
||||
ks = util.objectKeys(obj);
|
||||
for (; i < ks.length; i++) {
|
||||
ret.push(writer.marshal(em, ks[i], true, cache));
|
||||
ret.push(writer.marshal(em, obj[ks[i]], false, cache));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
} else if (em.objectBuilder != null) {
|
||||
return em.objectBuilder(obj, function(k) {
|
||||
return writer.marshal(em, k, true, cache);
|
||||
}, function(v) {
|
||||
return writer.marshal(em, v, false, cache);
|
||||
});
|
||||
} else {
|
||||
var name = handlers.constructor(obj).name, err = new Error("Cannot write " + name);
|
||||
err.data = {obj:obj, type:name};
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
writer.emitTaggedMap = function(em, tag, rep, skip, cache) {
|
||||
if (em.verbose) {
|
||||
var ret = {};
|
||||
ret[em.emitString(d.ESC_TAG, tag, "", true, cache)] = writer.marshal(em, rep, false, cache);
|
||||
return ret;
|
||||
} else {
|
||||
return [em.emitString(d.ESC_TAG, tag, "", true, cache), writer.marshal(em, rep, false, cache)];
|
||||
}
|
||||
};
|
||||
writer.emitEncoded = function(em, h, tag, rep, obj, asMapKey, cache) {
|
||||
if (tag.length === 1) {
|
||||
if (typeof rep === "string") {
|
||||
return em.emitString(d.ESC, tag, rep, asMapKey, cache);
|
||||
} else if (asMapKey || em.preferStrings) {
|
||||
var vh = em.verbose && h.getVerboseHandler();
|
||||
if (vh) {
|
||||
tag = vh.tag(obj);
|
||||
rep = vh.stringRep(obj, vh);
|
||||
} else {
|
||||
rep = h.stringRep(obj, h);
|
||||
}
|
||||
if (rep !== null) {
|
||||
return em.emitString(d.ESC, tag, rep, asMapKey, cache);
|
||||
} else {
|
||||
var err = new Error('Tag "' + tag + '" cannot be encoded as string');
|
||||
err.data = {tag:tag, rep:rep, obj:obj};
|
||||
throw err;
|
||||
}
|
||||
} else {
|
||||
return writer.emitTaggedMap(em, tag, rep, asMapKey, cache);
|
||||
}
|
||||
} else {
|
||||
return writer.emitTaggedMap(em, tag, rep, asMapKey, cache);
|
||||
}
|
||||
};
|
||||
writer.marshal = function(em, obj, asMapKey, cache) {
|
||||
if (em.transform !== null) {
|
||||
obj = em.transform(obj);
|
||||
}
|
||||
var h = em.handler(obj) || (em.handlerForForeign ? em.handlerForForeign(obj, em.handlers) : null), tag = h ? h.tag(obj) : null, rep = h ? h.rep(obj) : null;
|
||||
if (h != null && tag != null) {
|
||||
switch(tag) {
|
||||
case "_":
|
||||
return em.emitNil(asMapKey, cache);
|
||||
break;
|
||||
case "s":
|
||||
return em.emitString("", "", writer.escape(rep), asMapKey, cache);
|
||||
break;
|
||||
case "?":
|
||||
return em.emitBoolean(rep, asMapKey, cache);
|
||||
break;
|
||||
case "i":
|
||||
return em.emitInteger(rep, asMapKey, cache);
|
||||
break;
|
||||
case "d":
|
||||
return em.emitDouble(rep, asMapKey, cache);
|
||||
break;
|
||||
case "b":
|
||||
return em.emitBinary(rep, asMapKey, cache);
|
||||
break;
|
||||
case "'":
|
||||
return em.emitQuoted(em, rep, cache);
|
||||
break;
|
||||
case "array":
|
||||
return writer.emitArray(em, rep, asMapKey, cache);
|
||||
break;
|
||||
case "map":
|
||||
return writer.emitMap(em, rep, asMapKey, cache);
|
||||
break;
|
||||
default:
|
||||
return writer.emitEncoded(em, h, tag, rep, obj, asMapKey, cache);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
var name = handlers.constructor(obj).name, err = new Error("Cannot write " + name);
|
||||
err.data = {obj:obj, type:name};
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
writer.maybeQuoted = function(em, obj) {
|
||||
var h = em.handler(obj) || (em.handlerForForeign ? em.handlerForForeign(obj, em.handlers) : null);
|
||||
if (h != null) {
|
||||
if (h.tag(obj).length === 1) {
|
||||
return types.quoted(obj);
|
||||
} else {
|
||||
return obj;
|
||||
}
|
||||
} else {
|
||||
var name = handlers.constructor(obj).name, err = new Error("Cannot write " + name);
|
||||
err.data = {obj:obj, type:name};
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
writer.marshalTop = function(em, obj, asMapKey, cache) {
|
||||
return JSON.stringify(writer.marshal(em, writer.maybeQuoted(em, obj), asMapKey, cache));
|
||||
};
|
||||
writer.Writer = function Transit$Writer(marshaller, options) {
|
||||
this._marshaller = marshaller;
|
||||
this.options = options || {};
|
||||
if (this.options["cache"] === false) {
|
||||
this.cache = null;
|
||||
} else {
|
||||
this.cache = this.options["cache"] ? this.options["cache"] : new caching.WriteCache();
|
||||
}
|
||||
};
|
||||
writer.Writer.prototype.marshaller = function() {
|
||||
return this._marshaller;
|
||||
};
|
||||
writer.Writer.prototype["marshaller"] = writer.Writer.prototype.marshaller;
|
||||
writer.Writer.prototype.write = function(obj, opts) {
|
||||
var ret = null, ropts = opts || {}, asMapKey = ropts["asMapKey"] || false, cache = this._marshaller.verbose ? false : this.cache;
|
||||
if (ropts["marshalTop"] === false) {
|
||||
ret = writer.marshal(this._marshaller, obj, asMapKey, cache);
|
||||
} else {
|
||||
ret = writer.marshalTop(this._marshaller, obj, asMapKey, cache);
|
||||
}
|
||||
if (this.cache != null) {
|
||||
this.cache.clear();
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
writer.Writer.prototype["write"] = writer.Writer.prototype.write;
|
||||
writer.Writer.prototype.register = function(type, handler) {
|
||||
this._marshaller.registerHandler(type, handler);
|
||||
};
|
||||
writer.Writer.prototype["register"] = writer.Writer.prototype.register;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=com.cognitect.transit.impl.writer.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,176 +0,0 @@
|
|||
goog.provide("com.cognitect.transit");
|
||||
goog.require("com.cognitect.transit.util");
|
||||
goog.require("com.cognitect.transit.impl.reader");
|
||||
goog.require("com.cognitect.transit.impl.writer");
|
||||
goog.require("com.cognitect.transit.types");
|
||||
goog.require("com.cognitect.transit.eq");
|
||||
goog.require("com.cognitect.transit.impl.decoder");
|
||||
goog.require("com.cognitect.transit.caching");
|
||||
var TRANSIT_DEV = true;
|
||||
var TRANSIT_NODE_TARGET = false;
|
||||
var TRANSIT_BROWSER_TARGET = false;
|
||||
var TRANSIT_BROWSER_AMD_TARGET = false;
|
||||
goog.scope(function() {
|
||||
var transit = com.cognitect.transit;
|
||||
var util = com.cognitect.transit.util, reader = com.cognitect.transit.impl.reader, writer = com.cognitect.transit.impl.writer, decoder = com.cognitect.transit.impl.decoder, types = com.cognitect.transit.types, eq = com.cognitect.transit.eq, caching = com.cognitect.transit.caching;
|
||||
transit.MapLike;
|
||||
transit.SetLike;
|
||||
transit.reader = function(type, opts) {
|
||||
if (type === "json" || type === "json-verbose" || type == null) {
|
||||
type = "json";
|
||||
var unmarshaller = new reader.JSONUnmarshaller(opts);
|
||||
return new reader.Reader(unmarshaller, opts);
|
||||
} else {
|
||||
throw new Error("Cannot create reader of type " + type);
|
||||
}
|
||||
};
|
||||
transit.writer = function(type, opts) {
|
||||
if (type === "json" || type === "json-verbose" || type == null) {
|
||||
if (type === "json-verbose") {
|
||||
if (opts == null) {
|
||||
opts = {};
|
||||
}
|
||||
opts["verbose"] = true;
|
||||
}
|
||||
var marshaller = new writer.JSONMarshaller(opts);
|
||||
return new writer.Writer(marshaller, opts);
|
||||
} else {
|
||||
var err = new Error('Type must be "json"');
|
||||
err.data = {type:type};
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
transit.makeWriteHandler = function(obj) {
|
||||
var Handler = function() {
|
||||
};
|
||||
Handler.prototype.tag = obj["tag"];
|
||||
Handler.prototype.rep = obj["rep"];
|
||||
Handler.prototype.stringRep = obj["stringRep"];
|
||||
Handler.prototype.getVerboseHandler = obj["getVerboseHandler"];
|
||||
return new Handler();
|
||||
};
|
||||
transit.makeBuilder = function(obj) {
|
||||
var Builder = function() {
|
||||
};
|
||||
Builder.prototype.init = obj["init"];
|
||||
Builder.prototype.add = obj["add"];
|
||||
Builder.prototype.finalize = obj["finalize"];
|
||||
Builder.prototype.fromArray = obj["fromArray"];
|
||||
return new Builder();
|
||||
};
|
||||
transit.date = types.date;
|
||||
transit.integer = types.intValue;
|
||||
transit.isInteger = types.isInteger;
|
||||
transit.uuid = types.uuid;
|
||||
transit.isUUID = types.isUUID;
|
||||
transit.bigInt = types.bigInteger;
|
||||
transit.isBigInt = types.isBigInteger;
|
||||
transit.bigDec = types.bigDecimalValue;
|
||||
transit.isBigDec = types.isBigDecimal;
|
||||
transit.keyword = types.keyword;
|
||||
transit.isKeyword = types.isKeyword;
|
||||
transit.symbol = types.symbol;
|
||||
transit.isSymbol = types.isSymbol;
|
||||
transit.binary = types.binary;
|
||||
transit.isBinary = types.isBinary;
|
||||
transit.uri = types.uri;
|
||||
transit.isURI = types.isURI;
|
||||
transit.map = types.map;
|
||||
transit.isMap = types.isMap;
|
||||
transit.set = types.set;
|
||||
transit.isSet = types.isSet;
|
||||
transit.list = types.list;
|
||||
transit.isList = types.isList;
|
||||
transit.quoted = types.quoted;
|
||||
transit.isQuoted = types.isQuoted;
|
||||
transit.tagged = types.taggedValue;
|
||||
transit.isTaggedValue = types.isTaggedValue;
|
||||
transit.link = types.link;
|
||||
transit.isLink = types.isLink;
|
||||
transit.hash = eq.hashCode;
|
||||
transit.hashMapLike = eq.hashMapLike;
|
||||
transit.hashArrayLike = eq.hashArrayLike;
|
||||
transit.equals = eq.equals;
|
||||
transit.extendToEQ = eq.extendToEQ;
|
||||
transit.mapToObject = function(m) {
|
||||
var ret = {};
|
||||
m.forEach(function(v, k) {
|
||||
if (typeof k !== "string") {
|
||||
throw Error("Cannot convert map with non-string keys");
|
||||
} else {
|
||||
ret[k] = v;
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
};
|
||||
transit.objectToMap = function(obj) {
|
||||
var ret = transit.map();
|
||||
for (var p in obj) {
|
||||
if (obj.hasOwnProperty(p)) {
|
||||
ret.set(p, obj[p]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
transit.decoder = decoder.decoder;
|
||||
transit.readCache = caching.readCache;
|
||||
transit.writeCache = caching.writeCache;
|
||||
transit.UUIDfromString = types.UUIDfromString;
|
||||
transit.randomUUID = util.randomUUID;
|
||||
transit.stringableKeys = writer.stringableKeys;
|
||||
if (TRANSIT_BROWSER_TARGET) {
|
||||
goog.exportSymbol("transit.reader", transit.reader);
|
||||
goog.exportSymbol("transit.writer", transit.writer);
|
||||
goog.exportSymbol("transit.makeBuilder", transit.makeBuilder);
|
||||
goog.exportSymbol("transit.makeWriteHandler", transit.makeWriteHandler);
|
||||
goog.exportSymbol("transit.date", types.date);
|
||||
goog.exportSymbol("transit.integer", types.intValue);
|
||||
goog.exportSymbol("transit.isInteger", types.isInteger);
|
||||
goog.exportSymbol("transit.uuid", types.uuid);
|
||||
goog.exportSymbol("transit.isUUID", types.isUUID);
|
||||
goog.exportSymbol("transit.bigInt", types.bigInteger);
|
||||
goog.exportSymbol("transit.isBigInt", types.isBigInteger);
|
||||
goog.exportSymbol("transit.bigDec", types.bigDecimalValue);
|
||||
goog.exportSymbol("transit.isBigDec", types.isBigDecimal);
|
||||
goog.exportSymbol("transit.keyword", types.keyword);
|
||||
goog.exportSymbol("transit.isKeyword", types.isKeyword);
|
||||
goog.exportSymbol("transit.symbol", types.symbol);
|
||||
goog.exportSymbol("transit.isSymbol", types.isSymbol);
|
||||
goog.exportSymbol("transit.binary", types.binary);
|
||||
goog.exportSymbol("transit.isBinary", types.isBinary);
|
||||
goog.exportSymbol("transit.uri", types.uri);
|
||||
goog.exportSymbol("transit.isURI", types.isURI);
|
||||
goog.exportSymbol("transit.map", types.map);
|
||||
goog.exportSymbol("transit.isMap", types.isMap);
|
||||
goog.exportSymbol("transit.set", types.set);
|
||||
goog.exportSymbol("transit.isSet", types.isSet);
|
||||
goog.exportSymbol("transit.list", types.list);
|
||||
goog.exportSymbol("transit.isList", types.isList);
|
||||
goog.exportSymbol("transit.quoted", types.quoted);
|
||||
goog.exportSymbol("transit.isQuoted", types.isQuoted);
|
||||
goog.exportSymbol("transit.tagged", types.taggedValue);
|
||||
goog.exportSymbol("transit.isTaggedValue", types.isTaggedValue);
|
||||
goog.exportSymbol("transit.link", types.link);
|
||||
goog.exportSymbol("transit.isLink", types.isLink);
|
||||
goog.exportSymbol("transit.hash", eq.hashCode);
|
||||
goog.exportSymbol("transit.hashMapLike", eq.hashMapLike);
|
||||
goog.exportSymbol("transit.hashArrayLike", eq.hashArrayLike);
|
||||
goog.exportSymbol("transit.equals", eq.equals);
|
||||
goog.exportSymbol("transit.extendToEQ", eq.extendToEQ);
|
||||
goog.exportSymbol("transit.mapToObject", transit.mapToObject);
|
||||
goog.exportSymbol("transit.objectToMap", transit.objectToMap);
|
||||
goog.exportSymbol("transit.decoder", decoder.decoder);
|
||||
goog.exportSymbol("transit.UUIDfromString", types.UUIDfromString);
|
||||
goog.exportSymbol("transit.randomUUID", util.randomUUID);
|
||||
goog.exportSymbol("transit.stringableKeys", writer.stringableKeys);
|
||||
goog.exportSymbol("transit.readCache", caching.readCache);
|
||||
goog.exportSymbol("transit.writeCache", caching.writeCache);
|
||||
}
|
||||
if (TRANSIT_NODE_TARGET) {
|
||||
module.exports = {reader:transit.reader, writer:transit.writer, makeBuilder:transit.makeBuilder, makeWriteHandler:transit.makeWriteHandler, date:types.date, integer:types.intValue, isInteger:types.isInteger, uuid:types.uuid, isUUID:types.isUUID, bigInt:types.bigInteger, isBigInt:types.isBigInteger, bigDec:types.bigDecimalValue, isBigDec:types.isBigDecimal, keyword:types.keyword, isKeyword:types.isKeyword, symbol:types.symbol, isSymbol:types.isSymbol, binary:types.binary, isBinary:types.isBinary,
|
||||
uri:types.uri, isURI:types.isURI, map:types.map, isMap:types.isMap, set:types.set, isSet:types.isSet, list:types.list, isList:types.isList, quoted:types.quoted, isQuoted:types.isQuoted, tagged:types.taggedValue, isTaggedValue:types.isTaggedValue, link:types.link, isLink:types.isLink, hash:eq.hashCode, hashArrayLike:eq.hashArrayLike, hashMapLike:eq.hashMapLike, equals:eq.equals, extendToEQ:eq.extendToEQ, mapToObject:transit.mapToObject, objectToMap:transit.objectToMap, decoder:decoder.decoder,
|
||||
UUIDfromString:types.UUIDfromString, randomUUID:util.randomUUID, stringableKeys:writer.stringableKeys, readCache:caching.readCache, writeCache:caching.writeCache};
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=com.cognitect.transit.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,966 +0,0 @@
|
|||
goog.provide("com.cognitect.transit.types");
|
||||
goog.require("com.cognitect.transit.util");
|
||||
goog.require("com.cognitect.transit.eq");
|
||||
goog.require("goog.math.Long");
|
||||
goog.scope(function() {
|
||||
var types = com.cognitect.transit.types, util = com.cognitect.transit.util, eq = com.cognitect.transit.eq, Long = goog.math.Long;
|
||||
if (typeof Symbol != "undefined") {
|
||||
types.ITERATOR = Symbol.iterator;
|
||||
} else {
|
||||
types.ITERATOR = "@@iterator";
|
||||
}
|
||||
types.TaggedValue = function Transit$TaggedValue(tag, rep) {
|
||||
this.tag = tag;
|
||||
this.rep = rep;
|
||||
this.hashCode = -1;
|
||||
};
|
||||
types.TaggedValue.prototype.toString = function() {
|
||||
return "[TaggedValue: " + this.tag + ", " + this.rep + "]";
|
||||
};
|
||||
types.TaggedValue.prototype.equiv = function(other) {
|
||||
return eq.equals(this, other);
|
||||
};
|
||||
types.TaggedValue.prototype["equiv"] = types.TaggedValue.prototype.equiv;
|
||||
types.TaggedValue.prototype.com$cognitect$transit$equals = function(other) {
|
||||
if (other instanceof types.TaggedValue) {
|
||||
return this.tag === other.tag && eq.equals(this.rep, other.rep);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
types.TaggedValue.prototype.com$cognitect$transit$hashCode = function() {
|
||||
if (this.hashCode === -1) {
|
||||
this.hashCode = eq.hashCombine(eq.hashCode(this.tag), eq.hashCode(this.rep));
|
||||
}
|
||||
return this.hashCode;
|
||||
};
|
||||
types.taggedValue = function(tag, rep) {
|
||||
return new types.TaggedValue(tag, rep);
|
||||
};
|
||||
types.isTaggedValue = function(x) {
|
||||
return x instanceof types.TaggedValue;
|
||||
};
|
||||
types.nullValue = function() {
|
||||
return null;
|
||||
};
|
||||
types.boolValue = function(s) {
|
||||
return s === "t";
|
||||
};
|
||||
types.MAX_INT = Long.fromString("9007199254740991");
|
||||
types.MIN_INT = Long.fromString("-9007199254740991");
|
||||
types.intValue = function(s) {
|
||||
if (typeof s === "number") {
|
||||
return s;
|
||||
} else if (s instanceof Long) {
|
||||
return s;
|
||||
} else {
|
||||
var n = Long.fromString(s, 10);
|
||||
if (n.greaterThan(types.MAX_INT) || n.lessThan(types.MIN_INT)) {
|
||||
return n;
|
||||
} else {
|
||||
return n.toNumber();
|
||||
}
|
||||
}
|
||||
};
|
||||
Long.prototype.equiv = function(other) {
|
||||
return eq.equals(this, other);
|
||||
};
|
||||
Long.prototype["equiv"] = Long.prototype.equiv;
|
||||
Long.prototype.com$cognitect$transit$equals = function(other) {
|
||||
return other instanceof Long && this.equals(other);
|
||||
};
|
||||
Long.prototype.com$cognitect$transit$hashCode = function() {
|
||||
return this.toInt();
|
||||
};
|
||||
types.isInteger = function(x) {
|
||||
if (x instanceof Long) {
|
||||
return true;
|
||||
} else {
|
||||
return typeof x === "number" && !isNaN(x) && !(x === Infinity) && parseFloat(x) === parseInt(x, 10);
|
||||
}
|
||||
};
|
||||
types.floatValue = function(s) {
|
||||
return parseFloat(s);
|
||||
};
|
||||
types.bigInteger = function(s) {
|
||||
return types.taggedValue("n", s);
|
||||
};
|
||||
types.isBigInteger = function(x) {
|
||||
return x instanceof types.TaggedValue && x.tag === "n";
|
||||
};
|
||||
types.bigDecimalValue = function(s) {
|
||||
return types.taggedValue("f", s);
|
||||
};
|
||||
types.isBigDecimal = function(x) {
|
||||
return x instanceof types.TaggedValue && x.tag === "f";
|
||||
};
|
||||
types.charValue = function(s) {
|
||||
return s;
|
||||
};
|
||||
types.Keyword = function Transit$Keyword(name) {
|
||||
this._name = name;
|
||||
this.hashCode = -1;
|
||||
};
|
||||
types.Keyword.prototype.toString = function() {
|
||||
return ":" + this._name;
|
||||
};
|
||||
types.Keyword.prototype["namespace"] = function() {
|
||||
var idx = this._name.indexOf("/");
|
||||
if (idx != -1) {
|
||||
return this._name.substring(0, idx);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
types.Keyword.prototype["name"] = function() {
|
||||
var idx = this._name.indexOf("/");
|
||||
if (idx != -1) {
|
||||
return this._name.substring(idx + 1, this._name.length);
|
||||
} else {
|
||||
return this._name;
|
||||
}
|
||||
};
|
||||
types.Keyword.prototype.equiv = function(other) {
|
||||
return eq.equals(this, other);
|
||||
};
|
||||
types.Keyword.prototype["equiv"] = types.Keyword.prototype.equiv;
|
||||
types.Keyword.prototype.com$cognitect$transit$equals = function(other) {
|
||||
return other instanceof types.Keyword && this._name == other._name;
|
||||
};
|
||||
types.Keyword.prototype.com$cognitect$transit$hashCode = function() {
|
||||
if (this.hashCode === -1) {
|
||||
this.hashCode = eq.hashCode(this._name);
|
||||
}
|
||||
return this.hashCode;
|
||||
};
|
||||
types.keyword = function(s) {
|
||||
return new types.Keyword(s);
|
||||
};
|
||||
types.isKeyword = function(x) {
|
||||
return x instanceof types.Keyword;
|
||||
};
|
||||
types.Symbol = function Transit$Symbol(name) {
|
||||
this._name = name;
|
||||
this.hashCode = -1;
|
||||
};
|
||||
types.Symbol.prototype["namespace"] = function() {
|
||||
var idx = this._name.indexOf("/");
|
||||
if (idx != -1) {
|
||||
return this._name.substring(0, idx);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
types.Symbol.prototype["name"] = function() {
|
||||
var idx = this._name.indexOf("/");
|
||||
if (idx != -1) {
|
||||
return this._name.substring(idx + 1, this._name.length);
|
||||
} else {
|
||||
return this._name;
|
||||
}
|
||||
};
|
||||
types.Symbol.prototype.toString = function() {
|
||||
return this._name;
|
||||
};
|
||||
types.Symbol.prototype.equiv = function(other) {
|
||||
return eq.equals(this, other);
|
||||
};
|
||||
types.Symbol.prototype["equiv"] = types.Symbol.prototype.equiv;
|
||||
types.Symbol.prototype.com$cognitect$transit$equals = function(other) {
|
||||
return other instanceof types.Symbol && this._name == other._name;
|
||||
};
|
||||
types.Symbol.prototype.com$cognitect$transit$hashCode = function() {
|
||||
if (this.hashCode === -1) {
|
||||
this.hashCode = eq.hashCode(this._name);
|
||||
}
|
||||
return this.hashCode;
|
||||
};
|
||||
types.symbol = function(s) {
|
||||
return new types.Symbol(s);
|
||||
};
|
||||
types.isSymbol = function(x) {
|
||||
return x instanceof types.Symbol;
|
||||
};
|
||||
types.hexFor = function(aLong, sidx, eidx) {
|
||||
var ret = "";
|
||||
eidx = eidx || sidx + 1;
|
||||
for (var i = sidx, shift = (7 - i) * 8, mask = Long.fromInt(255).shiftLeft(shift); i < eidx; i++, shift -= 8, mask = mask.shiftRightUnsigned(8)) {
|
||||
var s = aLong.and(mask).shiftRightUnsigned(shift).toString(16);
|
||||
if (s.length == 1) {
|
||||
s = "0" + s;
|
||||
}
|
||||
ret += s;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
types.UUID = function Transit$UUID(high, low) {
|
||||
this.high = high;
|
||||
this.low = low;
|
||||
this.hashCode = -1;
|
||||
};
|
||||
types.UUID.prototype.getLeastSignificantBits = function() {
|
||||
return this.low;
|
||||
};
|
||||
types.UUID.prototype.getMostSignificantBits = function() {
|
||||
return this.high;
|
||||
};
|
||||
types.UUID.prototype.toString = function() {
|
||||
var s = "", hi64 = this.high, lo64 = this.low;
|
||||
s += types.hexFor(hi64, 0, 4) + "-";
|
||||
s += types.hexFor(hi64, 4, 6) + "-";
|
||||
s += types.hexFor(hi64, 6, 8) + "-";
|
||||
s += types.hexFor(lo64, 0, 2) + "-";
|
||||
s += types.hexFor(lo64, 2, 8);
|
||||
return s;
|
||||
};
|
||||
types.UUID.prototype.equiv = function(other) {
|
||||
return eq.equals(this, other);
|
||||
};
|
||||
types.UUID.prototype["equiv"] = types.UUID.prototype.equiv;
|
||||
types.UUID.prototype.com$cognitect$transit$equals = function(other) {
|
||||
return other instanceof types.UUID && this.high.equals(other.high) && this.low.equals(other.low);
|
||||
};
|
||||
types.UUID.prototype.com$cognitect$transit$hashCode = function() {
|
||||
if (this.hashCode === -1) {
|
||||
this.hashCode = eq.hashCode(this.toString());
|
||||
}
|
||||
return this.hashCode;
|
||||
};
|
||||
types.UUIDfromString = function uuidFromString(s) {
|
||||
s = s.replace(/-/g, "");
|
||||
var hi64 = null, lo64 = null, hi32 = 0, lo32 = 0, off = 24, i = 0;
|
||||
for (hi32 = 0, i = 0, off = 24; i < 8; i += 2, off -= 8) {
|
||||
hi32 |= parseInt(s.substring(i, i + 2), 16) << off;
|
||||
}
|
||||
for (lo32 = 0, i = 8, off = 24; i < 16; i += 2, off -= 8) {
|
||||
lo32 |= parseInt(s.substring(i, i + 2), 16) << off;
|
||||
}
|
||||
hi64 = Long.fromBits(lo32, hi32);
|
||||
for (hi32 = 0, i = 16, off = 24; i < 24; i += 2, off -= 8) {
|
||||
hi32 |= parseInt(s.substring(i, i + 2), 16) << off;
|
||||
}
|
||||
for (lo32 = 0, i = 24, off = 24; i < 32; i += 2, off -= 8) {
|
||||
lo32 |= parseInt(s.substring(i, i + 2), 16) << off;
|
||||
}
|
||||
lo64 = Long.fromBits(lo32, hi32);
|
||||
return new types.UUID(hi64, lo64);
|
||||
};
|
||||
types.uuid = function(s) {
|
||||
return types.UUIDfromString(s);
|
||||
};
|
||||
types.isUUID = function(x) {
|
||||
return x instanceof types.UUID;
|
||||
};
|
||||
types.date = function(s) {
|
||||
s = typeof s === "number" ? s : parseInt(s, 10);
|
||||
return new Date(s);
|
||||
};
|
||||
types.verboseDate = function(s) {
|
||||
return new Date(s);
|
||||
};
|
||||
Date.prototype.com$cognitect$transit$equals = function(other) {
|
||||
if (other instanceof Date) {
|
||||
return this.valueOf() === other.valueOf();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Date.prototype.com$cognitect$transit$hashCode = function() {
|
||||
return this.valueOf();
|
||||
};
|
||||
types.binary = function(str, decoder) {
|
||||
if ((!decoder || decoder.preferBuffers !== false) && typeof goog.global.Buffer != "undefined") {
|
||||
return new goog.global.Buffer(str, "base64");
|
||||
} else if (typeof Uint8Array != "undefined") {
|
||||
return util.Base64ToUint8(str);
|
||||
} else {
|
||||
return types.taggedValue("b", str);
|
||||
}
|
||||
};
|
||||
types.isBinary = function(x) {
|
||||
if (typeof goog.global.Buffer != "undefined" && x instanceof goog.global.Buffer) {
|
||||
return true;
|
||||
} else if (typeof Uint8Array != "undefined" && x instanceof Uint8Array) {
|
||||
return true;
|
||||
} else {
|
||||
return x instanceof types.TaggedValue && x.tag === "b";
|
||||
}
|
||||
};
|
||||
types.uri = function(s) {
|
||||
return types.taggedValue("r", s);
|
||||
};
|
||||
types.isURI = function(x) {
|
||||
return x instanceof types.TaggedValue && x.tag === "r";
|
||||
};
|
||||
types.KEYS = 0;
|
||||
types.VALUES = 1;
|
||||
types.ENTRIES = 2;
|
||||
types.TransitArrayMapIterator = function Transit$ArrayMapIterator(entries, type) {
|
||||
this.entries = entries;
|
||||
this.type = type || types.KEYS;
|
||||
this.idx = 0;
|
||||
};
|
||||
types.TransitArrayMapIterator.prototype.next = function() {
|
||||
if (this.idx < this.entries.length) {
|
||||
var value = null;
|
||||
if (this.type === types.KEYS) {
|
||||
value = this.entries[this.idx];
|
||||
} else if (this.type === types.VALUES) {
|
||||
value = this.entries[this.idx + 1];
|
||||
} else {
|
||||
value = [this.entries[this.idx], this.entries[this.idx + 1]];
|
||||
}
|
||||
var ret = {"value":value, "done":false};
|
||||
this.idx += 2;
|
||||
return ret;
|
||||
} else {
|
||||
return {"value":null, "done":true};
|
||||
}
|
||||
};
|
||||
types.TransitArrayMapIterator.prototype["next"] = types.TransitArrayMapIterator.prototype.next;
|
||||
types.TransitArrayMapIterator.prototype[types.ITERATOR] = function() {
|
||||
return this;
|
||||
};
|
||||
types.TransitMapIterator = function Transit$MapIterator(map, type) {
|
||||
this.map = map;
|
||||
this.type = type || types.KEYS;
|
||||
this.keys = this.map.getKeys();
|
||||
this.idx = 0;
|
||||
this.bucket = null;
|
||||
this.bucketIdx = 0;
|
||||
};
|
||||
types.TransitMapIterator.prototype.next = function() {
|
||||
if (this.idx < this.map.size) {
|
||||
if (this.bucket == null || !(this.bucketIdx < this.bucket.length)) {
|
||||
this.bucket = this.map.map[this.keys[this.idx]];
|
||||
this.bucketIdx = 0;
|
||||
}
|
||||
var value = null;
|
||||
if (this.type === types.KEYS) {
|
||||
value = this.bucket[this.bucketIdx];
|
||||
} else if (this.type === types.VALUES) {
|
||||
value = this.bucket[this.bucketIdx + 1];
|
||||
} else {
|
||||
value = [this.bucket[this.bucketIdx], this.bucket[this.bucketIdx + 1]];
|
||||
}
|
||||
var ret = {"value":value, "done":false};
|
||||
this.idx++;
|
||||
this.bucketIdx += 2;
|
||||
return ret;
|
||||
} else {
|
||||
return {"value":null, "done":true};
|
||||
}
|
||||
};
|
||||
types.TransitMapIterator.prototype["next"] = types.TransitMapIterator.prototype.next;
|
||||
types.TransitMapIterator.prototype[types.ITERATOR] = function() {
|
||||
return this;
|
||||
};
|
||||
types.mapEquals = function(me, you) {
|
||||
if (me instanceof types.TransitMap && types.isMap(you)) {
|
||||
if (me.size !== you.size) {
|
||||
return false;
|
||||
}
|
||||
for (var code in me.map) {
|
||||
var bucket = me.map[code];
|
||||
for (var j = 0; j < bucket.length; j += 2) {
|
||||
if (!eq.equals(bucket[j + 1], you.get(bucket[j]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (me instanceof types.TransitArrayMap && types.isMap(you)) {
|
||||
if (me.size !== you.size) {
|
||||
return false;
|
||||
}
|
||||
var entries = me._entries;
|
||||
for (var j = 0; j < entries.length; j += 2) {
|
||||
if (!eq.equals(entries[j + 1], you.get(entries[j]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (you != null && typeof you === "object") {
|
||||
var ks = util.objectKeys(you), kslen = ks.length;
|
||||
if (me.size === kslen) {
|
||||
for (var i = 0; i < kslen; i++) {
|
||||
var k = ks[i];
|
||||
if (!me.has(k) || !eq.equals(you[k], me.get(k))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
types.SMALL_ARRAY_MAP_THRESHOLD = 8;
|
||||
types.ARRAY_MAP_THRESHOLD = 32;
|
||||
types.ARRAY_MAP_ACCESS_THRESHOLD = 32;
|
||||
types.print = function(x) {
|
||||
if (x == null) {
|
||||
return "null";
|
||||
}
|
||||
if (goog.typeOf(x) === "array") {
|
||||
return "[" + x.toString() + "]";
|
||||
} else if (goog.typeOf(x) === "string") {
|
||||
return '"' + x + '"';
|
||||
} else {
|
||||
return x.toString();
|
||||
}
|
||||
};
|
||||
types.printMap = function(map) {
|
||||
var idx = 0, str = "TransitMap {";
|
||||
map.forEach(function(v, k) {
|
||||
str += types.print(k) + " \x3d\x3e " + types.print(v);
|
||||
if (idx < map.size - 1) {
|
||||
str += ", ";
|
||||
}
|
||||
idx++;
|
||||
});
|
||||
return str + "}";
|
||||
};
|
||||
types.printSet = function(set) {
|
||||
var idx = 0, str = "TransitSet {";
|
||||
set.forEach(function(v) {
|
||||
str += types.print(v);
|
||||
if (idx < set.size - 1) {
|
||||
str += ", ";
|
||||
}
|
||||
idx++;
|
||||
});
|
||||
return str + "}";
|
||||
};
|
||||
types.TransitArrayMap = function Transit$ArrayMap(entries) {
|
||||
this._entries = entries;
|
||||
this.backingMap = null;
|
||||
this.hashCode = -1;
|
||||
this.size = entries.length / 2;
|
||||
this.accesses = 0;
|
||||
};
|
||||
types.TransitArrayMap.prototype.toString = function() {
|
||||
return types.printMap(this);
|
||||
};
|
||||
types.TransitArrayMap.prototype["inspect"] = function() {
|
||||
return this.toString();
|
||||
};
|
||||
types.TransitArrayMap.prototype.convert = function() {
|
||||
if (this.backingMap) {
|
||||
throw Error("Invalid operation, already converted");
|
||||
}
|
||||
if (this.size < types.SMALL_ARRAY_MAP_THRESHOLD) {
|
||||
return false;
|
||||
}
|
||||
this.accesses++;
|
||||
if (this.accesses > types.ARRAY_MAP_ACCESS_THRESHOLD) {
|
||||
this.backingMap = types.map(this._entries, false, true);
|
||||
this._entries = [];
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype.clear = function() {
|
||||
this.hashCode = -1;
|
||||
if (this.backingMap) {
|
||||
this.backingMap.clear();
|
||||
this.size = 0;
|
||||
} else {
|
||||
this._entries = [];
|
||||
this.size = 0;
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype["clear"] = types.TransitArrayMap.prototype.clear;
|
||||
types.TransitArrayMap.prototype.keys = function() {
|
||||
if (this.backingMap) {
|
||||
return this.backingMap.keys();
|
||||
} else {
|
||||
return new types.TransitArrayMapIterator(this._entries, types.KEYS);
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype["keys"] = types.TransitArrayMap.prototype.keys;
|
||||
types.TransitArrayMap.prototype.keySet = function() {
|
||||
if (this.backingMap) {
|
||||
return this.backingMap.keySet();
|
||||
} else {
|
||||
var ret = [];
|
||||
for (var i = 0, j = 0; j < this._entries.length; i++, j += 2) {
|
||||
ret[i] = this._entries[j];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype["keySet"] = types.TransitArrayMap.prototype.keySet;
|
||||
types.TransitArrayMap.prototype.entries = function() {
|
||||
if (this.backingMap) {
|
||||
return this.backingMap.entries();
|
||||
} else {
|
||||
return new types.TransitArrayMapIterator(this._entries, types.ENTRIES);
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype["entries"] = types.TransitArrayMap.prototype.entries;
|
||||
types.TransitArrayMap.prototype.values = function() {
|
||||
if (this.backingMap) {
|
||||
return this.backingMap.values();
|
||||
} else {
|
||||
return new types.TransitArrayMapIterator(this._entries, types.VALUES);
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype["values"] = types.TransitArrayMap.prototype.values;
|
||||
types.TransitArrayMap.prototype.forEach = function(f) {
|
||||
if (this.backingMap) {
|
||||
this.backingMap.forEach(f);
|
||||
} else {
|
||||
for (var i = 0; i < this._entries.length; i += 2) {
|
||||
f(this._entries[i + 1], this._entries[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype["forEach"] = types.TransitArrayMap.prototype.forEach;
|
||||
types.TransitArrayMap.prototype.get = function(k, notFound) {
|
||||
if (this.backingMap) {
|
||||
return this.backingMap.get(k);
|
||||
} else {
|
||||
if (this.convert()) {
|
||||
return this.get(k);
|
||||
} else {
|
||||
for (var i = 0; i < this._entries.length; i += 2) {
|
||||
if (eq.equals(this._entries[i], k)) {
|
||||
return this._entries[i + 1];
|
||||
}
|
||||
}
|
||||
return notFound;
|
||||
}
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype["get"] = types.TransitArrayMap.prototype.get;
|
||||
types.TransitArrayMap.prototype.has = function(k) {
|
||||
if (this.backingMap) {
|
||||
return this.backingMap.has(k);
|
||||
} else {
|
||||
if (this.convert()) {
|
||||
return this.has(k);
|
||||
} else {
|
||||
for (var i = 0; i < this._entries.length; i += 2) {
|
||||
if (eq.equals(this._entries[i], k)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype["has"] = types.TransitArrayMap.prototype.has;
|
||||
types.TransitArrayMap.prototype.set = function(k, v) {
|
||||
this.hashCode = -1;
|
||||
if (this.backingMap) {
|
||||
this.backingMap.set(k, v);
|
||||
this.size = this.backingMap.size;
|
||||
} else {
|
||||
for (var i = 0; i < this._entries.length; i += 2) {
|
||||
if (eq.equals(this._entries[i], k)) {
|
||||
this._entries[i + 1] = v;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this._entries.push(k);
|
||||
this._entries.push(v);
|
||||
this.size++;
|
||||
if (this.size > types.ARRAY_MAP_THRESHOLD) {
|
||||
this.backingMap = types.map(this._entries, false, true);
|
||||
this._entries = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype["set"] = types.TransitArrayMap.prototype.set;
|
||||
types.TransitArrayMap.prototype["delete"] = function(k) {
|
||||
this.hashCode = -1;
|
||||
if (this.backingMap) {
|
||||
var ret = this.backingMap.delete(k);
|
||||
this.size = this.backingMap.size;
|
||||
return ret;
|
||||
} else {
|
||||
for (var i = 0; i < this._entries.length; i += 2) {
|
||||
if (eq.equals(this._entries[i], k)) {
|
||||
var ret = this._entries[i + 1];
|
||||
this._entries.splice(i, 2);
|
||||
this.size--;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype.clone = function() {
|
||||
var clone = types.map();
|
||||
this.forEach(function(v, k) {
|
||||
clone.set(k, v);
|
||||
});
|
||||
return clone;
|
||||
};
|
||||
types.TransitArrayMap.prototype["clone"] = types.TransitArrayMap.prototype.clone;
|
||||
types.TransitArrayMap.prototype[types.ITERATOR] = function() {
|
||||
return this.entries();
|
||||
};
|
||||
types.TransitArrayMap.prototype.com$cognitect$transit$hashCode = function() {
|
||||
if (this.backingMap) {
|
||||
return this.backingMap.com$cognitect$transit$hashCode();
|
||||
} else {
|
||||
if (this.hashCode === -1) {
|
||||
this.hashCode = eq.hashMapLike(this);
|
||||
}
|
||||
return this.hashCode;
|
||||
}
|
||||
};
|
||||
types.TransitArrayMap.prototype.com$cognitect$transit$equals = function(other) {
|
||||
if (this.backingMap) {
|
||||
return types.mapEquals(this.backingMap, other);
|
||||
} else {
|
||||
return types.mapEquals(this, other);
|
||||
}
|
||||
};
|
||||
types.TransitMap = function Transit$Map(keys, map, size) {
|
||||
this.map = map || {};
|
||||
this._keys = keys || [];
|
||||
this.size = size || 0;
|
||||
this.hashCode = -1;
|
||||
};
|
||||
types.TransitMap.prototype.toString = function() {
|
||||
return types.printMap(this);
|
||||
};
|
||||
types.TransitMap.prototype["inspect"] = function() {
|
||||
return this.toString();
|
||||
};
|
||||
types.TransitMap.prototype.clear = function() {
|
||||
this.hashCode = -1;
|
||||
this.map = {};
|
||||
this._keys = [];
|
||||
this.size = 0;
|
||||
};
|
||||
types.TransitMap.prototype["clear"] = types.TransitMap.prototype.clear;
|
||||
types.TransitMap.prototype.getKeys = function() {
|
||||
if (this._keys != null) {
|
||||
return this._keys;
|
||||
} else {
|
||||
return util.objectKeys(this.map);
|
||||
}
|
||||
};
|
||||
types.TransitMap.prototype["delete"] = function(k) {
|
||||
this.hashCode = -1;
|
||||
this._keys = null;
|
||||
var code = eq.hashCode(k), bucket = this.map[code];
|
||||
for (var i = 0; i < bucket.length; i += 2) {
|
||||
if (eq.equals(k, bucket[i])) {
|
||||
var ret = bucket[i + 1];
|
||||
bucket.splice(i, 2);
|
||||
if (bucket.length === 0) {
|
||||
delete this.map[code];
|
||||
}
|
||||
this.size--;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
};
|
||||
types.TransitMap.prototype.entries = function() {
|
||||
return new types.TransitMapIterator(this, types.ENTRIES);
|
||||
};
|
||||
types.TransitMap.prototype["entries"] = types.TransitMap.prototype.entries;
|
||||
types.TransitMap.prototype.forEach = function(callback) {
|
||||
var ks = this.getKeys();
|
||||
for (var i = 0; i < ks.length; i++) {
|
||||
var bucket = this.map[ks[i]];
|
||||
for (var j = 0; j < bucket.length; j += 2) {
|
||||
callback(bucket[j + 1], bucket[j], this);
|
||||
}
|
||||
}
|
||||
};
|
||||
types.TransitMap.prototype["forEach"] = types.TransitMap.prototype.forEach;
|
||||
types.TransitMap.prototype.get = function(k, notFound) {
|
||||
var code = eq.hashCode(k), bucket = this.map[code];
|
||||
if (bucket != null) {
|
||||
for (var i = 0; i < bucket.length; i += 2) {
|
||||
if (eq.equals(k, bucket[i])) {
|
||||
return bucket[i + 1];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return notFound;
|
||||
}
|
||||
};
|
||||
types.TransitMap.prototype["get"] = types.TransitMap.prototype.get;
|
||||
types.TransitMap.prototype.has = function(k) {
|
||||
var code = eq.hashCode(k), bucket = this.map[code];
|
||||
if (bucket != null) {
|
||||
for (var i = 0; i < bucket.length; i += 2) {
|
||||
if (eq.equals(k, bucket[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
types.TransitMap.prototype["has"] = types.TransitMap.prototype.has;
|
||||
types.TransitMap.prototype.keys = function() {
|
||||
return new types.TransitMapIterator(this, types.KEYS);
|
||||
};
|
||||
types.TransitMap.prototype["keys"] = types.TransitMap.prototype.keys;
|
||||
types.TransitMap.prototype.keySet = function() {
|
||||
var keys = this.getKeys(), ret = [];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var bucket = this.map[keys[i]];
|
||||
for (var j = 0; j < bucket.length; j += 2) {
|
||||
ret.push(bucket[j]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
types.TransitMap.prototype["keySet"] = types.TransitMap.prototype.keySet;
|
||||
types.TransitMap.prototype.set = function(k, v) {
|
||||
this.hashCode = -1;
|
||||
var code = eq.hashCode(k), bucket = this.map[code];
|
||||
if (bucket == null) {
|
||||
if (this._keys) {
|
||||
this._keys.push(code);
|
||||
}
|
||||
this.map[code] = [k, v];
|
||||
this.size++;
|
||||
} else {
|
||||
var newEntry = true;
|
||||
for (var i = 0; i < bucket.length; i += 2) {
|
||||
if (eq.equals(v, bucket[i])) {
|
||||
newEntry = false;
|
||||
bucket[i] = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newEntry) {
|
||||
bucket.push(k);
|
||||
bucket.push(v);
|
||||
this.size++;
|
||||
}
|
||||
}
|
||||
};
|
||||
types.TransitMap.prototype["set"] = types.TransitMap.prototype.set;
|
||||
types.TransitMap.prototype.values = function() {
|
||||
return new types.TransitMapIterator(this, types.VALUES);
|
||||
};
|
||||
types.TransitMap.prototype["values"] = types.TransitMap.prototype.values;
|
||||
types.TransitMap.prototype.clone = function() {
|
||||
var clone = types.map();
|
||||
this.forEach(function(v, k) {
|
||||
clone.set(k, v);
|
||||
});
|
||||
return clone;
|
||||
};
|
||||
types.TransitMap.prototype["clone"] = types.TransitMap.prototype.clone;
|
||||
types.TransitMap.prototype[types.ITERATOR] = function() {
|
||||
return this.entries();
|
||||
};
|
||||
types.TransitMap.prototype.com$cognitect$transit$hashCode = function() {
|
||||
if (this.hashCode === -1) {
|
||||
this.hashCode = eq.hashMapLike(this);
|
||||
}
|
||||
return this.hashCode;
|
||||
};
|
||||
types.TransitMap.prototype.com$cognitect$transit$equals = function(other) {
|
||||
return types.mapEquals(this, other);
|
||||
};
|
||||
types.map = function(arr, checkDups, hashMap) {
|
||||
arr = arr || [];
|
||||
checkDups = checkDups === false ? checkDups : true;
|
||||
hashMap = hashMap === true ? hashMap : false;
|
||||
if (!hashMap && arr.length <= types.ARRAY_MAP_THRESHOLD * 2) {
|
||||
if (checkDups) {
|
||||
var t = arr;
|
||||
arr = [];
|
||||
for (var i = 0; i < t.length; i += 2) {
|
||||
var seen = false;
|
||||
for (var j = 0; j < arr.length; j += 2) {
|
||||
if (eq.equals(arr[j], t[i])) {
|
||||
arr[j + 1] = t[i + 1];
|
||||
seen = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!seen) {
|
||||
arr.push(t[i]);
|
||||
arr.push(t[i + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new types.TransitArrayMap(arr);
|
||||
} else {
|
||||
var map = {}, keys = [], size = 0;
|
||||
for (var i = 0; i < arr.length; i += 2) {
|
||||
var code = eq.hashCode(arr[i]), bucket = map[code];
|
||||
if (bucket == null) {
|
||||
keys.push(code);
|
||||
map[code] = [arr[i], arr[i + 1]];
|
||||
size++;
|
||||
} else {
|
||||
var newEntry = true;
|
||||
for (var j = 0; j < bucket.length; j += 2) {
|
||||
if (eq.equals(bucket[j], arr[i])) {
|
||||
bucket[j + 1] = arr[i + 1];
|
||||
newEntry = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newEntry) {
|
||||
bucket.push(arr[i]);
|
||||
bucket.push(arr[i + 1]);
|
||||
size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new types.TransitMap(keys, map, size);
|
||||
}
|
||||
};
|
||||
types.isArrayMap = function(x) {
|
||||
return x instanceof types.TransitArrayMap;
|
||||
};
|
||||
types.isMap = function(x) {
|
||||
return x instanceof types.TransitArrayMap || x instanceof types.TransitMap;
|
||||
};
|
||||
types.TransitSet = function Transit$Set(map) {
|
||||
this.map = map;
|
||||
this.size = map.size;
|
||||
};
|
||||
types.TransitSet.prototype.toString = function() {
|
||||
return types.printSet(this);
|
||||
};
|
||||
types.TransitSet.prototype["inspect"] = function() {
|
||||
return this.toString();
|
||||
};
|
||||
types.TransitSet.prototype.add = function(value) {
|
||||
this.map.set(value, value);
|
||||
this.size = this.map.size;
|
||||
};
|
||||
types.TransitSet.prototype["add"] = types.TransitSet.prototype.add;
|
||||
types.TransitSet.prototype.clear = function() {
|
||||
this.map = new types.TransitMap();
|
||||
this.size = 0;
|
||||
};
|
||||
types.TransitSet.prototype["clear"] = types.TransitSet.prototype.clear;
|
||||
types.TransitSet.prototype["delete"] = function(value) {
|
||||
var ret = this.map.delete(value);
|
||||
this.size = this.map.size;
|
||||
return ret;
|
||||
};
|
||||
types.TransitSet.prototype.entries = function() {
|
||||
return this.map.entries();
|
||||
};
|
||||
types.TransitSet.prototype["entries"] = types.TransitSet.prototype.entries;
|
||||
types.TransitSet.prototype.forEach = function(iterator, thisArg) {
|
||||
var self = this;
|
||||
this.map.forEach(function(v, k, m) {
|
||||
iterator(k, self);
|
||||
});
|
||||
};
|
||||
types.TransitSet.prototype["forEach"] = types.TransitSet.prototype.forEach;
|
||||
types.TransitSet.prototype.has = function(value) {
|
||||
return this.map.has(value);
|
||||
};
|
||||
types.TransitSet.prototype["has"] = types.TransitSet.prototype.has;
|
||||
types.TransitSet.prototype.keys = function() {
|
||||
return this.map.keys();
|
||||
};
|
||||
types.TransitSet.prototype["keys"] = types.TransitSet.prototype.keys;
|
||||
types.TransitSet.prototype.keySet = function() {
|
||||
return this.map.keySet();
|
||||
};
|
||||
types.TransitSet.prototype["keySet"] = types.TransitSet.prototype.keySet;
|
||||
types.TransitSet.prototype.values = function() {
|
||||
return this.map.values();
|
||||
};
|
||||
types.TransitSet.prototype["values"] = types.TransitSet.prototype.values;
|
||||
types.TransitSet.prototype.clone = function() {
|
||||
var clone = types.set();
|
||||
this.forEach(function(k) {
|
||||
clone.add(k);
|
||||
});
|
||||
return clone;
|
||||
};
|
||||
types.TransitSet.prototype["clone"] = types.TransitSet.prototype.clone;
|
||||
types.TransitSet.prototype[types.ITERATOR] = function() {
|
||||
return this.values();
|
||||
};
|
||||
types.TransitSet.prototype.com$cognitect$transit$equals = function(other) {
|
||||
if (other instanceof types.TransitSet) {
|
||||
if (this.size === other.size) {
|
||||
return eq.equals(this.map, other.map);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
types.TransitSet.prototype.com$cognitect$transit$hashCode = function(other) {
|
||||
return eq.hashCode(this.map);
|
||||
};
|
||||
types.set = function(arr) {
|
||||
arr = arr || [];
|
||||
var map = {}, keys = [], size = 0;
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var code = eq.hashCode(arr[i]), vals = map[code];
|
||||
if (vals == null) {
|
||||
keys.push(code);
|
||||
map[code] = [arr[i], arr[i]];
|
||||
size++;
|
||||
} else {
|
||||
var newEntry = true;
|
||||
for (var j = 0; j < vals.length; j += 2) {
|
||||
if (eq.equals(vals[j], arr[i])) {
|
||||
newEntry = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newEntry) {
|
||||
vals.push(arr[i]);
|
||||
vals.push(arr[i]);
|
||||
size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new types.TransitSet(new types.TransitMap(keys, map, size));
|
||||
};
|
||||
types.isSet = function(x) {
|
||||
return x instanceof types.TransitSet;
|
||||
};
|
||||
types.quoted = function(obj) {
|
||||
return types.taggedValue("'", obj);
|
||||
};
|
||||
types.isQuoted = function(x) {
|
||||
return x instanceof types.TaggedValue && x.tag === "'";
|
||||
};
|
||||
types.list = function(xs) {
|
||||
return types.taggedValue("list", xs);
|
||||
};
|
||||
types.isList = function(x) {
|
||||
return x instanceof types.TaggedValue && x.tag === "list";
|
||||
};
|
||||
types.link = function(rep) {
|
||||
return types.taggedValue("link", rep);
|
||||
};
|
||||
types.isLink = function(x) {
|
||||
return x instanceof types.TaggedValue && x.tag === "link";
|
||||
};
|
||||
types.specialDouble = function(v) {
|
||||
switch(v) {
|
||||
case "-INF":
|
||||
return -Infinity;
|
||||
case "INF":
|
||||
return Infinity;
|
||||
case "NaN":
|
||||
return NaN;
|
||||
default:
|
||||
throw new Error("Invalid special double value " + v);
|
||||
break;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
//# sourceMappingURL=com.cognitect.transit.types.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,83 +0,0 @@
|
|||
goog.provide("com.cognitect.transit.util");
|
||||
goog.require("goog.object");
|
||||
goog.scope(function() {
|
||||
var util = com.cognitect.transit.util, gobject = goog.object;
|
||||
if (typeof Object.keys != "undefined") {
|
||||
util.objectKeys = function(obj) {
|
||||
return Object.keys(obj);
|
||||
};
|
||||
} else {
|
||||
util.objectKeys = function(obj) {
|
||||
return gobject.getKeys(obj);
|
||||
};
|
||||
}
|
||||
if (typeof Array.isArray != "undefined") {
|
||||
util.isArray = function(obj) {
|
||||
return Array.isArray(obj);
|
||||
};
|
||||
} else {
|
||||
util.isArray = function(obj) {
|
||||
return goog.typeOf(obj) === "array";
|
||||
};
|
||||
}
|
||||
util.chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d";
|
||||
util.randInt = function(ub) {
|
||||
return Math.round(Math.random() * ub);
|
||||
};
|
||||
util.randHex = function() {
|
||||
return util.randInt(15).toString(16);
|
||||
};
|
||||
util.randomUUID = function() {
|
||||
var rhex = (8 | 3 & util.randInt(14)).toString(16), ret = util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + "-" + util.randHex() + util.randHex() + util.randHex() + util.randHex() + "-" + "4" + util.randHex() + util.randHex() + util.randHex() + "-" + rhex + util.randHex() + util.randHex() + util.randHex() + "-" + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() +
|
||||
util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex();
|
||||
return ret;
|
||||
};
|
||||
util.btoa = function(input) {
|
||||
if (typeof btoa != "undefined") {
|
||||
return btoa(input);
|
||||
} else {
|
||||
var str = String(input);
|
||||
for (var block, charCode, idx = 0, map = util.chars, output = ""; str.charAt(idx | 0) || (map = "\x3d", idx % 1); output += map.charAt(63 & block >> 8 - idx % 1 * 8)) {
|
||||
charCode = str.charCodeAt(idx += 3 / 4);
|
||||
if (charCode > 255) {
|
||||
throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
|
||||
}
|
||||
block = block << 8 | charCode;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
};
|
||||
util.atob = function(input) {
|
||||
if (typeof atob != "undefined") {
|
||||
return atob(input);
|
||||
} else {
|
||||
var str = String(input).replace(/=+$/, "");
|
||||
if (str.length % 4 == 1) {
|
||||
throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");
|
||||
}
|
||||
for (var bc = 0, bs, buffer, idx = 0, output = ""; buffer = str.charAt(idx++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
|
||||
buffer = util.chars.indexOf(buffer);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
};
|
||||
util.Uint8ToBase64 = function(u8Arr) {
|
||||
var CHUNK_SIZE = 32768, index = 0, length = u8Arr.length, result = "", slice = null;
|
||||
while (index < length) {
|
||||
slice = u8Arr.subarray(index, Math.min(index + CHUNK_SIZE, length));
|
||||
result += String.fromCharCode.apply(null, slice);
|
||||
index += CHUNK_SIZE;
|
||||
}
|
||||
return util.btoa(result);
|
||||
};
|
||||
util.Base64ToUint8 = function(base64) {
|
||||
var binary_string = util.atob(base64), len = binary_string.length, bytes = new Uint8Array(len);
|
||||
for (var i = 0; i < len; i++) {
|
||||
var ascii = binary_string.charCodeAt(i);
|
||||
bytes[i] = ascii;
|
||||
}
|
||||
return bytes;
|
||||
};
|
||||
});
|
||||
|
||||
//# sourceMappingURL=com.cognitect.transit.util.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,56 +0,0 @@
|
|||
goog.provide('forms');
|
||||
/**
|
||||
* logs everything to the javascript console
|
||||
*/
|
||||
forms.log = console.log;
|
||||
forms.startup = (function forms$startup(){
|
||||
forms.form = document.getElementById("form");
|
||||
|
||||
(forms.log.cljs$core$IFn$_invoke$arity$1 ? forms.log.cljs$core$IFn$_invoke$arity$1(forms.form) : forms.log.call(null,forms.form));
|
||||
|
||||
forms.data = (new FormData(forms.form));
|
||||
|
||||
return (forms.log.cljs$core$IFn$_invoke$arity$1 ? forms.log.cljs$core$IFn$_invoke$arity$1(forms.data) : forms.log.call(null,forms.data));
|
||||
});
|
||||
forms.calc_age = (function forms$calc_age(dob){
|
||||
(forms.log.cljs$core$IFn$_invoke$arity$1 ? forms.log.cljs$core$IFn$_invoke$arity$1("HELLO CHICKENS!") : forms.log.call(null,"HELLO CHICKENS!"));
|
||||
|
||||
(forms.log.cljs$core$IFn$_invoke$arity$1 ? forms.log.cljs$core$IFn$_invoke$arity$1(dob) : forms.log.call(null,dob));
|
||||
|
||||
(forms.log.cljs$core$IFn$_invoke$arity$1 ? forms.log.cljs$core$IFn$_invoke$arity$1("HELLO CHICKENS!") : forms.log.call(null,"HELLO CHICKENS!"));
|
||||
|
||||
var diff_ms = (Date - dob.getTime);
|
||||
var age_dt = (new Date(diff_ms));
|
||||
(forms.log.cljs$core$IFn$_invoke$arity$1 ? forms.log.cljs$core$IFn$_invoke$arity$1(diff_ms) : forms.log.call(null,diff_ms));
|
||||
|
||||
(forms.log.cljs$core$IFn$_invoke$arity$1 ? forms.log.cljs$core$IFn$_invoke$arity$1(age_dt) : forms.log.call(null,age_dt));
|
||||
|
||||
return Math.abs((age_dt.getUTCFullyYear - (1970)));
|
||||
});
|
||||
forms.submitform = (function forms$submitform(e){
|
||||
var form = document.getElementById("form");
|
||||
var data = (new FormData(form));
|
||||
var birthdate = (new Date(cljs.core.get.cljs$core$IFn$_invoke$arity$2(data,"birthdate")));
|
||||
var age = forms.calc_age(birthdate);
|
||||
(data.age = age);
|
||||
|
||||
(forms.log.cljs$core$IFn$_invoke$arity$1 ? forms.log.cljs$core$IFn$_invoke$arity$1("HERE IS BIRTHDATE") : forms.log.call(null,"HERE IS BIRTHDATE"));
|
||||
|
||||
var G__18144_18147 = "birthdate";
|
||||
var G__18145_18148 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(data,"birtdate");
|
||||
(forms.log.cljs$core$IFn$_invoke$arity$2 ? forms.log.cljs$core$IFn$_invoke$arity$2(G__18144_18147,G__18145_18148) : forms.log.call(null,G__18144_18147,G__18145_18148));
|
||||
|
||||
var G__18146_18149 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(data,"tetanus-shot");
|
||||
(forms.log.cljs$core$IFn$_invoke$arity$1 ? forms.log.cljs$core$IFn$_invoke$arity$1(G__18146_18149) : forms.log.call(null,G__18146_18149));
|
||||
|
||||
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(cljs.core.get.cljs$core$IFn$_invoke$arity$2(data,"tetanus-shot"),"")){
|
||||
(data._tetanus_shot = "1111-11-11");
|
||||
} else {
|
||||
}
|
||||
|
||||
return (forms.log.cljs$core$IFn$_invoke$arity$1 ? forms.log.cljs$core$IFn$_invoke$arity$1(data) : forms.log.call(null,data));
|
||||
});
|
||||
goog.exportSymbol('forms.submitform', forms.submitform);
|
||||
document.addEventListener("DOMContentLoaded",forms.startup);
|
||||
|
||||
//# sourceMappingURL=forms.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["forms.cljs"],"mappings":";AACA;;;AAAKA,YAAgD,AAAOC;AAE5D,gBAAA,hBAAMC;AAAN,AACE,AAAKC,aAAK,wBAAA,xBAACC;;AACX,CAACJ,0CAAAA,sDAAAA,dAAIG,kCAAAA;;AACL,AAAKE,aAAK,KAAAC,SAAcH;;AACxB,QAACH,0CAAAA,sDAAAA,dAAIK,kCAAAA;;AAGP,iBAAA,jBAAME,0CAAUC;AAAhB,AACE,mFAAA,yCAAA,3HAACR,0CAAAA,6DAAAA;;AACD,CAACA,0CAAAA,+CAAAA,PAAIQ,2BAAAA;;AACL,mFAAA,yCAAA,3HAACR,0CAAAA,6DAAAA;;AACD,IAAMS,UAAQ,CAAGC,OAAS,AAAAF;IACpBG,SAAO,KAAAC,KAAUH;AADvB,AAEE,CAACT,0CAAAA,mDAAAA,XAAIS,+BAAAA;;AACL,CAACT,0CAAAA,kDAAAA,VAAIW,8BAAAA;;AACL,OAACE,SAAY,0BAAA,zBAAG,AAAAF;;AAEpB,mBAAA,nBAAeG,8CAAYC;AAA3B,AACE,IAAMC,OAAK,wBAAA,xBAACZ;IACNa,OAAK,KAAAX,SAAcU;IACnBE,YAAU,KAAAN,KAAU,iDAAA,jDAACO,4CAAIF;IACzBG,MAAI,AAACb,eAASW;AAHpB,AAIE,CAAM,AAAAD,WAASG;;AACf,mFAAA,2CAAA,7HAACpB,0CAAAA,+DAAAA;;AACD,IAAAqB,iBAAA;IAAAC,iBAAiB,iDAAA,jDAACH,4CAAIF;AAAtB,AAAA,mFAAAI,eAAAC,sCAAAD,eAAAC,tJAACtB,0CAAAA,yEAAAA;;AACD,IAAAuB,iBAAK,iDAAA,jDAACJ,4CAAIF;AAAV,AAAA,mFAAAM,sCAAAA,xHAACvB,0CAAAA,0DAAAA;;AACD,GAAI,8GAAA,9GAACwB,6CAAE,iDAAA,jDAACL,4CAAIF;AACV,sBAAA,rBAAM,AAAAA;;AADR;;AAEA,QAACjB,0CAAAA,gDAAAA,RAAIiB,4BAAAA;;;AAET,0BAAA,1BAACQ,6CAAgDvB","names":["forms/log","js/console","forms/startup","forms/form","js/document.getElementById","forms/data","js/FormData","forms/calc-age","dob","diff-ms","js/Date.","age-dt","js/Date","js/Math.abs","forms/submitform","e","form","data","birthdate","cljs.core.get","age","G__18144","G__18145","G__18146","cljs.core._EQ_","js/document.addEventListener"],"sourcesContent":["(ns forms)\n(def log \"logs everything to the javascript console\" (.-log js/console))\n\n(defn startup []\n (def form (js/document.getElementById \"form\"))\n (log form)\n (def data (js/FormData. form))\n (log data)\n )\n\n(defn calc-age [dob]\n (log \"HELLO CHICKENS!\")\n (log dob)\n (log \"HELLO CHICKENS!\")\n (let [diff-ms (- js/Date. dob.getTime)\n age-dt (js/Date. diff-ms)]\n (log diff-ms)\n (log age-dt)\n (js/Math.abs (- age-dt.getUTCFullyYear 1970))))\n\n(defn ^:export submitform [e]\n (let [form (js/document.getElementById \"form\")\n data (js/FormData. form)\n birthdate (js/Date. (get data \"birthdate\"))\n age (calc-age birthdate)]\n (set! data.age age)\n (log \"HERE IS BIRTHDATE\")\n (log \"birthdate\" (get data \"birtdate\"))\n (log (get data \"tetanus-shot\"))\n (if (= (get data \"tetanus-shot\") \"\")\n (set! data.-tetanus-shot \"1111-11-11\"))\n (log data)))\n\n(js/document.addEventListener \"DOMContentLoaded\" startup)\n"]}
|
|
@ -1,657 +0,0 @@
|
|||
goog.loadModule(function(exports) {
|
||||
"use strict";
|
||||
goog.module("goog.array");
|
||||
goog.module.declareLegacyNamespace();
|
||||
const asserts = goog.require("goog.asserts");
|
||||
goog.NATIVE_ARRAY_PROTOTYPES = goog.define("goog.NATIVE_ARRAY_PROTOTYPES", goog.TRUSTED_SITE);
|
||||
const ASSUME_NATIVE_FUNCTIONS = goog.define("goog.array.ASSUME_NATIVE_FUNCTIONS", goog.FEATURESET_YEAR > 2012);
|
||||
exports.ASSUME_NATIVE_FUNCTIONS = ASSUME_NATIVE_FUNCTIONS;
|
||||
function peek(array) {
|
||||
return array[array.length - 1];
|
||||
}
|
||||
exports.peek = peek;
|
||||
exports.last = peek;
|
||||
const indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.indexOf) ? function(arr, obj, opt_fromIndex) {
|
||||
asserts.assert(arr.length != null);
|
||||
return Array.prototype.indexOf.call(arr, obj, opt_fromIndex);
|
||||
} : function(arr, obj, opt_fromIndex) {
|
||||
const fromIndex = opt_fromIndex == null ? 0 : opt_fromIndex < 0 ? Math.max(0, arr.length + opt_fromIndex) : opt_fromIndex;
|
||||
if (typeof arr === "string") {
|
||||
if (typeof obj !== "string" || obj.length != 1) {
|
||||
return -1;
|
||||
}
|
||||
return arr.indexOf(obj, fromIndex);
|
||||
}
|
||||
for (let i = fromIndex; i < arr.length; i++) {
|
||||
if (i in arr && arr[i] === obj) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
exports.indexOf = indexOf;
|
||||
const lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.lastIndexOf) ? function(arr, obj, opt_fromIndex) {
|
||||
asserts.assert(arr.length != null);
|
||||
const fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
|
||||
return Array.prototype.lastIndexOf.call(arr, obj, fromIndex);
|
||||
} : function(arr, obj, opt_fromIndex) {
|
||||
let fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
|
||||
if (fromIndex < 0) {
|
||||
fromIndex = Math.max(0, arr.length + fromIndex);
|
||||
}
|
||||
if (typeof arr === "string") {
|
||||
if (typeof obj !== "string" || obj.length != 1) {
|
||||
return -1;
|
||||
}
|
||||
return arr.lastIndexOf(obj, fromIndex);
|
||||
}
|
||||
for (let i = fromIndex; i >= 0; i--) {
|
||||
if (i in arr && arr[i] === obj) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
exports.lastIndexOf = lastIndexOf;
|
||||
const forEach = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.forEach) ? function(arr, f, opt_obj) {
|
||||
asserts.assert(arr.length != null);
|
||||
Array.prototype.forEach.call(arr, f, opt_obj);
|
||||
} : function(arr, f, opt_obj) {
|
||||
const l = arr.length;
|
||||
const arr2 = typeof arr === "string" ? arr.split("") : arr;
|
||||
for (let i = 0; i < l; i++) {
|
||||
if (i in arr2) {
|
||||
f.call(opt_obj, arr2[i], i, arr);
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.forEach = forEach;
|
||||
function forEachRight(arr, f, opt_obj) {
|
||||
const l = arr.length;
|
||||
const arr2 = typeof arr === "string" ? arr.split("") : arr;
|
||||
for (let i = l - 1; i >= 0; --i) {
|
||||
if (i in arr2) {
|
||||
f.call(opt_obj, arr2[i], i, arr);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.forEachRight = forEachRight;
|
||||
const filter = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.filter) ? function(arr, f, opt_obj) {
|
||||
asserts.assert(arr.length != null);
|
||||
return Array.prototype.filter.call(arr, f, opt_obj);
|
||||
} : function(arr, f, opt_obj) {
|
||||
const l = arr.length;
|
||||
const res = [];
|
||||
let resLength = 0;
|
||||
const arr2 = typeof arr === "string" ? arr.split("") : arr;
|
||||
for (let i = 0; i < l; i++) {
|
||||
if (i in arr2) {
|
||||
const val = arr2[i];
|
||||
if (f.call(opt_obj, val, i, arr)) {
|
||||
res[resLength++] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
};
|
||||
exports.filter = filter;
|
||||
const map = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.map) ? function(arr, f, opt_obj) {
|
||||
asserts.assert(arr.length != null);
|
||||
return Array.prototype.map.call(arr, f, opt_obj);
|
||||
} : function(arr, f, opt_obj) {
|
||||
const l = arr.length;
|
||||
const res = new Array(l);
|
||||
const arr2 = typeof arr === "string" ? arr.split("") : arr;
|
||||
for (let i = 0; i < l; i++) {
|
||||
if (i in arr2) {
|
||||
res[i] = f.call(opt_obj, arr2[i], i, arr);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
};
|
||||
exports.map = map;
|
||||
const reduce = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduce) ? function(arr, f, val, opt_obj) {
|
||||
asserts.assert(arr.length != null);
|
||||
if (opt_obj) {
|
||||
f = goog.bind(f, opt_obj);
|
||||
}
|
||||
return Array.prototype.reduce.call(arr, f, val);
|
||||
} : function(arr, f, val, opt_obj) {
|
||||
let rval = val;
|
||||
forEach(arr, function(val, index) {
|
||||
rval = f.call(opt_obj, rval, val, index, arr);
|
||||
});
|
||||
return rval;
|
||||
};
|
||||
exports.reduce = reduce;
|
||||
const reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduceRight) ? function(arr, f, val, opt_obj) {
|
||||
asserts.assert(arr.length != null);
|
||||
asserts.assert(f != null);
|
||||
if (opt_obj) {
|
||||
f = goog.bind(f, opt_obj);
|
||||
}
|
||||
return Array.prototype.reduceRight.call(arr, f, val);
|
||||
} : function(arr, f, val, opt_obj) {
|
||||
let rval = val;
|
||||
forEachRight(arr, function(val, index) {
|
||||
rval = f.call(opt_obj, rval, val, index, arr);
|
||||
});
|
||||
return rval;
|
||||
};
|
||||
exports.reduceRight = reduceRight;
|
||||
const some = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.some) ? function(arr, f, opt_obj) {
|
||||
asserts.assert(arr.length != null);
|
||||
return Array.prototype.some.call(arr, f, opt_obj);
|
||||
} : function(arr, f, opt_obj) {
|
||||
const l = arr.length;
|
||||
const arr2 = typeof arr === "string" ? arr.split("") : arr;
|
||||
for (let i = 0; i < l; i++) {
|
||||
if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
exports.some = some;
|
||||
const every = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.every) ? function(arr, f, opt_obj) {
|
||||
asserts.assert(arr.length != null);
|
||||
return Array.prototype.every.call(arr, f, opt_obj);
|
||||
} : function(arr, f, opt_obj) {
|
||||
const l = arr.length;
|
||||
const arr2 = typeof arr === "string" ? arr.split("") : arr;
|
||||
for (let i = 0; i < l; i++) {
|
||||
if (i in arr2 && !f.call(opt_obj, arr2[i], i, arr)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
exports.every = every;
|
||||
function count(arr, f, opt_obj) {
|
||||
let count = 0;
|
||||
forEach(arr, function(element, index, arr) {
|
||||
if (f.call(opt_obj, element, index, arr)) {
|
||||
++count;
|
||||
}
|
||||
}, opt_obj);
|
||||
return count;
|
||||
}
|
||||
exports.count = count;
|
||||
function find(arr, f, opt_obj) {
|
||||
const i = findIndex(arr, f, opt_obj);
|
||||
return i < 0 ? null : typeof arr === "string" ? arr.charAt(i) : arr[i];
|
||||
}
|
||||
exports.find = find;
|
||||
function findIndex(arr, f, opt_obj) {
|
||||
const l = arr.length;
|
||||
const arr2 = typeof arr === "string" ? arr.split("") : arr;
|
||||
for (let i = 0; i < l; i++) {
|
||||
if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
exports.findIndex = findIndex;
|
||||
function findRight(arr, f, opt_obj) {
|
||||
const i = findIndexRight(arr, f, opt_obj);
|
||||
return i < 0 ? null : typeof arr === "string" ? arr.charAt(i) : arr[i];
|
||||
}
|
||||
exports.findRight = findRight;
|
||||
function findIndexRight(arr, f, opt_obj) {
|
||||
const l = arr.length;
|
||||
const arr2 = typeof arr === "string" ? arr.split("") : arr;
|
||||
for (let i = l - 1; i >= 0; i--) {
|
||||
if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
exports.findIndexRight = findIndexRight;
|
||||
function contains(arr, obj) {
|
||||
return indexOf(arr, obj) >= 0;
|
||||
}
|
||||
exports.contains = contains;
|
||||
function isEmpty(arr) {
|
||||
return arr.length == 0;
|
||||
}
|
||||
exports.isEmpty = isEmpty;
|
||||
function clear(arr) {
|
||||
if (!Array.isArray(arr)) {
|
||||
for (let i = arr.length - 1; i >= 0; i--) {
|
||||
delete arr[i];
|
||||
}
|
||||
}
|
||||
arr.length = 0;
|
||||
}
|
||||
exports.clear = clear;
|
||||
function insert(arr, obj) {
|
||||
if (!contains(arr, obj)) {
|
||||
arr.push(obj);
|
||||
}
|
||||
}
|
||||
exports.insert = insert;
|
||||
function insertAt(arr, obj, opt_i) {
|
||||
splice(arr, opt_i, 0, obj);
|
||||
}
|
||||
exports.insertAt = insertAt;
|
||||
function insertArrayAt(arr, elementsToAdd, opt_i) {
|
||||
goog.partial(splice, arr, opt_i, 0).apply(null, elementsToAdd);
|
||||
}
|
||||
exports.insertArrayAt = insertArrayAt;
|
||||
function insertBefore(arr, obj, opt_obj2) {
|
||||
let i;
|
||||
if (arguments.length == 2 || (i = indexOf(arr, opt_obj2)) < 0) {
|
||||
arr.push(obj);
|
||||
} else {
|
||||
insertAt(arr, obj, i);
|
||||
}
|
||||
}
|
||||
exports.insertBefore = insertBefore;
|
||||
function remove(arr, obj) {
|
||||
const i = indexOf(arr, obj);
|
||||
let rv;
|
||||
if (rv = i >= 0) {
|
||||
removeAt(arr, i);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
exports.remove = remove;
|
||||
function removeLast(arr, obj) {
|
||||
const i = lastIndexOf(arr, obj);
|
||||
if (i >= 0) {
|
||||
removeAt(arr, i);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.removeLast = removeLast;
|
||||
function removeAt(arr, i) {
|
||||
asserts.assert(arr.length != null);
|
||||
return Array.prototype.splice.call(arr, i, 1).length == 1;
|
||||
}
|
||||
exports.removeAt = removeAt;
|
||||
function removeIf(arr, f, opt_obj) {
|
||||
const i = findIndex(arr, f, opt_obj);
|
||||
if (i >= 0) {
|
||||
removeAt(arr, i);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.removeIf = removeIf;
|
||||
function removeAllIf(arr, f, opt_obj) {
|
||||
let removedCount = 0;
|
||||
forEachRight(arr, function(val, index) {
|
||||
if (f.call(opt_obj, val, index, arr)) {
|
||||
if (removeAt(arr, index)) {
|
||||
removedCount++;
|
||||
}
|
||||
}
|
||||
});
|
||||
return removedCount;
|
||||
}
|
||||
exports.removeAllIf = removeAllIf;
|
||||
function concat(var_args) {
|
||||
return Array.prototype.concat.apply([], arguments);
|
||||
}
|
||||
exports.concat = concat;
|
||||
function join(var_args) {
|
||||
return Array.prototype.concat.apply([], arguments);
|
||||
}
|
||||
exports.join = join;
|
||||
function toArray(object) {
|
||||
const length = object.length;
|
||||
if (length > 0) {
|
||||
const rv = new Array(length);
|
||||
for (let i = 0; i < length; i++) {
|
||||
rv[i] = object[i];
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
exports.toArray = toArray;
|
||||
const clone = toArray;
|
||||
exports.clone = clone;
|
||||
function extend(arr1, var_args) {
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
const arr2 = arguments[i];
|
||||
if (goog.isArrayLike(arr2)) {
|
||||
const len1 = arr1.length || 0;
|
||||
const len2 = arr2.length || 0;
|
||||
arr1.length = len1 + len2;
|
||||
for (let j = 0; j < len2; j++) {
|
||||
arr1[len1 + j] = arr2[j];
|
||||
}
|
||||
} else {
|
||||
arr1.push(arr2);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.extend = extend;
|
||||
function splice(arr, index, howMany, var_args) {
|
||||
asserts.assert(arr.length != null);
|
||||
return Array.prototype.splice.apply(arr, slice(arguments, 1));
|
||||
}
|
||||
exports.splice = splice;
|
||||
function slice(arr, start, opt_end) {
|
||||
asserts.assert(arr.length != null);
|
||||
if (arguments.length <= 2) {
|
||||
return Array.prototype.slice.call(arr, start);
|
||||
} else {
|
||||
return Array.prototype.slice.call(arr, start, opt_end);
|
||||
}
|
||||
}
|
||||
exports.slice = slice;
|
||||
function removeDuplicates(arr, opt_rv, opt_hashFn) {
|
||||
const returnArray = opt_rv || arr;
|
||||
const defaultHashFn = function(item) {
|
||||
return goog.isObject(item) ? "o" + goog.getUid(item) : (typeof item).charAt(0) + item;
|
||||
};
|
||||
const hashFn = opt_hashFn || defaultHashFn;
|
||||
let cursorInsert = 0;
|
||||
let cursorRead = 0;
|
||||
const seen = {};
|
||||
while (cursorRead < arr.length) {
|
||||
const current = arr[cursorRead++];
|
||||
const key = hashFn(current);
|
||||
if (!Object.prototype.hasOwnProperty.call(seen, key)) {
|
||||
seen[key] = true;
|
||||
returnArray[cursorInsert++] = current;
|
||||
}
|
||||
}
|
||||
returnArray.length = cursorInsert;
|
||||
}
|
||||
exports.removeDuplicates = removeDuplicates;
|
||||
function binarySearch(arr, target, opt_compareFn) {
|
||||
return binarySearch_(arr, opt_compareFn || defaultCompare, false, target);
|
||||
}
|
||||
exports.binarySearch = binarySearch;
|
||||
function binarySelect(arr, evaluator, opt_obj) {
|
||||
return binarySearch_(arr, evaluator, true, undefined, opt_obj);
|
||||
}
|
||||
exports.binarySelect = binarySelect;
|
||||
function binarySearch_(arr, compareFn, isEvaluator, opt_target, opt_selfObj) {
|
||||
let left = 0;
|
||||
let right = arr.length;
|
||||
let found;
|
||||
while (left < right) {
|
||||
const middle = left + (right - left >>> 1);
|
||||
let compareResult;
|
||||
if (isEvaluator) {
|
||||
compareResult = compareFn.call(opt_selfObj, arr[middle], middle, arr);
|
||||
} else {
|
||||
compareResult = compareFn(opt_target, arr[middle]);
|
||||
}
|
||||
if (compareResult > 0) {
|
||||
left = middle + 1;
|
||||
} else {
|
||||
right = middle;
|
||||
found = !compareResult;
|
||||
}
|
||||
}
|
||||
return found ? left : -left - 1;
|
||||
}
|
||||
function sort(arr, opt_compareFn) {
|
||||
arr.sort(opt_compareFn || defaultCompare);
|
||||
}
|
||||
exports.sort = sort;
|
||||
function stableSort(arr, opt_compareFn) {
|
||||
const compArr = new Array(arr.length);
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
compArr[i] = {index:i, value:arr[i]};
|
||||
}
|
||||
const valueCompareFn = opt_compareFn || defaultCompare;
|
||||
function stableCompareFn(obj1, obj2) {
|
||||
return valueCompareFn(obj1.value, obj2.value) || obj1.index - obj2.index;
|
||||
}
|
||||
sort(compArr, stableCompareFn);
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
arr[i] = compArr[i].value;
|
||||
}
|
||||
}
|
||||
exports.stableSort = stableSort;
|
||||
function sortByKey(arr, keyFn, opt_compareFn) {
|
||||
const keyCompareFn = opt_compareFn || defaultCompare;
|
||||
sort(arr, function(a, b) {
|
||||
return keyCompareFn(keyFn(a), keyFn(b));
|
||||
});
|
||||
}
|
||||
exports.sortByKey = sortByKey;
|
||||
function sortObjectsByKey(arr, key, opt_compareFn) {
|
||||
sortByKey(arr, function(obj) {
|
||||
return obj[key];
|
||||
}, opt_compareFn);
|
||||
}
|
||||
exports.sortObjectsByKey = sortObjectsByKey;
|
||||
function isSorted(arr, opt_compareFn, opt_strict) {
|
||||
const compare = opt_compareFn || defaultCompare;
|
||||
for (let i = 1; i < arr.length; i++) {
|
||||
const compareResult = compare(arr[i - 1], arr[i]);
|
||||
if (compareResult > 0 || compareResult == 0 && opt_strict) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
exports.isSorted = isSorted;
|
||||
function equals(arr1, arr2, opt_equalsFn) {
|
||||
if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) || arr1.length != arr2.length) {
|
||||
return false;
|
||||
}
|
||||
const l = arr1.length;
|
||||
const equalsFn = opt_equalsFn || defaultCompareEquality;
|
||||
for (let i = 0; i < l; i++) {
|
||||
if (!equalsFn(arr1[i], arr2[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
exports.equals = equals;
|
||||
function compare3(arr1, arr2, opt_compareFn) {
|
||||
const compare = opt_compareFn || defaultCompare;
|
||||
const l = Math.min(arr1.length, arr2.length);
|
||||
for (let i = 0; i < l; i++) {
|
||||
const result = compare(arr1[i], arr2[i]);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return defaultCompare(arr1.length, arr2.length);
|
||||
}
|
||||
exports.compare3 = compare3;
|
||||
function defaultCompare(a, b) {
|
||||
return a > b ? 1 : a < b ? -1 : 0;
|
||||
}
|
||||
exports.defaultCompare = defaultCompare;
|
||||
function inverseDefaultCompare(a, b) {
|
||||
return -defaultCompare(a, b);
|
||||
}
|
||||
exports.inverseDefaultCompare = inverseDefaultCompare;
|
||||
function defaultCompareEquality(a, b) {
|
||||
return a === b;
|
||||
}
|
||||
exports.defaultCompareEquality = defaultCompareEquality;
|
||||
function binaryInsert(array, value, opt_compareFn) {
|
||||
const index = binarySearch(array, value, opt_compareFn);
|
||||
if (index < 0) {
|
||||
insertAt(array, value, -(index + 1));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.binaryInsert = binaryInsert;
|
||||
function binaryRemove(array, value, opt_compareFn) {
|
||||
const index = binarySearch(array, value, opt_compareFn);
|
||||
return index >= 0 ? removeAt(array, index) : false;
|
||||
}
|
||||
exports.binaryRemove = binaryRemove;
|
||||
function bucket(array, sorter, opt_obj) {
|
||||
const buckets = {};
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
const value = array[i];
|
||||
const key = sorter.call(opt_obj, value, i, array);
|
||||
if (key !== undefined) {
|
||||
const bucket = buckets[key] || (buckets[key] = []);
|
||||
bucket.push(value);
|
||||
}
|
||||
}
|
||||
return buckets;
|
||||
}
|
||||
exports.bucket = bucket;
|
||||
function bucketToMap(array, sorter) {
|
||||
const buckets = new Map();
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
const value = array[i];
|
||||
const key = sorter(value, i, array);
|
||||
if (key !== undefined) {
|
||||
let bucket = buckets.get(key);
|
||||
if (!bucket) {
|
||||
bucket = [];
|
||||
buckets.set(key, bucket);
|
||||
}
|
||||
bucket.push(value);
|
||||
}
|
||||
}
|
||||
return buckets;
|
||||
}
|
||||
exports.bucketToMap = bucketToMap;
|
||||
function toObject(arr, keyFunc, opt_obj) {
|
||||
const ret = {};
|
||||
forEach(arr, function(element, index) {
|
||||
ret[keyFunc.call(opt_obj, element, index, arr)] = element;
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
exports.toObject = toObject;
|
||||
function toMap(arr, keyFunc) {
|
||||
const map = new Map();
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const element = arr[i];
|
||||
map.set(keyFunc(element, i, arr), element);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
exports.toMap = toMap;
|
||||
function range(startOrEnd, opt_end, opt_step) {
|
||||
const array = [];
|
||||
let start = 0;
|
||||
let end = startOrEnd;
|
||||
const step = opt_step || 1;
|
||||
if (opt_end !== undefined) {
|
||||
start = startOrEnd;
|
||||
end = opt_end;
|
||||
}
|
||||
if (step * (end - start) < 0) {
|
||||
return [];
|
||||
}
|
||||
if (step > 0) {
|
||||
for (let i = start; i < end; i += step) {
|
||||
array.push(i);
|
||||
}
|
||||
} else {
|
||||
for (let i = start; i > end; i += step) {
|
||||
array.push(i);
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
exports.range = range;
|
||||
function repeat(value, n) {
|
||||
const array = [];
|
||||
for (let i = 0; i < n; i++) {
|
||||
array[i] = value;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
exports.repeat = repeat;
|
||||
function flatten(var_args) {
|
||||
const CHUNK_SIZE = 8192;
|
||||
const result = [];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
const element = arguments[i];
|
||||
if (Array.isArray(element)) {
|
||||
for (let c = 0; c < element.length; c += CHUNK_SIZE) {
|
||||
const chunk = slice(element, c, c + CHUNK_SIZE);
|
||||
const recurseResult = flatten.apply(null, chunk);
|
||||
for (let r = 0; r < recurseResult.length; r++) {
|
||||
result.push(recurseResult[r]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result.push(element);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.flatten = flatten;
|
||||
function rotate(array, n) {
|
||||
asserts.assert(array.length != null);
|
||||
if (array.length) {
|
||||
n %= array.length;
|
||||
if (n > 0) {
|
||||
Array.prototype.unshift.apply(array, array.splice(-n, n));
|
||||
} else if (n < 0) {
|
||||
Array.prototype.push.apply(array, array.splice(0, -n));
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
exports.rotate = rotate;
|
||||
function moveItem(arr, fromIndex, toIndex) {
|
||||
asserts.assert(fromIndex >= 0 && fromIndex < arr.length);
|
||||
asserts.assert(toIndex >= 0 && toIndex < arr.length);
|
||||
const removedItems = Array.prototype.splice.call(arr, fromIndex, 1);
|
||||
Array.prototype.splice.call(arr, toIndex, 0, removedItems[0]);
|
||||
}
|
||||
exports.moveItem = moveItem;
|
||||
function zip(var_args) {
|
||||
if (!arguments.length) {
|
||||
return [];
|
||||
}
|
||||
const result = [];
|
||||
let minLen = arguments[0].length;
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
if (arguments[i].length < minLen) {
|
||||
minLen = arguments[i].length;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < minLen; i++) {
|
||||
const value = [];
|
||||
for (let j = 0; j < arguments.length; j++) {
|
||||
value.push(arguments[j][i]);
|
||||
}
|
||||
result.push(value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.zip = zip;
|
||||
function shuffle(arr, opt_randFn) {
|
||||
const randFn = opt_randFn || Math.random;
|
||||
for (let i = arr.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(randFn() * (i + 1));
|
||||
const tmp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = tmp;
|
||||
}
|
||||
}
|
||||
exports.shuffle = shuffle;
|
||||
function copyByIndex(arr, index_arr) {
|
||||
const result = [];
|
||||
forEach(index_arr, function(index) {
|
||||
result.push(arr[index]);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
exports.copyByIndex = copyByIndex;
|
||||
function concatMap(arr, f, opt_obj) {
|
||||
return concat.apply([], map(arr, f, opt_obj));
|
||||
}
|
||||
exports.concatMap = concatMap;
|
||||
return exports;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=goog.array.array.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,130 +0,0 @@
|
|||
goog.loadModule(function(exports) {
|
||||
"use strict";
|
||||
goog.module("goog.asserts");
|
||||
goog.module.declareLegacyNamespace();
|
||||
const DebugError = goog.require("goog.debug.Error");
|
||||
const NodeType = goog.require("goog.dom.NodeType");
|
||||
exports.ENABLE_ASSERTS = goog.define("goog.asserts.ENABLE_ASSERTS", goog.DEBUG);
|
||||
function AssertionError(messagePattern, messageArgs) {
|
||||
DebugError.call(this, subs(messagePattern, messageArgs));
|
||||
this.messagePattern = messagePattern;
|
||||
}
|
||||
goog.inherits(AssertionError, DebugError);
|
||||
exports.AssertionError = AssertionError;
|
||||
AssertionError.prototype.name = "AssertionError";
|
||||
exports.DEFAULT_ERROR_HANDLER = function(e) {
|
||||
throw e;
|
||||
};
|
||||
let errorHandler_ = exports.DEFAULT_ERROR_HANDLER;
|
||||
function subs(pattern, subs) {
|
||||
const splitParts = pattern.split("%s");
|
||||
let returnString = "";
|
||||
const subLast = splitParts.length - 1;
|
||||
for (let i = 0; i < subLast; i++) {
|
||||
const sub = i < subs.length ? subs[i] : "%s";
|
||||
returnString += splitParts[i] + sub;
|
||||
}
|
||||
return returnString + splitParts[subLast];
|
||||
}
|
||||
function doAssertFailure(defaultMessage, defaultArgs, givenMessage, givenArgs) {
|
||||
let message = "Assertion failed";
|
||||
let args;
|
||||
if (givenMessage) {
|
||||
message += ": " + givenMessage;
|
||||
args = givenArgs;
|
||||
} else if (defaultMessage) {
|
||||
message += ": " + defaultMessage;
|
||||
args = defaultArgs;
|
||||
}
|
||||
const e = new AssertionError("" + message, args || []);
|
||||
errorHandler_(e);
|
||||
}
|
||||
exports.setErrorHandler = function(errorHandler) {
|
||||
if (exports.ENABLE_ASSERTS) {
|
||||
errorHandler_ = errorHandler;
|
||||
}
|
||||
};
|
||||
exports.assert = function(condition, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && !condition) {
|
||||
doAssertFailure("", null, opt_message, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
return condition;
|
||||
};
|
||||
exports.assertExists = function(value, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && value == null) {
|
||||
doAssertFailure("Expected to exist: %s.", [value], opt_message, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
return value;
|
||||
};
|
||||
exports.fail = function(opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS) {
|
||||
errorHandler_(new AssertionError("Failure" + (opt_message ? ": " + opt_message : ""), Array.prototype.slice.call(arguments, 1)));
|
||||
}
|
||||
};
|
||||
exports.assertNumber = function(value, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && typeof value !== "number") {
|
||||
doAssertFailure("Expected number but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
return value;
|
||||
};
|
||||
exports.assertString = function(value, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && typeof value !== "string") {
|
||||
doAssertFailure("Expected string but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
return value;
|
||||
};
|
||||
exports.assertFunction = function(value, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && typeof value !== "function") {
|
||||
doAssertFailure("Expected function but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
return value;
|
||||
};
|
||||
exports.assertObject = function(value, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && !goog.isObject(value)) {
|
||||
doAssertFailure("Expected object but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
return value;
|
||||
};
|
||||
exports.assertArray = function(value, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && !Array.isArray(value)) {
|
||||
doAssertFailure("Expected array but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
return value;
|
||||
};
|
||||
exports.assertBoolean = function(value, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && typeof value !== "boolean") {
|
||||
doAssertFailure("Expected boolean but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
return value;
|
||||
};
|
||||
exports.assertElement = function(value, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && (!goog.isObject(value) || value.nodeType != NodeType.ELEMENT)) {
|
||||
doAssertFailure("Expected Element but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
return value;
|
||||
};
|
||||
exports.assertInstanceof = function(value, type, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && !(value instanceof type)) {
|
||||
doAssertFailure("Expected instanceof %s but got %s.", [getType(type), getType(value)], opt_message, Array.prototype.slice.call(arguments, 3));
|
||||
}
|
||||
return value;
|
||||
};
|
||||
exports.assertFinite = function(value, opt_message, var_args) {
|
||||
if (exports.ENABLE_ASSERTS && (typeof value != "number" || !isFinite(value))) {
|
||||
doAssertFailure("Expected %s to be a finite number but it is not.", [value], opt_message, Array.prototype.slice.call(arguments, 2));
|
||||
}
|
||||
return value;
|
||||
};
|
||||
function getType(value) {
|
||||
if (value instanceof Function) {
|
||||
return value.displayName || value.name || "unknown type name";
|
||||
} else if (value instanceof Object) {
|
||||
return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
|
||||
} else {
|
||||
return value === null ? "null" : typeof value;
|
||||
}
|
||||
}
|
||||
return exports;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=goog.asserts.asserts.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,86 +0,0 @@
|
|||
goog.loadModule(function(exports) {
|
||||
"use strict";
|
||||
goog.module("goog.asserts.dom");
|
||||
goog.module.declareLegacyNamespace();
|
||||
const TagName = goog.require("goog.dom.TagName");
|
||||
const asserts = goog.require("goog.asserts");
|
||||
const element = goog.require("goog.dom.element");
|
||||
const assertIsElement = value => {
|
||||
if (asserts.ENABLE_ASSERTS && !element.isElement(value)) {
|
||||
asserts.fail(`Argument is not an Element; got: ${debugStringForType(value)}`);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
const assertIsHtmlElement = value => {
|
||||
if (asserts.ENABLE_ASSERTS && !element.isHtmlElement(value)) {
|
||||
asserts.fail(`Argument is not an HTML Element; got: ${debugStringForType(value)}`);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
const assertIsHtmlElementOfType = (value, tagName) => {
|
||||
if (asserts.ENABLE_ASSERTS && !element.isHtmlElementOfType(value, tagName)) {
|
||||
asserts.fail(`Argument is not an HTML Element with tag name ` + `${tagName.toString()}; got: ${debugStringForType(value)}`);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
const assertIsHtmlAnchorElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.A);
|
||||
};
|
||||
const assertIsHtmlButtonElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.BUTTON);
|
||||
};
|
||||
const assertIsHtmlLinkElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.LINK);
|
||||
};
|
||||
const assertIsHtmlImageElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.IMG);
|
||||
};
|
||||
const assertIsHtmlAudioElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.AUDIO);
|
||||
};
|
||||
const assertIsHtmlVideoElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.VIDEO);
|
||||
};
|
||||
const assertIsHtmlInputElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.INPUT);
|
||||
};
|
||||
const assertIsHtmlTextAreaElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.TEXTAREA);
|
||||
};
|
||||
const assertIsHtmlCanvasElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.CANVAS);
|
||||
};
|
||||
const assertIsHtmlEmbedElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.EMBED);
|
||||
};
|
||||
const assertIsHtmlFormElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.FORM);
|
||||
};
|
||||
const assertIsHtmlFrameElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.FRAME);
|
||||
};
|
||||
const assertIsHtmlIFrameElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.IFRAME);
|
||||
};
|
||||
const assertIsHtmlObjectElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.OBJECT);
|
||||
};
|
||||
const assertIsHtmlScriptElement = value => {
|
||||
return assertIsHtmlElementOfType(value, TagName.SCRIPT);
|
||||
};
|
||||
const debugStringForType = value => {
|
||||
if (goog.isObject(value)) {
|
||||
try {
|
||||
return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
|
||||
} catch (e) {
|
||||
return "\x3cobject could not be stringified\x3e";
|
||||
}
|
||||
} else {
|
||||
return value === undefined ? "undefined" : value === null ? "null" : typeof value;
|
||||
}
|
||||
};
|
||||
exports = {assertIsElement, assertIsHtmlElement, assertIsHtmlElementOfType, assertIsHtmlAnchorElement, assertIsHtmlButtonElement, assertIsHtmlLinkElement, assertIsHtmlImageElement, assertIsHtmlAudioElement, assertIsHtmlVideoElement, assertIsHtmlInputElement, assertIsHtmlTextAreaElement, assertIsHtmlCanvasElement, assertIsHtmlEmbedElement, assertIsHtmlFormElement, assertIsHtmlFrameElement, assertIsHtmlIFrameElement, assertIsHtmlObjectElement, assertIsHtmlScriptElement,};
|
||||
return exports;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=goog.asserts.dom.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,86 +0,0 @@
|
|||
goog.provide("goog.async.nextTick");
|
||||
goog.require("goog.debug.entryPointRegistry");
|
||||
goog.require("goog.dom");
|
||||
goog.require("goog.dom.TagName");
|
||||
goog.require("goog.functions");
|
||||
goog.require("goog.labs.userAgent.browser");
|
||||
goog.require("goog.labs.userAgent.engine");
|
||||
goog.async.nextTick = function(callback, opt_context, opt_useSetImmediate) {
|
||||
var cb = callback;
|
||||
if (opt_context) {
|
||||
cb = goog.bind(callback, opt_context);
|
||||
}
|
||||
cb = goog.async.nextTick.wrapCallback_(cb);
|
||||
if (typeof goog.global.setImmediate === "function" && (opt_useSetImmediate || goog.async.nextTick.useSetImmediate_())) {
|
||||
goog.global.setImmediate(cb);
|
||||
return;
|
||||
}
|
||||
if (!goog.async.nextTick.nextTickImpl) {
|
||||
goog.async.nextTick.nextTickImpl = goog.async.nextTick.getNextTickImpl_();
|
||||
}
|
||||
goog.async.nextTick.nextTickImpl(cb);
|
||||
};
|
||||
goog.async.nextTick.useSetImmediate_ = function() {
|
||||
if (!goog.global.Window || !goog.global.Window.prototype) {
|
||||
return true;
|
||||
}
|
||||
if (goog.labs.userAgent.browser.isEdge() || goog.global.Window.prototype.setImmediate != goog.global.setImmediate) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
goog.async.nextTick.nextTickImpl;
|
||||
goog.async.nextTick.getNextTickImpl_ = function() {
|
||||
var Channel = goog.global["MessageChannel"];
|
||||
if (typeof Channel === "undefined" && typeof window !== "undefined" && window.postMessage && window.addEventListener && !goog.labs.userAgent.engine.isPresto()) {
|
||||
Channel = function() {
|
||||
var iframe = goog.dom.createElement(goog.dom.TagName.IFRAME);
|
||||
iframe.style.display = "none";
|
||||
document.documentElement.appendChild(iframe);
|
||||
var win = iframe.contentWindow;
|
||||
var doc = win.document;
|
||||
doc.open();
|
||||
doc.close();
|
||||
var message = "callImmediate" + Math.random();
|
||||
var origin = win.location.protocol == "file:" ? "*" : win.location.protocol + "//" + win.location.host;
|
||||
var onmessage = goog.bind(function(e) {
|
||||
if (origin != "*" && e.origin != origin || e.data != message) {
|
||||
return;
|
||||
}
|
||||
this["port1"].onmessage();
|
||||
}, this);
|
||||
win.addEventListener("message", onmessage, false);
|
||||
this["port1"] = {};
|
||||
this["port2"] = {postMessage:function() {
|
||||
win.postMessage(message, origin);
|
||||
}};
|
||||
};
|
||||
}
|
||||
if (typeof Channel !== "undefined" && !goog.labs.userAgent.browser.isIE()) {
|
||||
var channel = new Channel();
|
||||
var head = {};
|
||||
var tail = head;
|
||||
channel["port1"].onmessage = function() {
|
||||
if (head.next !== undefined) {
|
||||
head = head.next;
|
||||
var cb = head.cb;
|
||||
head.cb = null;
|
||||
cb();
|
||||
}
|
||||
};
|
||||
return function(cb) {
|
||||
tail.next = {cb:cb};
|
||||
tail = tail.next;
|
||||
channel["port2"].postMessage(0);
|
||||
};
|
||||
}
|
||||
return function(cb) {
|
||||
goog.global.setTimeout(cb, 0);
|
||||
};
|
||||
};
|
||||
goog.async.nextTick.wrapCallback_ = goog.functions.identity;
|
||||
goog.debug.entryPointRegistry.register(function(transformer) {
|
||||
goog.async.nextTick.wrapCallback_ = transformer;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=goog.async.nexttick.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -1,86 +0,0 @@
|
|||
goog.loadModule(function(exports) {
|
||||
"use strict";
|
||||
goog.module("goog.collections.iters");
|
||||
goog.module.declareLegacyNamespace();
|
||||
function getIterator(iterable) {
|
||||
return iterable[goog.global.Symbol.iterator]();
|
||||
}
|
||||
exports.getIterator = getIterator;
|
||||
function forEach(iterator, f) {
|
||||
let result;
|
||||
while (!(result = iterator.next()).done) {
|
||||
f(result.value);
|
||||
}
|
||||
}
|
||||
exports.forEach = forEach;
|
||||
class MapIterator {
|
||||
constructor(childIter, mapFn) {
|
||||
this.childIterator_ = getIterator(childIter);
|
||||
this.mapFn_ = mapFn;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return this;
|
||||
}
|
||||
next() {
|
||||
const childResult = this.childIterator_.next();
|
||||
return {value:childResult.done ? undefined : this.mapFn_.call(undefined, childResult.value), done:childResult.done,};
|
||||
}
|
||||
}
|
||||
exports.map = function(iterable, f) {
|
||||
return new MapIterator(iterable, f);
|
||||
};
|
||||
class FilterIterator {
|
||||
constructor(childIter, filterFn) {
|
||||
this.childIter_ = getIterator(childIter);
|
||||
this.filterFn_ = filterFn;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return this;
|
||||
}
|
||||
next() {
|
||||
while (true) {
|
||||
const childResult = this.childIter_.next();
|
||||
if (childResult.done) {
|
||||
return {done:true, value:undefined};
|
||||
}
|
||||
const passesFilter = this.filterFn_.call(undefined, childResult.value);
|
||||
if (passesFilter) {
|
||||
return childResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.filter = function(iterable, f) {
|
||||
return new FilterIterator(iterable, f);
|
||||
};
|
||||
class ConcatIterator {
|
||||
constructor(iterators) {
|
||||
this.iterators_ = iterators;
|
||||
this.iterIndex_ = 0;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return this;
|
||||
}
|
||||
next() {
|
||||
while (this.iterIndex_ < this.iterators_.length) {
|
||||
const result = this.iterators_[this.iterIndex_].next();
|
||||
if (!result.done) {
|
||||
return result;
|
||||
}
|
||||
this.iterIndex_++;
|
||||
}
|
||||
return {done:true};
|
||||
}
|
||||
}
|
||||
exports.concat = function(...iterables) {
|
||||
return new ConcatIterator(iterables.map(getIterator));
|
||||
};
|
||||
exports.toArray = function(iterator) {
|
||||
const arr = [];
|
||||
forEach(iterator, e => arr.push(e));
|
||||
return arr;
|
||||
};
|
||||
return exports;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=goog.collections.iters.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,78 +0,0 @@
|
|||
goog.loadModule(function(exports) {
|
||||
"use strict";
|
||||
goog.module("goog.collections.maps");
|
||||
goog.module.declareLegacyNamespace();
|
||||
class MapLike {
|
||||
constructor() {
|
||||
this.size;
|
||||
}
|
||||
set(key, val) {
|
||||
}
|
||||
get(key) {
|
||||
}
|
||||
keys() {
|
||||
}
|
||||
values() {
|
||||
}
|
||||
has(key) {
|
||||
}
|
||||
}
|
||||
exports.MapLike = MapLike;
|
||||
function setAll(map, entries) {
|
||||
if (!entries) {
|
||||
return;
|
||||
}
|
||||
for (const [k, v] of entries) {
|
||||
map.set(k, v);
|
||||
}
|
||||
}
|
||||
exports.setAll = setAll;
|
||||
function hasValue(map, val, valueEqualityFn = defaultEqualityFn) {
|
||||
for (const v of map.values()) {
|
||||
if (valueEqualityFn(v, val)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.hasValue = hasValue;
|
||||
const defaultEqualityFn = (a, b) => a === b;
|
||||
function equals(map, otherMap, valueEqualityFn = defaultEqualityFn) {
|
||||
if (map === otherMap) {
|
||||
return true;
|
||||
}
|
||||
if (map.size !== otherMap.size) {
|
||||
return false;
|
||||
}
|
||||
for (const key of map.keys()) {
|
||||
if (!otherMap.has(key)) {
|
||||
return false;
|
||||
}
|
||||
if (!valueEqualityFn(map.get(key), otherMap.get(key))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
exports.equals = equals;
|
||||
function transpose(map) {
|
||||
const transposed = new Map();
|
||||
for (const key of map.keys()) {
|
||||
const val = map.get(key);
|
||||
transposed.set(val, key);
|
||||
}
|
||||
return transposed;
|
||||
}
|
||||
exports.transpose = transpose;
|
||||
function toObject(map) {
|
||||
const obj = {};
|
||||
for (const key of map.keys()) {
|
||||
obj[key] = map.get(key);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
exports.toObject = toObject;
|
||||
return exports;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=goog.collections.maps.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,360 +0,0 @@
|
|||
goog.provide("goog.debug");
|
||||
goog.require("goog.array");
|
||||
goog.require("goog.debug.errorcontext");
|
||||
goog.debug.LOGGING_ENABLED = goog.define("goog.debug.LOGGING_ENABLED", goog.DEBUG);
|
||||
goog.debug.FORCE_SLOPPY_STACKS = goog.define("goog.debug.FORCE_SLOPPY_STACKS", false);
|
||||
goog.debug.CHECK_FOR_THROWN_EVENT = goog.define("goog.debug.CHECK_FOR_THROWN_EVENT", false);
|
||||
goog.debug.catchErrors = function(logFunc, opt_cancel, opt_target) {
|
||||
var target = opt_target || goog.global;
|
||||
var oldErrorHandler = target.onerror;
|
||||
var retVal = !!opt_cancel;
|
||||
target.onerror = function(message, url, line, opt_col, opt_error) {
|
||||
if (oldErrorHandler) {
|
||||
oldErrorHandler(message, url, line, opt_col, opt_error);
|
||||
}
|
||||
logFunc({message:message, fileName:url, line:line, lineNumber:line, col:opt_col, error:opt_error});
|
||||
return retVal;
|
||||
};
|
||||
};
|
||||
goog.debug.expose = function(obj, opt_showFn) {
|
||||
if (typeof obj == "undefined") {
|
||||
return "undefined";
|
||||
}
|
||||
if (obj == null) {
|
||||
return "NULL";
|
||||
}
|
||||
var str = [];
|
||||
for (var x in obj) {
|
||||
if (!opt_showFn && typeof obj[x] === "function") {
|
||||
continue;
|
||||
}
|
||||
var s = x + " \x3d ";
|
||||
try {
|
||||
s += obj[x];
|
||||
} catch (e) {
|
||||
s += "*** " + e + " ***";
|
||||
}
|
||||
str.push(s);
|
||||
}
|
||||
return str.join("\n");
|
||||
};
|
||||
goog.debug.deepExpose = function(obj, opt_showFn) {
|
||||
var str = [];
|
||||
var uidsToCleanup = [];
|
||||
var ancestorUids = {};
|
||||
var helper = function(obj, space) {
|
||||
var nestspace = space + " ";
|
||||
var indentMultiline = function(str) {
|
||||
return str.replace(/\n/g, "\n" + space);
|
||||
};
|
||||
try {
|
||||
if (obj === undefined) {
|
||||
str.push("undefined");
|
||||
} else if (obj === null) {
|
||||
str.push("NULL");
|
||||
} else if (typeof obj === "string") {
|
||||
str.push('"' + indentMultiline(obj) + '"');
|
||||
} else if (typeof obj === "function") {
|
||||
str.push(indentMultiline(String(obj)));
|
||||
} else if (goog.isObject(obj)) {
|
||||
if (!goog.hasUid(obj)) {
|
||||
uidsToCleanup.push(obj);
|
||||
}
|
||||
var uid = goog.getUid(obj);
|
||||
if (ancestorUids[uid]) {
|
||||
str.push("*** reference loop detected (id\x3d" + uid + ") ***");
|
||||
} else {
|
||||
ancestorUids[uid] = true;
|
||||
str.push("{");
|
||||
for (var x in obj) {
|
||||
if (!opt_showFn && typeof obj[x] === "function") {
|
||||
continue;
|
||||
}
|
||||
str.push("\n");
|
||||
str.push(nestspace);
|
||||
str.push(x + " \x3d ");
|
||||
helper(obj[x], nestspace);
|
||||
}
|
||||
str.push("\n" + space + "}");
|
||||
delete ancestorUids[uid];
|
||||
}
|
||||
} else {
|
||||
str.push(obj);
|
||||
}
|
||||
} catch (e) {
|
||||
str.push("*** " + e + " ***");
|
||||
}
|
||||
};
|
||||
helper(obj, "");
|
||||
for (var i = 0; i < uidsToCleanup.length; i++) {
|
||||
goog.removeUid(uidsToCleanup[i]);
|
||||
}
|
||||
return str.join("");
|
||||
};
|
||||
goog.debug.exposeArray = function(arr) {
|
||||
var str = [];
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (Array.isArray(arr[i])) {
|
||||
str.push(goog.debug.exposeArray(arr[i]));
|
||||
} else {
|
||||
str.push(arr[i]);
|
||||
}
|
||||
}
|
||||
return "[ " + str.join(", ") + " ]";
|
||||
};
|
||||
goog.debug.normalizeErrorObject = function(err) {
|
||||
var href = goog.getObjectByName("window.location.href");
|
||||
if (err == null) {
|
||||
err = 'Unknown Error of type "null/undefined"';
|
||||
}
|
||||
if (typeof err === "string") {
|
||||
return {"message":err, "name":"Unknown error", "lineNumber":"Not available", "fileName":href, "stack":"Not available"};
|
||||
}
|
||||
var lineNumber, fileName;
|
||||
var threwError = false;
|
||||
try {
|
||||
lineNumber = err.lineNumber || err.line || "Not available";
|
||||
} catch (e) {
|
||||
lineNumber = "Not available";
|
||||
threwError = true;
|
||||
}
|
||||
try {
|
||||
fileName = err.fileName || err.filename || err.sourceURL || goog.global["$googDebugFname"] || href;
|
||||
} catch (e) {
|
||||
fileName = "Not available";
|
||||
threwError = true;
|
||||
}
|
||||
var stack = goog.debug.serializeErrorStack_(err);
|
||||
if (threwError || !err.lineNumber || !err.fileName || !err.stack || !err.message || !err.name) {
|
||||
var message = err.message;
|
||||
if (message == null) {
|
||||
if (err.constructor && err.constructor instanceof Function) {
|
||||
var ctorName = err.constructor.name ? err.constructor.name : goog.debug.getFunctionName(err.constructor);
|
||||
message = 'Unknown Error of type "' + ctorName + '"';
|
||||
if (goog.debug.CHECK_FOR_THROWN_EVENT && ctorName == "Event") {
|
||||
try {
|
||||
message = message + ' with Event.type "' + (err.type || "") + '"';
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message = "Unknown Error of unknown type";
|
||||
}
|
||||
if (typeof err.toString === "function" && Object.prototype.toString !== err.toString) {
|
||||
message += ": " + err.toString();
|
||||
}
|
||||
}
|
||||
return {"message":message, "name":err.name || "UnknownError", "lineNumber":lineNumber, "fileName":fileName, "stack":stack || "Not available"};
|
||||
}
|
||||
err.stack = stack;
|
||||
return {"message":err.message, "name":err.name, "lineNumber":err.lineNumber, "fileName":err.fileName, "stack":err.stack};
|
||||
};
|
||||
goog.debug.serializeErrorStack_ = function(e, seen) {
|
||||
if (!seen) {
|
||||
seen = {};
|
||||
}
|
||||
seen[goog.debug.serializeErrorAsKey_(e)] = true;
|
||||
var stack = e["stack"] || "";
|
||||
var cause = e.cause;
|
||||
if (cause && !seen[goog.debug.serializeErrorAsKey_(cause)]) {
|
||||
stack += "\nCaused by: ";
|
||||
if (!cause.stack || cause.stack.indexOf(cause.toString()) != 0) {
|
||||
stack += typeof cause === "string" ? cause : cause.message + "\n";
|
||||
}
|
||||
stack += goog.debug.serializeErrorStack_(cause, seen);
|
||||
}
|
||||
return stack;
|
||||
};
|
||||
goog.debug.serializeErrorAsKey_ = function(e) {
|
||||
var keyPrefix = "";
|
||||
if (typeof e.toString === "function") {
|
||||
keyPrefix = "" + e;
|
||||
}
|
||||
return keyPrefix + e["stack"];
|
||||
};
|
||||
goog.debug.enhanceError = function(err, opt_message) {
|
||||
var error;
|
||||
if (!(err instanceof Error)) {
|
||||
error = Error(err);
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(error, goog.debug.enhanceError);
|
||||
}
|
||||
} else {
|
||||
error = err;
|
||||
}
|
||||
if (!error.stack) {
|
||||
error.stack = goog.debug.getStacktrace(goog.debug.enhanceError);
|
||||
}
|
||||
if (opt_message) {
|
||||
var x = 0;
|
||||
while (error["message" + x]) {
|
||||
++x;
|
||||
}
|
||||
error["message" + x] = String(opt_message);
|
||||
}
|
||||
return error;
|
||||
};
|
||||
goog.debug.enhanceErrorWithContext = function(err, opt_context) {
|
||||
var error = goog.debug.enhanceError(err);
|
||||
if (opt_context) {
|
||||
for (var key in opt_context) {
|
||||
goog.debug.errorcontext.addErrorContext(error, key, opt_context[key]);
|
||||
}
|
||||
}
|
||||
return error;
|
||||
};
|
||||
goog.debug.getStacktraceSimple = function(opt_depth) {
|
||||
if (!goog.debug.FORCE_SLOPPY_STACKS) {
|
||||
var stack = goog.debug.getNativeStackTrace_(goog.debug.getStacktraceSimple);
|
||||
if (stack) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
var sb = [];
|
||||
var fn = arguments.callee.caller;
|
||||
var depth = 0;
|
||||
while (fn && (!opt_depth || depth < opt_depth)) {
|
||||
sb.push(goog.debug.getFunctionName(fn));
|
||||
sb.push("()\n");
|
||||
try {
|
||||
fn = fn.caller;
|
||||
} catch (e) {
|
||||
sb.push("[exception trying to get caller]\n");
|
||||
break;
|
||||
}
|
||||
depth++;
|
||||
if (depth >= goog.debug.MAX_STACK_DEPTH) {
|
||||
sb.push("[...long stack...]");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (opt_depth && depth >= opt_depth) {
|
||||
sb.push("[...reached max depth limit...]");
|
||||
} else {
|
||||
sb.push("[end]");
|
||||
}
|
||||
return sb.join("");
|
||||
};
|
||||
goog.debug.MAX_STACK_DEPTH = 50;
|
||||
goog.debug.getNativeStackTrace_ = function(fn) {
|
||||
var tempErr = new Error();
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(tempErr, fn);
|
||||
return String(tempErr.stack);
|
||||
} else {
|
||||
try {
|
||||
throw tempErr;
|
||||
} catch (e) {
|
||||
tempErr = e;
|
||||
}
|
||||
var stack = tempErr.stack;
|
||||
if (stack) {
|
||||
return String(stack);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
goog.debug.getStacktrace = function(fn) {
|
||||
var stack;
|
||||
if (!goog.debug.FORCE_SLOPPY_STACKS) {
|
||||
var contextFn = fn || goog.debug.getStacktrace;
|
||||
stack = goog.debug.getNativeStackTrace_(contextFn);
|
||||
}
|
||||
if (!stack) {
|
||||
stack = goog.debug.getStacktraceHelper_(fn || arguments.callee.caller, []);
|
||||
}
|
||||
return stack;
|
||||
};
|
||||
goog.debug.getStacktraceHelper_ = function(fn, visited) {
|
||||
var sb = [];
|
||||
if (goog.array.contains(visited, fn)) {
|
||||
sb.push("[...circular reference...]");
|
||||
} else if (fn && visited.length < goog.debug.MAX_STACK_DEPTH) {
|
||||
sb.push(goog.debug.getFunctionName(fn) + "(");
|
||||
var args = fn.arguments;
|
||||
for (var i = 0; args && i < args.length; i++) {
|
||||
if (i > 0) {
|
||||
sb.push(", ");
|
||||
}
|
||||
var argDesc;
|
||||
var arg = args[i];
|
||||
switch(typeof arg) {
|
||||
case "object":
|
||||
argDesc = arg ? "object" : "null";
|
||||
break;
|
||||
case "string":
|
||||
argDesc = arg;
|
||||
break;
|
||||
case "number":
|
||||
argDesc = String(arg);
|
||||
break;
|
||||
case "boolean":
|
||||
argDesc = arg ? "true" : "false";
|
||||
break;
|
||||
case "function":
|
||||
argDesc = goog.debug.getFunctionName(arg);
|
||||
argDesc = argDesc ? argDesc : "[fn]";
|
||||
break;
|
||||
case "undefined":
|
||||
default:
|
||||
argDesc = typeof arg;
|
||||
break;
|
||||
}
|
||||
if (argDesc.length > 40) {
|
||||
argDesc = argDesc.slice(0, 40) + "...";
|
||||
}
|
||||
sb.push(argDesc);
|
||||
}
|
||||
visited.push(fn);
|
||||
sb.push(")\n");
|
||||
try {
|
||||
sb.push(goog.debug.getStacktraceHelper_(fn.caller, visited));
|
||||
} catch (e) {
|
||||
sb.push("[exception trying to get caller]\n");
|
||||
}
|
||||
} else if (fn) {
|
||||
sb.push("[...long stack...]");
|
||||
} else {
|
||||
sb.push("[end]");
|
||||
}
|
||||
return sb.join("");
|
||||
};
|
||||
goog.debug.getFunctionName = function(fn) {
|
||||
if (goog.debug.fnNameCache_[fn]) {
|
||||
return goog.debug.fnNameCache_[fn];
|
||||
}
|
||||
var functionSource = String(fn);
|
||||
if (!goog.debug.fnNameCache_[functionSource]) {
|
||||
var matches = /function\s+([^\(]+)/m.exec(functionSource);
|
||||
if (matches) {
|
||||
var method = matches[1];
|
||||
goog.debug.fnNameCache_[functionSource] = method;
|
||||
} else {
|
||||
goog.debug.fnNameCache_[functionSource] = "[Anonymous]";
|
||||
}
|
||||
}
|
||||
return goog.debug.fnNameCache_[functionSource];
|
||||
};
|
||||
goog.debug.makeWhitespaceVisible = function(string) {
|
||||
return string.replace(/ /g, "[_]").replace(/\f/g, "[f]").replace(/\n/g, "[n]\n").replace(/\r/g, "[r]").replace(/\t/g, "[t]");
|
||||
};
|
||||
goog.debug.runtimeType = function(value) {
|
||||
if (value instanceof Function) {
|
||||
return value.displayName || value.name || "unknown type name";
|
||||
} else if (value instanceof Object) {
|
||||
return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
|
||||
} else {
|
||||
return value === null ? "null" : typeof value;
|
||||
}
|
||||
};
|
||||
goog.debug.fnNameCache_ = {};
|
||||
goog.debug.freezeInternal_ = goog.DEBUG && Object.freeze || function(arg) {
|
||||
return arg;
|
||||
};
|
||||
goog.debug.freeze = function(arg) {
|
||||
return {valueOf:function() {
|
||||
return goog.debug.freezeInternal_(arg);
|
||||
}}.valueOf();
|
||||
};
|
||||
|
||||
//# sourceMappingURL=goog.debug.debug.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,39 +0,0 @@
|
|||
goog.provide("goog.debug.EntryPointMonitor");
|
||||
goog.provide("goog.debug.entryPointRegistry");
|
||||
goog.require("goog.asserts");
|
||||
goog.debug.entryPointRegistry.EntryPointMonitor = function() {
|
||||
};
|
||||
goog.debug.entryPointRegistry.EntryPointMonitor.prototype.wrap;
|
||||
goog.debug.entryPointRegistry.EntryPointMonitor.prototype.unwrap;
|
||||
goog.debug.EntryPointMonitor = goog.debug.entryPointRegistry.EntryPointMonitor;
|
||||
goog.debug.entryPointRegistry.refList_ = [];
|
||||
goog.debug.entryPointRegistry.monitors_ = [];
|
||||
goog.debug.entryPointRegistry.monitorsMayExist_ = false;
|
||||
goog.debug.entryPointRegistry.register = function(callback) {
|
||||
goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length] = callback;
|
||||
if (goog.debug.entryPointRegistry.monitorsMayExist_) {
|
||||
var monitors = goog.debug.entryPointRegistry.monitors_;
|
||||
for (var i = 0; i < monitors.length; i++) {
|
||||
callback(goog.bind(monitors[i].wrap, monitors[i]));
|
||||
}
|
||||
}
|
||||
};
|
||||
goog.debug.entryPointRegistry.monitorAll = function(monitor) {
|
||||
goog.debug.entryPointRegistry.monitorsMayExist_ = true;
|
||||
var transformer = goog.bind(monitor.wrap, monitor);
|
||||
for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) {
|
||||
goog.debug.entryPointRegistry.refList_[i](transformer);
|
||||
}
|
||||
goog.debug.entryPointRegistry.monitors_.push(monitor);
|
||||
};
|
||||
goog.debug.entryPointRegistry.unmonitorAllIfPossible = function(monitor) {
|
||||
var monitors = goog.debug.entryPointRegistry.monitors_;
|
||||
goog.asserts.assert(monitor == monitors[monitors.length - 1], "Only the most recent monitor can be unwrapped.");
|
||||
var transformer = goog.bind(monitor.unwrap, monitor);
|
||||
for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) {
|
||||
goog.debug.entryPointRegistry.refList_[i](transformer);
|
||||
}
|
||||
monitors.length--;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=goog.debug.entrypointregistry.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,28 +0,0 @@
|
|||
goog.loadModule(function(exports) {
|
||||
"use strict";
|
||||
goog.module("goog.debug.Error");
|
||||
goog.module.declareLegacyNamespace();
|
||||
function DebugError(msg = undefined, cause = undefined) {
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, DebugError);
|
||||
} else {
|
||||
const stack = (new Error()).stack;
|
||||
if (stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
}
|
||||
if (msg) {
|
||||
this.message = String(msg);
|
||||
}
|
||||
if (cause !== undefined) {
|
||||
this.cause = cause;
|
||||
}
|
||||
this.reportErrorToServer = true;
|
||||
}
|
||||
goog.inherits(DebugError, Error);
|
||||
DebugError.prototype.name = "CustomError";
|
||||
exports = DebugError;
|
||||
return exports;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=goog.debug.error.js.map
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"version":3,
|
||||
"file":"goog.debug.error.js",
|
||||
"lineCount":27,
|
||||
"mappings":"AAAA,IAAA,CAAA,UAAA,CAAA,QAAA,CAAA,OAAA,CAAA;AAAA,cAAA;AAcAA,MAAKC,CAAAA,MAAL,CAAY,kBAAZ,CAAA;AACAD,MAAKC,CAAAA,MAAOC,CAAAA,sBAAZ,EAAA;AAkBAC,UAASA,WAAU,CAACC,GAAA,GAAMC,SAAP,EAAkBC,KAAA,GAAQD,SAA1B,CAAqC;AAEtD,QAAIE,KAAMC,CAAAA,iBAAV;AACED,WAAMC,CAAAA,iBAAN,CAAwB,IAAxB,EAA8BL,UAA9B,CAAA;AADF,UAEO;AACL,YAAMM,QAAoBA,CAAZ,IAAIF,KAAJ,EAAYE,EAAAA,KAA1B;AACA,UAAIA,KAAJ;AAEE,YAAKA,CAAAA,KAAL,GAAaA,KAAb;AAFF;AAFK;AAQP,QAAIL,GAAJ;AAEE,UAAKM,CAAAA,OAAL,GAAeC,MAAA,CAAOP,GAAP,CAAf;AAFF;AAKA,QAAIE,KAAJ,KAAcD,SAAd;AAEE,UAAKC,CAAAA,KAAL,GAAaA,KAAb;AAFF;AAYA,QAAKM,CAAAA,mBAAL,GAA2B,IAA3B;AA7BsD;AA+BxDZ,MAAKa,CAAAA,QAAL,CAAcV,UAAd,EAA0BI,KAA1B,CAAA;AAIAJ,YAAWW,CAAAA,SAAUC,CAAAA,IAArB,GAA4B,aAA5B;AAGAC,SAAA,GAAUb,UAAV;AAvEA,SAAA,OAAA;AAAA,CAAA,CAAA;;",
|
||||
"sources":["goog/debug/error.js"],
|
||||
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Provides a base class for custom Error objects such that the\n * stack is correctly maintained.\n *\n * You should never need to throw DebugError(msg) directly, Error(msg) is\n * sufficient.\n */\n\ngoog.module('goog.debug.Error');\ngoog.module.declareLegacyNamespace();\n\n\n\n/**\n * Base class for custom error objects.\n * @param {*=} msg The message associated with the error.\n * @param {{\n * message: (?|undefined),\n * name: (?|undefined),\n * lineNumber: (?|undefined),\n * fileName: (?|undefined),\n * stack: (?|undefined),\n * cause: (?|undefined),\n * }=} cause The original error object to chain with.\n * @constructor\n * @extends {Error}\n */\nfunction DebugError(msg = undefined, cause = undefined) {\n // Attempt to ensure there is a stack trace.\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, DebugError);\n } else {\n const stack = new Error().stack;\n if (stack) {\n /** @override @type {string} */\n this.stack = stack;\n }\n }\n\n if (msg) {\n /** @override @type {string} */\n this.message = String(msg);\n }\n\n if (cause !== undefined) {\n /** @type {?} */\n this.cause = cause;\n }\n\n /**\n * Whether to report this error to the server. Setting this to false will\n * cause the error reporter to not report the error back to the server,\n * which can be useful if the client knows that the error has already been\n * logged on the server.\n * @type {boolean}\n */\n this.reportErrorToServer = true;\n}\ngoog.inherits(DebugError, Error);\n\n\n/** @override @type {string} */\nDebugError.prototype.name = 'CustomError';\n\n\nexports = DebugError;\n"],
|
||||
"names":["goog","module","declareLegacyNamespace","DebugError","msg","undefined","cause","Error","captureStackTrace","stack","message","String","reportErrorToServer","inherits","prototype","name","exports"]
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
goog.provide("goog.debug.errorcontext");
|
||||
goog.debug.errorcontext.addErrorContext = function(err, contextKey, contextValue) {
|
||||
if (!err[goog.debug.errorcontext.CONTEXT_KEY_]) {
|
||||
err[goog.debug.errorcontext.CONTEXT_KEY_] = {};
|
||||
}
|
||||
err[goog.debug.errorcontext.CONTEXT_KEY_][contextKey] = contextValue;
|
||||
};
|
||||
goog.debug.errorcontext.getErrorContext = function(err) {
|
||||
return err[goog.debug.errorcontext.CONTEXT_KEY_] || {};
|
||||
};
|
||||
goog.debug.errorcontext.CONTEXT_KEY_ = "__closure__error__context__984382";
|
||||
|
||||
//# sourceMappingURL=goog.debug.errorcontext.js.map
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"version":3,
|
||||
"file":"goog.debug.errorcontext.js",
|
||||
"lineCount":12,
|
||||
"mappings":"AAUAA,IAAKC,CAAAA,OAAL,CAAa,yBAAb,CAAA;AASAD,IAAKE,CAAAA,KAAMC,CAAAA,YAAaC,CAAAA,eAAxB,GAA0CC,QAAQ,CAC9CC,GAD8C,EACzCC,UADyC,EAC7BC,YAD6B,CACf;AAEjC,MAAI,CAACF,GAAA,CAAIN,IAAKE,CAAAA,KAAMC,CAAAA,YAAaM,CAAAA,YAA5B,CAAL;AACEH,OAAA,CAAIN,IAAKE,CAAAA,KAAMC,CAAAA,YAAaM,CAAAA,YAA5B,CAAA,GAA4C,EAA5C;AADF;AAGAH,KAAA,CAAIN,IAAKE,CAAAA,KAAMC,CAAAA,YAAaM,CAAAA,YAA5B,CAAA,CAA0CF,UAA1C,CAAA,GAAwDC,YAAxD;AALiC,CADnC;AAcAR,IAAKE,CAAAA,KAAMC,CAAAA,YAAaO,CAAAA,eAAxB,GAA0CC,QAAQ,CAACL,GAAD,CAAM;AAEtD,SAAOA,GAAA,CAAIN,IAAKE,CAAAA,KAAMC,CAAAA,YAAaM,CAAAA,YAA5B,CAAP,IAAoD,EAApD;AAFsD,CAAxD;AASAT,IAAKE,CAAAA,KAAMC,CAAAA,YAAaM,CAAAA,YAAxB,GAAuC,mCAAvC;;",
|
||||
"sources":["goog/debug/errorcontext.js"],
|
||||
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Provides methods dealing with context on error objects.\n */\n\ngoog.provide('goog.debug.errorcontext');\n\n\n/**\n * Adds key-value context to the error.\n * @param {!Error} err The error to add context to.\n * @param {string} contextKey Key for the context to be added.\n * @param {string} contextValue Value for the context to be added.\n */\ngoog.debug.errorcontext.addErrorContext = function(\n err, contextKey, contextValue) {\n 'use strict';\n if (!err[goog.debug.errorcontext.CONTEXT_KEY_]) {\n err[goog.debug.errorcontext.CONTEXT_KEY_] = {};\n }\n err[goog.debug.errorcontext.CONTEXT_KEY_][contextKey] = contextValue;\n};\n\n\n/**\n * @param {!Error} err The error to get context from.\n * @return {!Object<string, string>} The context of the provided error.\n */\ngoog.debug.errorcontext.getErrorContext = function(err) {\n 'use strict';\n return err[goog.debug.errorcontext.CONTEXT_KEY_] || {};\n};\n\n\n// TODO(user): convert this to a Symbol once goog.debug.ErrorReporter is\n// able to use ES6.\n/** @private @const {string} */\ngoog.debug.errorcontext.CONTEXT_KEY_ = '__closure__error__context__984382';\n"],
|
||||
"names":["goog","provide","debug","errorcontext","addErrorContext","goog.debug.errorcontext.addErrorContext","err","contextKey","contextValue","CONTEXT_KEY_","getErrorContext","goog.debug.errorcontext.getErrorContext"]
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
goog.provide("goog.dom.asserts");
|
||||
goog.require("goog.asserts");
|
||||
goog.dom.asserts.assertIsLocation = function(o) {
|
||||
if (goog.asserts.ENABLE_ASSERTS) {
|
||||
var win = goog.dom.asserts.getWindow_(o);
|
||||
if (win) {
|
||||
if (!o || !(o instanceof win.Location) && o instanceof win.Element) {
|
||||
goog.asserts.fail("Argument is not a Location (or a non-Element mock); got: %s", goog.dom.asserts.debugStringForType_(o));
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
};
|
||||
goog.dom.asserts.debugStringForType_ = function(value) {
|
||||
if (goog.isObject(value)) {
|
||||
try {
|
||||
return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
|
||||
} catch (e) {
|
||||
return "\x3cobject could not be stringified\x3e";
|
||||
}
|
||||
} else {
|
||||
return value === undefined ? "undefined" : value === null ? "null" : typeof value;
|
||||
}
|
||||
};
|
||||
goog.dom.asserts.getWindow_ = function(o) {
|
||||
try {
|
||||
var doc = o && o.ownerDocument;
|
||||
var win = doc && (doc.defaultView || doc.parentWindow);
|
||||
win = win || goog.global;
|
||||
if (win.Element && win.Location) {
|
||||
return win;
|
||||
}
|
||||
} catch (ex) {
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=goog.dom.asserts.js.map
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"version":3,
|
||||
"file":"goog.dom.asserts.js",
|
||||
"lineCount":37,
|
||||
"mappings":"AAMAA,IAAKC,CAAAA,OAAL,CAAa,kBAAb,CAAA;AAEAD,IAAKE,CAAAA,OAAL,CAAa,cAAb,CAAA;AA8CAF,IAAKG,CAAAA,GAAIC,CAAAA,OAAQC,CAAAA,gBAAjB,GAAoCC,QAAQ,CAACC,CAAD,CAAI;AAE9C,MAAIP,IAAKI,CAAAA,OAAQI,CAAAA,cAAjB,CAAiC;AAC/B,QAAIC,MAAMT,IAAKG,CAAAA,GAAIC,CAAAA,OAAQM,CAAAA,UAAjB,CAA4BH,CAA5B,CAAV;AACA,QAAIE,GAAJ;AACE,UAAI,CAACF,CAAL,IAAW,EAAEA,CAAF,YAAeE,GAAIE,CAAAA,QAAnB,CAAX,IAA2CJ,CAA3C,YAAwDE,GAAIG,CAAAA,OAA5D;AACEZ,YAAKI,CAAAA,OAAQS,CAAAA,IAAb,CACI,6DADJ,EAEIb,IAAKG,CAAAA,GAAIC,CAAAA,OAAQU,CAAAA,mBAAjB,CAAqCP,CAArC,CAFJ,CAAA;AADF;AADF;AAF+B;AAUjC,SAAiCA,CAAjC;AAZ8C,CAAhD;AAuBAP,IAAKG,CAAAA,GAAIC,CAAAA,OAAQU,CAAAA,mBAAjB,GAAuCC,QAAQ,CAACC,KAAD,CAAQ;AAErD,MAAIhB,IAAKiB,CAAAA,QAAL,CAAcD,KAAd,CAAJ;AACE,OAAI;AACF,aAAwCA,KAAME,CAAAA,WAAYC,CAAAA,WAA1D,IACIH,KAAME,CAAAA,WAAYE,CAAAA,IADtB,IAC8BC,MAAOC,CAAAA,SAAUC,CAAAA,QAASC,CAAAA,IAA1B,CAA+BR,KAA/B,CAD9B;AADE,KAGF,QAAOS,CAAP,CAAU;AACV,aAAO,yCAAP;AADU;AAJd;AAQE,WAAOT,KAAA,KAAUU,SAAV,GAAsB,WAAtB,GACsBV,KAAA,KAAU,IAAV,GAAiB,MAAjB,GAA0B,MAAOA,MAD9D;AARF;AAFqD,CAAvD;AAsBAhB,IAAKG,CAAAA,GAAIC,CAAAA,OAAQM,CAAAA,UAAjB,GAA8BiB,QAAQ,CAACpB,CAAD,CAAI;AAExC,KAAI;AACF,QAAIqB,MAAMrB,CAANqB,IAAWrB,CAAEsB,CAAAA,aAAjB;AAGA,QAAIpB,MACAmB,GADAnB,KAC+BmB,GAAIE,CAAAA,WAAL,IAAoBF,GAAIG,CAAAA,YADtDtB,CAAJ;AAEAA,OAAA,GAAMA,GAAN,IAAqCT,IAAKgC,CAAAA,MAA1C;AAGA,QAAIvB,GAAIG,CAAAA,OAAR,IAAmBH,GAAIE,CAAAA,QAAvB;AACE,aAAOF,GAAP;AADF;AATE,GAYF,QAAOwB,EAAP,CAAW;;AAEb,SAAO,IAAP;AAhBwC,CAA1C;;",
|
||||
"sources":["goog/dom/asserts.js"],
|
||||
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\ngoog.provide('goog.dom.asserts');\n\ngoog.require('goog.asserts');\n\n/**\n * @fileoverview Custom assertions to ensure that an element has the appropriate\n * type.\n *\n * Using a goog.dom.safe wrapper on an object on the incorrect type (via an\n * incorrect static type cast) can result in security bugs: For instance,\n * g.d.s.setAnchorHref ensures that the URL assigned to the .href attribute\n * satisfies the SafeUrl contract, i.e., is safe to dereference as a hyperlink.\n * However, the value assigned to a HTMLLinkElement's .href property requires\n * the stronger TrustedResourceUrl contract, since it can refer to a stylesheet.\n * Thus, using g.d.s.setAnchorHref on an (incorrectly statically typed) object\n * of type HTMLLinkElement can result in a security vulnerability.\n * Assertions of the correct run-time type help prevent such incorrect use.\n *\n * In some cases, code using the DOM API is tested using mock objects (e.g., a\n * plain object such as {'href': url} instead of an actual Location object).\n * To allow such mocking, the assertions permit objects of types that are not\n * relevant DOM API objects at all (for instance, not Element or Location).\n *\n * Note that instanceof checks don't work straightforwardly in older versions of\n * IE, or across frames (see,\n * http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object,\n * http://stackoverflow.com/questions/26248599/instanceof-htmlelement-in-iframe-is-not-element-or-object).\n *\n * Hence, these assertions may pass vacuously in such scenarios. The resulting\n * risk of security bugs is limited by the following factors:\n * - A bug can only arise in scenarios involving incorrect static typing (the\n * wrapper methods are statically typed to demand objects of the appropriate,\n * precise type).\n * - Typically, code is tested and exercised in multiple browsers.\n */\n\n/**\n * Asserts that a given object is a Location.\n *\n * To permit this assertion to pass in the context of tests where DOM APIs might\n * be mocked, also accepts any other type except for subtypes of {!Element}.\n * This is to ensure that, for instance, HTMLLinkElement is not being used in\n * place of a Location, since this could result in security bugs due to stronger\n * contracts required for assignments to the href property of the latter.\n *\n * @param {?Object} o The object whose type to assert.\n * @return {!Location}\n */\ngoog.dom.asserts.assertIsLocation = function(o) {\n 'use strict';\n if (goog.asserts.ENABLE_ASSERTS) {\n var win = goog.dom.asserts.getWindow_(o);\n if (win) {\n if (!o || (!(o instanceof win.Location) && o instanceof win.Element)) {\n goog.asserts.fail(\n 'Argument is not a Location (or a non-Element mock); got: %s',\n goog.dom.asserts.debugStringForType_(o));\n }\n }\n }\n return /** @type {!Location} */ (o);\n};\n\n\n/**\n * Returns a string representation of a value's type.\n *\n * @param {*} value An object, or primitive.\n * @return {string} The best display name for the value.\n * @private\n */\ngoog.dom.asserts.debugStringForType_ = function(value) {\n 'use strict';\n if (goog.isObject(value)) {\n try {\n return /** @type {string|undefined} */ (value.constructor.displayName) ||\n value.constructor.name || Object.prototype.toString.call(value);\n } catch (e) {\n return '<object could not be stringified>';\n }\n } else {\n return value === undefined ? 'undefined' :\n value === null ? 'null' : typeof value;\n }\n};\n\n/**\n * Gets window of element.\n * @param {?Object} o\n * @return {?Window}\n * @private\n * @suppress {strictMissingProperties} ownerDocument not defined on Object\n */\ngoog.dom.asserts.getWindow_ = function(o) {\n 'use strict';\n try {\n var doc = o && o.ownerDocument;\n // This can throw \u201cBlocked a frame with origin \"chrome-extension://...\" from\n // accessing a cross-origin frame\u201d in Chrome extension.\n var win =\n doc && /** @type {?Window} */ (doc.defaultView || doc.parentWindow);\n win = win || /** @type {!Window} */ (goog.global);\n // This can throw \u201cPermission denied to access property \"Element\" on\n // cross-origin object\u201d.\n if (win.Element && win.Location) {\n return win;\n }\n } catch (ex) {\n }\n return null;\n};\n"],
|
||||
"names":["goog","provide","require","dom","asserts","assertIsLocation","goog.dom.asserts.assertIsLocation","o","ENABLE_ASSERTS","win","getWindow_","Location","Element","fail","debugStringForType_","goog.dom.asserts.debugStringForType_","value","isObject","constructor","displayName","name","Object","prototype","toString","call","e","undefined","goog.dom.asserts.getWindow_","doc","ownerDocument","defaultView","parentWindow","global","ex"]
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
goog.provide("goog.dom.BrowserFeature");
|
||||
goog.require("goog.userAgent");
|
||||
goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS = goog.define("goog.dom.ASSUME_NO_OFFSCREEN_CANVAS", false);
|
||||
goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS = goog.define("goog.dom.ASSUME_OFFSCREEN_CANVAS", false);
|
||||
goog.dom.BrowserFeature.detectOffscreenCanvas_ = function(contextName) {
|
||||
try {
|
||||
return Boolean((new self.OffscreenCanvas(0, 0)).getContext(contextName));
|
||||
} catch (ex) {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
goog.dom.BrowserFeature.OFFSCREEN_CANVAS_2D = !goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS && (goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS || goog.dom.BrowserFeature.detectOffscreenCanvas_("2d"));
|
||||
goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES = true;
|
||||
goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE = true;
|
||||
goog.dom.BrowserFeature.CAN_USE_INNER_TEXT = false;
|
||||
goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY = goog.userAgent.IE || goog.userAgent.WEBKIT;
|
||||
goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT = goog.userAgent.IE;
|
||||
|
||||
//# sourceMappingURL=goog.dom.browserfeature.js.map
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"version":3,
|
||||
"file":"goog.dom.browserfeature.js",
|
||||
"lineCount":18,
|
||||
"mappings":"AAWAA,IAAKC,CAAAA,OAAL,CAAa,yBAAb,CAAA;AAEAD,IAAKE,CAAAA,OAAL,CAAa,gBAAb,CAAA;AAOAF,IAAKG,CAAAA,GAAIC,CAAAA,cAAeC,CAAAA,0BAAxB,GACIL,IAAKM,CAAAA,MAAL,CAAY,qCAAZ,EAAmD,KAAnD,CADJ;AAQAN,IAAKG,CAAAA,GAAIC,CAAAA,cAAeG,CAAAA,uBAAxB,GACIP,IAAKM,CAAAA,MAAL,CAAY,kCAAZ,EAAgD,KAAhD,CADJ;AASAN,IAAKG,CAAAA,GAAIC,CAAAA,cAAeI,CAAAA,sBAAxB,GAAiDC,QAAQ,CAACC,WAAD,CAAc;AAIrE,KAAI;AACF,WAAOC,OAAA,CAAuCC,CAA/B,IAAIC,IAAKC,CAAAA,eAAT,CAAyB,CAAzB,EAA4B,CAA5B,CAA+BF,EAAAA,UAA/B,CAA0CF,WAA1C,CAAR,CAAP;AADE,GAEF,QAAOK,EAAP,CAAW;;AAEb,SAAO,KAAP;AARqE,CAAvE;AAeAf,IAAKG,CAAAA,GAAIC,CAAAA,cAAeY,CAAAA,mBAAxB,GACI,CAAChB,IAAKG,CAAAA,GAAIC,CAAAA,cAAeC,CAAAA,0BAD7B,KAEKL,IAAKG,CAAAA,GAAIC,CAAAA,cAAeG,CAAAA,uBAF7B,IAGKP,IAAKG,CAAAA,GAAIC,CAAAA,cAAeI,CAAAA,sBAAxB,CAA+C,IAA/C,CAHL;AAUAR,IAAKG,CAAAA,GAAIC,CAAAA,cAAea,CAAAA,+BAAxB,GAA0D,IAA1D;AAQAjB,IAAKG,CAAAA,GAAIC,CAAAA,cAAec,CAAAA,0BAAxB,GAAqD,IAArD;AAOAlB,IAAKG,CAAAA,GAAIC,CAAAA,cAAee,CAAAA,kBAAxB,GAA6C,KAA7C;AAOAnB,IAAKG,CAAAA,GAAIC,CAAAA,cAAegB,CAAAA,+BAAxB,GACIpB,IAAKqB,CAAAA,SAAUC,CAAAA,EADnB,IACyBtB,IAAKqB,CAAAA,SAAUE,CAAAA,MADxC;AASAvB,IAAKG,CAAAA,GAAIC,CAAAA,cAAeoB,CAAAA,+BAAxB,GAA0DxB,IAAKqB,CAAAA,SAAUC,CAAAA,EAAzE;;",
|
||||
"sources":["goog/dom/browserfeature.js"],
|
||||
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Browser capability checks for the dom package.\n */\n\n\ngoog.provide('goog.dom.BrowserFeature');\n\ngoog.require('goog.userAgent');\n\n\n/**\n * @define {boolean} Whether we know at compile time that the browser doesn't\n * support OffscreenCanvas.\n */\ngoog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS =\n goog.define('goog.dom.ASSUME_NO_OFFSCREEN_CANVAS', false);\n\n/**\n * @define {boolean} Whether we know at compile time that the browser supports\n * all OffscreenCanvas contexts.\n */\n// TODO(user): Eventually this should default to \"FEATURESET_YEAR >= 202X\".\ngoog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS =\n goog.define('goog.dom.ASSUME_OFFSCREEN_CANVAS', false);\n\n/**\n * Detects if a particular OffscreenCanvas context is supported.\n * @param {string} contextName name of the context to test.\n * @return {boolean} Whether the browser supports this OffscreenCanvas context.\n * @private\n */\ngoog.dom.BrowserFeature.detectOffscreenCanvas_ = function(contextName) {\n 'use strict';\n // This code only gets removed because we forced @nosideeffects on\n // the functions. See: b/138802376\n try {\n return Boolean(new self.OffscreenCanvas(0, 0).getContext(contextName));\n } catch (ex) {\n }\n return false;\n};\n\n/**\n * Whether the browser supports OffscreenCanvas 2D context.\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.OFFSCREEN_CANVAS_2D =\n !goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS &&\n (goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS ||\n goog.dom.BrowserFeature.detectOffscreenCanvas_('2d'));\n\n/**\n * Whether attributes 'name' and 'type' can be added to an element after it's\n * created. False in Internet Explorer prior to version 9.\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES = true;\n\n/**\n * Whether we can use element.children to access an element's Element\n * children. Available since Gecko 1.9.1, IE 9. (IE<9 also includes comment\n * nodes in the collection.)\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE = true;\n\n/**\n * Opera, Safari 3, and Internet Explorer 9 all support innerText but they\n * include text nodes in script and style tags. Not document-mode-dependent.\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.CAN_USE_INNER_TEXT = false;\n\n/**\n * MSIE, Opera, and Safari>=4 support element.parentElement to access an\n * element's parent if it is an Element.\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY =\n goog.userAgent.IE || goog.userAgent.WEBKIT;\n\n/**\n * Whether NoScope elements need a scoped element written before them in\n * innerHTML.\n * MSDN: http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx#1\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT = goog.userAgent.IE;\n"],
|
||||
"names":["goog","provide","require","dom","BrowserFeature","ASSUME_NO_OFFSCREEN_CANVAS","define","ASSUME_OFFSCREEN_CANVAS","detectOffscreenCanvas_","goog.dom.BrowserFeature.detectOffscreenCanvas_","contextName","Boolean","getContext","self","OffscreenCanvas","ex","OFFSCREEN_CANVAS_2D","CAN_ADD_NAME_OR_TYPE_ATTRIBUTES","CAN_USE_CHILDREN_ATTRIBUTE","CAN_USE_INNER_TEXT","CAN_USE_PARENT_ELEMENT_PROPERTY","userAgent","IE","WEBKIT","INNER_HTML_NEEDS_SCOPED_ELEMENT"]
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
goog.provide("goog.dom.classlist");
|
||||
goog.require("goog.array");
|
||||
goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST = goog.define("goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST", false);
|
||||
goog.dom.classlist.getClassName_ = function(element) {
|
||||
return typeof element.className == "string" ? element.className : element.getAttribute && element.getAttribute("class") || "";
|
||||
};
|
||||
goog.dom.classlist.get = function(element) {
|
||||
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
|
||||
return element.classList;
|
||||
}
|
||||
return goog.dom.classlist.getClassName_(element).match(/\S+/g) || [];
|
||||
};
|
||||
goog.dom.classlist.set = function(element, className) {
|
||||
if (typeof element.className == "string") {
|
||||
element.className = className;
|
||||
return;
|
||||
} else if (element.setAttribute) {
|
||||
element.setAttribute("class", className);
|
||||
}
|
||||
};
|
||||
goog.dom.classlist.contains = function(element, className) {
|
||||
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
|
||||
return element.classList.contains(className);
|
||||
}
|
||||
return goog.array.contains(goog.dom.classlist.get(element), className);
|
||||
};
|
||||
goog.dom.classlist.add = function(element, className) {
|
||||
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
|
||||
element.classList.add(className);
|
||||
return;
|
||||
}
|
||||
if (!goog.dom.classlist.contains(element, className)) {
|
||||
var oldClassName = goog.dom.classlist.getClassName_(element);
|
||||
goog.dom.classlist.set(element, oldClassName + (oldClassName.length > 0 ? " " + className : className));
|
||||
}
|
||||
};
|
||||
goog.dom.classlist.addAll = function(element, classesToAdd) {
|
||||
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
|
||||
Array.prototype.forEach.call(classesToAdd, function(className) {
|
||||
goog.dom.classlist.add(element, className);
|
||||
});
|
||||
return;
|
||||
}
|
||||
var classMap = {};
|
||||
Array.prototype.forEach.call(goog.dom.classlist.get(element), function(className) {
|
||||
classMap[className] = true;
|
||||
});
|
||||
Array.prototype.forEach.call(classesToAdd, function(className) {
|
||||
classMap[className] = true;
|
||||
});
|
||||
var newClassName = "";
|
||||
for (var className in classMap) {
|
||||
newClassName += newClassName.length > 0 ? " " + className : className;
|
||||
}
|
||||
goog.dom.classlist.set(element, newClassName);
|
||||
};
|
||||
goog.dom.classlist.remove = function(element, className) {
|
||||
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
|
||||
element.classList.remove(className);
|
||||
return;
|
||||
}
|
||||
if (goog.dom.classlist.contains(element, className)) {
|
||||
goog.dom.classlist.set(element, Array.prototype.filter.call(goog.dom.classlist.get(element), function(c) {
|
||||
return c != className;
|
||||
}).join(" "));
|
||||
}
|
||||
};
|
||||
goog.dom.classlist.removeAll = function(element, classesToRemove) {
|
||||
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
|
||||
Array.prototype.forEach.call(classesToRemove, function(className) {
|
||||
goog.dom.classlist.remove(element, className);
|
||||
});
|
||||
return;
|
||||
}
|
||||
goog.dom.classlist.set(element, Array.prototype.filter.call(goog.dom.classlist.get(element), function(className) {
|
||||
return !goog.array.contains(classesToRemove, className);
|
||||
}).join(" "));
|
||||
};
|
||||
goog.dom.classlist.enable = function(element, className, enabled) {
|
||||
if (enabled) {
|
||||
goog.dom.classlist.add(element, className);
|
||||
} else {
|
||||
goog.dom.classlist.remove(element, className);
|
||||
}
|
||||
};
|
||||
goog.dom.classlist.enableAll = function(element, classesToEnable, enabled) {
|
||||
var f = enabled ? goog.dom.classlist.addAll : goog.dom.classlist.removeAll;
|
||||
f(element, classesToEnable);
|
||||
};
|
||||
goog.dom.classlist.swap = function(element, fromClass, toClass) {
|
||||
if (goog.dom.classlist.contains(element, fromClass)) {
|
||||
goog.dom.classlist.remove(element, fromClass);
|
||||
goog.dom.classlist.add(element, toClass);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
goog.dom.classlist.toggle = function(element, className) {
|
||||
var add = !goog.dom.classlist.contains(element, className);
|
||||
goog.dom.classlist.enable(element, className, add);
|
||||
return add;
|
||||
};
|
||||
goog.dom.classlist.addRemove = function(element, classToRemove, classToAdd) {
|
||||
goog.dom.classlist.remove(element, classToRemove);
|
||||
goog.dom.classlist.add(element, classToAdd);
|
||||
};
|
||||
|
||||
//# sourceMappingURL=goog.dom.classlist.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -1,66 +0,0 @@
|
|||
goog.loadModule(function(exports) {
|
||||
"use strict";
|
||||
goog.module("goog.dom.element");
|
||||
goog.module.declareLegacyNamespace();
|
||||
const NodeType = goog.require("goog.dom.NodeType");
|
||||
const TagName = goog.require("goog.dom.TagName");
|
||||
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
||||
const isElement = value => {
|
||||
return goog.isObject(value) && value.nodeType === NodeType.ELEMENT;
|
||||
};
|
||||
const isHtmlElement = value => {
|
||||
return goog.isObject(value) && isElement(value) && (!value.namespaceURI || value.namespaceURI === HTML_NAMESPACE);
|
||||
};
|
||||
const isHtmlElementOfType = (value, tagName) => {
|
||||
return goog.isObject(value) && isHtmlElement(value) && value.tagName.toUpperCase() === tagName.toString();
|
||||
};
|
||||
const isHtmlAnchorElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.A);
|
||||
};
|
||||
const isHtmlButtonElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.BUTTON);
|
||||
};
|
||||
const isHtmlLinkElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.LINK);
|
||||
};
|
||||
const isHtmlImageElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.IMG);
|
||||
};
|
||||
const isHtmlAudioElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.AUDIO);
|
||||
};
|
||||
const isHtmlVideoElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.VIDEO);
|
||||
};
|
||||
const isHtmlInputElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.INPUT);
|
||||
};
|
||||
const isHtmlTextAreaElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.TEXTAREA);
|
||||
};
|
||||
const isHtmlCanvasElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.CANVAS);
|
||||
};
|
||||
const isHtmlEmbedElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.EMBED);
|
||||
};
|
||||
const isHtmlFormElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.FORM);
|
||||
};
|
||||
const isHtmlFrameElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.FRAME);
|
||||
};
|
||||
const isHtmlIFrameElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.IFRAME);
|
||||
};
|
||||
const isHtmlObjectElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.OBJECT);
|
||||
};
|
||||
const isHtmlScriptElement = value => {
|
||||
return isHtmlElementOfType(value, TagName.SCRIPT);
|
||||
};
|
||||
exports = {isElement, isHtmlElement, isHtmlElementOfType, isHtmlAnchorElement, isHtmlButtonElement, isHtmlLinkElement, isHtmlImageElement, isHtmlAudioElement, isHtmlVideoElement, isHtmlInputElement, isHtmlTextAreaElement, isHtmlCanvasElement, isHtmlEmbedElement, isHtmlFormElement, isHtmlFrameElement, isHtmlIFrameElement, isHtmlObjectElement, isHtmlScriptElement,};
|
||||
return exports;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=goog.dom.element.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,241 +0,0 @@
|
|||
goog.provide("goog.dom.forms");
|
||||
goog.require("goog.dom.InputType");
|
||||
goog.require("goog.dom.TagName");
|
||||
goog.require("goog.dom.safe");
|
||||
goog.require("goog.structs.Map");
|
||||
goog.require("goog.window");
|
||||
goog.dom.forms.submitFormInNewWindow = function(form, opt_submitElement) {
|
||||
var formData = goog.dom.forms.getFormDataMap(form);
|
||||
var action = form.action;
|
||||
var method = form.method;
|
||||
if (opt_submitElement) {
|
||||
if (goog.dom.InputType.SUBMIT != opt_submitElement.type.toLowerCase()) {
|
||||
throw new Error("opt_submitElement does not have a valid type.");
|
||||
}
|
||||
var submitValue = goog.dom.forms.getValue(opt_submitElement);
|
||||
if (submitValue != null) {
|
||||
goog.dom.forms.addFormDataToMap_(formData, opt_submitElement.name, submitValue);
|
||||
}
|
||||
if (opt_submitElement.getAttribute("formaction")) {
|
||||
action = opt_submitElement.getAttribute("formaction");
|
||||
}
|
||||
if (opt_submitElement.getAttribute("formmethod")) {
|
||||
method = opt_submitElement.getAttribute("formmethod");
|
||||
}
|
||||
}
|
||||
return goog.dom.forms.submitFormDataInNewWindow(action, method, formData);
|
||||
};
|
||||
goog.dom.forms.submitFormDataInNewWindow = function(actionUri, method, formData) {
|
||||
var newWin = goog.window.openBlank("", {noreferrer:true});
|
||||
if (!newWin) {
|
||||
return false;
|
||||
}
|
||||
var newDocument = newWin.document;
|
||||
var newForm = newDocument.createElement("form");
|
||||
newForm.method = method;
|
||||
goog.dom.safe.setFormElementAction(newForm, actionUri);
|
||||
formData.forEach(function(fieldValues, fieldName) {
|
||||
for (var i = 0; i < fieldValues.length; i++) {
|
||||
var fieldValue = fieldValues[i];
|
||||
var newInput = newDocument.createElement("input");
|
||||
newInput.name = fieldName;
|
||||
newInput.value = fieldValue;
|
||||
newInput.type = "hidden";
|
||||
HTMLFormElement.prototype.appendChild.call(newForm, newInput);
|
||||
}
|
||||
});
|
||||
HTMLFormElement.prototype.submit.call(newForm);
|
||||
return true;
|
||||
};
|
||||
goog.dom.forms.getFormDataMap = function(form) {
|
||||
var map = new goog.structs.Map();
|
||||
goog.dom.forms.getFormDataHelper_(form, map, goog.dom.forms.addFormDataToMap_);
|
||||
return map;
|
||||
};
|
||||
goog.dom.forms.getFormDataString = function(form) {
|
||||
var sb = [];
|
||||
goog.dom.forms.getFormDataHelper_(form, sb, goog.dom.forms.addFormDataToStringBuffer_);
|
||||
return sb.join("\x26");
|
||||
};
|
||||
goog.dom.forms.getFormDataHelper_ = function(form, result, fnAppend) {
|
||||
var els = form.elements;
|
||||
for (var el, i = 0; el = els.item(i); i++) {
|
||||
if (el.form != form || el.disabled || el.tagName == goog.dom.TagName.FIELDSET) {
|
||||
continue;
|
||||
}
|
||||
var name = el.name;
|
||||
switch(el.type.toLowerCase()) {
|
||||
case goog.dom.InputType.FILE:
|
||||
case goog.dom.InputType.SUBMIT:
|
||||
case goog.dom.InputType.RESET:
|
||||
case goog.dom.InputType.BUTTON:
|
||||
break;
|
||||
case goog.dom.InputType.SELECT_MULTIPLE:
|
||||
var values = goog.dom.forms.getValue(el);
|
||||
if (values != null) {
|
||||
for (var value, j = 0; value = values[j]; j++) {
|
||||
fnAppend(result, name, value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
var value = goog.dom.forms.getValue(el);
|
||||
if (value != null) {
|
||||
fnAppend(result, name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
var inputs = form.getElementsByTagName(String(goog.dom.TagName.INPUT));
|
||||
for (var input, i = 0; input = inputs[i]; i++) {
|
||||
if (input.form == form && input.type.toLowerCase() == goog.dom.InputType.IMAGE) {
|
||||
name = input.name;
|
||||
fnAppend(result, name, input.value);
|
||||
fnAppend(result, name + ".x", "0");
|
||||
fnAppend(result, name + ".y", "0");
|
||||
}
|
||||
}
|
||||
};
|
||||
goog.dom.forms.addFormDataToMap_ = function(map, name, value) {
|
||||
var array = map.get(name);
|
||||
if (!array) {
|
||||
array = [];
|
||||
map.set(name, array);
|
||||
}
|
||||
array.push(value);
|
||||
};
|
||||
goog.dom.forms.addFormDataToStringBuffer_ = function(sb, name, value) {
|
||||
sb.push(encodeURIComponent(name) + "\x3d" + encodeURIComponent(value));
|
||||
};
|
||||
goog.dom.forms.hasFileInput = function(form) {
|
||||
var els = form.elements;
|
||||
for (var el, i = 0; el = els[i]; i++) {
|
||||
if (!el.disabled && el.type && el.type.toLowerCase() == goog.dom.InputType.FILE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
goog.dom.forms.setDisabled = function(el, disabled) {
|
||||
if (el.tagName == goog.dom.TagName.FORM) {
|
||||
var els = el.elements;
|
||||
for (var i = 0; el = els.item(i); i++) {
|
||||
goog.dom.forms.setDisabled(el, disabled);
|
||||
}
|
||||
} else {
|
||||
if (disabled == true) {
|
||||
el.blur();
|
||||
}
|
||||
el.disabled = disabled;
|
||||
}
|
||||
};
|
||||
goog.dom.forms.focusAndSelect = function(el) {
|
||||
el.focus();
|
||||
if (el.select) {
|
||||
el.select();
|
||||
}
|
||||
};
|
||||
goog.dom.forms.hasValue = function(el) {
|
||||
var value = goog.dom.forms.getValue(el);
|
||||
return !!value;
|
||||
};
|
||||
goog.dom.forms.hasValueByName = function(form, name) {
|
||||
var value = goog.dom.forms.getValueByName(form, name);
|
||||
return !!value;
|
||||
};
|
||||
goog.dom.forms.getValue = function(input) {
|
||||
var type = input.type;
|
||||
if (typeof type === "string") {
|
||||
var el = input;
|
||||
switch(type.toLowerCase()) {
|
||||
case goog.dom.InputType.CHECKBOX:
|
||||
case goog.dom.InputType.RADIO:
|
||||
return goog.dom.forms.getInputChecked_(el);
|
||||
case goog.dom.InputType.SELECT_ONE:
|
||||
return goog.dom.forms.getSelectSingle_(el);
|
||||
case goog.dom.InputType.SELECT_MULTIPLE:
|
||||
return goog.dom.forms.getSelectMultiple_(el);
|
||||
default:
|
||||
}
|
||||
}
|
||||
return input.value != null ? input.value : null;
|
||||
};
|
||||
goog.dom.forms.getValueByName = function(form, name) {
|
||||
var els = form.elements[name];
|
||||
if (!els) {
|
||||
return null;
|
||||
} else if (els.type) {
|
||||
return goog.dom.forms.getValue(els);
|
||||
} else {
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var val = goog.dom.forms.getValue(els[i]);
|
||||
if (val) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
goog.dom.forms.getInputChecked_ = function(el) {
|
||||
return el.checked ? el.value : null;
|
||||
};
|
||||
goog.dom.forms.getSelectSingle_ = function(el) {
|
||||
var selectedIndex = el.selectedIndex;
|
||||
return selectedIndex >= 0 ? el.options[selectedIndex].value : null;
|
||||
};
|
||||
goog.dom.forms.getSelectMultiple_ = function(el) {
|
||||
var values = [];
|
||||
for (var option, i = 0; option = el.options[i]; i++) {
|
||||
if (option.selected) {
|
||||
values.push(option.value);
|
||||
}
|
||||
}
|
||||
return values.length ? values : null;
|
||||
};
|
||||
goog.dom.forms.setValue = function(el, opt_value) {
|
||||
var type = el.type;
|
||||
switch(typeof type === "string" && type.toLowerCase()) {
|
||||
case goog.dom.InputType.CHECKBOX:
|
||||
case goog.dom.InputType.RADIO:
|
||||
goog.dom.forms.setInputChecked_(el, opt_value);
|
||||
return;
|
||||
case goog.dom.InputType.SELECT_ONE:
|
||||
goog.dom.forms.setSelectSingle_(el, opt_value);
|
||||
return;
|
||||
case goog.dom.InputType.SELECT_MULTIPLE:
|
||||
goog.dom.forms.setSelectMultiple_(el, opt_value);
|
||||
return;
|
||||
default:
|
||||
el.value = opt_value != null ? opt_value : "";
|
||||
}
|
||||
};
|
||||
goog.dom.forms.setInputChecked_ = function(el, opt_value) {
|
||||
el.checked = opt_value;
|
||||
};
|
||||
goog.dom.forms.setSelectSingle_ = function(el, opt_value) {
|
||||
el.selectedIndex = -1;
|
||||
if (typeof opt_value === "string") {
|
||||
for (var option, i = 0; option = el.options[i]; i++) {
|
||||
if (option.value == opt_value) {
|
||||
option.selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
goog.dom.forms.setSelectMultiple_ = function(el, opt_value) {
|
||||
if (typeof opt_value === "string") {
|
||||
opt_value = [opt_value];
|
||||
}
|
||||
for (var option, i = 0; option = el.options[i]; i++) {
|
||||
option.selected = false;
|
||||
if (opt_value) {
|
||||
for (var value, j = 0; value = opt_value[j]; j++) {
|
||||
if (option.value == value) {
|
||||
option.selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//# sourceMappingURL=goog.dom.forms.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +0,0 @@
|
|||
goog.provide("goog.dom.HtmlElement");
|
||||
goog.dom.HtmlElement = function() {
|
||||
};
|
||||
|
||||
//# sourceMappingURL=goog.dom.htmlelement.js.map
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"version":3,
|
||||
"file":"goog.dom.htmlelement.js",
|
||||
"lineCount":4,
|
||||
"mappings":"AAMAA,IAAKC,CAAAA,OAAL,CAAa,sBAAb,CAAA;AAcAD,IAAKE,CAAAA,GAAIC,CAAAA,WAAT,GAAuBC,QAAQ,EAAG;CAAlC;;",
|
||||
"sources":["goog/dom/htmlelement.js"],
|
||||
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\ngoog.provide('goog.dom.HtmlElement');\n\n\n\n/**\n * This subclass of HTMLElement is used when only a HTMLElement is possible and\n * not any of its subclasses. Normally, a type can refer to an instance of\n * itself or an instance of any subtype. More concretely, if HTMLElement is used\n * then the compiler must assume that it might still be e.g. HTMLScriptElement.\n * With this, the type check knows that it couldn't be any special element.\n *\n * @constructor\n * @extends {HTMLElement}\n */\ngoog.dom.HtmlElement = function() {};\n"],
|
||||
"names":["goog","provide","dom","HtmlElement","goog.dom.HtmlElement"]
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue