// Compiled by ClojureScript 1.10.520 {}
goog.provide('octet.spec.collections');
goog.require('cljs.core');
goog.require('octet.buffer');
goog.require('octet.spec');
/**
 * Create a arbitrary length (dynamic) array like
 *   typespec composition for `t` type.
 */
octet.spec.collections.vector_STAR_ = (function octet$spec$collections$vector_STAR_(t){
if((typeof octet !== 'undefined') && (typeof octet.spec !== 'undefined') && (typeof octet.spec.collections !== 'undefined') && (typeof octet.spec.collections.t_octet$spec$collections27548 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpecDynamicSize}
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
*/
octet.spec.collections.t_octet$spec$collections27548 = (function (t,meta27549){
this.t = t;
this.meta27549 = meta27549;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
octet.spec.collections.t_octet$spec$collections27548.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_27550,meta27549__$1){
var self__ = this;
var _27550__$1 = this;
return (new octet.spec.collections.t_octet$spec$collections27548(self__.t,meta27549__$1));
});

octet.spec.collections.t_octet$spec$collections27548.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_27550){
var self__ = this;
var _27550__$1 = this;
return self__.meta27549;
});

octet.spec.collections.t_octet$spec$collections27548.prototype.octet$spec$ISpecDynamicSize$ = cljs.core.PROTOCOL_SENTINEL;

octet.spec.collections.t_octet$spec$collections27548.prototype.octet$spec$ISpecDynamicSize$size_STAR_$arity$2 = (function (_,data){
var self__ = this;
var ___$1 = this;
return ((4) + cljs.core.reduce.call(null,((function (___$1){
return (function (p1__27546_SHARP_,p2__27547_SHARP_){
return (p1__27546_SHARP_ + (((((!((self__.t == null))))?((((false) || ((cljs.core.PROTOCOL_SENTINEL === self__.t.octet$spec$ISpecDynamicSize$))))?true:(((!self__.t.cljs$lang$protocol_mask$partition$))?cljs.core.native_satisfies_QMARK_.call(null,octet.spec.ISpecDynamicSize,self__.t):false)):cljs.core.native_satisfies_QMARK_.call(null,octet.spec.ISpecDynamicSize,self__.t)))?octet.spec.size_STAR_.call(null,self__.t,p2__27547_SHARP_):octet.spec.size.call(null,self__.t)));
});})(___$1))
,(0),data));
});

octet.spec.collections.t_octet$spec$collections27548.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

octet.spec.collections.t_octet$spec$collections27548.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buff,pos){
var self__ = this;
var ___$1 = this;
var nitems = octet.buffer.read_int.call(null,buff,pos);
var typespec = octet.spec.repeat.call(null,nitems,self__.t);
var vec__27552 = octet.spec.read.call(null,typespec,buff,(pos + (4)));
var readed = cljs.core.nth.call(null,vec__27552,(0),null);
var data = cljs.core.nth.call(null,vec__27552,(1),null);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(readed + (4)),data], null);
});

octet.spec.collections.t_octet$spec$collections27548.prototype.octet$spec$ISpec$write$arity$4 = (function (_,buff,pos,input){
var self__ = this;
var ___$1 = this;
var nitems = cljs.core.count.call(null,input);
var typespec = octet.spec.repeat.call(null,nitems,self__.t);
octet.buffer.write_int.call(null,buff,pos,nitems);

return ((4) + octet.spec.write.call(null,typespec,buff,(pos + (4)),input));
});

octet.spec.collections.t_octet$spec$collections27548.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"t","t",242699008,null),new cljs.core.Symbol(null,"meta27549","meta27549",-275042907,null)], null);
});

octet.spec.collections.t_octet$spec$collections27548.cljs$lang$type = true;

octet.spec.collections.t_octet$spec$collections27548.cljs$lang$ctorStr = "octet.spec.collections/t_octet$spec$collections27548";

octet.spec.collections.t_octet$spec$collections27548.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"octet.spec.collections/t_octet$spec$collections27548");
});

/**
 * Positional factory function for octet.spec.collections/t_octet$spec$collections27548.
 */
octet.spec.collections.__GT_t_octet$spec$collections27548 = (function octet$spec$collections$vector_STAR__$___GT_t_octet$spec$collections27548(t__$1,meta27549){
return (new octet.spec.collections.t_octet$spec$collections27548(t__$1,meta27549));
});

}

return (new octet.spec.collections.t_octet$spec$collections27548(t,cljs.core.PersistentArrayMap.EMPTY));
});
