text: /* 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=a.length,c=new Array(b),d=0;b>d;d++)c[d]=a[d];return c}function c(a,b){if(ka&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(oa)){for(var c=[],e=b;e;e=e.source)e.stack&&c.unshift(e.stack);c.unshift(a.stack);var f=c.join("\n"+oa+"\n");a.stack=d(f)}}function d(a){for(var b=a.split("\n"),c=[],d=0,g=b.length;g>d;d++){var h=b[d];e(h)||f(h)||!h||c.push(h)}return c.join("\n")}function e(a){var b=h(a);if(!b)return!1;var c=b[0],d=b[1];return c===ma&&d>=na&&Rc>=d}function f(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function g(){if(ka)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=h(c);if(!d)return;return ma=d[0],d[1]}}function h(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 i(a){var b=[];if(!Xa(a))return b;Wa.nonEnumArgs&&a.length&&Ya(a)&&(a=ab.call(a));var c=Wa.enumPrototypes&&"function"==typeof a,d=Wa.enumErrorProps&&(a===Ra||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Wa.nonEnumShadows&&a!==Sa){var f=a.constructor,g=-1,h=Da;if(a===(f&&f.prototype))var i=a===Ta?Na:a===Ra?Ia:Oa.call(a),j=Va[i];for(;++g<h;)e=Ca[g],j&&j[e]||!Pa.call(a,e)||b.push(e)}return b}function j(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 k(a,b){return j(a,b,i)}function l(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function m(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=Oa.call(a),h=Oa.call(b);if(g==Ea&&(g=La),h==Ea&&(h=La),g!=h)return!1;switch(g){case Ga:case Ha:return+a==+b;case Ka:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case Ma:case Na:return a==String(b)}var i=g==Fa;if(!i){if(g!=La||!Wa.nodeClass&&(l(a)||l(b)))return!1;var j=!Wa.argsObject&&Ya(a)?Object:a.constructor,n=!Wa.argsObject&&Ya(b)?Object:b.constructor;if(!(j==n||Pa.call(a,"constructor")&&Pa.call(b,"constructor")||ja(j)&&j instanceof j&&ja(n)&&n instanceof n||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var o=c.length;o--;)if(c[o]==a)return d[o]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(o=a.length,p=b.length,q=p==o)for(;p--;){var r=b[p];if(!(q=m(a[p],r,c,d)))break}}else k(b,function(b,e,f){return Pa.call(f,e)?(p++,q=Pa.call(a,e)&&m(a[e],b,c,d)):void 0}),q&&k(a,function(a,b,c){return Pa.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function n(){try{return Za.apply(this,arguments)}catch(a){return _a.e=a,_a}}function o(a){if(!ja(a))throw new TypeError("fn must be a function");return Za=a,n}function p(a){throw a}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.id=a,this.value=b}function t(a){this._s=s}function u(a){this._s=s,this._l=s.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&&Y.isFinite(a)}function y(b){var c,d=b[wa];if(!d&&"string"==typeof b)return c=new t(b),c[wa]();if(!d&&b.length!==a)return c=new v(b),c[wa]();if(!d)throw new TypeError("Object is not iterable");return b[wa]()}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>Zb?Zb:b):b}function B(a,b){this.observer=a,this.parent=b}function C(a,b){return rb(a)||(a=vb),new _b(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 new Jc(function(c){var d=new mb,e=new nb;return e.setDisposable(d),d.setDisposable(a.subscribe(function(a){c.onNext(a)},function(a){try{var d=b(a)}catch(f){return c.onError(f)}ia(d)&&(d=Cc(d));var g=new mb;e.setDisposable(g),g.setDisposable(d.subscribe(c))},function(a){c.onCompleted(a)})),e},a)}function G(){return!1}function H(a,b){var c=this;return new Jc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g=a[e++],h=o(b)(c,g);if(h===_a)return d.onError(h.e);d.onNext(h)}else d.onCompleted()},function(a){d.onError(a)},function(){d.onCompleted()})},c)}function G(){return!1}function I(){return[]}function G(){return!1}function J(){return[]}function K(a,b){this.observer=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 L(a,b,c){var d=Ba(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return ia(e)&&(e=Cc(e)),(za(e)||ya(e))&&(e=$b(e)),e}).concatAll()}function M(a,b,c){var d=Ba(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return ia(e)&&(e=Cc(e)),(za(e)||ya(e))&&(e=$b(e)),e}).mergeAll()}function N(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),ib(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function O(a,b,c){var d=new fb,e=Object.prototype.toString;if("[object NodeList]"===e.call(a)||"[object HTMLCollection]"===e.call(a))for(var f=0,g=a.length;g>f;f++)d.add(O(a.item(f),b,c));else a&&d.add(N(a,b,c));return d}function P(a,b){return new Jc(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function Q(a,b,c){return new Jc(function(d){var e=a,f=qb(b);return c.scheduleRecursiveWithAbsoluteAndState(0,e,function(a,b){if(f>0){var g=c.now();e+=f,g>=e&&(e=g+f)}d.onNext(a),b(a+1,e)})})}function R(a,b){return new Jc(function(c){return b.scheduleWithRelative(qb(a),function(){c.onNext(0),c.onCompleted()})})}function S(a,b,c){return a===b?new Jc(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):Ub(function(){return Q(c.now()+a,b,c)})}function T(a,b,c){return new Jc(function(d){var e,f=!1,g=new nb,h=null,i=[],j=!1;return e=a.materialize().timestamp(c).subscribe(function(a){var e,k;"E"===a.value.kind?(i=[],i.push(a),h=a.value.exception,k=!j):(i.push({value:a.value,timestamp:a.timestamp+b}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new mb,g.setDisposable(e),e.setDisposable(c.scheduleRecursiveWithRelative(b,function(a){var b,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-c.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-c.now())):f=!1,b=h,j=!1,null!==b?d.onError(b):k&&a(e)}}))))}),new fb(e,g)},a)}function U(a,b,c){return Ub(function(){return T(a,b-c.now(),c)})}function V(a,b){return new Jc(function(c){function d(){g&&(g=!1,c.onNext(e)),f&&c.onCompleted()}var e,f=!1,g=!1,h=new mb;return h.setDisposable(a.subscribe(function(a){g=!0,e=a},function(a){c.onError(a)},function(){f=!0,h.dispose()})),new fb(h,b.subscribe(d,function(a){c.onError(a)},d))},a)}function W(a,b,c){return new Jc(function(d){function e(a,b){if(j[b]=a,g[b]=!0,h||(h=g.every(da))){if(f)return d.onError(f);var e=o(c).apply(null,j);if(e===_a)return d.onError(e.e);d.onNext(e)}i&&j[1]&&d.onCompleted()}var f,g=[!1,!1],h=!1,i=!1,j=new Array(2);return new fb(a.subscribe(function(a){e(a,0)},function(a){j[1]?d.onError(a):f=a},function(){i=!0,j[1]&&d.onCompleted()}),b.subscribe(function(a){e(a,1)},function(a){d.onError(a)},function(){i=!0,e(!0,1)}))},a)}var X={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Y=X[typeof window]&&window||this,Z=X[typeof exports]&&exports&&!exports.nodeType&&exports,$=X[typeof module]&&module&&!module.nodeType&&module,_=$&&$.exports===Z&&Z,aa=X[typeof global]&&global;!aa||aa.global!==aa&&aa.window!==aa||(Y=aa);var ba={internals:{},config:{Promise:Y.Promise},helpers:{}},ca=ba.helpers.noop=function(){},da=(ba.helpers.notDefined=function(a){return"undefined"==typeof a},ba.helpers.identity=function(a){return a}),ea=(ba.helpers.pluck=function(a){return function(b){return b[a]}},ba.helpers.just=function(a){return function(){return a}},ba.helpers.defaultNow=Date.now),fa=ba.helpers.defaultComparer=function(a,b){return $a(a,b)},ga=ba.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},ha=(ba.helpers.defaultKeySerializer=function(a){return a.toString()},ba.helpers.defaultError=function(a){throw a}),ia=ba.helpers.isPromise=function(a){return!!a&&"function"!=typeof a.subscribe&&"function"==typeof a.then},ja=(ba.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},ba.helpers.not=function(a){return!a},ba.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==Oa.call(a)}),a}());ba.config.longStackSupport=!1;var ka=!1;try{throw new Error}catch(la){ka=!!la.stack}var ma,na=g(),oa="From previous event:",pa=ba.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};pa.prototype=Error.prototype;var qa=ba.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};qa.prototype=Error.prototype;var ra=ba.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};ra.prototype=Error.prototype;var sa=ba.NotSupportedError=function(a){this.message=a||"This operation is not supported",Error.call(this)};sa.prototype=Error.prototype;var ta=ba.NotImplementedError=function(a){this.message=a||"This operation is not implemented",Error.call(this)};ta.prototype=Error.prototype;var ua=ba.helpers.notImplemented=function(){throw new ta},va=ba.helpers.notSupported=function(){throw new sa},wa="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";Y.Set&&"function"==typeof(new Y.Set)["@@iterator"]&&(wa="@@iterator");var xa=ba.doneEnumerator={done:!0,value:a},ya=ba.helpers.isIterable=function(b){return b[wa]!==a},za=ba.helpers.isArrayLike=function(b){return b&&b.length!==a};ba.helpers.iterator=wa;var Aa,Ba=ba.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)}},Ca=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Da=Ca.length,Ea="[object Arguments]",Fa="[object Array]",Ga="[object Boolean]",Ha="[object Date]",Ia="[object Error]",Ja="[object Function]",Ka="[object Number]",La="[object Object]",Ma="[object RegExp]",Na="[object String]",Oa=Object.prototype.toString,Pa=Object.prototype.hasOwnProperty,Qa=Oa.call(arguments)==Ea,Ra=Error.prototype,Sa=Object.prototype,Ta=String.prototype,Ua=Sa.propertyIsEnumerable;try{Aa=!(Oa.call(document)==La&&!({toString:0}+""))}catch(la){Aa=!0}var Va={};Va[Fa]=Va[Ha]=Va[Ka]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Va[Ga]=Va[Na]={constructor:!0,toString:!0,valueOf:!0},Va[Ia]=Va[Ja]=Va[Ma]={constructor:!0,toString:!0},Va[La]={constructor:!0};var Wa={};!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);Wa.enumErrorProps=Ua.call(Ra,"message")||Ua.call(Ra,"name"),Wa.enumPrototypes=Ua.call(a,"prototype"),Wa.nonEnumArgs=0!=c,Wa.nonEnumShadows=!/valueOf/.test(b)}(1);var Xa=ba.internals.isObject=function(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1},Ya=function(a){return a&&"object"==typeof a?Oa.call(a)==Ea:!1};Qa||(Ya=function(a){return a&&"object"==typeof a?Pa.call(a,"callee"):!1});{var Za,$a=ba.internals.isEqual=function(a,b){return m(a,b,[],[])},_a={e:{}},ab=({}.hasOwnProperty,Array.prototype.slice),bb=this.inherits=ba.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},cb=ba.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]}};ba.internals.addRef=function(a,b){return new Jc(function(c){return new fb(b.getDisposable(),a.subscribe(c))})}}r.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var db=ba.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},eb=db.prototype;eb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},eb.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)}}},eb.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)}}},eb.peek=function(){return this.items[0].value},eb.removeAt=function(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,this.heapify()},eb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},eb.enqueue=function(a){var b=this.length++;this.items[b]=new r(db.count++,a),this.percolate(b)},eb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},db.count=0;var fb=ba.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(!kb(c[a]))throw new TypeError("Not a disposable");this.disposables=c,this.isDisposed=!1,this.length=c.length},gb=fb.prototype;gb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},gb.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},gb.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 hb=ba.Disposable=function(a){this.isDisposed=!1,this.action=a||ca};hb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ib=hb.create=function(a){return new hb(a)},jb=hb.empty={dispose:ca},kb=hb.isDisposable=function(a){return a&&ja(a.dispose)},lb=hb.checkDisposed=function(a){if(a.isDisposed)throw new qa},mb=ba.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};mb.prototype.getDisposable=function(){return this.current},mb.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()},mb.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var nb=ba.SerialDisposable=function(){this.isDisposed=!1,this.current=null};nb.prototype.getDisposable=function(){return this.current},nb.prototype.setDisposable=function(a){var b=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},nb.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var ob=(ba.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?jb:new a(this)},b}(),ba.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||ga,this.disposable=new mb});ob.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},ob.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},ob.prototype.isCancelled=function(){return this.disposable.isDisposed},ob.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var pb=ba.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(),jb}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=ea,a.normalize=function(a){return 0>a&&(a=0),a},a}(),qb=pb.normalize,rb=pb.isScheduler;!function(a){function b(a,b){function c(b){e(b,function(b){var d=!1,e=!1,g=a.scheduleWithState(b,function(a,b){return d?f.remove(g):e=!0,c(b),jb});e||(f.add(g),d=!0)})}var d=b[0],e=b[1],f=new fb;return c(d),f}function c(a,b,c){function d(b){f(b,function(b,e){var f=!1,h=!1,i=a[c](b,e,function(a,b){return f?g.remove(i):h=!0,d(b),jb});h||(g.add(i),f=!0)})}var e=b[0],f=b[1],g=new fb;return d(e),g}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,d)},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState([a,c],b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative([a,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([a,d],b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(pb.prototype),function(a){pb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},pb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof Y.setInterval)throw new sa;b=qb(b);var d=a,e=Y.setInterval(function(){d=c(d)},b);return ib(function(){Y.clearInterval(e)})}}(pb.prototype);var sb,tb,ub=pb.immediate=function(){function a(a,b){return b(this,a)}return new pb(ea,a,va,va)}(),vb=pb.currentThread=function(){function a(){for(;c.length>0;){var a=c.dequeue();!a.isCancelled()&&a.invoke()}}function b(b,d){var e=new ob(this,b,d,this.now());if(c)c.enqueue(e);else{c=new db(4),c.enqueue(e);var f=o(a)();if(c=null,f===_a)return p(f.e)}return e.disposable}var c,d=new pb(ea,b,va,va);return d.scheduleRequired=function(){return!c},d}(),wb=(ba.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 mb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),function(){var a,b=ca;if(Y.setTimeout)a=Y.setTimeout,b=Y.clearTimeout;else{if(!Y.WScript)throw new sa;a=function(a,b){Y.WScript.Sleep(b),a()}}return{setTimeout:a,clearTimeout:b}}()),xb=wb.setTimeout,yb=wb.clearTimeout;!function(){function a(b){if(f)xb(function(){a(b)},0);else{var c=e[b];if(c){f=!0;var d=o(c)();if(tb(b),f=!1,d===_a)return p(d.e)}}}function b(){if(!Y.postMessage||Y.importScripts)return!1;var a=!1,b=Y.onmessage;return Y.onmessage=function(){a=!0},Y.postMessage("","*"),Y.onmessage=b,a}function c(b){"string"==typeof b.data&&b.data.substring(0,i.length)===i&&a(b.data.substring(i.length))}var d=1,e={},f=!1;tb=function(a){delete e[a]};var g=RegExp("^"+String(Oa).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),h="function"==typeof(h=aa&&_&&aa.setImmediate)&&!g.test(h)&&h;if(ja(h))sb=function(b){var c=d++;return e[c]=b,h(function(){a(c)}),c};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))sb=function(b){var c=d++;return e[c]=b,process.nextTick(function(){a(c)}),c};else if(b()){var i="ms.rx.schedule"+Math.random();Y.addEventListener?Y.addEventListener("message",c,!1):Y.attachEvent?Y.attachEvent("onmessage",c):Y.onmessage=c,sb=function(a){var b=d++;return e[b]=a,Y.postMessage(i+currentId,"*"),b}}else if(Y.MessageChannel){var j=new Y.MessageChannel;j.port1.onmessage=function(b){a(b.data)},sb=function(a){var b=d++;return e[b]=a,j.port2.postMessage(b),b}}else sb="document"in Y&&"onreadystatechange"in Y.document.createElement("script")?function(b){var c=Y.document.createElement("script"),f=d++;return e[f]=b,c.onreadystatechange=function(){a(f),c.onreadystatechange=null,c.parentNode.removeChild(c),c=null},Y.document.documentElement.appendChild(c),f}:function(b){var c=d++;return e[c]=b,xb(function(){a(c)},0),c}}();var zb,Ab=pb.timeout=pb["default"]=function(){function a(a,b){var c=this,d=new mb,e=sb(function(){!d.isDisposed&&d.setDisposable(b(c,a))});return new fb(d,ib(function(){tb(e)}))}function b(a,b,c){var d=this,e=pb.normalize(b),f=new mb;if(0===e)return d.scheduleWithState(a,c);var g=xb(function(){!f.isDisposed&&f.setDisposable(c(d,a))},e);return new fb(f,ib(function(){yb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new pb(ea,a,b,c)}(),Bb=ba.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 rb(a)||(a=ub),new Jc(function(c){return a.scheduleWithState(b,function(a,b){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Cb=Bb.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 Bb("N",d,null,a,b,c)}}(),Db=Bb.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 Bb("E",null,d,a,b,c)}}(),Eb=Bb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){return new Bb("C",null,null,a,b,c)}}(),Fb=ba.Observer=function(){},Gb=Fb.create=function(a,b,c){return a||(a=ca),b||(b=ha),c||(c=ca),new Ib(a,b,c)},Hb=ba.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return bb(b,a),b.prototype.next=ua,b.prototype.error=ua,b.prototype.completed=ua,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}(Fb),Ib=ba.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return bb(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}(Hb),Jb=ba.Observable=function(){function a(a){if(ba.config.longStackSupport&&ka){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var d=this;this._subscribe=function(b){var e=b.onError.bind(b);return b.onError=function(a){c(a,d),e(a)},a.call(d,b)}}else this._subscribe=a}return zb=a.prototype,zb.subscribe=zb.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Gb(a,b,c))},zb.subscribeOnNext=function(a,b){return this._subscribe(Gb("undefined"!=typeof b?function(c){a.call(b,c)}:a))},zb.subscribeOnError=function(a,b){return this._subscribe(Gb(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},zb.subscribeOnCompleted=function(a,b){return this._subscribe(Gb(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},a}(),Kb=ba.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 nb}return bb(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}(Hb),Lb=ba.ObservableBase=function(a){function b(a){return a&&ja(a.dispose)?a:ja(a)?ib(a):jb}function c(a,c){var d=c[0],e=c[1],f=o(e.subscribeCore).call(e,d);return f!==_a||d.fail(_a.e)?void d.setDisposable(b(f)):p(_a.e)}function d(a){var b=new Kc(a),d=[b,this];return vb.scheduleRequired()?vb.scheduleWithState(d,c):c(null,d),b}function e(){a.call(this,d)}return bb(e,a),e.prototype.subscribeCore=ua,e}(Jb),Mb=ba.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 bb(b,a),b.prototype.subscribeCore=function(a){var b,d=new nb,e=ub.scheduleRecursiveWithState(this.sources[wa](),function(e,f){if(!b){var g=o(e.next).call(e);if(g===_a)return a.onError(g.e);if(g.done)return a.onCompleted();var h=g.value;ia(h)&&(h=Cc(h));var i=new mb;d.setDisposable(i),i.setDisposable(h.subscribe(new c(a,f,e)))}});return new fb(d,e,ib(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}(Lb);Mb.prototype.concat=function(){return new Nb(this)};var Ob=function(a){function b(b){this.sources=b,a.call(this)}return bb(b,a),b.prototype.subscribeCore=function(a){var b,c=this.sources[wa](),d=new nb,e=ub.scheduleRecursiveWithState(null,function(e,f){if(!b){var g=o(c.next).call(c);if(g===_a)return a.onError(g.e);if(g.done)return null!==e?a.onError(e):a.onCompleted();var h=g.value;ia(h)&&(h=Cc(h));var i=new mb;d.setDisposable(i),i.setDisposable(h.subscribe(function(b){a.onNext(b)},f,function(){a.onCompleted()}))}});return new fb(d,e,ib(function(){b=!0}))},b}(Lb);Mb.prototype.catchError=function(){return new Ob(this)},Mb.prototype.catchErrorWhen=function(a){var b=this;return new Jc(function(c){var d,e,f=new Mc,g=new Mc,h=a(f),i=h.subscribe(g),j=b[wa](),k=new nb,l=ub.scheduleRecursive(function(a){if(!d){var b=o(j.next).call(j);if(b===_a)return c.onError(b.e);if(b.done)return void(e?c.onError(e):c.onCompleted());var h=b.value;ia(h)&&(h=Cc(h));var i=new mb,l=new mb;k.setDisposable(new fb(l,i)),i.setDisposable(h.subscribe(function(a){c.onNext(a)},function(b){l.setDisposable(g.subscribe(a,function(a){c.onError(a)},function(){c.onCompleted()})),f.onNext(b)},function(){c.onCompleted()}))}});return new fb(i,k,l,ib(function(){d=!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 bb(b,a),b.prototype[wa]=function(){return new c(this)},c.prototype.next=function(){return 0===this.l?xa:(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?Ba(b,c,3):null}function c(a){this.i=-1,this.s=a.s,this.l=this.s.length,this.fn=a.fn}return bb(b,a),b.prototype[wa]=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]}:xa},b}(Mb),Sb=Mb.of=function(a,b,c){return new Rb(a,b,c)},Tb=function(a){function b(b){this.source=b,a.call(this)}function c(a){this.o=a,this.a=[],this.isStopped=!1}return bb(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}(Lb);zb.toArray=function(){return new Tb(this)},Jb.create=Jb.createWithDisposable=function(a,b){return new Jc(a,b)};var Ub=Jb.defer=function(a){return new Jc(function(b){var c;try{c=a()}catch(d){return ic(d).subscribe(b)}return ia(c)&&(c=Cc(c)),c.subscribe(b)})},Vb=function(a){function b(b){this.scheduler=b,a.call(this)}function c(a,b){this.observer=a,this.parent=b}function d(a,b){b.onCompleted()}return bb(b,a),b.prototype.subscribeCore=function(a){var b=new c(a,this);return b.run()},c.prototype.run=function(){return this.parent.scheduler.scheduleWithState(this.observer,d)},b}(Lb),Wb=Jb.empty=function(a){return rb(a)||(a=ub),new Vb(a)},Xb=function(a){function b(b,c,d){this.iterable=b,this.mapper=c,this.scheduler=d,a.call(this)}return bb(b,a),b.prototype.subscribeCore=function(a){var b=new Yb(a,this);return b.run()},b}(Lb),Yb=function(){function a(a,b){this.observer=a,this.parent=b}return a.prototype.run=function(){function a(a,b){try{var f=c.next()}catch(g){return d.onError(g)}if(f.done)return d.onCompleted();var h=f.value;if(e)try{h=e(h,a)}catch(g){return d.onError(g)}d.onNext(h),b(a+1)}var b=Object(this.parent.iterable),c=y(b),d=this.observer,e=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,a)},a}(),Zb=Math.pow(2,53)-1;t.prototype[wa]=function(){return new u(this._s)},u.prototype[wa]=function(){return this},u.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:xa},v.prototype[wa]=function(){return new w(this._a)},w.prototype[wa]=function(){return this},w.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:xa};var $b=Jb.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!ja(b))throw new Error("mapFn when provided must be a function");if(b)var e=Ba(b,c,2);return rb(d)||(d=vb),new Xb(a,e,d)},_b=function(a){function b(b,c){this.args=b,this.scheduler=c,a.call(this)}return bb(b,a),b.prototype.subscribeCore=function(a){var b=new B(a,this);return b.run()},b}(Lb);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 ac=Jb.fromArray=function(a,b){return rb(b)||(b=vb),new _b(a,b)},bc=function(a){function b(){a.call(this)}return bb(b,a),b.prototype.subscribeCore=function(a){return jb},b}(Lb);Jb.never=function(){return new bc}}Jb.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];
  
  return new _b(b,vb)},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 _b(c,a)};var cc=function(a){function b(b,c){this.obj=b,this.keys=Object.keys(b),this.scheduler=c,a.call(this)}return bb(b,a),b.prototype.subscribeCore=function(a){var b=new D(a,this);return b.run()},b}(Lb);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=vb),new cc(a,b)};var dc=function(a){function b(b,c,d){this.start=b,this.rangeCount=c,this.scheduler=d,a.call(this)}return bb(b,a),b.prototype.subscribeCore=function(a){var b=new ec(a,this);return b.run()},b}(Lb),ec=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 rb(c)||(c=vb),new dc(a,b,c)};var fc=function(a){function b(b,c,d){this.value=b,this.repeatCount=null==c?-1:c,this.scheduler=d,a.call(this)}return bb(b,a),b.prototype.subscribeCore=function(a){var b=new E(a,this);return b.run()},b}(Lb);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 rb(c)||(c=vb),new fc(a,b,c)};var gc=function(a){function b(b,c){this.value=b,this.scheduler=c,a.call(this)}function c(a,b){this.observer=a,this.parent=b}function d(a,b){var c=b[0],d=b[1];d.onNext(c),d.onCompleted()}return bb(b,a),b.prototype.subscribeCore=function(a){var b=new c(a,this);return b.run()},c.prototype.run=function(){return this.parent.scheduler.scheduleWithState([this.parent.value,this.observer],d)},b}(Lb),hc=(Jb["return"]=Jb.just=Jb.returnValue=function(a,b){return rb(b)||(b=ub),new gc(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 bb(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}(Lb)),ic=Jb["throw"]=Jb.throwError=Jb.throwException=function(a,b){return rb(b)||(b=ub),new hc(a,b)};zb["catch"]=zb.catchError=zb.catchException=function(a){return"function"==typeof a?F(this,a):jc([this,a])};var jc=Jb.catchError=Jb["catch"]=Jb.catchException=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 Sb(a).catchError()};zb.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),kc.apply(this,b)};var kc=Jb.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b.pop();return Array.isArray(b[0])&&(b=b[0]),new Jc(function(a){function c(b){if(h[b]=!0,i||(i=h.every(da))){try{var c=d.apply(null,k)}catch(e){return a.onError(e)}a.onNext(c)}else j.filter(function(a,c){return c!==b}).every(da)&&a.onCompleted()}function e(b){j[b]=!0,j.every(da)&&a.onCompleted()}for(var f=b.length,g=function(){return!1},h=q(f,g),i=!1,j=q(f,g),k=new Array(f),l=new Array(f),m=0;f>m;m++)!function(d){var f=b[d],g=new mb;ia(f)&&(f=Cc(f)),g.setDisposable(f.subscribe(function(a){k[d]=a,c(d)},function(b){a.onError(b)},function(){e(d)})),l[d]=g}(m);return new fb(l)},this)};zb.concat=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return a.unshift(this),mc.apply(null,a)};var lc=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){this.sources=a,this.o=b}return bb(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 nb,c=this.sources,d=c.length,e=this.o,f=ub.scheduleRecursiveWithState(0,function(f,g){if(!a){if(f===d)return e.onCompleted();var h=c[f];ia(h)&&(h=Cc(h));var i=new mb;b.setDisposable(i),i.setDisposable(h.subscribe(function(a){e.onNext(a)},function(a){e.onError(a)},function(){g(f+1)}))}});return new fb(b,f,ib(function(){a=!0}))},b}(Lb),mc=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 lc(a)};zb.concatAll=zb.concatObservable=function(){return this.merge(1)};var nc=function(a){function b(b,c){this.source=b,this.maxConcurrent=c,a.call(this)}return bb(b,a),b.prototype.subscribeCore=function(a){var b=new fb;return b.add(this.source.subscribe(new oc(a,this.maxConcurrent,b))),b},b}(Lb),oc=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 mb;this.g.add(c),ia(a)&&(a=Cc(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}();zb.merge=function(a){return"number"!=typeof a?pc(this,a):new nc(this,a)};var pc=Jb.merge=function(){var a,b,c=[],d=arguments.length;if(arguments[0])if(rb(arguments[0]))for(a=arguments[0],b=1;d>b;b++)c.push(arguments[b]);else for(a=ub,b=0;d>b;b++)c.push(arguments[b]);else for(a=ub,b=1;d>b;b++)c.push(arguments[b]);return Array.isArray(c[0])&&(c=c[0]),C(a,c).mergeAll()},qc=ba.CompositeError=function(a){this.name="NotImplementedError",this.innerErrors=a,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};qc.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 Jc(function(a){function b(){0===g.length?a.onCompleted():a.onError(1===g.length?g[0]:new qc(g))}var c=new fb,e=new mb,f=!1,g=[];return c.add(e),e.setDisposable(d.subscribe(function(d){var e=new mb;c.add(e),ia(d)&&(d=Cc(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 rc=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,c){this.parent=a,this.g=b,this.sad=c,this.isStopped=!1}return bb(b,a),b.prototype.subscribeCore=function(a){var b=new fb,d=new mb;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 mb;this.g.add(b),ia(a)&&(a=Cc(a)),b.setDisposable(a.subscribe(new d(this,this.g,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}(Lb);zb.mergeAll=zb.mergeObservable=function(){return new rc(this)},zb.skipUntil=function(a){var b=this;return new Jc(function(c){var d=!1,e=new fb(b.subscribe(function(a){d&&c.onNext(a)},function(a){c.onError(a)},function(){d&&c.onCompleted()}));ia(a)&&(a=Cc(a));var f=new mb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},function(a){c.onError(a)},function(){f.dispose()})),e},b)};var sc=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 bb(b,a),b.prototype.subscribeCore=function(a){var b=new nb,d=this.source.subscribe(new c(a,b));return new fb(d,b)},c.prototype.onNext=function(a){if(!this.isStopped){var b=new mb,c=++this.latest;this.hasLatest=!0,this.inner.setDisposable(b),ia(a)&&(a=Cc(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}(Lb);zb["switch"]=zb.switchLatest=function(){return new sc(this)};var tc=function(a){function b(b,c){this.source=b,this.other=ia(c)?Cc(c):c,a.call(this)}function c(a){this.o=a,this.isStopped=!1}return bb(b,a),b.prototype.subscribeCore=function(a){return new fb(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}(Lb);zb.takeUntil=function(a){return new tc(this,a)},zb.withLatestFrom=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b.pop(),e=this;return Array.isArray(b[0])&&(b=b[0]),new Jc(function(a){for(var c=b.length,f=q(c,G),g=!1,h=new Array(c),i=new Array(c+1),j=0;c>j;j++)!function(c){var d=b[c],e=new mb;ia(d)&&(d=Cc(d)),e.setDisposable(d.subscribe(function(a){h[c]=a,f[c]=!0,g=f.every(da)},function(b){a.onError(b)},ca)),i[c]=e}(j);var k=new mb;return k.setDisposable(e.subscribe(function(b){var c=[b].concat(h);if(g){var e=o(d).apply(null,c);return e===_a?a.onError(e.e):void a.onNext(e)}},function(b){a.onError(b)},function(){a.onCompleted()})),i[c]=k,new fb(i)},this)},zb.zip=function(){if(Array.isArray(arguments[0]))return H.apply(this,arguments);for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=this,e=b.pop();return b.unshift(d),new Jc(function(a){for(var c=b.length,f=q(c,I),g=q(c,G),h=new Array(c),i=0;c>i;i++)!function(c){var i=b[c],j=new mb;ia(i)&&(i=Cc(i)),j.setDisposable(i.subscribe(function(b){if(f[c].push(b),f.every(function(a){return a.length>0})){var h=f.map(function(a){return a.shift()}),i=o(e).apply(d,h);if(i===_a)return a.onError(i.e);a.onNext(i)}else g.filter(function(a,b){return b!==c}).every(da)&&a.onCompleted()},function(b){a.onError(b)},function(){g[c]=!0,g.every(da)&&a.onCompleted()})),h[c]=j}(i);return new fb(h)},d)},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)},Jb.zipArray=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 new Jc(function(b){for(var c=a.length,d=q(c,J),e=q(c,G),f=new Array(c),g=0;c>g;g++)!function(c){f[c]=new mb,f[c].setDisposable(a[c].subscribe(function(a){if(d[c].push(a),d.every(function(a){return a.length>0})){var f=d.map(function(a){return a.shift()});b.onNext(f)}else if(e.filter(function(a,b){return b!==c}).every(da))return b.onCompleted()},function(a){b.onError(a)},function(){e[c]=!0,e.every(da)&&b.onCompleted()}))}(g);return new fb(f)})},zb.asObservable=function(){var a=this;return new Jc(function(b){return a.subscribe(b)},a)},zb.dematerialize=function(){var a=this;return new Jc(function(b){return a.subscribe(function(a){return a.accept(b)},function(a){b.onError(a)},function(){b.onCompleted()})},this)},zb.distinctUntilChanged=function(a,b){var c=this;return b||(b=fa),new Jc(function(d){var e,f=!1;return c.subscribe(function(c){var g=c;if(a&&(g=o(a)(c),g===_a))return d.onError(g.e);if(f){var h=o(b)(e,g);if(h===_a)return d.onError(h.e)}f&&h||(f=!0,e=g,d.onNext(c))},function(a){d.onError(a)},function(){d.onCompleted()})},this)};var uc=function(a){function b(b,c,d,e){this.source=b,this.t=!c||ja(c)?Gb(c||ca,d||ca,e||ca):c,a.call(this)}function c(a,b){this.o=a,this.t=b,this.isStopped=!1}return bb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this.t))},c.prototype.onNext=function(a){if(!this.isStopped){var b=o(this.t.onNext).call(this.t,a);b===_a&&this.o.onError(b.e),this.o.onNext(a)}},c.prototype.onError=function(a){if(!this.isStopped){this.isStopped=!0;var b=o(this.t.onError).call(this.t,a);if(b===_a)return this.o.onError(b.e);this.o.onError(a)}},c.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=!0;var a=o(this.t.onCompleted).call(this.t);if(a===_a)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}(Lb);zb["do"]=zb.tap=zb.doAction=function(a,b,c){return new uc(this,a,b,c)},zb.doOnNext=zb.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},zb.doOnError=zb.tapOnError=function(a,b){return this.tap(ca,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},zb.doOnCompleted=zb.tapOnCompleted=function(a,b){return this.tap(ca,null,"undefined"!=typeof b?function(){a.call(b)}:a)},zb["finally"]=zb.ensure=function(a){var b=this;return new Jc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return ib(function(){try{d.dispose()}catch(b){throw b}finally{a()}})},this)},zb.finallyAction=function(a){return this.ensure(a)};var vc=function(a){function b(b){this.source=b,a.call(this)}function c(a){this.o=a,this.isStopped=!1}return bb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a))},c.prototype.onNext=ca,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}(Lb);zb.ignoreElements=function(){return new vc(this)},zb.materialize=function(){var a=this;return new Jc(function(b){return a.subscribe(function(a){b.onNext(Cb(a))},function(a){b.onNext(Db(a)),b.onCompleted()},function(){b.onNext(Eb()),b.onCompleted()})},a)},zb.repeat=function(a){return Qb(this,a).concat()},zb.retry=function(a){return Qb(this,a).catchError()},zb.retryWhen=function(a){return Qb(this).catchErrorWhen(a)};var wc=function(a){function b(b,c,d,e){this.source=b,this.accumulator=c,this.hasSeed=d,this.seed=e,a.call(this)}return bb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new K(a,this))},b}(Lb);K.prototype.onNext=function(a){if(!this.isStopped){!this.hasValue&&(this.hasValue=!0);try{this.hasAccumulation?this.accumulation=this.accumulator(this.accumulation,a):(this.accumulation=this.hasSeed?this.accumulator(this.seed,a):a,this.hasAccumulation=!0)}catch(b){return this.observer.onError(b)}this.observer.onNext(this.accumulation)}},K.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},K.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,!this.hasValue&&this.hasSeed&&this.observer.onNext(this.seed),this.observer.onCompleted())},K.prototype.dispose=function(){this.isStopped=!0},K.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},zb.scan=function(){var a,b,c=!1;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new wc(this,b,c,a)},zb.skipLast=function(a){if(0>a)throw new ra;var b=this;return new Jc(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)},zb.startWith=function(){var a,b=0;arguments.length&&rb(arguments[0])?(a=arguments[0],b=1):a=ub;for(var c=[],d=b,e=arguments.length;e>d;d++)c.push(arguments[d]);return Sb([ac(c,a),this]).concat()},zb.takeLast=function(a){if(0>a)throw new ra;var b=this;return new Jc(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)},zb.selectConcat=zb.concatMap=function(a,b,c){return ja(a)&&ja(b)?this.concatMap(function(c,d){var e=a(c,d);return ia(e)&&(e=Cc(e)),(za(e)||ya(e))&&(e=$b(e)),e.map(function(a,e){return b(c,a,d,e)})}):ja(a)?L(this,a,c):L(this,function(){return a})};var xc=function(a){function b(b,c,d){this.source=b,this.selector=Ba(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 d(a,b,c){this.o=a,this.selector=b,this.source=c,this.i=0,this.isStopped=!1}return bb(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 d(a,this.selector,this))},d.prototype.onNext=function(a){if(!this.isStopped){var b=o(this.selector)(a,this.i++,this.source);return b===_a?this.o.onError(b.e):void this.o.onNext(b)}},d.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},d.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},d.prototype.dispose=function(){this.isStopped=!0},d.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b}(Lb);zb.map=zb.select=function(a,b){var c="function"==typeof a?a:function(){return a};return this instanceof xc?this.internalMap(c,b):new xc(this,c,b)},zb.pluck=function(){var b=arguments,c=arguments.length;if(0===c)throw new Error("List of properties cannot be empty.");return this.map(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})},zb.selectMany=zb.flatMap=function(a,b,c){return ja(a)&&ja(b)?this.flatMap(function(c,d){var e=a(c,d);return ia(e)&&(e=Cc(e)),(za(e)||ya(e))&&(e=$b(e)),e.map(function(a,e){return b(c,a,d,e)})},c):ja(a)?M(this,a,c):M(this,function(){return a})},zb.selectSwitch=zb.flatMapLatest=zb.switchMap=function(a,b){return this.select(a,b).switchLatest()};var yc=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 bb(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}(Lb);zb.skip=function(a){if(0>a)throw new ra;return new yc(this,a)},zb.skipWhile=function(a,b){var c=this,d=Ba(a,b,3);return new Jc(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)},zb.take=function(a,b){if(0>a)throw new ra;if(0===a)return Wb(b);var c=this;return new Jc(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)},zb.takeWhile=function(a,b){var c=this,d=Ba(a,b,3);return new Jc(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 zc=function(a){function b(b,c,d){this.source=b,this.predicate=Ba(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 d(a,b,c){this.o=a,this.predicate=b,this.source=c,this.i=0,this.isStopped=!1}return bb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new d(a,this.predicate,this))},b.prototype.internalFilter=function(a,d){return new b(this.source,c(a,this),d)},d.prototype.onNext=function(a){if(!this.isStopped){var b=o(this.predicate)(a,this.i++,this.source);return b===_a?this.o.onError(b.e):void(b&&this.o.onNext(a))}},d.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},d.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},d.prototype.dispose=function(){this.isStopped=!0},d.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b}(Lb);zb.filter=zb.where=function(a,b){return this instanceof zc?this.internalFilter(a,b):new zc(this,a,b)},Jb.fromCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new Jc(function(d){function f(){for(var a=arguments.length,e=new Array(a),f=0;a>f;f++)e[f]=arguments[f];if(c){try{e=c.apply(b,e)}catch(g){return d.onError(g)}d.onNext(e)}else e.length<=1?d.onNext.apply(d,e):d.onNext(e);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},Jb.fromNodeCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new Jc(function(d){function f(a){if(a)return void d.onError(a);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(c){try{f=c.apply(b,f)}catch(h){return d.onError(h)}d.onNext(f)}else f.length<=1?d.onNext.apply(d,f):d.onNext(f);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},ba.config.useNativeEvents=!1,Jb.fromEvent=function(a,b,c){return a.addListener?Ac(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c):ba.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new Jc(function(d){return O(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e)}d.onNext(b)})}).publish().refCount():Ac(function(c){a.on(b,c)},function(c){a.off(b,c)},c)};var Ac=Jb.fromEventPattern=function(a,b,c){return new Jc(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e)}d.onNext(b)}var f=a(e);return ib(function(){b&&b(e,f)})}).publish().refCount()},Bc=function(a){function b(b){this.p=b,a.call(this)}return bb(b,a),b.prototype.subscribeCore=function(a){return this.p.then(function(b){a.onNext(b),a.onCompleted()},function(b){a.onError(b)}),jb},b}(Lb),Cc=Jb.fromPromise=function(a){return new Bc(a)};zb.toPromise=function(a){if(a||(a=ba.config.Promise),!a)throw new sa("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)})})},Jb.startAsync=function(a){var b;try{b=a()}catch(c){return ic(c)}return Cc(b)},zb.multicast=function(a,b){var c=this;return"function"==typeof a?new Jc(function(d){var e=c.multicast(a());return new fb(b(e).subscribe(d),e.connect())},c):new Dc(c,a)},zb.publish=function(a){return a&&ja(a)?this.multicast(function(){return new Mc},a):this.multicast(new Mc)},zb.share=function(){return this.publish().refCount()},zb.publishLast=function(a){return a&&ja(a)?this.multicast(function(){return new Nc},a):this.multicast(new Nc)},zb.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Pc(b)},a):this.multicast(new Pc(a))},zb.shareValue=function(a){return this.publishValue(a).refCount()},zb.replay=function(a,b,c,d){return a&&ja(a)?this.multicast(function(){return new Qc(b,c,d)},a):this.multicast(new Qc(b,c,d))},zb.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};{var Dc=ba.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new fb(f.subscribe(c),ib(function(){e=!1}))),d},a.call(this,function(a){return c.subscribe(a)})}return bb(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new Jc(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(Jb),Ec=Jb.interval=function(a,b){return S(a,a,rb(b)?b:Ab)};Jb.timer=function(b,c,d){var e;return rb(d)||(d=Ab),c!==a&&"number"==typeof c?e=c:rb(c)&&(d=c),b instanceof Date&&e===a?P(b.getTime(),d):b instanceof Date&&e!==a?(e=c,Q(b.getTime(),e,d)):e===a?R(b,d):S(b,e,d)}}zb.delay=function(a,b){return rb(b)||(b=Ab),a instanceof Date?U(this,a.getTime(),b):T(this,a,b)},zb.debounce=zb.throttleWithTimeout=function(a,b){rb(b)||(b=Ab);var c=this;return new Jc(function(d){var e,f=new nb,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new mb;f.setDisposable(j),j.setDisposable(b.scheduleWithRelative(a,function(){g&&h===i&&d.onNext(e),g=!1}))},function(a){f.dispose(),d.onError(a),g=!1,h++},function(){f.dispose(),g&&d.onNext(e),d.onCompleted(),g=!1,h++});return new fb(i,f)},this)},zb.throttle=function(a,b){return this.debounce(a,b)},zb.timestamp=function(a){return rb(a)||(a=Ab),this.map(function(b){return{value:b,timestamp:a.now()}})},zb.sample=zb.throttleLatest=function(a,b){return rb(b)||(b=Ab),"number"==typeof a?V(this,Ec(a,b)):V(this,a)},zb.timeout=function(a,b,c){(null==b||"string"==typeof b)&&(b=ic(new Error(b||"Timeout"))),rb(c)||(c=Ab);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new Jc(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(ia(b)&&(b=Cc(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new mb,j=new nb,k=!1,l=new nb;return j.setDisposable(i),g(),i.setDisposable(d.subscribe(function(a){k||(h++,f.onNext(a),g())},function(a){k||(h++,f.onError(a))},function(){k||(h++,f.onCompleted())})),new fb(j,l)},d)},zb.throttleFirst=function(a,b){rb(b)||(b=Ab);var c=+a||0;if(0>=c)throw new RangeError("windowDuration cannot be less or equal zero.");var d=this;return new Jc(function(a){var e=0;return d.subscribe(function(d){var f=b.now();(0===e||f-e>=c)&&(e=f,a.onNext(d))},function(b){a.onError(b)},function(){a.onCompleted()})},d)};var Fc=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=jb,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=jb)});return new fb(c,d,e)}function c(c,d){this.source=c,this.controller=new Mc,d&&d.subscribe?this.pauser=this.controller.merge(d):this.pauser=this.controller,a.call(this,b,c)}return bb(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(Jb);zb.pausable=function(a){return new Fc(this,a)};var Gc=function(b){function c(b){function c(){for(;e.length>0;)b.onNext(e.shift())}var d,e=[],f=W(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(f){d!==a&&f.shouldFire!=d?(d=f.shouldFire,f.shouldFire&&c()):(d=f.shouldFire,f.shouldFire?b.onNext(f.data):e.push(f.data))},function(a){c(),b.onError(a)},function(){c(),b.onCompleted()});return f}function d(a,d){this.source=a,this.controller=new Mc,d&&d.subscribe?this.pauser=this.controller.merge(d):this.pauser=this.controller,b.call(this,c,a)}return bb(d,b),d.prototype.pause=function(){this.controller.onNext(!1)},d.prototype.resume=function(){this.controller.onNext(!0)},d}(Jb);zb.pausableBuffered=function(a){return new Gc(this,a)};var Hc=function(a){function b(a){return this.source.subscribe(a)}function c(c,d,e){a.call(this,b,c),this.subject=new Ic(d,e),this.source=c.multicast(this.subject).refCount()}return bb(c,a),c.prototype.request=function(a){return this.subject.request(null==a?-1:a)},c}(Jb),Ic=function(a){function b(a){return this.subject.subscribe(a)}function c(c,d){null==c&&(c=!0),a.call(this,b),this.subject=new Mc,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=jb,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.scheduler=d||vb}return bb(c,a),cb(c.prototype,Fb,{onCompleted:function(){this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length?this.queue.push(Bb.createOnCompleted()):this.subject.onCompleted()},onError:function(a){this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length?this.queue.push(Bb.createOnError(a)):this.subject.onError(a)},onNext:function(a){var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(Bb.createOnNext(a)):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0||this.queue.length>0&&"N"!==this.queue[0].kind;){var b=this.queue.shift();b.accept(this.subject),"N"===b.kind?a--:(this.disposeCurrentRequest(),this.queue=[])}return{numberOfItems:a,returnValue:0!==this.queue.length}}return{numberOfItems:a,returnValue:!1}},request:function(a){this.disposeCurrentRequest();var b=this;return this.requestedDisposable=this.scheduler.scheduleWithState(a,function(a,c){var d=b._processRequest(c),e=d.numberOfItems;d.returnValue||(b.requestedCount=e,b.requestedDisposable=ib(function(){b.requestedCount=0}))}),this.requestedDisposable},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=jb}}),c}(Jb);zb.controlled=function(a,b){return a&&rb(a)&&(b=a,a=!0),null==a&&(a=!0),new Hc(this,a,b)},zb.pipe=function(a){function b(){c.resume()}var c=this.pausableBuffered();return a.addListener("drain",b),c.subscribe(function(b){!a.write(String(b))&&c.pause()},function(b){a.emit("error",b)},function(){!a._isStdio&&a.end(),a.removeListener("drain",b)}),c.resume(),a},zb.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 Jc(function(d){var e=a(b(d));return c.subscribe(function(a){
  try{e["@@transducer/step"](d,a)}catch(b){d.onError(b)}},function(a){d.onError(a)},function(){e["@@transducer/result"](d)})},c)};var Jc=ba.AnonymousObservable=function(a){function b(a){return a&&ja(a.dispose)?a:ja(a)?ib(a):jb}function c(a,c){var d=c[0],e=c[1],f=o(e)(d);return f!==_a||d.fail(_a.e)?void d.setDisposable(b(f)):p(_a.e)}function d(b,d){function e(a){var d=new Kc(a),e=[d,b];return vb.scheduleRequired()?vb.scheduleWithState(e,c):c(null,e),d}this.source=d,a.call(this,e)}return bb(d,a),d}(Jb),Kc=function(a){function b(b){a.call(this),this.observer=b,this.m=new mb}bb(b,a);var c=b.prototype;return c.next=function(a){var b=o(this.observer.onNext).call(this.observer,a);b===_a&&(this.dispose(),p(b.e))},c.error=function(a){var b=o(this.observer.onError).call(this.observer,a);this.dispose(),b===_a&&p(b.e)},c.completed=function(){var a=o(this.observer.onCompleted).call(this.observer);this.dispose(),a===_a&&p(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}(Hb),Lc=function(a,b){this.subject=a,this.observer=b};Lc.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 Mc=ba.Subject=function(a){function c(a){return lb(this),this.isStopped?this.hasError?(a.onError(this.error),jb):(a.onCompleted(),jb):(this.observers.push(a),new Lc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return bb(d,a),cb(d.prototype,Fb.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(lb(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(lb(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(lb(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 Oc(a,b)},d}(Jb),Nc=ba.AsyncSubject=function(a){function c(a){return lb(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),jb):(this.observers.push(a),new Lc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return bb(d,a),cb(d.prototype,Fb,{hasObservers:function(){return lb(this),this.observers.length>0},onCompleted:function(){var a,c;if(lb(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(lb(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){lb(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),Oc=ba.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 bb(c,a),cb(c.prototype,Fb.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Jb),Pc=ba.BehaviorSubject=function(a){function c(a){return lb(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),jb):(this.observers.push(a),a.onNext(this.value),new Lc(this,a))}function d(b){a.call(this,c),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return bb(d,a),cb(d.prototype,Fb,{getValue:function(){if(lb(this),this.hasError)throw this.error;return this.value},hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(lb(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(lb(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){if(lb(this),!this.isStopped){this.value=a;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,this.value=null,this.exception=null}}),d}(Jb),Qc=ba.ReplaySubject=function(a){function c(a,b){return ib(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function d(a){var b=new Kb(this.scheduler,a),d=c(this,b);lb(this),this._trim(this.scheduler.now()),this.observers.push(b);for(var e=0,f=this.q.length;f>e;e++)b.onNext(this.q[e].value);return this.hasError?b.onError(this.error):this.isStopped&&b.onCompleted(),b.ensureActive(),d}function e(b,c,e){this.bufferSize=null==b?f:b,this.windowSize=null==c?f:c,this.scheduler=e||vb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,d)}var f=Math.pow(2,53)-1;return bb(e,a),cb(e.prototype,Fb.prototype,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){if(lb(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=0,e=b(this.observers),f=e.length;f>d;d++){var g=e[d];g.onNext(a),g.ensureActive()}}},onError:function(a){if(lb(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=0,e=b(this.observers),f=e.length;f>d;d++){var g=e[d];g.onError(a),g.ensureActive()}this.observers.length=0}},onCompleted:function(){if(lb(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var c=0,d=b(this.observers),e=d.length;e>c;c++){var f=d[c];f.onCompleted(),f.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(Jb);ba.Pauser=function(a){function b(){a.call(this)}return bb(b,a),b.prototype.pause=function(){this.onNext(!1)},b.prototype.resume=function(){this.onNext(!0)},b}(Mc),"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Y.Rx=ba,define(function(){return ba})):Z&&$?_?($.exports=ba).Rx=ba:Z.Rx=ba:Y.Rx=ba;var Rc=g()}).call(this);
  //# sourceMappingURL=rx.lite.map