forked from Reactive-Extensions/RxJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrx.min.js
More file actions
4 lines (4 loc) · 44.7 KB
/
Copy pathrx.min.js
File metadata and controls
4 lines (4 loc) · 44.7 KB
1
2
3
4
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){function b(){if(this.isDisposed)throw new Error(U)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;sb.nonEnumArgs&&a.length&&h(a)&&(a=ub.call(a));var d=sb.enumPrototypes&&"function"==typeof a,e=sb.enumErrorProps&&(a===mb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(sb.nonEnumShadows&&a!==nb){var g=a.constructor,i=-1,j=qb.length;if(a===(g&&g.prototype))var k=a===stringProto?ib:a===mb?db:jb.call(a),l=rb[k];for(;++i<j;)f=qb[i],l&&l[f]||!kb.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?jb.call(a)==_:!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=jb.call(a),l=jb.call(b);if(k==_&&(k=gb),l==_&&(l=gb),k!=l)return!1;switch(k){case bb:case cb:return+a==+b;case fb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case hb:case ib:return a==String(b)}var m=k==ab;if(!m){if(k!=gb||!sb.nodeClass&&(g(a)||g(b)))return!1;var n=!sb.argsObject&&h(a)?Object:a.constructor,o=!sb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||kb.call(a,"constructor")&&kb.call(b,"constructor")||S(n)&&n instanceof n&&S(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 kb.call(f,e)?(q++,r=kb.call(a,e)&&i(a[e],b,c,d)):void 0}),r&&f(a,function(a,b,c){return kb.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]:ub.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(){this._s=s}function o(){this._s=s,this._l=s.length,this._i=0}function p(a){this._a=a}function q(a){this._a=a,this._l=v(a),this._i=0}function r(a){return"number"==typeof a&&E.isFinite(a)}function t(b){var c,d=b[V];if(!d&&"string"==typeof b)return c=new n(b),c[V]();if(!d&&b.length!==a)return c=new p(b),c[V]();if(!d)throw new TypeError("Object is not iterable");return b[V]()}function u(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function v(a){var b=+a.length;return isNaN(b)?0:0!==b&&r(b)?(b=u(b)*Math.floor(Math.abs(b)),0>=b?0:b>lc?lc:b):b}function w(a,b){return L(a)||(a=Nb),new wc(function(c){var d=0,e=b.length;return a.scheduleRecursive(function(a){e>d?(c.onNext(b[d++]),a()):c.onCompleted()})})}function x(a,b){return new wc(function(c){var d=new Fb,e=new Gb;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)}R(f)&&(f=ic(f)),d=new Fb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function y(a,b){var c=this;return new wc(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 z(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return R(f)&&(f=ic(f)),(Y(f)||X(f))&&(f=mc(f)),f}).concatAll()}function A(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function B(a){this.comparer=a,this.set=[]}function C(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return R(f)&&(f=ic(f)),(Y(f)||X(f))&&(f=mc(f)),f}).mergeAll()}var D={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},E=D[typeof window]&&window||this,F=D[typeof exports]&&exports&&!exports.nodeType&&exports,G=D[typeof module]&&module&&!module.nodeType&&module,H=G&&G.exports===F&&F,I=D[typeof global]&&global;!I||I.global!==I&&I.window!==I||(E=I);var J={internals:{},config:{Promise:E.Promise},helpers:{}},K=J.helpers.noop=function(){},L=(J.helpers.notDefined=function(a){return"undefined"==typeof a},J.helpers.isScheduler=function(a){return a instanceof J.Scheduler}),M=J.helpers.identity=function(a){return a},N=(J.helpers.pluck=function(a){return function(b){return b[a]}},J.helpers.just=function(a){return function(){return a}},J.helpers.defaultNow=Date.now),O=J.helpers.defaultComparer=function(a,b){return tb(a,b)},P=J.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},Q=(J.helpers.defaultKeySerializer=function(a){return a.toString()},J.helpers.defaultError=function(a){throw a}),R=J.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},S=(J.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},J.helpers.not=function(a){return!a},J.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==jb.call(a)}),a}()),T="Argument out of range",U="Object has been disposed",V="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";E.Set&&"function"==typeof(new E.Set)["@@iterator"]&&(V="@@iterator");var W=J.doneEnumerator={done:!0,value:a},X=J.helpers.isIterable=function(b){return b[V]!==a},Y=J.helpers.isArrayLike=function(b){return b&&b.length!==a};J.helpers.iterator=V;var Z,$=J.helpers.deprecate=function(a,b){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(a+" is deprecated, use "+b+" instead.",new Error("").stack)},_="[object Arguments]",ab="[object Array]",bb="[object Boolean]",cb="[object Date]",db="[object Error]",eb="[object Function]",fb="[object Number]",gb="[object Object]",hb="[object RegExp]",ib="[object String]",jb=Object.prototype.toString,kb=Object.prototype.hasOwnProperty,lb=jb.call(arguments)==_,mb=Error.prototype,nb=Object.prototype,ob=nb.propertyIsEnumerable;try{Z=!(jb.call(document)==gb&&!({toString:0}+""))}catch(pb){Z=!0}var qb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],rb={};rb[ab]=rb[cb]=rb[fb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},rb[bb]=rb[ib]={constructor:!0,toString:!0,valueOf:!0},rb[db]=rb[eb]=rb[hb]={constructor:!0,toString:!0},rb[gb]={constructor:!0};var sb={};!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);sb.enumErrorProps=ob.call(mb,"message")||ob.call(mb,"name"),sb.enumPrototypes=ob.call(a,"prototype"),sb.nonEnumArgs=0!=c,sb.nonEnumShadows=!/valueOf/.test(b)}(1),lb||(h=function(a){return a&&"object"==typeof a?kb.call(a,"callee"):!1});var tb=J.internals.isEqual=function(a,b){return i(a,b,[],[])},ub=Array.prototype.slice,vb=({}.hasOwnProperty,this.inherits=J.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),wb=J.internals.addProperties=function(a){for(var b=ub.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},xb=J.internals.addRef=function(a,b){return new wc(function(c){return new Ab(b.getDisposable(),a.subscribe(c))})};l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var yb=J.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},zb=yb.prototype;zb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},zb.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)}}},zb.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)}}},zb.peek=function(){return this.items[0].value},zb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},zb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},zb.enqueue=function(a){var b=this.length++;this.items[b]=new l(yb.count++,a),this.percolate(b)},zb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},yb.count=0;var Ab=J.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Bb=Ab.prototype;Bb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},Bb.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},Bb.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()}},Bb.toArray=function(){return this.disposables.slice(0)};var Cb=J.Disposable=function(a){this.isDisposed=!1,this.action=a||K};Cb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Db=Cb.create=function(a){return new Cb(a)},Eb=Cb.empty={dispose:K},Fb=J.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}(),Gb=J.SerialDisposable=Fb,Hb=J.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?Eb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Ib=J.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||P,this.disposable=new Fb};Ib.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ib.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Ib.prototype.isCancelled=function(){return this.disposable.isDisposed},Ib.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Jb=J.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(),Eb}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=N,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Kb=Jb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new Ab,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),Eb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new Ab,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),Eb});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")})}}(Jb.prototype),function(){Jb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Jb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof E.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=E.setInterval(function(){d=c(d)},b);return Db(function(){E.clearInterval(e)})}}(Jb.prototype),function(a){a.catchError=a["catch"]=function(a){return new Sb(this,a)}}(Jb.prototype);var Lb,Mb=(J.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 Fb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Jb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Kb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Jb(N,a,b,c)}()),Nb=Jb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Jb.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()+Jb.normalize(c),g=new Ib(this,b,d,f);if(e)e.enqueue(g);else{e=new yb(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 Jb(N,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Ob=K,Pb=function(){var a,b=K;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!E.setTimeout)throw new Error("No concurrency detected!");a=E.setTimeout,b=E.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Qb=Pb.setTimeout,Rb=Pb.clearTimeout;!function(){function a(){if(!E.postMessage||E.importScripts)return!1;var a=!1,b=E.onmessage;return E.onmessage=function(){a=!0},E.postMessage("","*"),E.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(jb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=I&&H&&I.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=I&&H&&I.clearImmediate)&&!c.test(e)&&e;if("function"==typeof d)Lb=d,Ob=e;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Lb=process.nextTick;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;E.addEventListener?E.addEventListener("message",b,!1):E.attachEvent("onmessage",b,!1),Lb=function(a){var b=h++;g[b]=a,E.postMessage(f+b,"*")}}else if(E.MessageChannel){var i=new E.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Lb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in E&&"onreadystatechange"in E.document.createElement("script")?Lb=function(a){var b=E.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},E.document.documentElement.appendChild(b)}:(Lb=function(a){return Qb(a,0)},Ob=Rb)}();var Sb=(Jb.timeout=function(){function a(a,b){var c=this,d=new Fb,e=Lb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Ab(d,Db(function(){Ob(e)}))}function b(a,b,c){var d=this,e=Jb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Fb,g=Qb(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Ab(f,Db(function(){Rb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Jb(N,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 vb(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 Eb}}},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 Fb;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}(Jb)),Tb=J.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 L(a)||(a=Mb),new wc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Ub=Tb.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 Tb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Vb=Tb.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 Tb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Wb=Tb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Tb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Xb=J.internals.Enumerator=function(a){this._next=a};Xb.prototype.next=function(){return this._next()},Xb.prototype[V]=function(){return this};var Yb=J.internals.Enumerable=function(a){this._iterator=a};Yb.prototype[V]=function(){return this._iterator()},Yb.prototype.concat=function(){var a=this;return new wc(function(b){var c;try{c=a[V]()}catch(d){return void b.onError()}var e,f=new Gb,g=Mb.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;R(h)&&(h=ic(h));var i=new Fb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new Ab(f,g,Db(function(){e=!0}))})},Yb.prototype.catchError=function(){var a=this;return new wc(function(b){var c;try{c=a[V]()}catch(d){return void b.onError()}var e,f,g=new Gb,h=Mb.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;R(i)&&(i=ic(i));var j=new Fb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new Ab(g,h,Db(function(){e=!0}))})};var Zb=Yb.repeat=function(a,b){return null==b&&(b=-1),new Yb(function(){var c=b;return new Xb(function(){return 0===c?W:(c>0&&c--,{done:!1,value:a})})})},$b=Yb.of=function(a,b,c){return b||(b=M),new Yb(function(){var d=-1;return new Xb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:W})})},_b=J.Observer=function(){};_b.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},_b.prototype.asObserver=function(){return new dc(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},_b.prototype.checked=function(){return new ec(this)};var ac=_b.create=function(a,b,c){return a||(a=K),b||(b=Q),c||(c=K),new dc(a,b,c)};_b.fromNotifier=function(a,b){return new dc(function(c){return a.call(b,Ub(c))},function(c){return a.call(b,Vb(c))},function(){return a.call(b,Wb())})},_b.notifyOn=function(a){return new gc(a,this)};var bc,cc=J.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return vb(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}(_b),dc=J.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return vb(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}(cc),ec=function(a){function b(b){a.call(this),this._observer=b,this._state=0}vb(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}(_b),fc=J.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 Gb}return vb(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}(cc),gc=function(a){function b(){a.apply(this,arguments)}return vb(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}(fc),hc=J.Observable=function(){function a(a){this._subscribe=a}return bc=a.prototype,bc.subscribe=bc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:ac(a,b,c))},bc.subscribeOnNext=function(a,b){return this._subscribe(ac(2===arguments.length?function(c){a.call(b,c)}:a))},bc.subscribeOnError=function(a,b){return this._subscribe(ac(null,2===arguments.length?function(c){a.call(b,c)}:a))},bc.subscribeOnCompleted=function(a,b){return this._subscribe(ac(null,null,2===arguments.length?function(){a.call(b)}:a))},a}();bc.observeOn=function(a){var b=this;return new wc(function(c){return b.subscribe(new gc(a,c))})},bc.subscribeOn=function(a){var b=this;return new wc(function(c){var d=new Fb,e=new Gb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var ic=hc.fromPromise=function(a){return jc(function(){var b=new J.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};bc.toPromise=function(a){if(a||(a=J.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)})})},bc.toArray=function(){var a=this;return new wc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},hc.create=hc.createWithDisposable=function(a){return new wc(a)};var jc=hc.defer=function(a){return new wc(function(b){var c;try{c=a()}catch(d){return qc(d).subscribe(b)}return R(c)&&(c=ic(c)),c.subscribe(b)})},kc=hc.empty=function(a){return L(a)||(a=Mb),new wc(function(b){return a.schedule(function(){b.onCompleted()})})},lc=Math.pow(2,53)-1;n.prototype[V]=function(){return new o(this._s)},o.prototype[V]=function(){return this},o.prototype.next=function(){if(this._i<this._l){var a=this._s.charAt(this._i++);return{done:!1,value:a}}return W},p.prototype[V]=function(){return new q(this._a)},q.prototype[V]=function(){return this},q.prototype.next=function(){if(this._i<this._l){var a=this._a[this._i++];return{done:!1,value:a}}return W};var mc=hc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!S(b))throw new Error("mapFn when provided must be a function");L(d)||(d=Nb);var e=Object(a),f=t(e);return new wc(function(a){var e=0;return d.scheduleRecursive(function(d){var g;try{g=f.next()}catch(h){return void a.onError(h)}if(g.done)return void a.onCompleted();var i=g.value;if(b&&S(b))try{i=b.call(c,i,e)}catch(h){return void a.onError(h)}a.onNext(i),e++,d()})})},nc=hc.fromArray=function(a,b){return $("fromArray","from"),L(b)||(b=Nb),new wc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};hc.generate=function(a,b,c,d,e){return L(e)||(e=Nb),new wc(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 oc=hc.never=function(){return new wc(function(){return Eb})};hc.of=function(){return w(null,arguments)},hc.ofWithScheduler=function(a){return w(a,ub.call(arguments,1))},hc.range=function(a,b,c){return L(c)||(c=Nb),new wc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},hc.repeat=function(a,b,c){return L(c)||(c=Nb),pc(a,c).repeat(null==b?-1:b)};var pc=hc["return"]=hc.just=function(a,b){return L(b)||(b=Mb),new wc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})};hc.returnValue=function(){return $("returnValue","return or just"),pc.apply(null,arguments)};var qc=hc["throw"]=hc.throwException=hc.throwError=function(a,b){return L(b)||(b=Mb),new wc(function(c){return b.schedule(function(){c.onError(a)})})};hc.using=function(a,b){return new wc(function(c){var d,e,f=Eb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new Ab(qc(g).subscribe(c),f)}return new Ab(e.subscribe(c),f)})},bc.amb=function(a){var b=this;return new wc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new Fb,j=new Fb;return R(a)&&(a=ic(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 Ab(i,j)})},hc.amb=function(){function a(a,b){return a.amb(b)}for(var b=oc(),c=j(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},bc["catch"]=bc.catchError=function(a){return"function"==typeof a?x(this,a):rc([this,a])},bc.catchException=function(a){return $("catchException","catch or catchError"),this.catchError(a)};var rc=hc.catchError=hc["catch"]=function(){return $b(j(arguments,0)).catchError()};hc.catchException=function(){return $("catchException","catch or catchError"),rc.apply(null,arguments)},bc.combineLatest=function(){var a=ub.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),sc.apply(this,a)};var sc=hc.combineLatest=function(){var a=ub.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new wc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(M))){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(M)&&c.onCompleted()}function e(a){j[a]=!0,j.every(M)&&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 Fb;R(f)&&(f=ic(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 Ab(m)})};bc.concat=function(){var a=ub.call(arguments,0);return a.unshift(this),tc.apply(this,a)};var tc=hc.concat=function(){return $b(j(arguments,0)).concat()};bc.concatAll=function(){return this.merge(1)},bc.concatObservable=function(){return $("concatObservable","concatAll"),this.merge(1)},bc.merge=function(a){if("number"!=typeof a)return uc(this,a);var b=this;return new wc(function(c){function d(a){var b=new Fb;f.add(b),R(a)&&(a=ic(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 Ab,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 uc=hc.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=ub.call(arguments,1)):(a=Mb,b=ub.call(arguments,0)):(a=Mb,b=ub.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),w(a,b).mergeAll()};bc.mergeAll=function(){var a=this;return new wc(function(b){var c=new Ab,d=!1,e=new Fb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new Fb;c.add(e),R(a)&&(a=ic(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})},bc.mergeObservable=function(){return $("mergeObservable","mergeAll"),this.mergeAll.apply(this,arguments)},bc.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return vc([this,a])};var vc=hc.onErrorResumeNext=function(){var a=j(arguments,0);return new wc(function(b){var c=0,d=new Gb,e=Mb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],R(f)&&(f=ic(f)),g=new Fb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new Ab(d,e)})};bc.skipUntil=function(a){var b=this;return new wc(function(c){var d=!1,e=new Ab(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));R(a)&&(a=ic(a));var f=new Fb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},bc["switch"]=bc.switchLatest=function(){var a=this;return new wc(function(b){var c=!1,d=new Gb,e=!1,f=0,g=a.subscribe(function(a){var g=new Fb,h=++f;
c=!0,d.setDisposable(g),R(a)&&(a=ic(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 Ab(g,d)})},bc.takeUntil=function(a){var b=this;return new wc(function(c){return R(a)&&(a=ic(a)),new Ab(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),K))})},bc.zip=function(){if(Array.isArray(arguments[0]))return y.apply(this,arguments);var a=this,b=ub.call(arguments),c=b.pop();return b.unshift(a),new wc(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(M)&&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 Fb;R(c)&&(c=ic(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 Ab(j)})},hc.zip=function(){var a=ub.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},hc.zipArray=function(){var a=j(arguments,0);return new wc(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(M))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(M)?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 Fb,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 Ab(h);return j.add(Db(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},bc.asObservable=function(){return new wc(this.subscribe.bind(this))},bc.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})},bc.dematerialize=function(){var a=this;return new wc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},bc.distinctUntilChanged=function(a,b){var c=this;return a||(a=M),b||(b=O),new wc(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))})},bc["do"]=bc.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 wc(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()})})},bc.doAction=function(){return $("doAction","do or tap"),this.tap.apply(this,arguments)},bc.doOnNext=bc.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},bc.doOnError=bc.tapOnError=function(a,b){return this.tap(K,2===arguments.length?function(c){a.call(b,c)}:a)},bc.doOnCompleted=bc.tapOnCompleted=function(a,b){return this.tap(K,null,2===arguments.length?function(){a.call(b)}:a)},bc["finally"]=bc.ensure=function(a){var b=this;return new wc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return Db(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},bc.finallyAction=function(a){return $("finallyAction","finally or ensure"),this.ensure(a)},bc.ignoreElements=function(){var a=this;return new wc(function(b){return a.subscribe(K,b.onError.bind(b),b.onCompleted.bind(b))})},bc.materialize=function(){var a=this;return new wc(function(b){return a.subscribe(function(a){b.onNext(Ub(a))},function(a){b.onNext(Vb(a)),b.onCompleted()},function(){b.onNext(Wb()),b.onCompleted()})})},bc.repeat=function(a){return Zb(this,a).concat()},bc.retry=function(a){return Zb(this,a).catchError()},bc.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 wc(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()})})},bc.skipLast=function(a){var b=this;return new wc(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))})},bc.startWith=function(){var a,b,c=0;return arguments.length&&L(arguments[0])?(b=arguments[0],c=1):b=Mb,a=ub.call(arguments,c),$b([nc(a,b),this]).concat()},bc.takeLast=function(a){var b=this;return new wc(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()})})},bc.takeLastBuffer=function(a){var b=this;return new wc(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()})})},bc.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(T);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(T);return new wc(function(d){function e(){var a=new zc;i.push(a),d.onNext(xb(a,g))}var f=new Fb,g=new Hb(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})},bc.selectConcat=bc.concatMap=function(a,b,c){return S(a)&&S(b)?this.concatMap(function(c,d){var e=a(c,d);return R(e)&&(e=ic(e)),(Y(e)||X(e))&&(e=mc(e)),e.map(function(a,e){return b(c,a,d,e)})}):S(a)?z(this,a,c):z(this,function(){return a})},bc.concatMapObserver=bc.selectConcatObserver=function(a,b,c,d){var e=this;return new wc(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)}R(c)&&(c=ic(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}R(c)&&(c=ic(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}R(a)&&(a=ic(a)),f.onNext(a),f.onCompleted()})}).concatAll()},bc.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new wc(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()})})},B.prototype.push=function(a){var b=-1===A(this.set,a,this.comparer);return b&&this.set.push(a),b},bc.distinct=function(a,b){var c=this;return b||(b=O),new wc(function(d){var e=new B(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))})},bc.select=bc.map=function(a,b){var c=S(a)?a:function(){return a},d=this;return new wc(function(a){var e=0;return d.subscribe(function(f){var g;try{g=c.call(b,f,e++,d)}catch(h){return void a.onError(h)}a.onNext(g)},a.onError.bind(a),a.onCompleted.bind(a))})},bc.pluck=function(a){return this.map(function(b){return b[a]})},bc.flatMapObserver=bc.selectManyObserver=function(a,b,c,d){var e=this;return new wc(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)}R(c)&&(c=ic(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}R(c)&&(c=ic(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}R(a)&&(a=ic(a)),f.onNext(a),f.onCompleted()})}).mergeAll()},bc.selectMany=bc.flatMap=function(a,b,c){return S(a)&&S(b)?this.flatMap(function(c,d){var e=a(c,d);return R(e)&&(e=ic(e)),(Y(e)||X(e))&&(e=mc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):S(a)?C(this,a,c):C(this,function(){return a})},bc.selectSwitch=bc.flatMapLatest=bc.switchMap=function(a,b){return this.select(a,b).switchLatest()},bc.skip=function(a){if(0>a)throw new Error(T);var b=this;return new wc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},bc.skipWhile=function(a,b){var c=this;return new wc(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))})},bc.take=function(a,b){if(0>a)throw new RangeError(T);if(0===a)return kc(b);var c=this;return new wc(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))})},bc.takeWhile=function(a,b){var c=this;return new wc(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))})},bc.where=bc.filter=function(a,b){var c=this;return new wc(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))})},bc.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 wc(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 wc=J.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Db(a):Eb}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 xc(a);return Nb.scheduleRequired()?Nb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return vb(c,a),c}(hc),xc=function(a){function b(b){a.call(this),this.observer=b,this.m=new Fb}vb(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}(cc),yc=function(a,b){this.subject=a,this.observer=b};yc.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 zc=J.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),Eb):(a.onCompleted(),Eb):(this.observers.push(a),new yc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return vb(d,a),wb(d.prototype,_b,{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 Ac(a,b)},d}(hc),Ac=(J.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new yc(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(),Eb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return vb(d,a),wb(d.prototype,_b,{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}(hc),J.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return vb(b,a),wb(b.prototype,_b,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(hc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(E.Rx=J,define(function(){return J})):F&&G?H?(G.exports=J).Rx=J:F.Rx=J:E.Rx=J}).call(this);
//# sourceMappingURL=rx.map