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
5 lines (5 loc) · 63.7 KB
/
Copy pathrx.min.js
File metadata and controls
5 lines (5 loc) · 63.7 KB
1
2
3
4
5
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){function b(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a[c]);return b}function c(){try{return R.apply(this,arguments)}catch(a){return ha.e=a,ha}}function d(a){if(!ga(a))throw new TypeError("fn must be a function");return R=a,c}function e(a){throw a}function f(a,b){if(ia&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(ma)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var e=c.join("\n"+ma+"\n");a.stack=g(e)}}function g(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var f=b[d];h(f)||i(f)||!f||c.push(f)}return c.join("\n")}function h(a){var b=k(a);if(!b)return!1;var c=b[0],d=b[1];return c===ka&&d>=la&&Nc>=d}function i(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function j(){if(ia)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=k(c);if(!d)return;return ka=d[0],d[1]}}function k(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function l(a){var b=[];if(!Wa(a))return b;Va.nonEnumArgs&&a.length&&Xa(a)&&(a=Za.call(a));var c=Va.enumPrototypes&&"function"==typeof a,d=Va.enumErrorProps&&(a===Pa||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Va.nonEnumShadows&&a!==Qa){var f=a.constructor,g=-1,h=Ba;if(a===(f&&f.prototype))var i=a===Ra?La:a===Pa?Ga:Ma.call(a),j=Ua[i];for(;++g<h;)e=Aa[g],j&&j[e]||!Na.call(a,e)||b.push(e)}return b}function m(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 n(a,b){return m(a,b,l)}function o(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function p(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=Ma.call(a),h=Ma.call(b);if(g==Ca&&(g=Ja),h==Ca&&(h=Ja),g!=h)return!1;switch(g){case Ea:case Fa:return+a==+b;case Ia:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case Ka:case La:return a==String(b)}var i=g==Da;if(!i){if(g!=Ja||!Va.nodeClass&&(o(a)||o(b)))return!1;var j=!Va.argsObject&&Xa(a)?Object:a.constructor,k=!Va.argsObject&&Xa(b)?Object:b.constructor;if(!(j==k||Na.call(a,"constructor")&&Na.call(b,"constructor")||ga(j)&&j instanceof j&&ga(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var l=c.length;l--;)if(c[l]==a)return d[l]==b;var m=0,q=!0;if(c.push(a),d.push(b),i){if(l=a.length,m=b.length,q=m==l)for(;m--;){var r=b[m];if(!(q=p(a[m],r,c,d)))break}}else n(b,function(b,e,f){return Na.call(f,e)?(m++,q=Na.call(a,e)&&p(a[e],b,c,d)):void 0}),q&&n(a,function(a,b,c){return Na.call(c,b)?q=--m>-1:void 0});return c.pop(),d.pop(),q}function q(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function r(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function s(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function t(a){this._s=a}function u(a){this._s=a,this._l=a.length,this._i=0}function v(a){this._a=a}function w(a){this._a=a,this._l=A(a),this._i=0}function x(a){return"number"==typeof a&&Z.isFinite(a)}function y(b){var c,d=b[ua];if(!d&&"string"==typeof b)return c=new t(b),c[ua]();if(!d&&b.length!==a)return c=new v(b),c[ua]();if(!d)throw new TypeError("Object is not iterable");return b[ua]()}function z(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function A(a){var b=+a.length;return isNaN(b)?0:0!==b&&x(b)?(b=z(b)*Math.floor(Math.abs(b)),0>=b?0:b>_b?_b:b):b}function B(a,b){this.observer=a,this.parent=b}function C(a,b){return ob(a)||(a=sb),new bc(b,a)}function D(a,b){this.observer=a,this.parent=b}function E(a,b){this.observer=a,this.parent=b}function F(a,b){return a.amb(b)}function G(a,b){return new Ic(function(c){var d=new ib,e=new jb;return e.setDisposable(d),d.setDisposable(a.subscribe(new nc(c,e,b))),e},a)}function H(){return!1}function I(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return b}function H(){return!1}function H(){return!1}function J(){return[]}function I(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return b}function H(){return!1}function J(){return[]}function I(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return b}function K(a){return function(b){return a.subscribe(b)}}function L(a){return a.toArray()}function M(a){return a.length>0}function N(a,b){this.o=a,this.accumulator=b.accumulator,this.hasSeed=b.hasSeed,this.seed=b.seed,this.hasAccumulation=!1,this.accumulation=null,this.hasValue=!1,this.isStopped=!1}function O(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function P(a){this.comparer=a,this.set=[]}function Q(b,c){return function(d){for(var e=d,f=0;c>f;f++){var g=e[b[f]];if("undefined"==typeof g)return a;e=g}return e}}var R,S={"function":!0,object:!0},T=S[typeof exports]&&exports&&!exports.nodeType&&exports,U=S[typeof self]&&self.Object&&self,V=S[typeof window]&&window&&window.Object&&window,W=S[typeof module]&&module&&!module.nodeType&&module,X=W&&W.exports===T&&T,Y=T&&W&&"object"==typeof global&&global&&global.Object&&global,Z=Z=Y||V!==(this&&this.window)&&V||U||this,$={internals:{},config:{Promise:Z.Promise},helpers:{}},_=$.helpers.noop=function(){},aa=$.helpers.identity=function(a){return a},ba=$.helpers.defaultNow=Date.now,ca=$.helpers.defaultComparer=function(a,b){return Ya(a,b)},da=$.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},ea=($.helpers.defaultKeySerializer=function(a){return a.toString()},$.helpers.defaultError=function(a){throw a}),fa=$.helpers.isPromise=function(a){return!!a&&"function"!=typeof a.subscribe&&"function"==typeof a.then},ga=$.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==Ma.call(a)}),a}(),ha={e:{}};$.config.longStackSupport=!1;var ia=!1,ja=d(function(){throw new Error})();ia=!!ja.e&&!!ja.e.stack;var ka,la=j(),ma="From previous event:",na=$.EmptyError=function(){this.message="Sequence contains no elements.",this.name="EmptyError",Error.call(this)};na.prototype=Error.prototype;var oa=$.ObjectDisposedError=function(){this.message="Object has been disposed",this.name="ObjectDisposedError",Error.call(this)};oa.prototype=Error.prototype;var pa=$.ArgumentOutOfRangeError=function(){this.message="Argument out of range",this.name="ArgumentOutOfRangeError",Error.call(this)};pa.prototype=Error.prototype;var qa=$.NotSupportedError=function(a){this.message=a||"This operation is not supported",this.name="NotSupportedError",Error.call(this)};qa.prototype=Error.prototype;var ra=$.NotImplementedError=function(a){this.message=a||"This operation is not implemented",this.name="NotImplementedError",Error.call(this)};ra.prototype=Error.prototype;var sa=$.helpers.notImplemented=function(){throw new ra},ta=$.helpers.notSupported=function(){throw new qa},ua="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";Z.Set&&"function"==typeof(new Z.Set)["@@iterator"]&&(ua="@@iterator");var va=$.doneEnumerator={done:!0,value:a},wa=$.helpers.isIterable=function(b){return b[ua]!==a},xa=$.helpers.isArrayLike=function(b){return b&&b.length!==a};$.helpers.iterator=ua;var ya,za=$.internals.bindCallback=function(a,b,c){if("undefined"==typeof b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}},Aa=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ba=Aa.length,Ca="[object Arguments]",Da="[object Array]",Ea="[object Boolean]",Fa="[object Date]",Ga="[object Error]",Ha="[object Function]",Ia="[object Number]",Ja="[object Object]",Ka="[object RegExp]",La="[object String]",Ma=Object.prototype.toString,Na=Object.prototype.hasOwnProperty,Oa=Ma.call(arguments)==Ca,Pa=Error.prototype,Qa=Object.prototype,Ra=String.prototype,Sa=Qa.propertyIsEnumerable;try{ya=!(Ma.call(document)==Ja&&!({toString:0}+""))}catch(Ta){ya=!0}var Ua={};Ua[Da]=Ua[Fa]=Ua[Ia]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Ua[Ea]=Ua[La]={constructor:!0,toString:!0,valueOf:!0},Ua[Ga]=Ua[Ha]=Ua[Ka]={constructor:!0,toString:!0},Ua[Ja]={constructor:!0};var Va={};!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);Va.enumErrorProps=Sa.call(Pa,"message")||Sa.call(Pa,"name"),Va.enumPrototypes=Sa.call(a,"prototype"),Va.nonEnumArgs=0!=c,Va.nonEnumShadows=!/valueOf/.test(b)}(1);var Wa=$.internals.isObject=function(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1},Xa=function(a){return a&&"object"==typeof a?Ma.call(a)==Ca:!1};Oa||(Xa=function(a){return a&&"object"==typeof a?Na.call(a,"callee"):!1});var Ya=$.internals.isEqual=function(a,b){return p(a,b,[],[])},Za=({}.hasOwnProperty,Array.prototype.slice),$a=$.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},_a=$.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},ab=$.internals.addRef=function(a,b){return new Ic(function(c){return new bb(b.getDisposable(),a.subscribe(c))})},bb=$.CompositeDisposable=function(){var a,b,c=[];if(Array.isArray(arguments[0]))c=arguments[0],b=c.length;else for(b=arguments.length,c=new Array(b),a=0;b>a;a++)c[a]=arguments[a];for(a=0;b>a;a++)if(!gb(c[a]))throw new TypeError("Not a disposable");this.disposables=c,this.isDisposed=!1,this.length=c.length},cb=bb.prototype;cb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},cb.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},cb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=this.disposables.length,b=new Array(a),c=0;a>c;c++)b[c]=this.disposables[c];for(this.disposables=[],this.length=0,c=0;a>c;c++)b[c].dispose()}};var db=$.Disposable=function(a){this.isDisposed=!1,this.action=a||_};db.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var eb=db.create=function(a){return new db(a)},fb=db.empty={dispose:_},gb=db.isDisposable=function(a){return a&&ga(a.dispose)},hb=db.checkDisposed=function(a){if(a.isDisposed)throw new oa},ib=$.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};ib.prototype.getDisposable=function(){return this.current},ib.prototype.setDisposable=function(a){if(this.current)throw new Error("Disposable has already been assigned");var b=this.isDisposed;!b&&(this.current=a),b&&a&&a.dispose()},ib.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var jb=$.SerialDisposable=function(){this.isDisposed=!1,this.current=null};jb.prototype.getDisposable=function(){return this.current},jb.prototype.setDisposable=function(a){var b=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},jb.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var kb=$.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?fb:new a(this)},b}();r.prototype.dispose=function(){this.scheduler.scheduleWithState(this,s)};var lb=$.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||da,this.disposable=new ib};lb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},lb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},lb.prototype.isCancelled=function(){return this.disposable.isDisposed},lb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var mb=$.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(),fb}a.isScheduler=function(b){return b instanceof a};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=ba,a.normalize=function(a){return 0>a&&(a=0),a},a}(),nb=mb.normalize,ob=mb.isScheduler;!function(a){function b(a,b){function c(b){function d(a,b){return g?f.remove(i):h=!0,e(b,c),fb}var g=!1,h=!1,i=a.scheduleWithState(b,d);h||(f.add(i),g=!0)}var d=b[0],e=b[1],f=new bb;return e(d,c),f}function c(a,b,c){function d(b,e){function h(a,b){return i?g.remove(k):j=!0,f(b,d),fb}var i=!1,j=!1,k=a[c](b,e,h);j||(g.add(k),i=!0)}var e=b[0],f=b[1],g=new bb;return f(e,d),g}function d(a,b){return c(a,b,"scheduleWithRelativeAndState")}function e(a,b){return c(a,b,"scheduleWithAbsoluteAndState")}function f(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,f)},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState([a,c],b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,f)},a.scheduleRecursiveWithRelativeAndState=function(a,b,c){return this._scheduleRelative([a,c],b,d)},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,f)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute([a,c],b,e)}}(mb.prototype),function(a){mb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},mb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof Z.setInterval)throw new qa;b=nb(b);var d=a,e=Z.setInterval(function(){d=c(d)},b);return eb(function(){Z.clearInterval(e)})}}(mb.prototype),function(a){a.catchError=a["catch"]=function(a){return new wb(this,a)}}(mb.prototype);var pb,qb,rb=($.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 ib;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),mb.immediate=function(){function a(a,b){return b(this,a)}return new mb(ba,a,ta,ta)}()),sb=mb.currentThread=function(){function a(){for(;c.length>0;){var a=c.shift();!a.isCancelled()&&a.invoke()}}function b(b,f){var g=new lb(this,b,f,this.now());if(c)c.push(g);else{c=[g];var h=d(a)();if(c=null,h===ha)return e(h.e)}return g.disposable}var c,f=new mb(ba,b,ta,ta);return f.scheduleRequired=function(){return!c},f}(),tb=function(){var a,b=_;if(Z.setTimeout)a=Z.setTimeout,b=Z.clearTimeout;else{if(!Z.WScript)throw new qa;a=function(a,b){Z.WScript.Sleep(b),a()}}return{setTimeout:a,clearTimeout:b}}(),ub=tb.setTimeout,vb=tb.clearTimeout;!function(){function a(b){if(h)ub(function(){a(b)},0);else{var c=g[b];if(c){h=!0;var f=d(c)();if(qb(b),h=!1,f===ha)return e(f.e)}}}function b(){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 c(b){"string"==typeof b.data&&b.data.substring(0,k.length)===k&&a(b.data.substring(k.length))}var f=1,g={},h=!1;qb=function(a){delete g[a]};var i=RegExp("^"+String(Ma).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),j="function"==typeof(j=Y&&X&&Y.setImmediate)&&!i.test(j)&&j;if(ga(j))pb=function(b){var c=f++;return g[c]=b,j(function(){a(c)}),c};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))pb=function(b){var c=f++;return g[c]=b,process.nextTick(function(){a(c)}),c};else if(b()){var k="ms.rx.schedule"+Math.random();Z.addEventListener?Z.addEventListener("message",c,!1):Z.attachEvent?Z.attachEvent("onmessage",c):Z.onmessage=c,pb=function(a){var b=f++;return g[b]=a,Z.postMessage(k+currentId,"*"),b}}else if(Z.MessageChannel){var l=new Z.MessageChannel;l.port1.onmessage=function(b){a(b.data)},pb=function(a){var b=f++;return g[b]=a,l.port2.postMessage(b),b}}else pb="document"in Z&&"onreadystatechange"in Z.document.createElement("script")?function(b){var c=Z.document.createElement("script"),d=f++;return g[d]=b,c.onreadystatechange=function(){a(d),c.onreadystatechange=null,c.parentNode.removeChild(c),c=null},Z.document.documentElement.appendChild(c),d}:function(b){var c=f++;return g[c]=b,ub(function(){a(c)},0),c}}();var wb=(mb.timeout=mb["default"]=function(){function a(a,b){var c=this,d=new ib,e=pb(function(){!d.isDisposed&&d.setDisposable(b(c,a))});return new bb(d,eb(function(){qb(e)}))}function b(a,b,c){var d=this,e=mb.normalize(b),f=new ib;if(0===e)return d.scheduleWithState(a,c);var g=ub(function(){!f.isDisposed&&f.setDisposable(c(d,a))},e);return new bb(f,eb(function(){vb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new mb(ba,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 $a(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 fb}}},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 ib;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}(mb)),xb=$.Notification=function(){function a(a,b,c,d,e,f){this.kind=a,this.value=b,this.exception=c,this._accept=d,this._acceptObservable=e,this.toString=f}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 ob(a)||(a=rb),new Ic(function(c){return a.scheduleWithState(b,function(a,b){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),yb=xb.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){return new xb("N",d,null,a,b,c)}}(),zb=xb.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){return new xb("E",null,d,a,b,c)}}(),Ab=xb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){return new xb("C",null,null,a,b,c)}}(),Bb=$.Observer=function(){};Bb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Bb.prototype.asObserver=function(){var a=this;return new Fb(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})},Bb.prototype.checked=function(){return new Gb(this)};var Cb=Bb.create=function(a,b,c){return a||(a=_),b||(b=ea),c||(c=_),new Fb(a,b,c)};Bb.fromNotifier=function(a,b){var c=za(a,b,1);return new Fb(function(a){return c(yb(a))},function(a){return c(zb(a))},function(){return c(Ab())})},Bb.prototype.notifyOn=function(a){return new Ib(a,this)},Bb.prototype.makeSafe=function(a){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,a)};var Db,Eb=$.internals.AbstractObserver=function(a){function b(){this.isStopped=!1}return $a(b,a),b.prototype.next=sa,b.prototype.error=sa,b.prototype.completed=sa,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}(Bb),Fb=$.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return $a(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}(Eb),Gb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}$a(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=d(this._observer.onNext).call(this._observer,a);this._state=0,b===ha&&e(b.e)},c.onError=function(a){this.checkAccess();var b=d(this._observer.onError).call(this._observer,a);this._state=2,b===ha&&e(b.e)},c.onCompleted=function(){this.checkAccess();var a=d(this._observer.onCompleted).call(this._observer);this._state=2,a===ha&&e(a.e)},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}(Bb),Hb=$.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 jb}return $a(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;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursiveWithState(this,function(a,b){var c;if(!(a.queue.length>0))return void(a.isAcquired=!1);c=a.queue.shift();var f=d(c)();return f===ha?(a.queue=[],a.hasFaulted=!0,e(f.e)):void b(a)}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Eb),Ib=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return $a(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.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(Hb),Jb=$.Observable=function(){function a(a,b){return function(c){var d=c.onError;return c.onError=function(b){f(b,a),d.call(c,b)},b.call(a,c)}}function b(b){if($.config.longStackSupport&&ia){var c=d(e)(new Error).e;this.stack=c.stack.substring(c.stack.indexOf("\n")+1),this._subscribe=a(this,b)}else this._subscribe=b}return Db=b.prototype,b.isObservable=function(a){return a&&ga(a.subscribe)},Db.subscribe=Db.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Cb(a,b,c))},Db.subscribeOnNext=function(a,b){return this._subscribe(Cb("undefined"!=typeof b?function(c){a.call(b,c)}:a))},Db.subscribeOnError=function(a,b){return this._subscribe(Cb(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},Db.subscribeOnCompleted=function(a,b){return this._subscribe(Cb(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},b}(),Kb=$.ObservableBase=function(a){function b(a){return a&&ga(a.dispose)?a:ga(a)?eb(a):fb}function c(a,c){var f=c[0],g=c[1],h=d(g.subscribeCore).call(g,f);return h!==ha||f.fail(ha.e)?void f.setDisposable(b(h)):e(ha.e)}function f(a){var b=new Jc(a),d=[b,this];return sb.scheduleRequired()?sb.scheduleWithState(d,c):c(null,d),b}function g(){a.call(this,f)}return $a(g,a),g.prototype.subscribeCore=sa,g}(Jb),Lb=function(a){function b(b,c,d,e){this.resultSelector=$.helpers.isFunction(d)?d:null,this.selector=$.internals.bindCallback($.helpers.isFunction(c)?c:function(){return c},e,3),this.source=b,a.call(this)}function c(a,b,c,d){this.i=0,this.selector=b,this.resultSelector=c,this.source=d,this.isStopped=!1,this.o=a}return $a(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this.selector,this.resultSelector,this))},c.prototype._wrapResult=function(a,b,c){return this.resultSelector?a.map(function(a,d){return this.resultSelector(b,a,c,d)},this):a},c.prototype.onNext=function(a){if(!this.isStopped){var b=this.i++,c=d(this.selector)(a,b,this.source);if(c===ha)return this.o.onError(c.e);$.helpers.isPromise(c)&&(c=$.Observable.fromPromise(c)),($.helpers.isArrayLike(c)||$.helpers.isIterable(c))&&(c=$.Observable.from(c)),this.o.onNext(this._wrapResult(c,a,b))}},c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},b}(Kb),Mb=$.internals.Enumerable=function(){},Nb=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b,c){this.o=a,this.s=b,this.e=c,this.isStopped=!1}return $a(b,a),b.prototype.subscribeCore=function(a){var b,e=new jb,f=rb.scheduleRecursiveWithState(this.sources[ua](),function(f,g){if(!b){var h=d(f.next).call(f);if(h===ha)return a.onError(h.e);if(h.done)return a.onCompleted();var i=h.value;fa(i)&&(i=Ub(i));var j=new ib;e.setDisposable(j),j.setDisposable(i.subscribe(new c(a,g,f)))}});return new bb(e,f,eb(function(){b=!0}))},c.prototype.onNext=function(a){this.isStopped||this.o.onNext(a)},c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.s(this.e))},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b}(Kb);Mb.prototype.concat=function(){return new Nb(this)};var Ob=function(a){function b(b){this.sources=b,a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){var b,c=this.sources[ua](),e=new jb,f=rb.scheduleRecursiveWithState(null,function(f,g){if(!b){var h=d(c.next).call(c);if(h===ha)return a.onError(h.e);if(h.done)return null!==f?a.onError(f):a.onCompleted();var i=h.value;fa(i)&&(i=Ub(i));var j=new ib;e.setDisposable(j),j.setDisposable(i.subscribe(function(b){a.onNext(b)},g,function(){a.onCompleted()}))}});return new bb(e,f,eb(function(){b=!0}))},b}(Kb);Mb.prototype.catchError=function(){return new Ob(this)},Mb.prototype.catchErrorWhen=function(a){var b=this;return new Ic(function(c){var e,f,g=new Lc,h=new Lc,i=a(g),j=i.subscribe(h),k=b[ua](),l=new jb,m=rb.scheduleRecursive(function(a){if(!e){var b=d(k.next).call(k);if(b===ha)return c.onError(b.e);if(b.done)return void(f?c.onError(f):c.onCompleted());var i=b.value;fa(i)&&(i=Ub(i));var j=new ib,m=new ib;l.setDisposable(new bb(m,j)),j.setDisposable(i.subscribe(function(a){c.onNext(a)},function(b){m.setDisposable(h.subscribe(a,function(a){c.onError(a)},function(){c.onCompleted()})),g.onNext(b)},function(){c.onCompleted()}))}});return new bb(j,l,m,eb(function(){e=!0}))})};var Pb=function(a){function b(a,b){this.v=a,this.c=null==b?-1:b}function c(a){this.v=a.v,this.l=a.c}return $a(b,a),b.prototype[ua]=function(){return new c(this)},c.prototype.next=function(){return 0===this.l?va:(this.l>0&&this.l--,{done:!1,value:this.v})},b}(Mb),Qb=Mb.repeat=function(a,b){return new Pb(a,b)},Rb=function(a){function b(a,b,c){this.s=a,this.fn=b?za(b,c,3):null}function c(a){this.i=-1,this.s=a.s,this.l=this.s.length,this.fn=a.fn}return $a(b,a),b.prototype[ua]=function(){return new c(this)},c.prototype.next=function(){return++this.i<this.l?{done:!1,value:this.fn?this.fn(this.s[this.i],this.i,this.s):this.s[this.i]}:va},b}(Mb),Sb=Mb.of=function(a,b,c){return new Rb(a,b,c)};Db.observeOn=function(a){var b=this;return new Ic(function(c){return b.subscribe(new Ib(a,c))},b)},Db.subscribeOn=function(a){var b=this;return new Ic(function(c){var d=new ib,e=new jb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new r(a,b.subscribe(c)))})),e},b)};var Tb=function(a){function b(b){this.p=b,a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){return this.p.then(function(b){a.onNext(b),a.onCompleted()},function(b){a.onError(b)}),fb},b}(Kb),Ub=Jb.fromPromise=function(a){return new Tb(a)};Db.toPromise=function(a){if(a||(a=$.config.Promise),!a)throw new qa("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)})})};var Vb=function(a){function b(b){this.source=b,a.call(this)}function c(a){this.o=a,this.a=[],this.isStopped=!1}return $a(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a))},c.prototype.onNext=function(a){this.isStopped||this.a.push(a)},c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onNext(this.a),this.o.onCompleted())},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b}(Kb);Db.toArray=function(){return new Vb(this)},Jb.create=function(a,b){return new Ic(a,b)};var Wb=(Jb.defer=function(a){return new Ic(function(b){var c;try{c=a()}catch(d){return mc(d).subscribe(b)}return fa(c)&&(c=Ub(c)),c.subscribe(b)})},function(a){function b(b){this.scheduler=b,a.call(this)}function c(a,b){this.observer=a,this.scheduler=b}function d(a,b){return b.onCompleted(),fb}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new c(a,this.scheduler);return b.run()},c.prototype.run=function(){return this.scheduler.scheduleWithState(this.observer,d)},b}(Kb)),Xb=new Wb(rb),Yb=Jb.empty=function(a){return ob(a)||(a=rb),a===rb?Xb:new Wb(a)},Zb=function(a){function b(b,c,d){this.iterable=b,this.mapper=c,this.scheduler=d,a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new $b(a,this);return b.run()},b}(Kb),$b=function(){function a(a,b){this.o=a,this.parent=b}return a.prototype.run=function(){function a(a,b){var g=d(c.next).call(c);if(g===ha)return e.onError(g.e);if(g.done)return e.onCompleted();var h=g.value;return ga(f)&&(h=d(f)(h,a),h===ha)?e.onError(h.e):(e.onNext(h),void b(a+1))}var b=Object(this.parent.iterable),c=y(b),e=this.o,f=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,a)},a}(),_b=Math.pow(2,53)-1;t.prototype[ua]=function(){
return new u(this._s)},u.prototype[ua]=function(){return this},u.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:va},v.prototype[ua]=function(){return new w(this._a)},w.prototype[ua]=function(){return this},w.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:va};var ac=Jb.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!ga(b))throw new Error("mapFn when provided must be a function");if(b)var e=za(b,c,2);return ob(d)||(d=sb),new Zb(a,e,d)},bc=function(a){function b(b,c){this.args=b,this.scheduler=c,a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new B(a,this);return b.run()},b}(Kb);B.prototype.run=function(){function a(a,e){d>a?(b.onNext(c[a]),e(a+1)):b.onCompleted()}var b=this.observer,c=this.parent.args,d=c.length;return this.parent.scheduler.scheduleRecursiveWithState(0,a)};var cc=Jb.fromArray=function(a,b){return ob(b)||(b=sb),new bc(a,b)};Jb.generate=function(a,b,c,d,e){return ob(e)||(e=sb),new Ic(function(f){var g=!0;return e.scheduleRecursiveWithState(a,function(a,e){var h,i;try{g?g=!1:a=c(a),h=b(a),h&&(i=d(a))}catch(j){return f.onError(j)}h?(f.onNext(i),e(a)):f.onCompleted()})})};var dc=function(a){function b(){a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){return fb},b}(Kb),ec=new dc,fc=Jb.never=function(){return ec};Jb.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return new bc(b,sb)},Jb.ofWithScheduler=function(a){for(var b=arguments.length,c=new Array(b-1),d=1;b>d;d++)c[d-1]=arguments[d];return new bc(c,a)};var gc=function(a){function b(b,c){this.obj=b,this.keys=Object.keys(b),this.scheduler=c,a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new D(a,this);return b.run()},b}(Kb);D.prototype.run=function(){function a(a,f){if(e>a){var g=d[a];b.onNext([g,c[g]]),f(a+1)}else b.onCompleted()}var b=this.observer,c=this.parent.obj,d=this.parent.keys,e=d.length;return this.parent.scheduler.scheduleRecursiveWithState(0,a)},Jb.pairs=function(a,b){return b||(b=sb),new gc(a,b)};var hc=function(a){function b(b,c,d){this.start=b,this.rangeCount=c,this.scheduler=d,a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new ic(a,this);return b.run()},b}(Kb),ic=function(){function a(a,b){this.observer=a,this.parent=b}return a.prototype.run=function(){function a(a,e){c>a?(d.onNext(b+a),e(a+1)):d.onCompleted()}var b=this.parent.start,c=this.parent.rangeCount,d=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,a)},a}();Jb.range=function(a,b,c){return ob(c)||(c=sb),new hc(a,b,c)};var jc=function(a){function b(b,c,d){this.value=b,this.repeatCount=null==c?-1:c,this.scheduler=d,a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new E(a,this);return b.run()},b}(Kb);E.prototype.run=function(){function a(a,d){return(-1===a||a>0)&&(b.onNext(c),a>0&&a--),0===a?b.onCompleted():void d(a)}var b=this.observer,c=this.parent.value;return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount,a)},Jb.repeat=function(a,b,c){return ob(c)||(c=sb),new jc(a,b,c)};var kc=function(a){function b(b,c){this.value=b,this.scheduler=c,a.call(this)}function c(a,b,c){this.observer=a,this.value=b,this.scheduler=c}function d(a,b){var c=b[0],d=b[1];return d.onNext(c),d.onCompleted(),fb}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new c(a,this.value,this.scheduler);return b.run()},c.prototype.run=function(){var a=[this.value,this.observer];return this.scheduler===rb?d(null,a):this.scheduler.scheduleWithState(a,d)},b}(Kb),lc=(Jb["return"]=Jb.just=function(a,b){return ob(b)||(b=rb),new kc(a,b)},function(a){function b(b,c){this.error=b,this.scheduler=c,a.call(this)}function c(a,b){this.o=a,this.p=b}function d(a,b){var c=b[0],d=b[1];d.onError(c)}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new c(a,this);return b.run()},c.prototype.run=function(){return this.p.scheduler.scheduleWithState([this.p.error,this.o],d)},b}(Kb)),mc=Jb["throw"]=function(a,b){return ob(b)||(b=rb),new lc(a,b)};Jb.using=function(a,b){return new Ic(function(c){var e=fb,f=d(a)();if(f===ha)return new bb(mc(f.e).subscribe(c),e);f&&(e=f);var g=d(b)(f);return g===ha?new bb(mc(g.e).subscribe(c),e):new bb(g.subscribe(c),e)})},Db.amb=function(a){var b=this;return new Ic(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new ib,j=new ib;fa(a)&&(a=Ub(a));var k=Cb(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()}),l=Cb(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()});return i.setDisposable(b.subscribe(k)),j.setDisposable(a.subscribe(l)),new bb(i,j)})},Jb.amb=function(){var a,b=fc();if(Array.isArray(arguments[0]))a=arguments[0];else{var c=arguments.length;a=new Array(a);for(var d=0;c>d;d++)a[d]=arguments[d]}for(var d=0,c=a.length;c>d;d++)b=F(b,a[d]);return b};var nc=function(a){function b(b,c,d){this._o=b,this._s=c,this._fn=d,a.call(this)}return $a(b,a),b.prototype.next=function(a){this._o.onNext(a)},b.prototype.completed=function(){return this._o.onCompleted()},b.prototype.error=function(a){var b=d(this._fn)(a);if(b===ha)return this._o.onError(b.e);fa(b)&&(b=Ub(b));var c=new ib;this._s.setDisposable(c),c.setDisposable(b.subscribe(this._o))},b}(Eb);Db["catch"]=function(a){return ga(a)?G(this,a):oc([this,a])};var oc=Jb["catch"]=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return Sb(a).catchError()};Db.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return Array.isArray(b[0])?b[0].unshift(this):b.unshift(this),pc.apply(this,b)};var pc=Jb.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=ga(b[a-1])?b.pop():I;return Array.isArray(b[0])&&(b=b[0]),new Ic(function(a){function c(b){if(g[b]=!0,h||(h=g.every(aa))){try{var c=d.apply(null,j)}catch(e){return a.onError(e)}a.onNext(c)}else i.filter(function(a,c){return c!==b}).every(aa)&&a.onCompleted()}function e(b){i[b]=!0,i.every(aa)&&a.onCompleted()}for(var f=b.length,g=q(f,H),h=!1,i=q(f,H),j=new Array(f),k=new Array(f),l=0;f>l;l++)!function(d){var f=b[d],g=new ib;fa(f)&&(f=Ub(f)),g.setDisposable(f.subscribe(function(a){j[d]=a,c(d)},function(b){a.onError(b)},function(){e(d)})),k[d]=g}(l);return new bb(k)},this)};Db.concat=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return a.unshift(this),rc.apply(null,a)};var qc=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){this.sources=a,this.o=b}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new c(this.sources,a);return b.run()},c.prototype.run=function(){var a,b=new jb,c=this.sources,d=c.length,e=this.o,f=rb.scheduleRecursiveWithState(0,function(f,g){if(!a){if(f===d)return e.onCompleted();var h=c[f];fa(h)&&(h=Ub(h));var i=new ib;b.setDisposable(i),i.setDisposable(h.subscribe(function(a){e.onNext(a)},function(a){e.onError(a)},function(){g(f+1)}))}});return new bb(b,f,eb(function(){a=!0}))},b}(Kb),rc=Jb.concat=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(arguments.length);for(var b=0,c=arguments.length;c>b;b++)a[b]=arguments[b]}return new qc(a)};Db.concatAll=function(){return this.merge(1)};var sc=function(a){function b(b,c){this.source=b,this.maxConcurrent=c,a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new bb;return b.add(this.source.subscribe(new tc(a,this.maxConcurrent,b))),b},b}(Kb),tc=function(){function a(a,b,c){this.o=a,this.max=b,this.g=c,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function b(a,b){this.parent=a,this.sad=b,this.isStopped=!1}return a.prototype.handleSubscribe=function(a){var c=new ib;this.g.add(c),fa(a)&&(a=Ub(a)),c.setDisposable(a.subscribe(new b(this,c)))},a.prototype.onNext=function(a){this.isStopped||(this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(a)):this.q.push(a))},a.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},a.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,0===this.activeCount&&this.o.onCompleted())},a.prototype.dispose=function(){this.isStopped=!0},a.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b.prototype.onNext=function(a){this.isStopped||this.parent.o.onNext(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.parent.o.onError(a))},b.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var a=this.parent;a.g.remove(this.sad),a.q.length>0?a.handleSubscribe(a.q.shift()):(a.activeCount--,a.done&&0===a.activeCount&&a.o.onCompleted())}},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(a),!0)},a}();Db.merge=function(a){return"number"!=typeof a?uc(this,a):new sc(this,a)};var uc=Jb.merge=function(){var a,b,c=[],d=arguments.length;if(arguments[0])if(ob(arguments[0]))for(a=arguments[0],b=1;d>b;b++)c.push(arguments[b]);else for(a=rb,b=0;d>b;b++)c.push(arguments[b]);else for(a=rb,b=1;d>b;b++)c.push(arguments[b]);return Array.isArray(c[0])&&(c=c[0]),C(a,c).mergeAll()},vc=$.CompositeError=function(a){this.name="NotImplementedError",this.innerErrors=a,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};vc.prototype=Error.prototype,Jb.mergeDelayError=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}var d=C(null,a);return new Ic(function(a){function b(){0===g.length?a.onCompleted():1===g.length?a.onError(g[0]):a.onError(new vc(g))}var c=new bb,e=new ib,f=!1,g=[];return c.add(e),e.setDisposable(d.subscribe(function(d){var e=new ib;c.add(e),fa(d)&&(d=Ub(d)),e.setDisposable(d.subscribe(function(b){a.onNext(b)},function(a){g.push(a),c.remove(e),f&&1===c.length&&b()},function(){c.remove(e),f&&1===c.length&&b()}))},function(a){g.push(a),f=!0,1===c.length&&b()},function(){f=!0,1===c.length&&b()})),c})};var wc=function(a){function b(b){this.source=b,a.call(this)}function c(a,b){this.o=a,this.g=b,this.isStopped=!1,this.done=!1}function d(a,b){this.parent=a,this.sad=b,this.isStopped=!1}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new bb,d=new ib;return b.add(d),d.setDisposable(this.source.subscribe(new c(a,b))),b},c.prototype.onNext=function(a){if(!this.isStopped){var b=new ib;this.g.add(b),fa(a)&&(a=Ub(a)),b.setDisposable(a.subscribe(new d(this,b)))}},c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},d.prototype.onNext=function(a){this.isStopped||this.parent.o.onNext(a)},d.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.parent.o.onError(a))},d.prototype.onCompleted=function(){if(!this.isStopped){var a=this.parent;this.isStopped=!0,a.g.remove(this.sad),a.done&&1===a.g.length&&a.o.onCompleted()}},d.prototype.dispose=function(){this.isStopped=!0},d.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(a),!0)},b}(Kb);Db.mergeAll=function(){return new wc(this)},Db.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return xc([this,a])};var xc=Jb.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new Ic(function(b){var c=0,d=new jb,e=rb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],fa(f)&&(f=Ub(f)),g=new ib,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new bb(d,e)})};Db.skipUntil=function(a){var b=this;return new Ic(function(c){var d=!1,e=new bb(b.subscribe(function(a){d&&c.onNext(a)},function(a){c.onError(a)},function(){d&&c.onCompleted()}));fa(a)&&(a=Ub(a));var f=new ib;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},function(a){c.onError(a)},function(){f.dispose()})),e},b)};var yc=function(a){function b(b){this.source=b,a.call(this)}function c(a,b){this.o=a,this.inner=b,this.stopped=!1,this.latest=0,this.hasLatest=!1,this.isStopped=!1}function d(a,b){this.parent=a,this.id=b,this.isStopped=!1}return $a(b,a),b.prototype.subscribeCore=function(a){var b=new jb,d=this.source.subscribe(new c(a,b));return new bb(d,b)},c.prototype.onNext=function(a){if(!this.isStopped){var b=new ib,c=++this.latest;this.hasLatest=!0,this.inner.setDisposable(b),fa(a)&&(a=Ub(a)),b.setDisposable(a.subscribe(new d(this,c)))}},c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.stopped=!0,!this.hasLatest&&this.o.onCompleted())},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},d.prototype.onNext=function(a){this.isStopped||this.parent.latest===this.id&&this.parent.o.onNext(a)},d.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.parent.latest===this.id&&this.parent.o.onError(a))},d.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.parent.latest===this.id&&(this.parent.hasLatest=!1,this.parent.isStopped&&this.parent.o.onCompleted()))},d.prototype.dispose=function(){this.isStopped=!0},d.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(a),!0)},b}(Kb);Db["switch"]=Db.switchLatest=function(){return new yc(this)};var zc=function(a){function b(b,c){this.source=b,this.other=fa(c)?Ub(c):c,a.call(this)}function c(a){this.o=a,this.isStopped=!1}return $a(b,a),b.prototype.subscribeCore=function(a){return new bb(this.source.subscribe(a),this.other.subscribe(new c(a)))},c.prototype.onNext=function(a){this.isStopped||this.o.onCompleted()},c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){!this.isStopped&&(this.isStopped=!0)},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b}(Kb);Db.takeUntil=function(a){return new zc(this,a)},Db.withLatestFrom=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var e=b.pop(),f=this;return Array.isArray(b[0])&&(b=b[0]),new Ic(function(a){for(var c=b.length,g=q(c,H),h=!1,i=new Array(c),j=new Array(c+1),k=0;c>k;k++)!function(c){var d=b[c],e=new ib;fa(d)&&(d=Ub(d)),e.setDisposable(d.subscribe(function(a){i[c]=a,g[c]=!0,h=g.every(aa)},function(b){a.onError(b)},_)),j[c]=e}(k);var l=new ib;return l.setDisposable(f.subscribe(function(b){var c=[b].concat(i);if(h){var f=d(e).apply(null,c);return f===ha?a.onError(f.e):void a.onNext(f)}},function(b){a.onError(b)},function(){a.onCompleted()})),j[c]=l,new bb(j)},this)},Db.zip=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var e=ga(b[a-1])?b.pop():I;Array.isArray(b[0])&&(b=b[0]);var f=this;return b.unshift(f),new Ic(function(a){for(var c=b.length,g=q(c,J),h=q(c,H),i=new Array(c),j=0;c>j;j++)!function(c){var j=b[c],k=new ib;fa(j)&&(j=Ub(j)),k.setDisposable(j.subscribe(function(b){if(g[c].push(b),g.every(function(a){return a.length>0})){var i=g.map(function(a){return a.shift()}),j=d(e).apply(f,i);if(j===ha)return a.onError(j.e);a.onNext(j)}else h.filter(function(a,b){return b!==c}).every(aa)&&a.onCompleted()},function(b){a.onError(b)},function(){h[c]=!0,h.every(aa)&&a.onCompleted()})),i[c]=k}(j);return new bb(i)},f)},Jb.zip=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b.shift();return d.zip.apply(d,b)},Db.zipIterable=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var e=ga(b[a-1])?b.pop():I,f=this;return b.unshift(f),new Ic(function(a){for(var c=b.length,g=q(c,J),h=q(c,H),i=new Array(c),j=0;c>j;j++)!function(c){var j=b[c],k=new ib;(xa(j)||wa(j))&&(j=ac(j)),k.setDisposable(j.subscribe(function(b){if(g[c].push(b),g.every(function(a){return a.length>0})){var i=g.map(function(a){return a.shift()}),j=d(e).apply(f,i);if(j===ha)return a.onError(j.e);a.onNext(j)}else h.filter(function(a,b){return b!==c}).every(aa)&&a.onCompleted()},function(b){a.onError(b)},function(){h[c]=!0,h.every(aa)&&a.onCompleted()})),i[c]=k}(j);return new bb(i)},f)},Db.asObservable=function(){return new Ic(K(this),this)},Db.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).flatMap(L).filter(M)},Db.dematerialize=function(){var a=this;return new Ic(function(b){return a.subscribe(function(a){return a.accept(b)},function(a){b.onError(a)},function(){b.onCompleted()})},this)};var Ac=function(a){function b(b,c,d){this.source=b,this.keyFn=c,this.comparer=d,a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Bc(a,this.keyFn,this.comparer))},b}(Kb),Bc=function(a){function b(b,c,d){this.o=b,this.keyFn=c,this.comparer=d,this.hasCurrentKey=!1,this.currentKey=null,a.call(this)}return $a(b,a),b.prototype.next=function(a){var b,c=a;return ga(this.keyFn)&&(c=d(this.keyFn)(a),c===ha)?this.o.onError(c.e):this.hasCurrentKey&&(b=d(this.comparer)(this.currentKey,c),b===ha)?this.o.onError(b.e):void(this.hasCurrentKey&&b||(this.hasCurrentKey=!0,this.currentKey=c,this.o.onNext(a)))},b.prototype.error=function(a){this.o.onError(a)},b.prototype.completed=function(){this.o.onCompleted()},b}(Eb);Db.distinctUntilChanged=function(a,b){return b||(b=ca),new Ac(this,a,b)};var Cc=function(a){function b(b,c,d,e){this.source=b,this._oN=c,this._oE=d,this._oC=e,a.call(this)}function c(a,b){this.o=a,this.t=!b._oN||ga(b._oN)?Cb(b._oN||_,b._oE||_,b._oC||_):b._oN,this.isStopped=!1}return $a(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this))},c.prototype.onNext=function(a){if(!this.isStopped){var b=d(this.t.onNext).call(this.t,a);b===ha&&this.o.onError(b.e),this.o.onNext(a)}},c.prototype.onError=function(a){if(!this.isStopped){this.isStopped=!0;var b=d(this.t.onError).call(this.t,a);if(b===ha)return this.o.onError(b.e);this.o.onError(a)}},c.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var a=d(this.t.onCompleted).call(this.t);if(a===ha)return this.o.onError(a.e);this.o.onCompleted()}},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b}(Kb);Db["do"]=Db.tap=Db.doAction=function(a,b,c){return new Cc(this,a,b,c)},Db.doOnNext=Db.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},Db.doOnError=Db.tapOnError=function(a,b){return this.tap(_,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},Db.doOnCompleted=Db.tapOnCompleted=function(a,b){return this.tap(_,null,"undefined"!=typeof b?function(){a.call(b)}:a)},Db["finally"]=function(a){var b=this;return new Ic(function(c){var f=d(b.subscribe).call(b,c);return f===ha?(a(),e(f.e)):eb(function(){var b=d(f.dispose).call(f);a(),b===ha&&e(b.e)})},this)};var Dc=function(a){function b(b){this.source=b,a.call(this)}function c(a){this.o=a,this.isStopped=!1}return $a(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a))},c.prototype.onNext=_,c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},b}(Kb);Db.ignoreElements=function(){return new Dc(this)},Db.materialize=function(){var a=this;return new Ic(function(b){return a.subscribe(function(a){b.onNext(yb(a))},function(a){b.onNext(zb(a)),b.onCompleted()},function(){b.onNext(Ab()),b.onCompleted()})},a)},Db.repeat=function(a){return Qb(this,a).concat()},Db.retry=function(a){return Qb(this,a).catchError()},Db.retryWhen=function(a){return Qb(this).catchErrorWhen(a)};var Ec=function(a){function b(b,c,d,e){this.source=b,this.accumulator=c,this.hasSeed=d,this.seed=e,a.call(this)}return $a(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new N(a,this))},b}(Kb);N.prototype={onNext:function(a){return this.isStopped?void 0:(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.accumulation=d(this.accumulator)(this.accumulation,a):(this.accumulation=this.hasSeed?d(this.accumulator)(this.seed,a):a,this.hasAccumulation=!0),this.accumulation===ha?this.o.onError(this.accumulation.e):void this.o.onNext(this.accumulation))},onError:function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},onCompleted:function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.o.onNext(this.seed),this.o.onCompleted())},dispose:function(){this.isStopped=!0},fail:function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)}},Db.scan=function(){var a,b=!1,c=arguments[0];return 2===arguments.length&&(b=!0,a=arguments[1]),new Ec(this,c,b,a)},Db.skipLast=function(a){if(0>a)throw new pa;var b=this;return new Ic(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},function(a){c.onError(a)},function(){c.onCompleted()})},b)},Db.startWith=function(){var a,b=0;arguments.length&&ob(arguments[0])?(a=arguments[0],b=1):a=rb;for(var c=[],d=b,e=arguments.length;e>d;d++)c.push(arguments[d]);return Sb([cc(c,a),this]).concat()},Db.takeLast=function(a){if(0>a)throw new pa;var b=this;return new Ic(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})},b)},Db.takeLastBuffer=function(a){var b=this;return new Ic(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},Db.windowWithCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new pa;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new pa;return new Ic(function(d){function e(){var a=new Lc;i.push(a),d.onNext(ab(a,g))}var f=new ib,g=new kb(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},c)},Db.flatMapConcat=Db.concatMap=function(a,b,c){return new Lb(this,a,b,c).merge(1)},Db.concatMapObserver=Db.selectConcatObserver=function(a,b,c,d){var e=this,f=za(a,d,2),g=za(b,d,1),h=za(c,d,0);return new Ic(function(a){var b=0;return e.subscribe(function(c){var d;try{d=f(c,b++)}catch(e){return void a.onError(e)}fa(d)&&(d=Ub(d)),a.onNext(d)},function(b){var c;try{c=g(b)}catch(d){return void a.onError(d)}fa(c)&&(c=Ub(c)),a.onNext(c),a.onCompleted()},function(){var b;try{b=h()}catch(c){return void a.onError(c)}fa(b)&&(b=Ub(b)),a.onNext(b),a.onCompleted()})},this).concatAll()},Db.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new Ic(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},function(b){a.onError(b)},function(){!d&&a.onNext(b),a.onCompleted()})},c)},P.prototype.push=function(a){var b=-1===O(this.set,a,this.comparer);return b&&this.set.push(a),b},Db.distinct=function(a,b){var c=this;return b||(b=ca),new Ic(function(d){var e=new P(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)},function(a){d.onError(a)},function(){d.onCompleted()})},this)};var Fc=function(a){function b(b,c,d){this.source=b,this.selector=za(c,d,3),a.call(this)}function c(a,b){return function(c,d,e){return a.call(this,b.selector(c,d,e),d,e)}}function e(a,b,c){this.o=a,this.selector=b,this.source=c,this.i=0,this.isStopped=!1}return $a(b,a),b.prototype.internalMap=function(a,d){return new b(this.source,c(a,this),d)},b.prototype.subscribeCore=function(a){return this.source.subscribe(new e(a,this.selector,this))},e.prototype.onNext=function(a){if(!this.isStopped){var b=d(this.selector)(a,this.i++,this.source);return b===ha?this.o.onError(b.e):void this.o.onNext(b)}},e.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b}(Kb);Db.map=Db.select=function(a,b){var c="function"==typeof a?a:function(){return a};return this instanceof Fc?this.internalMap(c,b):new Fc(this,c,b)},Db.pluck=function(){var a=arguments.length,b=new Array(a);if(0===a)throw new Error("List of properties cannot be empty.");for(var c=0;a>c;c++)b[c]=arguments[c];return this.map(Q(b,a))},Db.flatMapObserver=Db.selectManyObserver=function(a,b,c,d){var e=this;return new Ic(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)}fa(c)&&(c=Ub(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}fa(c)&&(c=Ub(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}fa(a)&&(a=Ub(a)),f.onNext(a),f.onCompleted()})},e).mergeAll()},Db.flatMap=Db.selectMany=function(a,b,c){return new Lb(this,a,b,c).mergeAll()},$.Observable.prototype.flatMapLatest=function(a,b,c){return new Lb(this,a,b,c).switchLatest()};var Gc=function(a){function b(b,c){this.source=b,this.skipCount=c,a.call(this)}function c(a,b){this.c=b,this.r=b,this.o=a,this.isStopped=!1}return $a(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this.skipCount))},c.prototype.onNext=function(a){this.isStopped||(this.r<=0?this.o.onNext(a):this.r--)},c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b}(Kb);Db.skip=function(a){if(0>a)throw new pa;return new Gc(this,a)},Db.skipWhile=function(a,b){var c=this,d=za(a,b,3);return new Ic(function(a){var b=0,e=!1;return c.subscribe(function(f){if(!e)try{e=!d(f,b++,c)}catch(g){return void a.onError(g)}e&&a.onNext(f)},function(b){a.onError(b)},function(){a.onCompleted()})},c)},Db.take=function(a,b){if(0>a)throw new pa;if(0===a)return Yb(b);var c=this;return new Ic(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0>=d&&b.onCompleted())},function(a){b.onError(a)},function(){b.onCompleted()})},c)},Db.takeWhile=function(a,b){var c=this,d=za(a,b,3);return new Ic(function(a){var b=0,e=!0;return c.subscribe(function(f){if(e){try{e=d(f,b++,c)}catch(g){return void a.onError(g)}e?a.onNext(f):a.onCompleted()}},function(b){a.onError(b)},function(){a.onCompleted()})},c)};var Hc=function(a){function b(b,c,d){this.source=b,this.predicate=za(c,d,3),a.call(this)}function c(a,b){return function(c,d,e){return b.predicate(c,d,e)&&a.call(this,c,d,e)}}function e(a,b,c){this.o=a,this.predicate=b,this.source=c,this.i=0,this.isStopped=!1}return $a(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new e(a,this.predicate,this))},b.prototype.internalFilter=function(a,d){return new b(this.source,c(a,this),d)},e.prototype.onNext=function(a){if(!this.isStopped){var b=d(this.predicate)(a,this.i++,this.source);return b===ha?this.o.onError(b.e):void(b&&this.o.onNext(a))}},e.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b}(Kb);Db.filter=Db.where=function(a,b){return this instanceof Hc?this.internalFilter(a,b):new Hc(this,a,b)},Db.transduce=function(a){function b(a){return{"@@transducer/init":function(){return a},"@@transducer/step":function(a,b){return a.onNext(b)},"@@transducer/result":function(a){return a.onCompleted()}}}var c=this;return new Ic(function(e){var f=a(b(e));return c.subscribe(function(a){var b=d(f["@@transducer/step"]).call(f,e,a);b===ha&&e.onError(b.e)},function(a){e.onError(a)},function(){f["@@transducer/result"](e)})},c)};var Ic=$.AnonymousObservable=function(a){function b(a){return a&&ga(a.dispose)?a:ga(a)?eb(a):fb}function c(a,c){var f=c[0],g=c[1],h=d(g.__subscribe).call(g,f);return h!==ha||f.fail(ha.e)?void f.setDisposable(b(h)):e(ha.e)}function f(a){var b=new Jc(a),d=[b,this];return sb.scheduleRequired()?sb.scheduleWithState(d,c):c(null,d),b}function g(b,c){this.source=c,this.__subscribe=b,a.call(this,f)}return $a(g,a),g}(Jb),Jc=function(a){function b(b){a.call(this),this.observer=b,this.m=new ib}$a(b,a);var c=b.prototype;return c.next=function(a){var b=d(this.observer.onNext).call(this.observer,a);b===ha&&(this.dispose(),e(b.e))},c.error=function(a){var b=d(this.observer.onError).call(this.observer,a);this.dispose(),b===ha&&e(b.e)},c.completed=function(){var a=d(this.observer.onCompleted).call(this.observer);this.dispose(),a===ha&&e(a.e)},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Eb),Kc=function(a,b){this.subject=a,this.observer=b};Kc.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 Lc=$.Subject=function(a){function c(a){return hb(this),this.isStopped?this.hasError?(a.onError(this.error),fb):(a.onCompleted(),fb):(this.observers.push(a),new Kc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return $a(d,a),_a(d.prototype,Bb.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(hb(this),!this.isStopped){this.isStopped=!0;for(var a=0,c=b(this.observers),d=c.length;d>a;a++)c[a].onCompleted();this.observers.length=0}},onError:function(a){if(hb(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var c=0,d=b(this.observers),e=d.length;e>c;c++)d[c].onError(a);this.observers.length=0}},onNext:function(a){if(hb(this),!this.isStopped)for(var c=0,d=b(this.observers),e=d.length;e>c;c++)d[c].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Mc(a,b)},d}(Jb),Mc=($.AsyncSubject=function(a){function c(a){return hb(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),fb):(this.observers.push(a),new Kc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return $a(d,a),_a(d.prototype,Bb,{hasObservers:function(){return hb(this),this.observers.length>0},onCompleted:function(){var a,c;if(hb(this),!this.isStopped){this.isStopped=!0;var d=b(this.observers),c=d.length;
if(this.hasValue)for(a=0;c>a;a++){var e=d[a];e.onNext(this.value),e.onCompleted()}else for(a=0;c>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(hb(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var c=0,d=b(this.observers),e=d.length;e>c;c++)d[c].onError(a);this.observers.length=0}},onNext:function(a){hb(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(Jb),$.AnonymousSubject=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){this.observer=c,this.observable=d,a.call(this,b)}return $a(c,a),_a(c.prototype,Bb.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Jb));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Z.Rx=$,define(function(){return $})):T&&W?X?(W.exports=$).Rx=$:T.Rx=$:Z.Rx=$;var Nc=j()}).call(this);
//# sourceMappingURL=rx.map