// Compiled by ClojureScript 1.9.562 {}
goog.provide('weathergen.falcon.files');
goog.require('cljs.core');
goog.require('clojure.string');
goog.require('octet.core');
goog.require('taoensso.timbre');
goog.require('weathergen.util');
weathergen.falcon.files.all_errors = new cljs.core.Keyword(null,"default","default",-1987822328);
weathergen.falcon.files.read_trace = (function weathergen$falcon$files$read_trace(msg,spec){
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34393 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34393 = (function (msg,spec,meta34394){
this.msg = msg;
this.spec = spec;
this.meta34394 = meta34394;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34393.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34395,meta34394__$1){
var self__ = this;
var _34395__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34393(self__.msg,self__.spec,meta34394__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34393.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34395){
var self__ = this;
var _34395__$1 = this;
return self__.meta34394;
});

weathergen.falcon.files.t_weathergen$falcon$files34393.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34393.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"debug","debug",-1608172596),"weathergen.falcon.files",null,21,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (___$1){
return (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [[cljs.core.str.cljs$core$IFn$_invoke$arity$1("start: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(self__.msg),cljs.core.str.cljs$core$IFn$_invoke$arity$1("@"),cljs.core.str.cljs$core$IFn$_invoke$arity$1(pos)].join('')], null);
});})(___$1))
,null)),null,143369002);

var result = octet.spec.read.call(null,self__.spec,buf,pos);
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"debug","debug",-1608172596),"weathergen.falcon.files",null,23,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (result,___$1){
return (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [[cljs.core.str.cljs$core$IFn$_invoke$arity$1("end: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(self__.msg)].join('')], null);
});})(result,___$1))
,null)),null,1666071950);

try{var result__14684__auto__ = result;
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"debug","debug",-1608172596),"weathergen.falcon.files",null,24,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (result__14684__auto__,result,___$1){
return (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"result","result",-1239343558,null),"=>",result__14684__auto__], null);
});})(result__14684__auto__,result,___$1))
,null)),null,-2025455528);

return result__14684__auto__;
}catch (e34396){if((e34396 instanceof Error)){
var e__14646__auto__ = e34396;
taoensso.timbre._log_BANG_.call(null,taoensso.timbre._STAR_config_STAR_,new cljs.core.Keyword(null,"error","error",-978969032),"weathergen.falcon.files",null,24,new cljs.core.Keyword(null,"p","p",151049309),new cljs.core.Keyword(null,"auto","auto",-566279492),(new cljs.core.Delay(((function (e__14646__auto__,result,___$1){
return (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [e__14646__auto__], null);
});})(e__14646__auto__,result,___$1))
,null)),null,-341227175);

throw e__14646__auto__;
} else {
throw e34396;

}
}});

weathergen.falcon.files.t_weathergen$falcon$files34393.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"msg","msg",254428083,null),new cljs.core.Symbol(null,"spec","spec",1988051928,null),new cljs.core.Symbol(null,"meta34394","meta34394",1775188063,null)], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34393.cljs$lang$type = true;

weathergen.falcon.files.t_weathergen$falcon$files34393.cljs$lang$ctorStr = "weathergen.falcon.files/t_weathergen$falcon$files34393";

weathergen.falcon.files.t_weathergen$falcon$files34393.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34393");
});

