rxjs-rails 2.3.11 → 2.3.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  /* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
2
- (function(a){function b(){if(this.isDisposed)throw new Error(P)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;kb.nonEnumArgs&&a.length&&h(a)&&(a=mb.call(a));var d=kb.enumPrototypes&&"function"==typeof a,e=kb.enumErrorProps&&(a===eb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(kb.nonEnumShadows&&a!==fb){var g=a.constructor,i=-1,j=ib.length;if(a===(g&&g.prototype))var k=a===stringProto?ab:a===eb?X:bb.call(a),l=jb[k];for(;++i<j;)f=ib[i],l&&l[f]||!cb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?bb.call(a)==T:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=bb.call(a),l=bb.call(b);if(k==T&&(k=$),l==T&&(l=$),k!=l)return!1;switch(k){case V:case W:return+a==+b;case Z:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case _:case ab:return a==String(b)}var m=k==U;if(!m){if(k!=$||!kb.nodeClass&&(g(a)||g(b)))return!1;var n=!kb.argsObject&&h(a)?Object:a.constructor,o=!kb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||cb.call(a,"constructor")&&cb.call(b,"constructor")||N(n)&&n instanceof n&&N(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0;if(result=!0,c.push(a),d.push(b),m){if(p=a.length,q=b.length,result=q==p)for(;q--;){var r=b[q];if(!(result=i(a[q],r,c,d)))break}}else f(b,function(b,e,f){return cb.call(f,e)?(q++,result=cb.call(a,e)&&i(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return cb.call(c,b)?result=--q>-1:void 0});return c.pop(),d.pop(),result}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:mb.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function n(a){return"number"==typeof a&&z.isFinite(a)}function o(b){return b[Q]!==a}function p(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function q(a){var b=+a.length;return isNaN(b)?0:0!==b&&n(b)?(b=p(b)*Math.floor(Math.abs(b)),0>=b?0:b>fc?fc:b):b}function r(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function s(a,b){return new pc(function(c){var d=new zb,e=new Ab;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}M(f)&&(f=cc(f)),d=new zb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new pc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?cc(e):e}).concatAll()}function v(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function w(a){this.comparer=a,this.set=[]}function x(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?cc(e):e}).mergeObservable()}var y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z=y[typeof window]&&window||this,A=y[typeof exports]&&exports&&!exports.nodeType&&exports,B=y[typeof module]&&module&&!module.nodeType&&module,C=B&&B.exports===A&&A,D=y[typeof global]&&global;!D||D.global!==D&&D.window!==D||(z=D);var E={internals:{},config:{Promise:z.Promise},helpers:{}},F=E.helpers.noop=function(){},G=(E.helpers.notDefined=function(a){return"undefined"==typeof a},E.helpers.isScheduler=function(a){return a instanceof E.Scheduler}),H=E.helpers.identity=function(a){return a},I=(E.helpers.pluck=function(a){return function(b){return b[a]}},E.helpers.just=function(a){return function(){return a}},E.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),J=E.helpers.defaultComparer=function(a,b){return lb(a,b)},K=E.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},L=(E.helpers.defaultKeySerializer=function(a){return a.toString()},E.helpers.defaultError=function(a){throw a}),M=E.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},N=(E.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},E.helpers.not=function(a){return!a},E.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==bb.call(a)}),a}()),O="Argument out of range",P="Object has been disposed",Q="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";z.Set&&"function"==typeof(new z.Set)["@@iterator"]&&(Q="@@iterator");var R=E.doneEnumerator={done:!0,value:a};E.iterator=Q;var S,T="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",X="[object Error]",Y="[object Function]",Z="[object Number]",$="[object Object]",_="[object RegExp]",ab="[object String]",bb=Object.prototype.toString,cb=Object.prototype.hasOwnProperty,db=bb.call(arguments)==T,eb=Error.prototype,fb=Object.prototype,gb=fb.propertyIsEnumerable;try{S=!(bb.call(document)==$&&!({toString:0}+""))}catch(hb){S=!0}var ib=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],jb={};jb[U]=jb[W]=jb[Z]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},jb[V]=jb[ab]={constructor:!0,toString:!0,valueOf:!0},jb[X]=jb[Y]=jb[_]={constructor:!0,toString:!0},jb[$]={constructor:!0};var kb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);kb.enumErrorProps=gb.call(eb,"message")||gb.call(eb,"name"),kb.enumPrototypes=gb.call(a,"prototype"),kb.nonEnumArgs=0!=c,kb.nonEnumShadows=!/valueOf/.test(b)}(1),db||(h=function(a){return a&&"object"==typeof a?cb.call(a,"callee"):!1});var lb=E.internals.isEqual=function(a,b){return i(a,b,[],[])},mb=Array.prototype.slice,nb=({}.hasOwnProperty,this.inherits=E.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),ob=E.internals.addProperties=function(a){for(var b=mb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},pb=E.internals.addRef=function(a,b){return new pc(function(c){return new ub(b.getDisposable(),a.subscribe(c))})};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=mb.call(arguments,1),d=function(){function e(){}if(this instanceof d){e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(mb.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(mb.call(arguments)))};return d}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=0;f>d;){var g;d in e&&(g=e[d],a.call(c,g,d,e)),d++}});var qb=Object("a"),rb="a"!=qb[0]||!(0 in qb);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=rb&&{}.toString.call(this)==ab?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=Y)throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(a){var b=Object(this),c=rb&&{}.toString.call(this)==ab?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=Y)throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){for(var b,c=[],d=new Object(this),e=0,f=d.length>>>0;f>e;e++)b=d[e],e in d&&a.call(arguments[1],b,e,d)&&c.push(b);return c}),Array.isArray||(Array.isArray=function(a){return{}.toString.call(a)==U}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&1/0!=d&&d!==-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var sb=E.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},tb=sb.prototype;tb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},tb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},tb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},tb.peek=function(){return this.items[0].value},tb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},tb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},tb.enqueue=function(a){var b=this.length++;this.items[b]=new l(sb.count++,a),this.percolate(b)},tb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},sb.count=0;var ub=E.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},vb=ub.prototype;vb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},vb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},vb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},vb.toArray=function(){return this.disposables.slice(0)};var wb=E.Disposable=function(a){this.isDisposed=!1,this.action=a||F};wb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var xb=wb.create=function(a){return new wb(a)},yb=wb.empty={dispose:F},zb=E.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Ab=E.SerialDisposable=zb,Bb=E.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?yb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Cb=E.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||K,this.disposable=new zb};Cb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Cb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Cb.prototype.isCancelled=function(){return this.disposable.isDisposed},Cb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Db=E.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),yb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=I,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Eb=Db.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new ub,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),yb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new ub,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),yb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Db.prototype),function(){Db.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Db.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof z.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=z.setInterval(function(){d=c(d)},b);return xb(function(){z.clearInterval(e)})}}(Db.prototype),function(a){a.catchError=a["catch"]=function(a){return new Mb(this,a)}}(Db.prototype);var Fb,Gb=(E.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new zb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Db.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Eb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Db(I,a,b,c)}()),Hb=Db.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Db.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Db.normalize(c),g=new Cb(this,b,d,f);if(e)e.enqueue(g);else{e=new sb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Db(I,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Ib=F,Jb=function(){var a,b=F;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!z.setTimeout)throw new Error("No concurrency detected!");a=z.setTimeout,b=z.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Kb=Jb.setTimeout,Lb=Jb.clearTimeout;!function(){function a(){if(!z.postMessage||z.importScripts)return!1;var a=!1,b=z.onmessage;return z.onmessage=function(){a=!0},z.postMessage("","*"),z.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(bb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=D&&C&&D.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=D&&C&&D.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Fb=process.nextTick;else if("function"==typeof d)Fb=d,Ib=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;z.addEventListener?z.addEventListener("message",b,!1):z.attachEvent("onmessage",b,!1),Fb=function(a){var b=h++;g[b]=a,z.postMessage(f+b,"*")}}else if(z.MessageChannel){var i=new z.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Fb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in z&&"onreadystatechange"in z.document.createElement("script")?Fb=function(a){var b=z.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},z.document.documentElement.appendChild(b)}:(Fb=function(a){return Kb(a,0)},Ib=Lb)}();var Mb=(Db.timeout=function(){function a(a,b){var c=this,d=new zb,e=Fb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new ub(d,xb(function(){Ib(e)}))}function b(a,b,c){var d=this,e=Db.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new zb,g=Kb(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new ub(f,xb(function(){Lb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Db(I,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return nb(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return yb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new zb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(Db)),Nb=E.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return G(a)||(a=Gb),new pc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Ob=Nb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Nb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Pb=Nb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Nb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Qb=Nb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Nb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Rb=E.internals.Enumerator=function(a){this._next=a};Rb.prototype.next=function(){return this._next()},Rb.prototype[Q]=function(){return this};var Sb=E.internals.Enumerable=function(a){this._iterator=a};Sb.prototype[Q]=function(){return this._iterator()},Sb.prototype.concat=function(){var a=this;return new pc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f=new Ab,g=Gb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;M(h)&&(h=cc(h));var i=new zb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new ub(f,g,xb(function(){e=!0}))})},Sb.prototype.catchException=function(){var a=this;return new pc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f,g=new Ab,h=Gb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;M(i)&&(i=cc(i));var j=new zb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new ub(g,h,xb(function(){e=!0}))})};var Tb=Sb.repeat=function(a,b){return null==b&&(b=-1),new Sb(function(){var c=b;return new Rb(function(){return 0===c?R:(c>0&&c--,{done:!1,value:a})})})},Ub=Sb.of=function(a,b,c){return b||(b=H),new Sb(function(){var d=-1;return new Rb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:R})})},Vb=E.Observer=function(){};Vb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Vb.prototype.asObserver=function(){return new Zb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Vb.prototype.checked=function(){return new $b(this)};var Wb=Vb.create=function(a,b,c){return a||(a=F),b||(b=L),c||(c=F),new Zb(a,b,c)};Vb.fromNotifier=function(a,b){return new Zb(function(c){return a.call(b,Ob(c))},function(c){return a.call(b,Pb(c))},function(){return a.call(b,Qb())})},Vb.notifyOn=function(a){return new ac(a,this)};var Xb,Yb=E.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return nb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Vb),Zb=E.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return nb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Yb),$b=function(a){function b(b){a.call(this),this._observer=b,this._state=0}nb(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(Vb),_b=E.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Ab}return nb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Yb),ac=function(a){function b(){a.apply(this,arguments)}return nb(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b}(_b),bc=E.Observable=function(){function a(a){this._subscribe=a}return Xb=a.prototype,Xb.subscribe=Xb.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Wb(a,b,c))},Xb.subscribeOnNext=function(a,b){return this._subscribe(Wb(2===arguments.length?function(c){a.call(b,c)}:a))},Xb.subscribeOnError=function(a,b){return this._subscribe(Wb(null,2===arguments.length?function(c){a.call(b,c)}:a))},Xb.subscribeOnCompleted=function(a,b){return this._subscribe(Wb(null,null,2===arguments.length?function(){a.call(b)}:a))},a}();Xb.observeOn=function(a){var b=this;return new pc(function(c){return b.subscribe(new ac(a,c))})},Xb.subscribeOn=function(a){var b=this;return new pc(function(c){var d=new zb,e=new Ab;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var cc=bc.fromPromise=function(a){return dc(function(){var b=new E.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};Xb.toPromise=function(a){if(a||(a=E.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},Xb.toArray=function(){var a=this;return new pc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},bc.create=bc.createWithDisposable=function(a){return new pc(a)};var dc=bc.defer=function(a){return new pc(function(b){var c;try{c=a()}catch(d){return jc(d).subscribe(b)}return M(c)&&(c=cc(c)),c.subscribe(b)})},ec=bc.empty=function(a){return G(a)||(a=Gb),new pc(function(b){return a.schedule(function(){b.onCompleted()})})},fc=Math.pow(2,53)-1;bc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!r(b))throw new Error("mapFn when provided must be a function");return G(d)||(d=Hb),new pc(function(e){var f=Object(a),g=o(f),h=g?0:q(f),i=g?f[Q]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&r(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};var gc=bc.fromArray=function(a,b){return G(b)||(b=Hb),new pc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};bc.generate=function(a,b,c,d,e){return G(e)||(e=Hb),new pc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})};var hc=bc.never=function(){return new pc(function(){return yb})};bc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return gc(b)};bc.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return gc(c,a)};bc.range=function(a,b,c){return G(c)||(c=Hb),new pc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},bc.repeat=function(a,b,c){return G(c)||(c=Hb),ic(a,c).repeat(null==b?-1:b)};var ic=bc["return"]=bc.returnValue=bc.just=function(a,b){return G(b)||(b=Gb),new pc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},jc=bc["throw"]=bc.throwException=bc.throwError=function(a,b){return G(b)||(b=Gb),new pc(function(c){return b.schedule(function(){c.onError(a)})})};bc.using=function(a,b){return new pc(function(c){var d,e,f=yb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new ub(jc(g).subscribe(c),f)}return new ub(e.subscribe(c),f)})},Xb.amb=function(a){var b=this;return new pc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new zb,j=new zb;return M(a)&&(a=cc(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new ub(i,j)})},bc.amb=function(){function a(a,b){return a.amb(b)}for(var b=hc(),c=j(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Xb["catch"]=Xb.catchError=Xb.catchException=function(a){return"function"==typeof a?s(this,a):kc([this,a])};var kc=bc.catchException=bc.catchError=bc["catch"]=function(){return Ub(j(arguments,0)).catchException()};Xb.combineLatest=function(){var a=mb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),lc.apply(this,a)};var lc=bc.combineLatest=function(){var a=mb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new pc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(H))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(H)&&c.onCompleted()}function e(a){j[a]=!0,j.every(H)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new zb;M(f)&&(f=cc(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new ub(m)})};Xb.concat=function(){var a=mb.call(arguments,0);return a.unshift(this),mc.apply(this,a)};var mc=bc.concat=function(){return Ub(j(arguments,0)).concat()};Xb.concatObservable=Xb.concatAll=function(){return this.merge(1)},Xb.merge=function(a){if("number"!=typeof a)return nc(this,a);var b=this;return new pc(function(c){function d(a){var b=new zb;f.add(b),M(a)&&(a=cc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new ub,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var nc=bc.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=mb.call(arguments,1)):(a=Gb,b=mb.call(arguments,0)):(a=Gb,b=mb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),gc(b,a).mergeObservable()};Xb.mergeObservable=Xb.mergeAll=function(){var a=this;return new pc(function(b){var c=new ub,d=!1,e=new zb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new zb;c.add(e),M(a)&&(a=cc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Xb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return oc([this,a])};var oc=bc.onErrorResumeNext=function(){var a=j(arguments,0);return new pc(function(b){var c=0,d=new Ab,e=Gb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],M(f)&&(f=cc(f)),g=new zb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()
3
- });return new ub(d,e)})};Xb.skipUntil=function(a){var b=this;return new pc(function(c){var d=!1,e=new ub(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));M(a)&&(a=cc(a));var f=new zb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Xb["switch"]=Xb.switchLatest=function(){var a=this;return new pc(function(b){var c=!1,d=new Ab,e=!1,f=0,g=a.subscribe(function(a){var g=new zb,h=++f;c=!0,d.setDisposable(g),M(a)&&(a=cc(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new ub(g,d)})},Xb.takeUntil=function(a){var b=this;return new pc(function(c){return M(a)&&(a=cc(a)),new ub(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),F))})},Xb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=mb.call(arguments),c=b.pop();return b.unshift(a),new pc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(H)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new zb;M(c)&&(c=cc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new ub(j)})},bc.zip=function(){var a=mb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},bc.zipArray=function(){var a=j(arguments,0);return new pc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(H))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(H)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new zb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new ub(h);return j.add(xb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Xb.asObservable=function(){return new pc(this.subscribe.bind(this))},Xb.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},Xb.dematerialize=function(){var a=this;return new pc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Xb.distinctUntilChanged=function(a,b){var c=this;return a||(a=H),b||(b=J),new pc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Xb["do"]=Xb.doAction=Xb.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new pc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})})},Xb.doOnNext=Xb.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},Xb.doOnError=Xb.tapOnError=function(a,b){return this.tap(F,2===arguments.length?function(c){a.call(b,c)}:a)},Xb.doOnCompleted=Xb.tapOnCompleted=function(a,b){return this.tap(F,null,2===arguments.length?function(){a.call(b)}:a)},Xb["finally"]=Xb.finallyAction=function(a){var b=this;return new pc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return xb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Xb.ignoreElements=function(){var a=this;return new pc(function(b){return a.subscribe(F,b.onError.bind(b),b.onCompleted.bind(b))})},Xb.materialize=function(){var a=this;return new pc(function(b){return a.subscribe(function(a){b.onNext(Ob(a))},function(a){b.onNext(Pb(a)),b.onCompleted()},function(){b.onNext(Qb()),b.onCompleted()})})},Xb.repeat=function(a){return Tb(this,a).concat()},Xb.retry=function(a){return Tb(this,a).catchException()},Xb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new pc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Xb.skipLast=function(a){var b=this;return new pc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Xb.startWith=function(){var a,b,c=0;return arguments.length&&G(arguments[0])?(b=arguments[0],c=1):b=Gb,a=mb.call(arguments,c),Ub([gc(a,b),this]).concat()},Xb.takeLast=function(a){var b=this;return new pc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},Xb.takeLastBuffer=function(a){var b=this;return new pc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Xb.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(O);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(O);return new pc(function(d){function e(){var a=new sc;i.push(a),d.onNext(pb(a,g))}var f=new zb,g=new Bb(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g})},Xb.selectConcat=Xb.concatMap=function(a,b,c){return b?this.concatMap(function(c,d){var e=a(c,d),f=M(e)?cc(e):e;return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?u(this,a,c):u(this,function(){return a})},Xb.concatMapObserver=Xb.selectConcatObserver=function(a,b,c,d){var e=this;return new pc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=cc(a)),f.onNext(a),f.onCompleted()})}).concatAll()},Xb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new pc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},w.prototype.push=function(a){var b=-1===v(this.set,a,this.comparer);return b&&this.set.push(a),b},Xb.distinct=function(a,b){var c=this;return b||(b=J),new pc(function(d){var e=new w(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.select=Xb.map=function(a,b){var c=this;return new pc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.pluck=function(a){return this.map(function(b){return b[a]})},Xb.selectMany=Xb.flatMap=function(a,b,c){return b?this.flatMap(function(c,d){var e=a(c,d),f=M(e)?cc(e):e;return f.map(function(a){return b(c,a,d)})},c):"function"==typeof a?x(this,a,c):x(this,function(){return a})},Xb.flatMapObserver=Xb.selectManyObserver=function(a,b,c,d){var e=this;return new pc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=cc(a)),f.onNext(a),f.onCompleted()})}).mergeAll()},Xb.selectSwitch=Xb.flatMapLatest=Xb.switchMap=function(a,b){return this.select(a,b).switchLatest()},Xb.skip=function(a){if(0>a)throw new Error(O);var b=this;return new pc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Xb.skipWhile=function(a,b){var c=this;return new pc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.take=function(a,b){if(0>a)throw new RangeError(O);if(0===a)return ec(b);var c=this;return new pc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Xb.takeWhile=function(a,b){var c=this;return new pc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.where=Xb.filter=function(a,b){var c=this;return new pc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.exclusive=function(){var a=this;return new pc(function(b){var c=!1,d=!1,e=new zb,f=new ub;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,M(a)&&(a=cc(a));var e=new zb;f.add(e),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){f.remove(e),c=!1,d&&1===f.length&&b.onCompleted()}))}},b.onError.bind(b),function(){d=!0,c||1!==f.length||b.onCompleted()})),f})},Xb.exclusiveMap=function(a,b){var c=this;return new pc(function(d){var e=0,f=!1,g=!0,h=new zb,i=new ub;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new zb,i.add(innerSubscription),M(c)&&(c=cc(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var pc=E.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?xb(a):yb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new qc(a);return Hb.scheduleRequired()?Hb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return nb(c,a),c}(bc),qc=function(a){function b(b){a.call(this),this.observer=b,this.m=new zb}nb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Yb),rc=function(a,b){this.subject=a,this.observer=b};rc.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var sc=E.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),yb):(a.onCompleted(),yb):(this.observers.push(a),new rc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return nb(d,a),ob(d.prototype,Vb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new tc(a,b)},d}(bc),tc=(E.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new rc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),yb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return nb(d,a),ob(d.prototype,Vb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(bc),E.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return nb(b,a),ob(b.prototype,Vb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(bc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(z.Rx=E,define(function(){return E})):A&&B?C?(B.exports=E).Rx=E:A.Rx=E:z.Rx=E}).call(this);
2
+ (function(a){function b(){if(this.isDisposed)throw new Error(P)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;kb.nonEnumArgs&&a.length&&h(a)&&(a=mb.call(a));var d=kb.enumPrototypes&&"function"==typeof a,e=kb.enumErrorProps&&(a===eb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(kb.nonEnumShadows&&a!==fb){var g=a.constructor,i=-1,j=ib.length;if(a===(g&&g.prototype))var k=a===stringProto?ab:a===eb?X:bb.call(a),l=jb[k];for(;++i<j;)f=ib[i],l&&l[f]||!cb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?bb.call(a)==T:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=bb.call(a),l=bb.call(b);if(k==T&&(k=$),l==T&&(l=$),k!=l)return!1;switch(k){case V:case W:return+a==+b;case Z:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case _:case ab:return a==String(b)}var m=k==U;if(!m){if(k!=$||!kb.nodeClass&&(g(a)||g(b)))return!1;var n=!kb.argsObject&&h(a)?Object:a.constructor,o=!kb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||cb.call(a,"constructor")&&cb.call(b,"constructor")||N(n)&&n instanceof n&&N(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0,r=!0;if(c.push(a),d.push(b),m){if(p=a.length,q=b.length,r=q==p)for(;q--;){var s=b[q];if(!(r=i(a[q],s,c,d)))break}}else f(b,function(b,e,f){return cb.call(f,e)?(q++,r=cb.call(a,e)&&i(a[e],b,c,d)):void 0}),r&&f(a,function(a,b,c){return cb.call(c,b)?r=--q>-1:void 0});return c.pop(),d.pop(),r}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:mb.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function n(a){return"number"==typeof a&&z.isFinite(a)}function o(b){return b[Q]!==a}function p(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function q(a){var b=+a.length;return isNaN(b)?0:0!==b&&n(b)?(b=p(b)*Math.floor(Math.abs(b)),0>=b?0:b>fc?fc:b):b}function r(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function s(a,b){return new qc(function(c){var d=new zb,e=new Ab;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}M(f)&&(f=cc(f)),d=new zb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new qc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return M(f)&&(f=cc(f)),(Array.isArray(f)||o(f))&&(f=gc(f)),f}).concatAll()}function v(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function w(a){this.comparer=a,this.set=[]}function x(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return M(f)&&(f=cc(f)),(Array.isArray(f)||o(f))&&(f=gc(f)),f}).mergeObservable()}var y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z=y[typeof window]&&window||this,A=y[typeof exports]&&exports&&!exports.nodeType&&exports,B=y[typeof module]&&module&&!module.nodeType&&module,C=B&&B.exports===A&&A,D=y[typeof global]&&global;!D||D.global!==D&&D.window!==D||(z=D);var E={internals:{},config:{Promise:z.Promise},helpers:{}},F=E.helpers.noop=function(){},G=(E.helpers.notDefined=function(a){return"undefined"==typeof a},E.helpers.isScheduler=function(a){return a instanceof E.Scheduler}),H=E.helpers.identity=function(a){return a},I=(E.helpers.pluck=function(a){return function(b){return b[a]}},E.helpers.just=function(a){return function(){return a}},E.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),J=E.helpers.defaultComparer=function(a,b){return lb(a,b)},K=E.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},L=(E.helpers.defaultKeySerializer=function(a){return a.toString()},E.helpers.defaultError=function(a){throw a}),M=E.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},N=(E.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},E.helpers.not=function(a){return!a},E.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==bb.call(a)}),a}()),O="Argument out of range",P="Object has been disposed",Q="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";z.Set&&"function"==typeof(new z.Set)["@@iterator"]&&(Q="@@iterator");var R=E.doneEnumerator={done:!0,value:a};E.iterator=Q;var S,T="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",X="[object Error]",Y="[object Function]",Z="[object Number]",$="[object Object]",_="[object RegExp]",ab="[object String]",bb=Object.prototype.toString,cb=Object.prototype.hasOwnProperty,db=bb.call(arguments)==T,eb=Error.prototype,fb=Object.prototype,gb=fb.propertyIsEnumerable;try{S=!(bb.call(document)==$&&!({toString:0}+""))}catch(hb){S=!0}var ib=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],jb={};jb[U]=jb[W]=jb[Z]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},jb[V]=jb[ab]={constructor:!0,toString:!0,valueOf:!0},jb[X]=jb[Y]=jb[_]={constructor:!0,toString:!0},jb[$]={constructor:!0};var kb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);kb.enumErrorProps=gb.call(eb,"message")||gb.call(eb,"name"),kb.enumPrototypes=gb.call(a,"prototype"),kb.nonEnumArgs=0!=c,kb.nonEnumShadows=!/valueOf/.test(b)}(1),db||(h=function(a){return a&&"object"==typeof a?cb.call(a,"callee"):!1});var lb=E.internals.isEqual=function(a,b){return i(a,b,[],[])},mb=Array.prototype.slice,nb=({}.hasOwnProperty,this.inherits=E.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),ob=E.internals.addProperties=function(a){for(var b=mb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},pb=E.internals.addRef=function(a,b){return new qc(function(c){return new ub(b.getDisposable(),a.subscribe(c))})};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=mb.call(arguments,1),d=function(){function e(){}if(this instanceof d){e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(mb.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(mb.call(arguments)))};return d}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=0;f>d;){var g;d in e&&(g=e[d],a.call(c,g,d,e)),d++}});var qb=Object("a"),rb="a"!=qb[0]||!(0 in qb);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=rb&&{}.toString.call(this)==ab?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=Y)throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(a){var b=Object(this),c=rb&&{}.toString.call(this)==ab?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=Y)throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){for(var b,c=[],d=new Object(this),e=0,f=d.length>>>0;f>e;e++)b=d[e],e in d&&a.call(arguments[1],b,e,d)&&c.push(b);return c}),Array.isArray||(Array.isArray=function(a){return{}.toString.call(a)==U}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&1/0!=d&&d!==-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var sb=E.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},tb=sb.prototype;tb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},tb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},tb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},tb.peek=function(){return this.items[0].value},tb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},tb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},tb.enqueue=function(a){var b=this.length++;this.items[b]=new l(sb.count++,a),this.percolate(b)},tb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},sb.count=0;var ub=E.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},vb=ub.prototype;vb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},vb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},vb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},vb.toArray=function(){return this.disposables.slice(0)};var wb=E.Disposable=function(a){this.isDisposed=!1,this.action=a||F};wb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var xb=wb.create=function(a){return new wb(a)},yb=wb.empty={dispose:F},zb=E.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Ab=E.SerialDisposable=zb,Bb=E.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?yb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Cb=E.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||K,this.disposable=new zb};Cb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Cb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Cb.prototype.isCancelled=function(){return this.disposable.isDisposed},Cb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Db=E.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),yb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=I,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Eb=Db.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new ub,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),yb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new ub,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),yb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Db.prototype),function(){Db.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Db.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof z.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=z.setInterval(function(){d=c(d)},b);return xb(function(){z.clearInterval(e)})}}(Db.prototype),function(a){a.catchError=a["catch"]=function(a){return new Mb(this,a)}}(Db.prototype);var Fb,Gb=(E.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new zb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Db.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Eb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Db(I,a,b,c)}()),Hb=Db.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Db.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Db.normalize(c),g=new Cb(this,b,d,f);if(e)e.enqueue(g);else{e=new sb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Db(I,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Ib=F,Jb=function(){var a,b=F;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!z.setTimeout)throw new Error("No concurrency detected!");a=z.setTimeout,b=z.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Kb=Jb.setTimeout,Lb=Jb.clearTimeout;!function(){function a(){if(!z.postMessage||z.importScripts)return!1;var a=!1,b=z.onmessage;return z.onmessage=function(){a=!0},z.postMessage("","*"),z.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(bb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=D&&C&&D.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=D&&C&&D.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Fb=process.nextTick;else if("function"==typeof d)Fb=d,Ib=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;z.addEventListener?z.addEventListener("message",b,!1):z.attachEvent("onmessage",b,!1),Fb=function(a){var b=h++;g[b]=a,z.postMessage(f+b,"*")}}else if(z.MessageChannel){var i=new z.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Fb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in z&&"onreadystatechange"in z.document.createElement("script")?Fb=function(a){var b=z.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},z.document.documentElement.appendChild(b)}:(Fb=function(a){return Kb(a,0)},Ib=Lb)}();var Mb=(Db.timeout=function(){function a(a,b){var c=this,d=new zb,e=Fb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new ub(d,xb(function(){Ib(e)}))}function b(a,b,c){var d=this,e=Db.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new zb,g=Kb(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new ub(f,xb(function(){Lb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Db(I,a,b,c)}(),function(a){function b(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function c(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function d(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function e(e,f){this._scheduler=e,this._handler=f,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,this._scheduler.now.bind(this._scheduler),b,c,d)}return nb(e,a),e.prototype._clone=function(a){return new e(a,this._handler)},e.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return yb}}},e.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},e.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new zb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},e}(Db)),Nb=E.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return G(a)||(a=Gb),new qc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Ob=Nb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Nb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Pb=Nb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Nb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Qb=Nb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Nb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Rb=E.internals.Enumerator=function(a){this._next=a};Rb.prototype.next=function(){return this._next()},Rb.prototype[Q]=function(){return this};var Sb=E.internals.Enumerable=function(a){this._iterator=a};Sb.prototype[Q]=function(){return this._iterator()},Sb.prototype.concat=function(){var a=this;return new qc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f=new Ab,g=Gb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;M(h)&&(h=cc(h));var i=new zb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new ub(f,g,xb(function(){e=!0}))})},Sb.prototype.catchException=function(){var a=this;return new qc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f,g=new Ab,h=Gb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;M(i)&&(i=cc(i));var j=new zb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new ub(g,h,xb(function(){e=!0}))})};var Tb=Sb.repeat=function(a,b){return null==b&&(b=-1),new Sb(function(){var c=b;return new Rb(function(){return 0===c?R:(c>0&&c--,{done:!1,value:a})})})},Ub=Sb.of=function(a,b,c){return b||(b=H),new Sb(function(){var d=-1;return new Rb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:R})})},Vb=E.Observer=function(){};Vb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Vb.prototype.asObserver=function(){return new Zb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Vb.prototype.checked=function(){return new $b(this)};var Wb=Vb.create=function(a,b,c){return a||(a=F),b||(b=L),c||(c=F),new Zb(a,b,c)};Vb.fromNotifier=function(a,b){return new Zb(function(c){return a.call(b,Ob(c))},function(c){return a.call(b,Pb(c))},function(){return a.call(b,Qb())})},Vb.notifyOn=function(a){return new ac(a,this)};var Xb,Yb=E.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return nb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Vb),Zb=E.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return nb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Yb),$b=function(a){function b(b){a.call(this),this._observer=b,this._state=0}nb(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(Vb),_b=E.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Ab}return nb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Yb),ac=function(a){function b(){a.apply(this,arguments)}return nb(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b}(_b),bc=E.Observable=function(){function a(a){this._subscribe=a}return Xb=a.prototype,Xb.subscribe=Xb.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Wb(a,b,c))},Xb.subscribeOnNext=function(a,b){return this._subscribe(Wb(2===arguments.length?function(c){a.call(b,c)}:a))},Xb.subscribeOnError=function(a,b){return this._subscribe(Wb(null,2===arguments.length?function(c){a.call(b,c)}:a))},Xb.subscribeOnCompleted=function(a,b){return this._subscribe(Wb(null,null,2===arguments.length?function(){a.call(b)}:a))},a}();Xb.observeOn=function(a){var b=this;return new qc(function(c){return b.subscribe(new ac(a,c))})},Xb.subscribeOn=function(a){var b=this;return new qc(function(c){var d=new zb,e=new Ab;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var cc=bc.fromPromise=function(a){return dc(function(){var b=new E.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};Xb.toPromise=function(a){if(a||(a=E.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},Xb.toArray=function(){var a=this;return new qc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},bc.create=bc.createWithDisposable=function(a){return new qc(a)};var dc=bc.defer=function(a){return new qc(function(b){var c;try{c=a()}catch(d){return kc(d).subscribe(b)}return M(c)&&(c=cc(c)),c.subscribe(b)})},ec=bc.empty=function(a){return G(a)||(a=Gb),new qc(function(b){return a.schedule(function(){b.onCompleted()})})},fc=Math.pow(2,53)-1,gc=bc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!r(b))throw new Error("mapFn when provided must be a function");return G(d)||(d=Hb),new qc(function(e){var f=Object(a),g=o(f),h=g?0:q(f),i=g?f[Q]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k;try{k=i.next()}catch(l){return void e.onError(l)}if(k.done)return void e.onCompleted();d=k.value}else d=f.charAt?f.charAt(j):f[j];if(b&&r(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})},hc=bc.fromArray=function(a,b){return G(b)||(b=Hb),new qc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};bc.generate=function(a,b,c,d,e){return G(e)||(e=Hb),new qc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})};var ic=bc.never=function(){return new qc(function(){return yb})};bc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return hc(b)};bc.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return hc(c,a)};bc.range=function(a,b,c){return G(c)||(c=Hb),new qc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},bc.repeat=function(a,b,c){return G(c)||(c=Hb),jc(a,c).repeat(null==b?-1:b)};var jc=bc["return"]=bc.returnValue=bc.just=function(a,b){return G(b)||(b=Gb),new qc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},kc=bc["throw"]=bc.throwException=bc.throwError=function(a,b){return G(b)||(b=Gb),new qc(function(c){return b.schedule(function(){c.onError(a)})})};bc.using=function(a,b){return new qc(function(c){var d,e,f=yb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new ub(kc(g).subscribe(c),f)}return new ub(e.subscribe(c),f)})},Xb.amb=function(a){var b=this;return new qc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new zb,j=new zb;return M(a)&&(a=cc(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new ub(i,j)})},bc.amb=function(){function a(a,b){return a.amb(b)}for(var b=ic(),c=j(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Xb["catch"]=Xb.catchError=Xb.catchException=function(a){return"function"==typeof a?s(this,a):lc([this,a])};var lc=bc.catchException=bc.catchError=bc["catch"]=function(){return Ub(j(arguments,0)).catchException()};Xb.combineLatest=function(){var a=mb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),mc.apply(this,a)};var mc=bc.combineLatest=function(){var a=mb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new qc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(H))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(H)&&c.onCompleted()}function e(a){j[a]=!0,j.every(H)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new zb;M(f)&&(f=cc(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new ub(m)})};Xb.concat=function(){var a=mb.call(arguments,0);return a.unshift(this),nc.apply(this,a)};var nc=bc.concat=function(){return Ub(j(arguments,0)).concat()};Xb.concatObservable=Xb.concatAll=function(){return this.merge(1)},Xb.merge=function(a){if("number"!=typeof a)return oc(this,a);var b=this;return new qc(function(c){function d(a){var b=new zb;f.add(b),M(a)&&(a=cc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new ub,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var oc=bc.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=mb.call(arguments,1)):(a=Gb,b=mb.call(arguments,0)):(a=Gb,b=mb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),hc(b,a).mergeObservable()};Xb.mergeObservable=Xb.mergeAll=function(){var a=this;return new qc(function(b){var c=new ub,d=!1,e=new zb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new zb;c.add(e),M(a)&&(a=cc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Xb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return pc([this,a])};var pc=bc.onErrorResumeNext=function(){var a=j(arguments,0);
3
+ return new qc(function(b){var c=0,d=new Ab,e=Gb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],M(f)&&(f=cc(f)),g=new zb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new ub(d,e)})};Xb.skipUntil=function(a){var b=this;return new qc(function(c){var d=!1,e=new ub(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));M(a)&&(a=cc(a));var f=new zb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Xb["switch"]=Xb.switchLatest=function(){var a=this;return new qc(function(b){var c=!1,d=new Ab,e=!1,f=0,g=a.subscribe(function(a){var g=new zb,h=++f;c=!0,d.setDisposable(g),M(a)&&(a=cc(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new ub(g,d)})},Xb.takeUntil=function(a){var b=this;return new qc(function(c){return M(a)&&(a=cc(a)),new ub(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),F))})},Xb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=mb.call(arguments),c=b.pop();return b.unshift(a),new qc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(H)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new zb;M(c)&&(c=cc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new ub(j)})},bc.zip=function(){var a=mb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},bc.zipArray=function(){var a=j(arguments,0);return new qc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(H))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(H)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new zb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new ub(h);return j.add(xb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Xb.asObservable=function(){return new qc(this.subscribe.bind(this))},Xb.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},Xb.dematerialize=function(){var a=this;return new qc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Xb.distinctUntilChanged=function(a,b){var c=this;return a||(a=H),b||(b=J),new qc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Xb["do"]=Xb.doAction=Xb.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new qc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})})},Xb.doOnNext=Xb.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},Xb.doOnError=Xb.tapOnError=function(a,b){return this.tap(F,2===arguments.length?function(c){a.call(b,c)}:a)},Xb.doOnCompleted=Xb.tapOnCompleted=function(a,b){return this.tap(F,null,2===arguments.length?function(){a.call(b)}:a)},Xb["finally"]=Xb.finallyAction=function(a){var b=this;return new qc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return xb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Xb.ignoreElements=function(){var a=this;return new qc(function(b){return a.subscribe(F,b.onError.bind(b),b.onCompleted.bind(b))})},Xb.materialize=function(){var a=this;return new qc(function(b){return a.subscribe(function(a){b.onNext(Ob(a))},function(a){b.onNext(Pb(a)),b.onCompleted()},function(){b.onNext(Qb()),b.onCompleted()})})},Xb.repeat=function(a){return Tb(this,a).concat()},Xb.retry=function(a){return Tb(this,a).catchException()},Xb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new qc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Xb.skipLast=function(a){var b=this;return new qc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Xb.startWith=function(){var a,b,c=0;return arguments.length&&G(arguments[0])?(b=arguments[0],c=1):b=Gb,a=mb.call(arguments,c),Ub([hc(a,b),this]).concat()},Xb.takeLast=function(a){var b=this;return new qc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},Xb.takeLastBuffer=function(a){var b=this;return new qc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Xb.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(O);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(O);return new qc(function(d){function e(){var a=new tc;i.push(a),d.onNext(pb(a,g))}var f=new zb,g=new Bb(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g})},Xb.selectConcat=Xb.concatMap=function(a,b,c){return"function"==typeof a&&"function"==typeof b?this.concatMap(function(c,d){var e=a(c,d);return M(e)&&(e=cc(e)),(Array.isArray(e)||o(e))&&(e=gc(e)),e.map(function(a,e){return b(c,a,d,e)})}):"function"==typeof a?u(this,a,c):u(this,function(){return a})},Xb.concatMapObserver=Xb.selectConcatObserver=function(a,b,c,d){var e=this;return new qc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=cc(a)),f.onNext(a),f.onCompleted()})}).concatAll()},Xb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new qc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},w.prototype.push=function(a){var b=-1===v(this.set,a,this.comparer);return b&&this.set.push(a),b},Xb.distinct=function(a,b){var c=this;return b||(b=J),new qc(function(d){var e=new w(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.select=Xb.map=function(a,b){var c=this;return new qc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.pluck=function(a){return this.map(function(b){return b[a]})},Xb.selectMany=Xb.flatMap=function(a,b,c){return"function"==typeof a&&"function"==typeof b?this.flatMap(function(c,d){var e=a(c,d);return M(e)&&(e=cc(e)),(Array.isArray(e)||o(e))&&(e=gc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):"function"==typeof a?x(this,a,c):x(this,function(){return a})},Xb.flatMapObserver=Xb.selectManyObserver=function(a,b,c,d){var e=this;return new qc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=cc(a)),f.onNext(a),f.onCompleted()})}).mergeAll()},Xb.selectSwitch=Xb.flatMapLatest=Xb.switchMap=function(a,b){return this.select(a,b).switchLatest()},Xb.skip=function(a){if(0>a)throw new Error(O);var b=this;return new qc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Xb.skipWhile=function(a,b){var c=this;return new qc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.take=function(a,b){if(0>a)throw new RangeError(O);if(0===a)return ec(b);var c=this;return new qc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Xb.takeWhile=function(a,b){var c=this;return new qc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.where=Xb.filter=function(a,b){var c=this;return new qc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.transduce=function(a){function b(a){return{init:function(){return a},step:function(a,b){return a.onNext(b)},result:function(a){return a.onCompleted()}}}var c=this;return new qc(function(d){var e=a(b(d));return c.subscribe(function(a){try{e.step(d,a)}catch(b){d.onError(b)}},d.onError.bind(d),function(){e.result(d)})})};var qc=E.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?xb(a):yb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new rc(a);return Hb.scheduleRequired()?Hb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return nb(c,a),c}(bc),rc=function(a){function b(b){a.call(this),this.observer=b,this.m=new zb}nb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Yb),sc=function(a,b){this.subject=a,this.observer=b};sc.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var tc=E.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),yb):(a.onCompleted(),yb):(this.observers.push(a),new sc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return nb(d,a),ob(d.prototype,Vb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new uc(a,b)},d}(bc),uc=(E.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new sc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),yb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return nb(d,a),ob(d.prototype,Vb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(bc),E.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return nb(b,a),ob(b.prototype,Vb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(bc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(z.Rx=E,define(function(){return E})):A&&B?C?(B.exports=E).Rx=E:A.Rx=E:z.Rx=E}).call(this);
4
4
  //# sourceMappingURL=rx.compat.map
@@ -461,5 +461,117 @@
461
461
 
462
462
  }(Observable));
463
463
 
464
+ /*
465
+ * Performs a exclusive waiting for the first to finish before subscribing to another observable.
466
+ * Observables that come in between subscriptions will be dropped on the floor.
467
+ * @returns {Observable} A exclusive observable with only the results that happen when subscribed.
468
+ */
469
+ observableProto.exclusive = function () {
470
+ var sources = this;
471
+ return new AnonymousObservable(function (observer) {
472
+ var hasCurrent = false,
473
+ isStopped = false,
474
+ m = new SingleAssignmentDisposable(),
475
+ g = new CompositeDisposable();
476
+
477
+ g.add(m);
478
+
479
+ m.setDisposable(sources.subscribe(
480
+ function (innerSource) {
481
+ if (!hasCurrent) {
482
+ hasCurrent = true;
483
+
484
+ isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
485
+
486
+ var innerSubscription = new SingleAssignmentDisposable();
487
+ g.add(innerSubscription);
488
+
489
+ innerSubscription.setDisposable(innerSource.subscribe(
490
+ observer.onNext.bind(observer),
491
+ observer.onError.bind(observer),
492
+ function () {
493
+ g.remove(innerSubscription);
494
+ hasCurrent = false;
495
+ if (isStopped && g.length === 1) {
496
+ observer.onCompleted();
497
+ }
498
+ }));
499
+ }
500
+ },
501
+ observer.onError.bind(observer),
502
+ function () {
503
+ isStopped = true;
504
+ if (!hasCurrent && g.length === 1) {
505
+ observer.onCompleted();
506
+ }
507
+ }));
508
+
509
+ return g;
510
+ });
511
+ };
512
+
513
+ /*
514
+ * Performs a exclusive map waiting for the first to finish before subscribing to another observable.
515
+ * Observables that come in between subscriptions will be dropped on the floor.
516
+ * @param {Function} selector Selector to invoke for every item in the current subscription.
517
+ * @param {Any} [thisArg] An optional context to invoke with the selector parameter.
518
+ * @returns {Observable} An exclusive observable with only the results that happen when subscribed.
519
+ */
520
+ observableProto.exclusiveMap = function (selector, thisArg) {
521
+ var sources = this;
522
+ return new AnonymousObservable(function (observer) {
523
+ var index = 0,
524
+ hasCurrent = false,
525
+ isStopped = true,
526
+ m = new SingleAssignmentDisposable(),
527
+ g = new CompositeDisposable();
528
+
529
+ g.add(m);
530
+
531
+ m.setDisposable(sources.subscribe(
532
+ function (innerSource) {
533
+
534
+ if (!hasCurrent) {
535
+ hasCurrent = true;
536
+
537
+ innerSubscription = new SingleAssignmentDisposable();
538
+ g.add(innerSubscription);
539
+
540
+ isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
541
+
542
+ innerSubscription.setDisposable(innerSource.subscribe(
543
+ function (x) {
544
+ var result;
545
+ try {
546
+ result = selector.call(thisArg, x, index++, innerSource);
547
+ } catch (e) {
548
+ observer.onError(e);
549
+ return;
550
+ }
551
+
552
+ observer.onNext(result);
553
+ },
554
+ observer.onError.bind(observer),
555
+ function () {
556
+ g.remove(innerSubscription);
557
+ hasCurrent = false;
558
+
559
+ if (isStopped && g.length === 1) {
560
+ observer.onCompleted();
561
+ }
562
+ }));
563
+ }
564
+ },
565
+ observer.onError.bind(observer),
566
+ function () {
567
+ isStopped = true;
568
+ if (g.length === 1 && !hasCurrent) {
569
+ observer.onCompleted();
570
+ }
571
+ }));
572
+ return g;
573
+ });
574
+ };
575
+
464
576
  return Rx;
