/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/(function(a){functionb(a){returna&&a.Object===Object?a:null}varc={"function":!0,object:!0},d=c[typeofexports]&&exports&&!exports.nodeType?exports:null,e=c[typeofmodule]&&module&&!module.nodeType?module:null,f=b(d&&e&&"object"==typeofglobal&&global),g=b(c[typeofself]&&self),h=b(c[typeofwindow]&&window),i=(e&&e.exports===d?d:null,b(c[typeofthis]&&this)),j=f||h!==(i&&i.window)&&h||g||i||Function("return this")();"function"==typeofdefine&&define.amd?define(["./rx.lite"],function(b,c){returna(j,c,b)}):"object"==typeofmodule&&module&&module.exports===d?module.exports=a(j,module.exports,require("rx-lite")):j.Rx=a(j,{},j.Rx)}).call(this,function(a,b,c,d){functione(a){returnfunction(){try{returna.apply(this,arguments)}catch(b){returnC.e=b,C}}}functionf(a){if(0===a.length)thrownewz;returna[0]}functiong(a,b,c,d){vare=y(b,c,3);returnnewk(function(b){returna.subscribe(newda(b,a,e,d))},a)}varh=c.Observable,i=h.prototype,j=c.BinaryDisposable,k=c.AnonymousObservable,l=c.internals.AbstractObserver,m=c.Disposable.empty,n=c.helpers,o=n.defaultComparer,p=n.identity,q=n.defaultSubComparer,r=n.isFunction,s=n.isPromise,t=n.isArrayLike,u=n.isIterable,v=c.internals.inherits,w=h.fromPromise,x=h.from,y=c.internals.bindCallback,z=c.EmptyError,A=c.ObservableBase,B=c.ArgumentOutOfRangeError,C={e:{}},D=c.internals.tryCatch=function(a){if(!r(a))thrownewTypeError("fn must be a function");returne(a)},E=function(a){functionb(b,c,d){this.source=b,this._k=c,this._c=d,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newF(a,this._k,this._c))},b}(A),F=function(a){functionb(b,c,d){this._o=b,this._k=c,this._c=d,this._v=null,this._hv=!1,this._l=[],a.call(this)}returnv(b,a),b.prototype.next=function(a){varb=D(this._k)(a);if(b===C)returnthis._o.onError(b.e);varc=0;if(this._hv){if(c=D(this._c)(b,this._v),c===C)returnthis._o.onError(c.e)}elsethis._hv=!0,this._v=b;c>0&&(this._v=b,this._l=[]),c>=0&&this._l.push(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._l),this._o.onCompleted()},b}(l),G=function(a){functionb(b,c,d,e){this.source=b,this.accumulator=c,this.hasSeed=d,this.seed=e,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newH(a,this))},b}(A),H=function(a){functionb(b,c){this._o=b,this._p=c,this._fn=c.accumulator,this._hs=c.hasSeed,this._s=c.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){return!this._hv&&(this._hv=!0),this._ha?this._a=D(this._fn)(this._a,a,this._i,this._p):(this._a=this._hs?D(this._fn)(this._s,a,this._i,this._p):a,this._ha=!0),this._a===C?this._o.onError(this._a.e):voidthis._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv&&this._o.onNext(this._a),!this._hv&&this._hs&&this._o.onNext(this._s),!this._hv&&!this._hs&&this._o.onError(newz),this._o.onCompleted()},b}(l);i.reduce=function(){vara,b=!1,c=arguments[0];return2===arguments.length&&(b=!0,a=arguments[1]),newG(this,c,b,a)};varI=function(a){functionb(b,c){this.source=b,this._fn=c,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newJ(a,this._fn,this.source))},b}(A),J=function(a){functionb(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){varb=D(this._fn)(a,this._i++,this._s);returnb===C?this._o.onError(b.e):void(Boolean(b)&&(this._o.onNext(!0),this._o.onCompleted()))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},b}(l);i.some=function(a,b){varc=y(a,b,3);returnnewI(this,c)};varK=function(a){functionb(b){this.source=b,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newL(a))},b}(A),L=function(a){functionb(b){this._o=b,a.call(this)}returnv(b,a),b.prototype.next=function(){this._o.onNext(!1),this._o.onCompleted()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},b}(l);i.isEmpty=function(){returnnewK(this)};varM=function(a){functionb(b,c){this.source=b,this._fn=c,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newN(a,this._fn,this.source))},b}(A),N=function(a){functionb(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){varb=D(this._fn)(a,this._i++,this._s);returnb===C?this._o.onError(b.e):void(Boolean(b)||(this._o.onNext(!1),this._o.onCompleted()))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},b}(l);i.every=function(a,b){varc=y(a,b,3);returnnewM(this,c)};varO=function(a){functionb(b,c,d){vare=+d||0;Math.abs(e)===1/0&&(e=0),this.source=b,this._elem=c,this._n=e,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis._n<0?(a.onNext(!1),a.onCompleted(),m):this.source.subscribe(newP(a,this._elem,this._n))},b}(A),P=function(a){functionb(b,c,d){this._o=b,this._elem=c,this._n=d,this._i=0,a.call(this)}functionc(a,b){return0===a&&0===b||a===b||isNaN(a)&&isNaN(b)}returnv(b,a),b.prototype.next=function(a){this._i++>=this._n&&c(a,this._elem)&&(this._o.onNext(!0),this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},b}(l);i.includes=function(a,b){returnnewO(this,a,b)};varQ=function(a){functionb(b,c){this.source=b,this._fn=c,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newR(a,this._fn,this.source))},b}(A),R=function(a){functionb(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,this._c=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){if(this._fn){varb=D(this._fn)(a,this._i++,this._s);if(b===C)returnthis._o.onError(b.e);Boolean(b)&&this._c++}elsethis._c++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},b}(l);i.count=function(a,b){varc=y(a,b,3);returnnewQ(this,c)};varS=function(a){functionb(b,c,d){this.source=b,this._e=c,this._n=d,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis._n<0?(a.onNext(-1),a.onCompleted(),m):this.source.subscribe(newT(a,this._e,this._n))},b}(A),T=function(a){functionb(b,c,d){this._o=b,this._e=c,this._n=d,this._i=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){this._i>=this._n&&a===this._e&&(this._o.onNext(this._i),this._o.onCompleted()),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(-1),this._o.onCompleted()},b}(l);i.indexOf=function(a,b){varc=+b||0;returnMath.abs(c)===1/0&&(c=0),newS(this,a,c)};varU=function(a){functionb(b,c){this.source=b,this._fn=c,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newV(a,this._fn,this.source))},b}(A),V=function(a){functionb(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,this._c=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){if(this._fn){varb=D(this._fn)(a,this._i++,this._s);if(b===C)returnthis._o.onError(b.e);this._c+=b}elsethis._c+=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},b}(l);i.sum=function(a,b){varc=y(a,b,3);returnnewU(this,c)},i.minBy=function(a,b){returnb||(b=q),newE(this,a,function(a,c){return-1*b(a,c)})},i.min=function(a){returnthis.minBy(p,a).map(f)},i.maxBy=function(a,b){returnb||(b=q),newE(this,a,b)},i.max=function(a){returnthis.maxBy(p,a).map(f)};varW=function(a){functionb(b,c){this.source=b,this._fn=c,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newX(a,this._fn,this.source))},b}(A),X=function(a){functionb(b,c,d){this._o=b,this._fn=c,this._s=d,this._c=0,this._t=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){if(this._fn){varb=D(this._fn)(a,this._c++,this._s);if(b===C)returnthis._o.onError(b.e);this._t+=b}elsethis._c++,this._t+=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){return0===this._c?this._o.onError(newz):(this._o.onNext(this._t/this._c),voidthis._o.onCompleted())},b}(l);i.average=function(a,b){varc,d=this;returnr(a)&&(c=y(a,b,3)),newW(d,c)},i.sequenceEqual=function(a,b){varc=this;returnb||(b=o),newk(function(d){vare=!1,f=!1,g=[],h=[],i=c.subscribe(function(a){if(h.length>0){varc=h.shift(),e=D(b)(c,a);if(e===C)returnd.onError(e.e);e||(d.onNext(!1),d.onCompleted())}elsef?(d.onNext(!1),d.onCompleted()):g.push(a)},function(a){d.onError(a)},function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))});(t(a)||u(a))&&(a=x(a)),s(a)&&(a=w(a));vark=a.subscribe(function(a){if(g.length>0){varc=g.shift(),f=D(b)(c,a);if(f===C)returnd.onError(f.e);f||(d.onNext(!1),d.onCompleted())}elsee?(d.onNext(!1),d.onCompleted()):h.push(a)},function(a){d.onError(a)},function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});returnnewj(i,k)},c)};varY=function(a){functionb(b,c,d){this.source=b,this._i=c,this._d=d,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newZ(a,this._i,this._d))},b}(A),Z=function(a){functionb(b,c,d){this._o=b,this._i=c,this._d=d,a.call(this)}returnv(b,a),b.prototype.next=function(a){0===this._i--&&(this._o.onNext(a),this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._d===d?this._o.onError(newB):(this._o.onNext(this._d),this._o.onCompleted())},b}(l);i.elementAt=function(a,b){if(0>a)thrownewB;returnnewY(this,a,b)};var$=function(a){functionb(b,c,d){this._o=b,this._obj=c,this._s=d,this._i=0,this._hv=!1,this._v=null,a.call(this)}returnv(b,a),b.prototype.next=function(a){varb=!1;if(this._obj.predicate){varc=D(this._obj.predicate)(a,this._i++,this._s);if(c===C)returnthis._o.onError(c.e);Boolean(c)&&(b=!0)}elsethis._obj.predicate||(b=!0);if(b){if(this._hv)returnthis._o.onError(newError("Sequence contains more than one matching element"));this._hv=!0,this._v=a}},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===d?this._o.onError(newz):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},b}(l);i.single=function(a,b){varc={},d=this;if(c="object"==typeofarguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},r(c.predicate)){vare=c.predicate;c.predicate=y(e,c.thisArg,3)}returnnewk(function(a){returnd.subscribe(new$(a,c,d))},d)};var_=function(a){functionb(b,c){this.source=b,this._obj=c,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newaa(a,this._obj,this.source))},b}(A),aa=function(a){functionb(b,c,d){this._o=b,this._obj=c,this._s=d,this._i=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){if(this._obj.predicate){varb=D(this._obj.predicate)(a,this._i++,this._s);if(b===C)returnthis._o.onError(b.e);Boolean(b)&&(this._o.onNext(a),this._o.onCompleted())}elsethis._obj.predicate||(this._o.onNext(a),this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._obj.defaultValue===d?this._o.onError(newz):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},b}(l);i.first=function(){vara={};if(a="object"==typeofarguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},r(a.predicate)){varb=a.predicate;a.predicate=y(b,a.thisArg,3)}returnnew_(this,a)};varba=function(a){functionb(b,c){this.source=b,this._obj=c,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newca(a,this._obj,this.source))},b}(A),ca=function(a){functionb(b,c,d){this._o=b,this._obj=c,this._s=d,this._i=0,this._hv=!1,this._v=null,a.call(this)}returnv(b,a),b.prototype.next=function(a){varb=!1;if(this._obj.predicate){varc=D(this._obj.predicate)(a,this._i++,this._s);if(c===C)returnthis._o.onError(c.e);Boolean(c)&&(b=!0)}elsethis._obj.predicate||(b=!0);b&&(this._hv=!0,this._v=a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===d?this._o.onError(newz):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},b}(l);i.last=function(){vara={};if(a="object"==typeofarguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},r(a.predicate)){varb=a.predicate;a.predicate=y(b,a.thisArg,3)}returnnewba(this,a)};varda=function(a){functionb(b,c,d,e){this._o=b,this._s=c,this._cb=d,this._y=e,this._i=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){varb=D(this._cb)(a,this._i,this._s);returnb===C?this._o.onError(b.e):void(b?(this._o.onNext(this._y?this._i:a),this._o.onCompleted()):this._i++)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._y&&this._o.onNext(-1),this._o.onCompleted()},b}(l);i.find=function(a,b){returng(this,a,b,!1)},i.findIndex=function(a,b){returng(this,a,b,!0)};varea=function(a){functionb(b){this.source=b,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newfa(a))},b}(A),fa=function(b){functionc(c){this._o=c,this._s=newa.Set,b.call(this)}returnv(c,b),c.prototype.next=function(a){this._s.add(a)},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._o.onNext(this._s),this._o.onCompleted()},c}(l);i.toSet=function(){if("undefined"==typeofa.Set)thrownewTypeError;returnnewea(this)};varga=function(a){functionb(b,c,d){this.source=b,this._k=c,this._e=d,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newha(a,this._k,this._e))},b}(A),ha=function(b){functionc(c,d,e){this._o=c,this._k=d,this._e=e,this._m=newa.Map,b.call(this)}returnv(c,b),c.prototype.next=function(a){varb=D(this._k)(a);if(b===C)returnthis._o.onError(b.e);varc=a;returnthis._e&&(c=D(this._e)(a),c===C)?this._o.onError(c.e):voidthis._m.set(b,c)},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._o.onNext(this._m),this._o.onCompleted()},c}(l);i.toMap=function(b,c){if("undefined"==typeofa.Map)thrownewTypeError;returnnewga(this,b,c)};varia=function(a){functionb(b,c,d){this.source=b,this._b=c,this._e=d,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis.source.subscribe(newja(a,this._b,this._e))},b}(A),ja=function(a){functionb(b,c,d){this._o=b,this._b=c,this._e=d,this._i=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){this._i>=this._b&&(this._e===this._i?this._o.onCompleted():this._o.onNext(a)),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(l);i.slice=function(a,b){vard=a||0;if(0>d)thrownewc.ArgumentOutOfRangeError;if("number"==typeofb&&d>b)thrownewc.ArgumentOutOfRangeError;returnnewia(this,d,b)};varka=function(a){functionb(b,c,d){this.source=b,this._e=c,this._n=d,a.call(this)}returnv(b,a),b.prototype.subscribeCore=function(a){returnthis._n<0?(a.onNext(-1),a.onCompleted(),m):this.source.subscribe(newla(a,this._e,this._n))},b}(A),la=function(a){functionb(b,c,d){this._o=b,this._e=c,this._n=d,this._v=0,this._hv=!1,this._i=0,a.call(this)}returnv(b,a),b.prototype.next=function(a){this._i>=this._n&&a===this._e&&(this._hv=!0,this._v=this._i),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv?this._o.onNext(this._v):this._o.onNext(-1),this._o.onCompleted()},b}(l);returni.lastIndexOf=function(a,b){varc=+b||0;returnMath.abs(c)===1/0&&(c=0),newka(this,a,c)},c});//# sourceMappingURL=rx.lite.aggregates.map