weathergen.falcon.files.__GT_t_weathergen$falcon$files34393 = (function weathergen$falcon$files$read_trace_$___GT_t_weathergen$falcon$files34393(msg__$1,spec__$1,meta34394){
return (new weathergen.falcon.files.t_weathergen$falcon$files34393(msg__$1,spec__$1,meta34394));
});

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34393(msg,spec,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Length prefixed string
 */
weathergen.falcon.files.lstring = (function weathergen$falcon$files$lstring(length_spec){
var len_size = octet.core.size.call(null,length_spec);
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34401 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.IFn}
 * @implements {octet.spec.ISpecDynamicSize}
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34401 = (function (length_spec,len_size,meta34402){
this.length_spec = length_spec;
this.len_size = len_size;
this.meta34402 = meta34402;
this.cljs$lang$protocol_mask$partition0$ = 393217;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34401.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (len_size){
return (function (_34403,meta34402__$1){
var self__ = this;
var _34403__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34401(self__.length_spec,self__.len_size,meta34402__$1));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34401.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (len_size){
return (function (_34403){
var self__ = this;
var _34403__$1 = this;
return self__.meta34402;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34401.prototype.call = ((function (len_size){
return (function (self__){
var self__ = this;
var self____$1 = this;
var s = self____$1;
return s;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34401.prototype.apply = ((function (len_size){
return (function (self__,args34404){
var self__ = this;
var self____$1 = this;
return self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone.call(null,args34404)));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34401.prototype.cljs$core$IFn$_invoke$arity$0 = ((function (len_size){
return (function (){
var self__ = this;
var s = this;
return s;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34401.prototype.octet$spec$ISpecDynamicSize$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34401.prototype.octet$spec$ISpecDynamicSize$size_STAR_$arity$2 = ((function (len_size){
return (function (_,data){
var self__ = this;
var ___$1 = this;
var data__$1 = octet.spec.string.string__GT_bytes.call(null,data);
return (self__.len_size + cljs.core.count.call(null,data__$1));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34401.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34401.prototype.octet$spec$ISpec$read$arity$3 = ((function (len_size){
return (function (_,buff,pos){
var self__ = this;
var ___$1 = this;
var datasize = octet.core.read.call(null,buff,self__.length_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var data = octet.buffer.read_bytes.call(null,buff,(pos + self__.len_size),datasize);
var data__$1 = octet.spec.string.bytes__GT_string.call(null,data,datasize);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(datasize + self__.len_size),data__$1], null);
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34401.prototype.octet$spec$ISpec$write$arity$4 = ((function (len_size){
return (function (_,buff,pos,value){
var self__ = this;
var ___$1 = this;
var input = octet.spec.string.string__GT_bytes.call(null,value);
var length = cljs.core.count.call(null,input);
octet.core.write_BANG_.call(null,buff,self__.length_spec,pos,length);

octet.buffer.write_bytes.call(null,buff,(pos + self__.len_size),length,input);

return (length + self__.len_size);
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34401.getBasis = ((function (len_size){
return (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"length-spec","length-spec",-1802545726,null),new cljs.core.Symbol(null,"len-size","len-size",1194866842,null),new cljs.core.Symbol(null,"meta34402","meta34402",-1603297314,null)], null);
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34401.cljs$lang$type = true;

weathergen.falcon.files.t_weathergen$falcon$files34401.cljs$lang$ctorStr = "weathergen.falcon.files/t_weathergen$falcon$files34401";

weathergen.falcon.files.t_weathergen$falcon$files34401.cljs$lang$ctorPrWriter = ((function (len_size){
return (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34401");
});})(len_size))
;

weathergen.falcon.files.__GT_t_weathergen$falcon$files34401 = ((function (len_size){
return (function weathergen$falcon$files$lstring_$___GT_t_weathergen$falcon$files34401(length_spec__$1,len_size__$1,meta34402){
return (new weathergen.falcon.files.t_weathergen$falcon$files34401(length_spec__$1,len_size__$1,meta34402));
});})(len_size))
;

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34401(length_spec,len_size,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Returns `s` trimmed of any trailing null characters.
 */
weathergen.falcon.files.remove_trailing_nulls = (function weathergen$falcon$files$remove_trailing_nulls(s){
return cljs.core.subs.call(null,s,(0),cljs.core.count.call(null,cljs.core.take_while.call(null,(function (p1__34405_SHARP_){
return !((p1__34405_SHARP_.charCodeAt() === (0)));
}),s)));
});
/**
 * Octet spec for a string of a fixed size. Removes trailing null
 *   characters, if any, unline `buf/string`.
 */
weathergen.falcon.files.fixed_string = (function weathergen$falcon$files$fixed_string(size){
var spc = octet.core.string.call(null,size);
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34412 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
 * @implements {octet.spec.ISpecSize}
*/
weathergen.falcon.files.t_weathergen$falcon$files34412 = (function (size,spc,meta34413){
this.size = size;
this.spc = spc;
this.meta34413 = meta34413;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34412.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (spc){
return (function (_34414,meta34413__$1){
var self__ = this;
var _34414__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34412(self__.size,self__.spc,meta34413__$1));
});})(spc))
;

weathergen.falcon.files.t_weathergen$falcon$files34412.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (spc){
return (function (_34414){
var self__ = this;
var _34414__$1 = this;
return self__.meta34413;
});})(spc))
;

weathergen.falcon.files.t_weathergen$falcon$files34412.prototype.octet$spec$ISpecSize$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34412.prototype.octet$spec$ISpecSize$size$arity$1 = ((function (spc){
return (function (_){
var self__ = this;
var ___$1 = this;
return octet.core.size.call(null,self__.spc);
});})(spc))
;

weathergen.falcon.files.t_weathergen$falcon$files34412.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34412.prototype.octet$spec$ISpec$read$arity$3 = ((function (spc){
return (function (_,buff,pos){
var self__ = this;
var ___$1 = this;
var vec__34415 = octet.core.read_STAR_.call(null,buff,self__.spc,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var size__$1 = cljs.core.nth.call(null,vec__34415,(0),null);
var data = cljs.core.nth.call(null,vec__34415,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [size__$1,weathergen.falcon.files.remove_trailing_nulls.call(null,data)], null);
});})(spc))
;

weathergen.falcon.files.t_weathergen$falcon$files34412.prototype.octet$spec$ISpec$write$arity$4 = ((function (spc){
return (function (_,buff,pos,value){
var self__ = this;
var ___$1 = this;
return octet.core.write_BANG_.call(null,buff,self__.spc,value,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
});})(spc))
;

weathergen.falcon.files.t_weathergen$falcon$files34412.getBasis = ((function (spc){
return (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"size","size",-1555742762,null),new cljs.core.Symbol(null,"spc","spc",-189939168,null),new cljs.core.Symbol(null,"meta34413","meta34413",969473901,null)], null);
});})(spc))
;

weathergen.falcon.files.t_weathergen$falcon$files34412.cljs$lang$type = true;

weathergen.falcon.files.t_weathergen$falcon$files34412.cljs$lang$ctorStr = "weathergen.falcon.files/t_weathergen$falcon$files34412";

weathergen.falcon.files.t_weathergen$falcon$files34412.cljs$lang$ctorPrWriter = ((function (spc){
return (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34412");
});})(spc))
;

weathergen.falcon.files.__GT_t_weathergen$falcon$files34412 = ((function (spc){
return (function weathergen$falcon$files$fixed_string_$___GT_t_weathergen$falcon$files34412(size__$1,spc__$1,meta34413){
return (new weathergen.falcon.files.t_weathergen$falcon$files34412(size__$1,spc__$1,meta34413));
});})(spc))
;

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34412(size,spc,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Octet spec for a length prefixed array.
 */
weathergen.falcon.files.larray = (function weathergen$falcon$files$larray(length_spec,item_spec){
var len_size = octet.core.size.call(null,length_spec);
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34425 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {cljs.core.IFn}
 * @implements {octet.spec.ISpecDynamicSize}
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34425 = (function (length_spec,item_spec,len_size,meta34426){
this.length_spec = length_spec;
this.item_spec = item_spec;
this.len_size = len_size;
this.meta34426 = meta34426;
this.cljs$lang$protocol_mask$partition0$ = 393217;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34425.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (len_size){
return (function (_34427,meta34426__$1){
var self__ = this;
var _34427__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34425(self__.length_spec,self__.item_spec,self__.len_size,meta34426__$1));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34425.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (len_size){
return (function (_34427){
var self__ = this;
var _34427__$1 = this;
return self__.meta34426;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34425.prototype.call = ((function (len_size){
return (function (self__){
var self__ = this;
var self____$1 = this;
var s = self____$1;
return s;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34425.prototype.apply = ((function (len_size){
return (function (self__,args34428){
var self__ = this;
var self____$1 = this;
return self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone.call(null,args34428)));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34425.prototype.cljs$core$IFn$_invoke$arity$0 = ((function (len_size){
return (function (){
var self__ = this;
var s = this;
return s;
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34425.prototype.octet$spec$ISpecDynamicSize$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34425.prototype.octet$spec$ISpecDynamicSize$size_STAR_$arity$2 = ((function (len_size){
return (function (_,data){
var self__ = this;
var ___$1 = this;
return (self__.len_size + (octet.core.size.call(null,self__.item_spec) * cljs.core.count.call(null,data)));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34425.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34425.prototype.octet$spec$ISpec$read$arity$3 = ((function (len_size){
return (function (_,buff,pos){
var self__ = this;
var ___$1 = this;
var n = octet.core.read.call(null,buff,self__.length_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var vec__34429 = octet.core.read_STAR_.call(null,buff,octet.core.repeat.call(null,n,self__.item_spec),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(pos + self__.len_size)], null));
var datasize = cljs.core.nth.call(null,vec__34429,(0),null);
var data = cljs.core.nth.call(null,vec__34429,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(datasize + self__.len_size),data], null);
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34425.prototype.octet$spec$ISpec$write$arity$4 = ((function (len_size){
return (function (_,buff,pos,value){
var self__ = this;
var ___$1 = this;
var n = cljs.core.count.call(null,value);
return (octet.core.write_BANG_.call(null,buff,n,self__.length_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null)) + octet.core.write_BANG_.call(null,buff,value,octet.core.repeat.call(null,n,self__.item_spec),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(pos + self__.len_size)], null)));
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34425.getBasis = ((function (len_size){
return (function (){
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"length-spec","length-spec",-1802545726,null),new cljs.core.Symbol(null,"item-spec","item-spec",1394678941,null),new cljs.core.Symbol(null,"len-size","len-size",1194866842,null),new cljs.core.Symbol(null,"meta34426","meta34426",1052311993,null)], null);
});})(len_size))
;

weathergen.falcon.files.t_weathergen$falcon$files34425.cljs$lang$type = true;

weathergen.falcon.files.t_weathergen$falcon$files34425.cljs$lang$ctorStr = "weathergen.falcon.files/t_weathergen$falcon$files34425";

weathergen.falcon.files.t_weathergen$falcon$files34425.cljs$lang$ctorPrWriter = ((function (len_size){
return (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34425");
});})(len_size))
;

weathergen.falcon.files.__GT_t_weathergen$falcon$files34425 = ((function (len_size){
return (function weathergen$falcon$files$larray_$___GT_t_weathergen$falcon$files34425(length_spec__$1,item_spec__$1,len_size__$1,meta34426){
return (new weathergen.falcon.files.t_weathergen$falcon$files34425(length_spec__$1,item_spec__$1,len_size__$1,meta34426));
});})(len_size))
;

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34425(length_spec,item_spec,len_size,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Returns a spec that decodes from read values via the mapping in m.
 */
weathergen.falcon.files.enum$ = (function weathergen$falcon$files$enum(item_spec,m){
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34438 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
 * @implements {octet.spec.ISpecSize}
*/
weathergen.falcon.files.t_weathergen$falcon$files34438 = (function (item_spec,m,meta34439){
this.item_spec = item_spec;
this.m = m;
this.meta34439 = meta34439;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34438.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34440,meta34439__$1){
var self__ = this;
var _34440__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34438(self__.item_spec,self__.m,meta34439__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34438.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34440){
var self__ = this;
var _34440__$1 = this;
return self__.meta34439;
});

weathergen.falcon.files.t_weathergen$falcon$files34438.prototype.octet$spec$ISpecSize$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34438.prototype.octet$spec$ISpecSize$size$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return octet.core.size.call(null,self__.item_spec);
});

weathergen.falcon.files.t_weathergen$falcon$files34438.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34438.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34441 = octet.core.read_STAR_.call(null,buf,self__.item_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var datasize = cljs.core.nth.call(null,vec__34441,(0),null);
var val = cljs.core.nth.call(null,vec__34441,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [datasize,self__.m.call(null,val,val)], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34438.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"item-spec","item-spec",1394678941,null),new cljs.core.Symbol(null,"m","m",-1021758608,null),new cljs.core.Symbol(null,"meta34439","meta34439",-1519530653,null)], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34438.cljs$lang$type = true;

weathergen.falcon.files.t_weathergen$falcon$files34438.cljs$lang$ctorStr = "weathergen.falcon.files/t_weathergen$falcon$files34438";

weathergen.falcon.files.t_weathergen$falcon$files34438.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34438");
});

weathergen.falcon.files.__GT_t_weathergen$falcon$files34438 = (function weathergen$falcon$files$enum_$___GT_t_weathergen$falcon$files34438(item_spec__$1,m__$1,meta34439){
return (new weathergen.falcon.files.t_weathergen$falcon$files34438(item_spec__$1,m__$1,meta34439));
});

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34438(item_spec,m,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Returns a spec that decodes from a read value into a set of bits
 *   based on the mapping in m.
 */
weathergen.falcon.files.bitflags = (function weathergen$falcon$files$bitflags(item_spec,m){
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34466 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34466 = (function (item_spec,m,meta34467){
this.item_spec = item_spec;
this.m = m;
this.meta34467 = meta34467;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34466.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34468,meta34467__$1){
var self__ = this;
var _34468__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34466(self__.item_spec,self__.m,meta34467__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34466.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34468){
var self__ = this;
var _34468__$1 = this;
return self__.meta34467;
});

weathergen.falcon.files.t_weathergen$falcon$files34466.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34466.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34469 = octet.core.read_STAR_.call(null,buf,self__.item_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var datasize = cljs.core.nth.call(null,vec__34469,(0),null);
var val = cljs.core.nth.call(null,vec__34469,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [datasize,cljs.core.set.call(null,cljs.core.remove.call(null,cljs.core.nil_QMARK_,(function (){var iter__24010__auto__ = ((function (vec__34469,datasize,val,___$1){
return (function weathergen$falcon$files$bitflags_$_iter__34472(s__34473){
return (new cljs.core.LazySeq(null,((function (vec__34469,datasize,val,___$1){
return (function (){
var s__34473__$1 = s__34473;
while(true){
var temp__5278__auto__ = cljs.core.seq.call(null,s__34473__$1);
if(temp__5278__auto__){
var s__34473__$2 = temp__5278__auto__;
if(cljs.core.chunked_seq_QMARK_.call(null,s__34473__$2)){
var c__24008__auto__ = cljs.core.chunk_first.call(null,s__34473__$2);
var size__24009__auto__ = cljs.core.count.call(null,c__24008__auto__);
var b__34475 = cljs.core.chunk_buffer.call(null,size__24009__auto__);
if((function (){var i__34474 = (0);
while(true){
if((i__34474 < size__24009__auto__)){
var vec__34482 = cljs.core._nth.call(null,c__24008__auto__,i__34474);
var flag = cljs.core.nth.call(null,vec__34482,(0),null);
var mask = cljs.core.nth.call(null,vec__34482,(1),null);
cljs.core.chunk_append.call(null,b__34475,(cljs.core.truth_(weathergen.util.has_flag_QMARK_.call(null,val,mask))?flag:null));

var G__34488 = (i__34474 + (1));
i__34474 = G__34488;
continue;
} else {
return true;
}
break;
}
})()){
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__34475),weathergen$falcon$files$bitflags_$_iter__34472.call(null,cljs.core.chunk_rest.call(null,s__34473__$2)));
} else {
return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__34475),null);
}
} else {
var vec__34485 = cljs.core.first.call(null,s__34473__$2);
var flag = cljs.core.nth.call(null,vec__34485,(0),null);
var mask = cljs.core.nth.call(null,vec__34485,(1),null);
return cljs.core.cons.call(null,(cljs.core.truth_(weathergen.util.has_flag_QMARK_.call(null,val,mask))?flag:null),weathergen$falcon$files$bitflags_$_iter__34472.call(null,cljs.core.rest.call(null,s__34473__$2)));
}
} else {
return null;
}
break;
}
});})(vec__34469,datasize,val,___$1))
,null,null));
});})(vec__34469,datasize,val,___$1))
;
return iter__24010__auto__.call(null,self__.m);
})()))], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34466.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"item-spec","item-spec",1394678941,null),new cljs.core.Symbol(null,"m","m",-1021758608,null),new cljs.core.Symbol(null,"meta34467","meta34467",591632901,null)], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34466.cljs$lang$type = true;

weathergen.falcon.files.t_weathergen$falcon$files34466.cljs$lang$ctorStr = "weathergen.falcon.files/t_weathergen$falcon$files34466";

weathergen.falcon.files.t_weathergen$falcon$files34466.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34466");
});

weathergen.falcon.files.__GT_t_weathergen$falcon$files34466 = (function weathergen$falcon$files$bitflags_$___GT_t_weathergen$falcon$files34466(item_spec__$1,m__$1,meta34467){
return (new weathergen.falcon.files.t_weathergen$falcon$files34466(item_spec__$1,m__$1,meta34467));
});

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34466(item_spec,m,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Returns a spec that consumes and produces no data, but reads a
 *   constant value.
 */
weathergen.falcon.files.constant = (function weathergen$falcon$files$constant(val){
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34492 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34492 = (function (val,meta34493){
this.val = val;
this.meta34493 = meta34493;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34492.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34494,meta34493__$1){
var self__ = this;
var _34494__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34492(self__.val,meta34493__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34492.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34494){
var self__ = this;
var _34494__$1 = this;
return self__.meta34493;
});

weathergen.falcon.files.t_weathergen$falcon$files34492.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34492.prototype.octet$spec$ISpec$read$arity$3 = (function (_,___$1,___$2){
var self__ = this;
var ___$3 = this;
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),self__.val], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34492.prototype.octet$spec$ISpec$write$arity$4 = (function (_,___$1,___$2,___$3){
var self__ = this;
var ___$4 = this;
return null;
});

weathergen.falcon.files.t_weathergen$falcon$files34492.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,"meta34493","meta34493",1285443517,null)], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34492.cljs$lang$type = true;

weathergen.falcon.files.t_weathergen$falcon$files34492.cljs$lang$ctorStr = "weathergen.falcon.files/t_weathergen$falcon$files34492";

weathergen.falcon.files.t_weathergen$falcon$files34492.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34492");
});

weathergen.falcon.files.__GT_t_weathergen$falcon$files34492 = (function weathergen$falcon$files$constant_$___GT_t_weathergen$falcon$files34492(val__$1,meta34493){
return (new weathergen.falcon.files.t_weathergen$falcon$files34492(val__$1,meta34493));
});

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34492(val,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Read thread operator. Composes a read against multiple (potentially
 *   dynamically determined) specs passing the accumulated read value in
 *   turn through spec-fns, each a function from the accumulator to a
 *   spec.
 */
weathergen.falcon.files.read__GT_ = (function weathergen$falcon$files$read__GT_(var_args){
var args__24376__auto__ = [];
var len__24369__auto___34511 = arguments.length;
var i__24370__auto___34512 = (0);
while(true){
if((i__24370__auto___34512 < len__24369__auto___34511)){
args__24376__auto__.push((arguments[i__24370__auto___34512]));

var G__34513 = (i__24370__auto___34512 + (1));
i__24370__auto___34512 = G__34513;
continue;
} else {
}
break;
}

var argseq__24377__auto__ = ((((2) < args__24376__auto__.length))?(new cljs.core.IndexedSeq(args__24376__auto__.slice((2)),(0),null)):null);
return weathergen.falcon.files.read__GT_.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__24377__auto__);
});

weathergen.falcon.files.read__GT_.cljs$core$IFn$_invoke$arity$variadic = (function (buf,offset,spec_fns){
var size = (0);
var data = cljs.core.PersistentArrayMap.EMPTY;
var G__34501 = spec_fns;
var vec__34502 = G__34501;
var seq__34503 = cljs.core.seq.call(null,vec__34502);
var first__34504 = cljs.core.first.call(null,seq__34503);
var seq__34503__$1 = cljs.core.next.call(null,seq__34503);
var spec_fn = first__34504;
var more = seq__34503__$1;
var size__$1 = size;
var data__$1 = data;
var G__34501__$1 = G__34501;
while(true){
var size__$2 = size__$1;
var data__$2 = data__$1;
var vec__34505 = G__34501__$1;
var seq__34506 = cljs.core.seq.call(null,vec__34505);
var first__34507 = cljs.core.first.call(null,seq__34506);
var seq__34506__$1 = cljs.core.next.call(null,seq__34506);
var spec_fn__$1 = first__34507;
var more__$1 = seq__34506__$1;
if(cljs.core.not.call(null,spec_fn__$1)){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [size__$2,data__$2], null);
} else {
var vec__34508 = octet.core.read_STAR_.call(null,buf,spec_fn__$1.call(null,data__$2),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(offset + size__$2)], null));
var size_STAR_ = cljs.core.nth.call(null,vec__34508,(0),null);
var data_STAR_ = cljs.core.nth.call(null,vec__34508,(1),null);
var G__34514 = (size__$2 + size_STAR_);
var G__34515 = cljs.core.merge.call(null,data__$2,data_STAR_);
var G__34516 = more__$1;
size__$1 = G__34514;
data__$1 = G__34515;
G__34501__$1 = G__34516;
continue;
}
break;
}
});

weathergen.falcon.files.read__GT_.cljs$lang$maxFixedArity = (2);

weathergen.falcon.files.read__GT_.cljs$lang$applyTo = (function (seq34495){
var G__34496 = cljs.core.first.call(null,seq34495);
var seq34495__$1 = cljs.core.next.call(null,seq34495);
var G__34497 = cljs.core.first.call(null,seq34495__$1);
var seq34495__$2 = cljs.core.next.call(null,seq34495__$1);
return weathergen.falcon.files.read__GT_.cljs$core$IFn$_invoke$arity$variadic(G__34496,G__34497,seq34495__$2);
});

/**
 * Returns a spec that conditionally reads/write a map. It first reads
 *   `flag-spec`, then passes the value to `flag-pred`. Depending on the
 *   value returned, either reads `true-spec` or `false-spec`. Read
 *   values are returned under keys `flag-key` and `branch-key`.
 */
weathergen.falcon.files.spec_if = (function weathergen$falcon$files$spec_if(flag_key,flag_spec,flag_pred,branch_key,true_spec,false_spec){
if(typeof weathergen.falcon.files.t_weathergen$falcon$files34526 !== 'undefined'){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
weathergen.falcon.files.t_weathergen$falcon$files34526 = (function (flag_key,flag_spec,flag_pred,branch_key,true_spec,false_spec,meta34527){
this.flag_key = flag_key;
this.flag_spec = flag_spec;
this.flag_pred = flag_pred;
this.branch_key = branch_key;
this.true_spec = true_spec;
this.false_spec = false_spec;
this.meta34527 = meta34527;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
weathergen.falcon.files.t_weathergen$falcon$files34526.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_34528,meta34527__$1){
var self__ = this;
var _34528__$1 = this;
return (new weathergen.falcon.files.t_weathergen$falcon$files34526(self__.flag_key,self__.flag_spec,self__.flag_pred,self__.branch_key,self__.true_spec,self__.false_spec,meta34527__$1));
});

weathergen.falcon.files.t_weathergen$falcon$files34526.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_34528){
var self__ = this;
var _34528__$1 = this;
return self__.meta34527;
});

weathergen.falcon.files.t_weathergen$falcon$files34526.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

weathergen.falcon.files.t_weathergen$falcon$files34526.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buf,pos){
var self__ = this;
var ___$1 = this;
var vec__34529 = octet.core.read_STAR_.call(null,buf,self__.flag_spec,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),pos], null));
var flag_size = cljs.core.nth.call(null,vec__34529,(0),null);
var flag_val = cljs.core.nth.call(null,vec__34529,(1),null);
var vec__34532 = octet.core.read_STAR_.call(null,buf,(cljs.core.truth_(self__.flag_pred.call(null,flag_val))?self__.true_spec:self__.false_spec),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"offset","offset",296498311),(pos + flag_size)], null));
var branch_size = cljs.core.nth.call(null,vec__34532,(0),null);
var branch_val = cljs.core.nth.call(null,vec__34532,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(flag_size + branch_size),cljs.core.PersistentHashMap.fromArrays([self__.flag_key,self__.branch_key],[flag_val,branch_val])], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34526.getBasis = (function (){
return new cljs.core.PersistentVector(null, 7, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"flag-key","flag-key",-1036087809,null),new cljs.core.Symbol(null,"flag-spec","flag-spec",-648358532,null),new cljs.core.Symbol(null,"flag-pred","flag-pred",-548885820,null),new cljs.core.Symbol(null,"branch-key","branch-key",1453905826,null),new cljs.core.Symbol(null,"true-spec","true-spec",-704610023,null),new cljs.core.Symbol(null,"false-spec","false-spec",432945414,null),new cljs.core.Symbol(null,"meta34527","meta34527",-1553329371,null)], null);
});

weathergen.falcon.files.t_weathergen$falcon$files34526.cljs$lang$type = true;

weathergen.falcon.files.t_weathergen$falcon$files34526.cljs$lang$ctorStr = "weathergen.falcon.files/t_weathergen$falcon$files34526";

weathergen.falcon.files.t_weathergen$falcon$files34526.cljs$lang$ctorPrWriter = (function (this__23805__auto__,writer__23806__auto__,opt__23807__auto__){
return cljs.core._write.call(null,writer__23806__auto__,"weathergen.falcon.files/t_weathergen$falcon$files34526");
});

weathergen.falcon.files.__GT_t_weathergen$falcon$files34526 = (function weathergen$falcon$files$spec_if_$___GT_t_weathergen$falcon$files34526(flag_key__$1,flag_spec__$1,flag_pred__$1,branch_key__$1,true_spec__$1,false_spec__$1,meta34527){
return (new weathergen.falcon.files.t_weathergen$falcon$files34526(flag_key__$1,flag_spec__$1,flag_pred__$1,branch_key__$1,true_spec__$1,false_spec__$1,meta34527));
});

}

return (new weathergen.falcon.files.t_weathergen$falcon$files34526(flag_key,flag_spec,flag_pred,branch_key,true_spec,false_spec,cljs.core.PersistentArrayMap.EMPTY));
});