465
577
  }));
@@ -1,3 +1,3 @@
1
1
  /* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
2
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:v.call(a)}function f(a,b){return new r(function(){return new q(function(){return a()?{done:!1,value:b}:{done:!0,value:d}})})}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=g.concat,k=g.defer,l=g.empty,m=c.Disposable.empty,n=c.CompositeDisposable,o=c.SerialDisposable,p=c.SingleAssignmentDisposable,q=c.internals.Enumerator,r=c.internals.Enumerable,s=r.of,t=c.Scheduler.immediate,u=c.Scheduler.currentThread,v=Array.prototype.slice,w=c.AsyncSubject,x=c.Observer,y=c.internals.inherits,z=c.internals.addProperties,A=c.helpers,B=A.noop,C=A.isPromise,D=A.isScheduler,E=g.fromPromise,F="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";a.Set&&"function"==typeof(new a.Set)["@@iterator"]&&(F="@@iterator");c.doneEnumerator={done:!0,value:d};c.iterator=F,h.letBind=h.let=function(a){return a(this)},g["if"]=g.ifThen=function(a,b,c){return k(function(){return c||(c=l()),C(b)&&(b=E(b)),C(c)&&(c=E(c)),"function"==typeof c.now&&(c=l(c)),a()?b:c})},g["for"]=g.forIn=function(a,b,c){return s(a,b,c).concat()};var G=g["while"]=g.whileDo=function(a,b){return C(b)&&(b=E(b)),f(a,b).concat()};h.doWhile=function(a){return j([this,G(a,this)])},g["case"]=g.switchCase=function(a,b,c){return k(function(){C(c)&&(c=E(c)),c||(c=l()),"function"==typeof c.now&&(c=l(c));var d=b[a()];return C(d)&&(d=E(d)),d||c})},h.expand=function(a,b){D(b)||(b=t);var c=this;return new i(function(d){var e=[],f=new o,g=new n(f),h=0,i=!1,j=function(){var c=!1;e.length>0&&(c=!i,i=!0),c&&f.setDisposable(b.scheduleRecursive(function(b){var c;if(!(e.length>0))return void(i=!1);c=e.shift();var f=new p;g.add(f),f.setDisposable(c.subscribe(function(b){d.onNext(b);var c=null;try{c=a(b)}catch(f){d.onError(f)}e.push(c),h++,j()},d.onError.bind(d),function(){g.remove(f),h--,0===h&&d.onCompleted()})),b()}))};return e.push(c),h++,j(),g})},g.forkJoin=function(){var a=e(arguments,0);return new i(function(b){var c=a.length;if(0===c)return b.onCompleted(),m;for(var d=new n,e=!1,f=new Array(c),g=new Array(c),h=new Array(c),i=0;c>i;i++)!function(i){var j=a[i];C(j)&&(j=E(j)),d.add(j.subscribe(function(a){e||(f[i]=!0,h[i]=a)},function(a){e=!0,b.onError(a),d.dispose()},function(){if(!e){if(!f[i])return void b.onCompleted();g[i]=!0;for(var a=0;c>a;a++)if(!g[a])return;e=!0,b.onNext(h),b.onCompleted()}}))}(i);return d})},h.forkJoin=function(a,b){var c=this;return new i(function(d){var e,f,g=!1,h=!1,i=!1,j=!1,k=new p,l=new p;return C(a)&&(a=E(a)),k.setDisposable(c.subscribe(function(a){i=!0,e=a},function(a){l.dispose(),d.onError(a)},function(){if(g=!0,h)if(i)if(j){var a;try{a=b(e,f)}catch(c){return void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),l.setDisposable(a.subscribe(function(a){j=!0,f=a},function(a){k.dispose(),d.onError(a)},function(){if(h=!0,g)if(i)if(j){var a;try{a=b(e,f)}catch(c){return void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),new n(k,l)})},h.manySelect=function(a,b){D(b)||(b=t);var c=this;return k(function(){var d;return c.map(function(a){var b=new H(a);return d&&d.onNext(a),d=b,b}).tap(B,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).map(a)})};var H=function(a){function b(a){var b=this,c=new n;return c.add(u.schedule(function(){a.onNext(b.head),c.add(b.tail.mergeObservable().subscribe(a))})),c}function c(c){a.call(this,b),this.head=c,this.tail=new w}return y(c,a),z(c.prototype,x,{onCompleted:function(){this.onNext(g.empty())},onError:function(a){this.onNext(g.throwException(a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),c}(g);return c});
2
+ (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:v.call(a)}function f(a,b){return new r(function(){return new q(function(){return a()?{done:!1,value:b}:{done:!0,value:d}})})}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=g.concat,k=g.defer,l=g.empty,m=c.Disposable.empty,n=c.CompositeDisposable,o=c.SerialDisposable,p=c.SingleAssignmentDisposable,q=c.internals.Enumerator,r=c.internals.Enumerable,s=r.of,t=c.Scheduler.immediate,u=c.Scheduler.currentThread,v=Array.prototype.slice,w=c.AsyncSubject,x=c.Observer,y=c.internals.inherits,z=c.internals.addProperties,A=c.helpers,B=A.noop,C=A.isPromise,D=A.isScheduler,E=g.fromPromise,F="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";a.Set&&"function"==typeof(new a.Set)["@@iterator"]&&(F="@@iterator");c.doneEnumerator={done:!0,value:d};c.iterator=F,h.letBind=h.let=function(a){return a(this)},g["if"]=g.ifThen=function(a,b,c){return k(function(){return c||(c=l()),C(b)&&(b=E(b)),C(c)&&(c=E(c)),"function"==typeof c.now&&(c=l(c)),a()?b:c})},g["for"]=g.forIn=function(a,b,c){return s(a,b,c).concat()};var G=g["while"]=g.whileDo=function(a,b){return C(b)&&(b=E(b)),f(a,b).concat()};h.doWhile=function(a){return j([this,G(a,this)])},g["case"]=g.switchCase=function(a,b,c){return k(function(){C(c)&&(c=E(c)),c||(c=l()),"function"==typeof c.now&&(c=l(c));var d=b[a()];return C(d)&&(d=E(d)),d||c})},h.expand=function(a,b){D(b)||(b=t);var c=this;return new i(function(d){var e=[],f=new o,g=new n(f),h=0,i=!1,j=function(){var c=!1;e.length>0&&(c=!i,i=!0),c&&f.setDisposable(b.scheduleRecursive(function(b){var c;if(!(e.length>0))return void(i=!1);c=e.shift();var f=new p;g.add(f),f.setDisposable(c.subscribe(function(b){d.onNext(b);var c=null;try{c=a(b)}catch(f){d.onError(f)}e.push(c),h++,j()},d.onError.bind(d),function(){g.remove(f),h--,0===h&&d.onCompleted()})),b()}))};return e.push(c),h++,j(),g})},g.forkJoin=function(){var a=e(arguments,0);return new i(function(b){var c=a.length;if(0===c)return b.onCompleted(),m;for(var d=new n,e=!1,f=new Array(c),g=new Array(c),h=new Array(c),i=0;c>i;i++)!function(i){var j=a[i];C(j)&&(j=E(j)),d.add(j.subscribe(function(a){e||(f[i]=!0,h[i]=a)},function(a){e=!0,b.onError(a),d.dispose()},function(){if(!e){if(!f[i])return void b.onCompleted();g[i]=!0;for(var a=0;c>a;a++)if(!g[a])return;e=!0,b.onNext(h),b.onCompleted()}}))}(i);return d})},h.forkJoin=function(a,b){var c=this;return new i(function(d){var e,f,g=!1,h=!1,i=!1,j=!1,k=new p,l=new p;return C(a)&&(a=E(a)),k.setDisposable(c.subscribe(function(a){i=!0,e=a},function(a){l.dispose(),d.onError(a)},function(){if(g=!0,h)if(i)if(j){var a;try{a=b(e,f)}catch(c){return void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),l.setDisposable(a.subscribe(function(a){j=!0,f=a},function(a){k.dispose(),d.onError(a)},function(){if(h=!0,g)if(i)if(j){var a;try{a=b(e,f)}catch(c){return void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),new n(k,l)})},h.manySelect=function(a,b){D(b)||(b=t);var c=this;return k(function(){var d;return c.map(function(a){var b=new H(a);return d&&d.onNext(a),d=b,b}).tap(B,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).map(a)})};var H=function(a){function b(a){var b=this,c=new n;return c.add(u.schedule(function(){a.onNext(b.head),c.add(b.tail.mergeObservable().subscribe(a))})),c}function c(c){a.call(this,b),this.head=c,this.tail=new w}return y(c,a),z(c.prototype,x,{onCompleted:function(){this.onNext(g.empty())},onError:function(a){this.onNext(g.throwException(a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),c}(g);return h.exclusive=function(){var a=this;return new i(function(b){var c=!1,d=!1,e=new p,f=new n;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,C(a)&&(a=E(a));var e=new p;f.add(e),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){f.remove(e),c=!1,d&&1===f.length&&b.onCompleted()}))}},b.onError.bind(b),function(){d=!0,c||1!==f.length||b.onCompleted()})),f})},h.exclusiveMap=function(a,b){var c=this;return new i(function(d){var e=0,f=!1,g=!0,h=new p,i=new n;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new p,i.add(innerSubscription),C(c)&&(c=E(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})},c});
3
3
  //# sourceMappingURL=rx.experimental.map