diff --git a/Gruntfile.js b/Gruntfile.js index 779a3f53a..1f7691372 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1042,6 +1042,7 @@ var browsers = [{ // Time operators 'src/core/linq/observable/_observabletimertimespan.js', // AnonymousObservable, normalizeTime 'src/core/linq/observable/_observabletimertimespanandperiod.js', // AnonymousObservable, defer, _observabletimerdateandperiod + 'src/core/linq/observable/_observabletimerdateandperiod.js', 'src/core/linq/observable/interval.js', // timeoutScheduler, _observabletimertimespanandperiod 'src/core/linq/observable/timer-lite.js', // timeoutScheduler, _observabletimerdate, _observabletimerdateandperiod, _observabletimertimespan, _observabletimertimespanandperiod 'src/core/linq/observable/delay-lite.js', // AnonymousObservable, timeoutScheduler, SerialDisposable, materialize, timestamp @@ -1212,6 +1213,7 @@ var browsers = [{ // Time operators 'src/core/linq/observable/_observabletimertimespan.js', // AnonymousObservable, normalizeTime 'src/core/linq/observable/_observabletimertimespanandperiod.js', // AnonymousObservable, defer, _observabletimerdateandperiod + 'src/core/linq/observable/_observabletimerdateandperiod.js', 'src/core/linq/observable/interval.js', // timeoutScheduler, _observabletimertimespanandperiod 'src/core/linq/observable/timer-lite.js', // timeoutScheduler, _observabletimerdate, _observabletimerdateandperiod, _observabletimertimespan, _observabletimertimespanandperiod 'src/core/linq/observable/delay-lite.js', // AnonymousObservable, timeoutScheduler, SerialDisposable, materialize, timestamp diff --git a/dist/rx.all.compat.js b/dist/rx.all.compat.js index 02f90beda..30712de72 100644 --- a/dist/rx.all.compat.js +++ b/dist/rx.all.compat.js @@ -7491,24 +7491,24 @@ }); } - function observableTimerDateAndPeriod(dueTime, period, scheduler) { - var p = normalizeTime(period); - return new AnonymousObservable(function (observer) { - var count = 0, d = dueTime; - return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { - var now; - if (p > 0) { - now = scheduler.now(); - d = d + p; - if (d <= now) { - d = now + p; - } - } - observer.onNext(count++); - self(d); - }); - }); - } + function observableTimerDateAndPeriod(dueTime, period, scheduler) { + var p = normalizeTime(period); + return new AnonymousObservable(function (observer) { + var count = 0, d = dueTime; + return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { + var now; + if (p > 0) { + now = scheduler.now(); + d = d + p; + if (d <= now) { + d = now + p; + } + } + observer.onNext(count++); + self(d); + }); + }); + } function observableTimerTimeSpan(dueTime, scheduler) { var d = normalizeTime(dueTime); @@ -7520,19 +7520,19 @@ }); } - function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { - if (dueTime === period) { - return new AnonymousObservable(function (observer) { - return scheduler.schedulePeriodicWithState(0, period, function (count) { - observer.onNext(count); - return count + 1; - }); - }); - } - return observableDefer(function () { - return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { + if (dueTime === period) { + return new AnonymousObservable(function (observer) { + return scheduler.schedulePeriodicWithState(0, period, function (count) { + observer.onNext(count); + return count + 1; }); + }); } + return observableDefer(function () { + return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + }); + } /** * Returns an observable sequence that produces a value after each period. diff --git a/dist/rx.all.js b/dist/rx.all.js index cefea40c4..4666fa4c2 100644 --- a/dist/rx.all.js +++ b/dist/rx.all.js @@ -7305,24 +7305,24 @@ }); } - function observableTimerDateAndPeriod(dueTime, period, scheduler) { - var p = normalizeTime(period); - return new AnonymousObservable(function (observer) { - var count = 0, d = dueTime; - return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { - var now; - if (p > 0) { - now = scheduler.now(); - d = d + p; - if (d <= now) { - d = now + p; - } - } - observer.onNext(count++); - self(d); - }); - }); - } + function observableTimerDateAndPeriod(dueTime, period, scheduler) { + var p = normalizeTime(period); + return new AnonymousObservable(function (observer) { + var count = 0, d = dueTime; + return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { + var now; + if (p > 0) { + now = scheduler.now(); + d = d + p; + if (d <= now) { + d = now + p; + } + } + observer.onNext(count++); + self(d); + }); + }); + } function observableTimerTimeSpan(dueTime, scheduler) { var d = normalizeTime(dueTime); @@ -7334,19 +7334,19 @@ }); } - function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { - if (dueTime === period) { - return new AnonymousObservable(function (observer) { - return scheduler.schedulePeriodicWithState(0, period, function (count) { - observer.onNext(count); - return count + 1; - }); - }); - } - return observableDefer(function () { - return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { + if (dueTime === period) { + return new AnonymousObservable(function (observer) { + return scheduler.schedulePeriodicWithState(0, period, function (count) { + observer.onNext(count); + return count + 1; }); + }); } + return observableDefer(function () { + return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + }); + } /** * Returns an observable sequence that produces a value after each period. diff --git a/dist/rx.lite.compat.js b/dist/rx.lite.compat.js index d2f50a692..1241ec572 100644 --- a/dist/rx.lite.compat.js +++ b/dist/rx.lite.compat.js @@ -4042,19 +4042,38 @@ }); } - function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { - if (dueTime === period) { - return new AnonymousObservable(function (observer) { - return scheduler.schedulePeriodicWithState(0, period, function (count) { - observer.onNext(count); - return count + 1; - }); - }); - } - return observableDefer(function () { - return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { + if (dueTime === period) { + return new AnonymousObservable(function (observer) { + return scheduler.schedulePeriodicWithState(0, period, function (count) { + observer.onNext(count); + return count + 1; }); + }); } + return observableDefer(function () { + return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + }); + } + + function observableTimerDateAndPeriod(dueTime, period, scheduler) { + var p = normalizeTime(period); + return new AnonymousObservable(function (observer) { + var count = 0, d = dueTime; + return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { + var now; + if (p > 0) { + now = scheduler.now(); + d = d + p; + if (d <= now) { + d = now + p; + } + } + observer.onNext(count++); + self(d); + }); + }); + } /** * Returns an observable sequence that produces a value after each period. diff --git a/dist/rx.lite.compat.min.js b/dist/rx.lite.compat.min.js index 088f3b81e..7b1cf88da 100644 --- a/dist/rx.lite.compat.min.js +++ b/dist/rx.lite.compat.min.js @@ -1,2 +1,2 @@ -(function(t){function e(){if(this.isDisposed)throw Error(V)}function n(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function r(t){var e=[];if(!n(t))return e;ue.nonEnumArgs&&t.length&&u(t)&&(t=ae.call(t));var r=ue.enumPrototypes&&"function"==typeof t,i=ue.enumErrorProps&&(t===ee||t instanceof Error);for(var o in t)r&&"prototype"==o||i&&("message"==o||"name"==o)||e.push(o);if(ue.nonEnumShadows&&t!==ne){var s=t.constructor,c=-1,a=oe.length;if(t===(s&&s.prototype))var h=t===stringProto?X:t===ee?H:G.call(t),l=se[h];for(;a>++c;)o=oe[c],l&&l[o]||!Y.call(t,o)||e.push(o)}return e}function i(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function o(t,e){return i(t,e,r)}function s(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function u(t){return t&&"object"==typeof t?G.call(t)==F:!1}function c(t){return"function"==typeof t||!1}function a(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var h=typeof e,l=typeof n;if(e===e&&(null==e||null==n||"function"!=h&&"object"!=h&&"function"!=l&&"object"!=l))return!1;var f=G.call(e),p=G.call(n);if(f==F&&(f=J),p==F&&(p=J),f!=p)return!1;switch(f){case U:case Q:return+e==+n;case K:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case Z:case X:return e==n+""}var d=f==B;if(!d){if(f!=J||!ue.nodeClass&&(s(e)||s(n)))return!1;var b=!ue.argsObject&&u(e)?Object:e.constructor,v=!ue.argsObject&&u(n)?Object:n.constructor;if(!(b==v||Y.call(e,"constructor")&&Y.call(n,"constructor")||c(b)&&b instanceof b&&c(v)&&v instanceof v||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),d){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=a(e[y],w,r,i)))break}}else o(n,function(n,o,s){return Y.call(s,o)?(y++,result=Y.call(e,o)&&a(e[o],n,r,i)):t}),result&&o(e,function(e,n,r){return Y.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function h(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:ae.call(t)}function l(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function f(e,n){return new vn(function(r){var i=new Ce,o=new De;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}T(s)&&(s=cn(s)),i=new Ce,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function p(e,n){var r=this;return new vn(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function d(t){return this.map(function(e,n){var r=t(e,n);return T(r)?cn(r):r}).concatAll()}function b(t){return this.select(function(e,n){var r=t(e,n);return T(r)?cn(r):r}).mergeObservable()}function v(t){var e=function(){this.cancelBubble=!0},n=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(t){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(t||(t=D.event),!t.target)switch(t.target=t.target||t.srcElement,"mouseover"==t.type&&(t.relatedTarget=t.fromElement),"mouseout"==t.type&&(t.relatedTarget=t.toElement),t.stopPropagation||(t.stopPropagation=e,t.preventDefault=n),t.type){case"keypress":var r="charCode"in t?t.charCode:t.keyCode;10==r?(r=0,t.keyCode=13):13==r||27==r?r=0:3==r&&(r=99),t.charCode=r,t.keyChar=t.charCode?String.fromCharCode(t.charCode):""}return t}function m(t,e,n){if(t.addListener)return t.addListener(e,n),ge(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),ge(function(){t.removeEventListener(e,n,!1)});if(t.attachEvent){var r=function(t){n(v(t))};return t.attachEvent("on"+e,r),ge(function(){t.detachEvent("on"+e,r)})}return t["on"+e]=n,ge(function(){t["on"+e]=null})}function y(t,e,n){var r=new me;if("function"==typeof t.item&&"number"==typeof t.length)for(var i=0,o=t.length;o>i;i++)r.add(y(t.item(i),e,n));else t&&r.add(m(t,e,n));return r}function w(t,e){var n=Ae(t);return new vn(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function g(t,e,n){return t===e?new vn(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):Ke(function(){return observableTimerDateAndPeriod(n.now()+t,e,n)})}function E(t,e){return new vn(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new me(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}function x(e,n,r){return new vn(function(i){function o(e,n){h[n]=e;var o;if(u[n]=!0,c||(c=u.every(R))){try{o=r.apply(null,h)}catch(s){return i.onError(s),t}i.onNext(o)}else a&&i.onCompleted()}var s=2,u=[!1,!1],c=!1,a=!1,h=Array(s);return new me(e.subscribe(function(t){o(t,0)},i.onError.bind(i),function(){a=!0,i.onCompleted()}),n.subscribe(function(t){o(t,1)},i.onError.bind(i)))})}var C={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D=C[typeof window]&&window||this,S=C[typeof exports]&&exports&&!exports.nodeType&&exports,N=C[typeof module]&&module&&!module.nodeType&&module,A=N&&N.exports===S&&S,_=C[typeof global]&&global;!_||_.global!==_&&_.window!==_||(D=_);var O={internals:{},config:{Promise:D.Promise},helpers:{}},j=O.helpers.noop=function(){},R=O.helpers.identity=function(t){return t},W=(O.helpers.pluck=function(t){return function(e){return e[t]}},O.helpers.just=function(t){return function(){return t}},O.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),k=O.helpers.defaultComparer=function(t,e){return ce(t,e)},q=O.helpers.defaultSubComparer=function(t,e){return t>e?1:e>t?-1:0},P=(O.helpers.defaultKeySerializer=function(t){return""+t},O.helpers.defaultError=function(t){throw t}),T=O.helpers.isPromise=function(t){return!!t&&"function"==typeof t.then&&t.then!==O.Observable.prototype.then};O.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},O.helpers.not=function(t){return!t};var L="Argument out of range",V="Object has been disposed",z="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";D.Set&&"function"==typeof(new D.Set)["@@iterator"]&&(z="@@iterator");var M,I={done:!0,value:t},F="[object Arguments]",B="[object Array]",U="[object Boolean]",Q="[object Date]",H="[object Error]",$="[object Function]",K="[object Number]",J="[object Object]",Z="[object RegExp]",X="[object String]",G=Object.prototype.toString,Y=Object.prototype.hasOwnProperty,te=G.call(arguments)==F,ee=Error.prototype,ne=Object.prototype,re=ne.propertyIsEnumerable;try{M=!(G.call(document)==J&&!({toString:0}+""))}catch(ie){M=!0}var oe=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],se={};se[B]=se[Q]=se[K]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},se[U]=se[X]={constructor:!0,toString:!0,valueOf:!0},se[H]=se[$]=se[Z]={constructor:!0,toString:!0},se[J]={constructor:!0};var ue={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);ue.enumErrorProps=re.call(ee,"message")||re.call(ee,"name"),ue.enumPrototypes=re.call(t,"prototype"),ue.nonEnumArgs=0!=n,ue.nonEnumShadows=!/valueOf/.test(e)})(1),te||(u=function(t){return t&&"object"==typeof t?Y.call(t,"callee"):!1}),c(/x/)&&(c=function(t){return"function"==typeof t&&G.call(t)==$});var ce=O.internals.isEqual=function(t,e){return a(t,e,[],[])},ae=Array.prototype.slice;({}).hasOwnProperty;var he=this.inherits=O.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},le=O.internals.addProperties=function(t){for(var e=ae.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};O.internals.addRef=function(t,e){return new vn(function(n){return new me(e.getDisposable(),t.subscribe(n))})},Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=ae.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(ae.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(ae.call(arguments)))};return r});var fe=Object("a"),pe="a"!=fe[0]||!(0 in fe);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=pe&&{}.toString.call(this)==X?this.split(""):e,r=n.length>>>0,i=arguments[1];if({}.toString.call(t)!=$)throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=pe&&{}.toString.call(this)==X?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if({}.toString.call(t)!=$)throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return Object.prototype.toString.call(t)==B}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var de=function(t,e){this.id=t,this.value=e};de.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var be=O.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},ve=be.prototype;ve.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},ve.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},ve.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},ve.peek=function(){return this.items[0].value},ve.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},ve.dequeue=function(){var t=this.peek();return this.removeAt(0),t},ve.enqueue=function(t){var e=this.length++;this.items[e]=new de(be.count++,t),this.percolate(e)},ve.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},be.count=0;var me=O.CompositeDisposable=function(){this.disposables=h(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},ye=me.prototype;ye.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},ye.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},ye.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},ye.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},ye.contains=function(t){return-1!==this.disposables.indexOf(t)},ye.toArray=function(){return this.disposables.slice(0)};var we=O.Disposable=function(t){this.isDisposed=!1,this.action=t||j};we.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ge=we.create=function(t){return new we(t)},Ee=we.empty={dispose:j},xe=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),Ce=O.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return he(e,t),e}(xe),De=O.SerialDisposable=function(t){function e(){t.call(this,!1)}return he(e,t),e}(xe);O.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.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()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?Ee:new t(this)},e}();var Se=O.internals.ScheduledItem=function(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||q,this.disposable=new Ce};Se.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Se.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},Se.prototype.isCancelled=function(){return this.disposable.isDisposed},Se.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ne=O.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new me,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),Ee});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new me,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),Ee});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),Ee}var i=t.prototype;return i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return ge(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=W,t.normalize=function(t){return 0>t&&(t=0),t},t}(),Ae=Ne.normalize,_e=Ne.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=Ae(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ne(W,t,e,n)}(),Oe=Ne.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-Ne.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+Ne.normalize(n),s=new Se(this,e,r,o);if(i)i.enqueue(s);else{i=new be(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new Ne(W,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}();O.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new Ce;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var je,Re=j;(function(){function t(){if(!D.postMessage||D.importScripts)return!1;var t=!1,e=D.onmessage;return D.onmessage=function(){t=!0},D.postMessage("","*"),D.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(G+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=_&&A&&_.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=_&&A&&_.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))je=process.nextTick;else if("function"==typeof r)je=r,Re=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;D.addEventListener?D.addEventListener("message",e,!1):D.attachEvent("onmessage",e,!1),je=function(t){var e=u++;s[e]=t,D.postMessage(o+e,"*")}}else if(D.MessageChannel){var c=new D.MessageChannel,a={},h=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},je=function(t){var e=h++;a[e]=t,c.port2.postMessage(e)}}else"document"in D&&"onreadystatechange"in D.document.createElement("script")?je=function(t){var e=D.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},D.document.documentElement.appendChild(e)}:(je=function(t){return setTimeout(t,0)},Re=clearTimeout)})();var We=Ne.timeout=function(){function t(t,e){var n=this,r=new Ce,i=je(function(){r.isDisposed||r.setDisposable(e(n,t))});return new me(r,ge(function(){Re(i)}))}function e(t,e,n){var r=this,i=Ne.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new Ce,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new me(o,ge(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ne(W,t,e,n)}(),ke=O.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=_e),new vn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),qe=ke.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new ke("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Pe=ke.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new ke("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Te=ke.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new ke("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),Le=O.internals.Enumerator=function(t){this._next=t};Le.prototype.next=function(){return this._next()},Le.prototype[z]=function(){return this};var Ve=O.internals.Enumerable=function(t){this._iterator=t};Ve.prototype[z]=function(){return this._iterator()},Ve.prototype.concat=function(){var e=this;return new vn(function(n){var r;try{r=e[z]()}catch(i){return n.onError(),t}var o,s=new De,u=_e.scheduleRecursive(function(e){var i;if(!o){try{i=r.next()}catch(u){return n.onError(u),t}if(i.done)return n.onCompleted(),t;var c=i.value;T(c)&&(c=cn(c));var a=new Ce;s.setDisposable(a),a.setDisposable(c.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new me(s,u,ge(function(){o=!0}))})},Ve.prototype.catchException=function(){var e=this;return new vn(function(n){var r;try{r=e[z]()}catch(i){return n.onError(),t}var o,s,u=new De,c=_e.scheduleRecursive(function(e){if(!o){var i;try{i=r.next()}catch(c){return n.onError(c),t}if(i.done)return s?n.onError(s):n.onCompleted(),t;var a=i.value;T(a)&&(a=cn(a));var h=new Ce;u.setDisposable(h),h.setDisposable(a.subscribe(n.onNext.bind(n),function(t){s=t,e()},n.onCompleted.bind(n)))}});return new me(u,c,ge(function(){o=!0}))})};var ze=Ve.repeat=function(t,e){return null==e&&(e=-1),new Ve(function(){var n=e;return new Le(function(){return 0===n?I:(n>0&&n--,{done:!1,value:t})})})},Me=Ve.forEach=function(t,e,n){return e||(e=R),new Ve(function(){var r=-1;return new Le(function(){return++r0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Ue);Be.toArray=function(){var t=this;return new vn(function(e){var n=[];return t.subscribe(n.push.bind(n),e.onError.bind(e),function(){e.onNext(n),e.onCompleted()})})},He.create=He.createWithDisposable=function(t){return new vn(t)};var Ke=He.defer=function(t){return new vn(function(e){var n;try{n=t()}catch(r){return Ye(r).subscribe(e)}return T(n)&&(n=cn(n)),n.subscribe(e)})},Je=He.empty=function(t){return t||(t=_e),new vn(function(e){return t.schedule(function(){e.onCompleted()})})},Ze=He.fromArray=function(t,e){return e||(e=Oe),new vn(function(n){var r=0,i=t.length;return e.scheduleRecursive(function(e){i>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};He.fromIterable=function(e,n){return n||(n=Oe),new vn(function(r){var i;try{i=e[z]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},He.generate=function(e,n,r,i,o){return o||(o=Oe),new vn(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Xe=He.never=function(){return new vn(function(){return Ee})};He.of=function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return Ze(e)},He.ofWithScheduler=function(t){for(var e=arguments.length-1,n=Array(e),r=0;e>r;r++)n[r]=arguments[r+1];return Ze(n,t)},He.range=function(t,e,n){return n||(n=Oe),new vn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},He.repeat=function(t,e,n){return n||(n=Oe),null==e&&(e=-1),Ge(t,n).repeat(e)};var Ge=He["return"]=He.returnValue=He.just=function(t,e){return e||(e=_e),new vn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ye=He["throw"]=He.throwException=function(t,e){return e||(e=_e),new vn(function(n){return e.schedule(function(){n.onError(t)})})};Be["catch"]=Be.catchException=function(t){return"function"==typeof t?f(this,t):tn([this,t])};var tn=He.catchException=He["catch"]=function(){var t=h(arguments,0);return Me(t).catchException()};Be.combineLatest=function(){var t=ae.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),en.apply(this,t)};var en=He.combineLatest=function(){var e=ae.call(arguments),n=e.pop();return Array.isArray(e[0])&&(e=e[0]),new vn(function(r){function i(e){var i;if(c[e]=!0,a||(a=c.every(R))){try{i=n.apply(null,f)}catch(o){return r.onError(o),t}r.onNext(i)}else h.filter(function(t,n){return n!==e}).every(R)&&r.onCompleted()}function o(t){h[t]=!0,h.every(R)&&r.onCompleted()}for(var s=function(){return!1},u=e.length,c=l(u,s),a=!1,h=l(u,s),f=Array(u),p=Array(u),d=0;u>d;d++)(function(t){var n=e[t],s=new Ce;T(n)&&(n=cn(n)),s.setDisposable(n.subscribe(function(e){f[t]=e,i(t)},r.onError.bind(r),function(){o(t)})),p[t]=s})(d);return new me(p)})};Be.concat=function(){var t=ae.call(arguments,0);return t.unshift(this),nn.apply(this,t)};var nn=He.concat=function(){var t=h(arguments,0);return Me(t).concat()};Be.concatObservable=Be.concatAll=function(){return this.merge(1)},Be.merge=function(t){if("number"!=typeof t)return rn(this,t);var e=this;return new vn(function(n){var r=0,i=new me,o=!1,s=[],u=function(t){var e=new Ce;i.add(e),T(t)&&(t=cn(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var rn=He.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=ae.call(arguments,1)):(t=_e,e=ae.call(arguments,0)):(t=_e,e=ae.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Ze(e,t).mergeObservable()};Be.mergeObservable=Be.mergeAll=function(){var t=this;return new vn(function(e){var n=new me,r=!1,i=new Ce;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new Ce;n.add(i),T(t)&&(t=cn(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Be.skipUntil=function(t){var e=this;return new vn(function(n){var r=!1,i=new me(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()}));T(t)&&(t=cn(t));var o=new Ce;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Be["switch"]=Be.switchLatest=function(){var t=this;return new vn(function(e){var n=!1,r=new De,i=!1,o=0,s=t.subscribe(function(t){var s=new Ce,u=++o;n=!0,r.setDisposable(s),T(t)&&(t=cn(t)),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new me(s,r)})},Be.takeUntil=function(t){var e=this;return new vn(function(n){return T(t)&&(t=cn(t)),new me(e.subscribe(n),t.subscribe(n.onCompleted.bind(n),n.onError.bind(n),j))})},Be.zip=function(){if(Array.isArray(arguments[0]))return p.apply(this,arguments);var e=this,n=ae.call(arguments),r=n.pop();return n.unshift(e),new vn(function(i){function o(n){var o,s;if(c.every(function(t){return t.length>0})){try{s=c.map(function(t){return t.shift()}),o=r.apply(e,s)}catch(u){return i.onError(u),t}i.onNext(o)}else a.filter(function(t,e){return e!==n}).every(R)&&i.onCompleted()}function s(t){a[t]=!0,a.every(function(t){return t})&&i.onCompleted()}for(var u=n.length,c=l(u,function(){return[]}),a=l(u,function(){return!1}),h=Array(u),f=0;u>f;f++)(function(t){var e=n[t],r=new Ce;T(e)&&(e=cn(e)),r.setDisposable(e.subscribe(function(e){c[t].push(e),o(t)},i.onError.bind(i),function(){s(t)})),h[t]=r})(f);return new me(h)})},He.zip=function(){var t=ae.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},He.zipArray=function(){var e=h(arguments,0);return new vn(function(n){function r(e){if(s.every(function(t){return t.length>0})){var r=s.map(function(t){return t.shift()});n.onNext(r)}else if(u.filter(function(t,n){return n!==e}).every(R))return n.onCompleted(),t}function i(e){return u[e]=!0,u.every(R)?(n.onCompleted(),t):t}for(var o=e.length,s=l(o,function(){return[]}),u=l(o,function(){return!1}),c=Array(o),a=0;o>a;a++)(function(t){c[t]=new Ce,c[t].setDisposable(e[t].subscribe(function(e){s[t].push(e),r(t)},n.onError.bind(n),function(){i(t)}))})(a);var h=new me(c);return h.add(ge(function(){for(var t=0,e=s.length;e>t;t++)s[t]=[]})),h})},Be.asObservable=function(){var t=this;return new vn(function(e){return t.subscribe(e)})},Be.dematerialize=function(){var t=this;return new vn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Be.distinctUntilChanged=function(e,n){var r=this;return e||(e=R),n||(n=k),new vn(function(i){var o,s=!1;return r.subscribe(function(r){var u,c=!1;try{u=e(r)}catch(a){return i.onError(a),t}if(s)try{c=n(o,u)}catch(a){return i.onError(a),t}s&&c||(s=!0,o=u,i.onNext(r))},i.onError.bind(i),i.onCompleted.bind(i))})},Be["do"]=Be.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new vn(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Be["finally"]=Be.finallyAction=function(t){var e=this;return new vn(function(n){var r;try{r=e.subscribe(n)}catch(i){throw t(),i}return ge(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Be.ignoreElements=function(){var t=this;return new vn(function(e){return t.subscribe(j,e.onError.bind(e),e.onCompleted.bind(e))})},Be.materialize=function(){var t=this;return new vn(function(e){return t.subscribe(function(t){e.onNext(qe(t)) -},function(t){e.onNext(Pe(t)),e.onCompleted()},function(){e.onNext(Te()),e.onCompleted()})})},Be.repeat=function(t){return ze(this,t).concat()},Be.retry=function(t){return ze(this,t).catchException()},Be.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new vn(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},Be.skipLast=function(t){var e=this;return new vn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Be.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=_e,t=ae.call(arguments,n),Me([Ze(t,e),this]).concat()},Be.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Ze(t,e)})},Be.takeLastBuffer=function(t){var e=this;return new vn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Be.selectConcat=Be.concatMap=function(t,e){return e?this.concatMap(function(n,r){var i=t(n,r),o=T(i)?cn(i):i;return o.map(function(t){return e(n,t,r)})}):"function"==typeof t?d.call(this,t):d.call(this,function(){return t})},Be.select=Be.map=function(e,n){var r=this;return new vn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Be.pluck=function(t){return this.select(function(e){return e[t]})},Be.selectMany=Be.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=T(i)?cn(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?b.call(this,t):b.call(this,function(){return t})},Be.selectSwitch=Be.flatMapLatest=Be.switchMap=function(t,e){return this.select(t,e).switchLatest()},Be.skip=function(t){if(0>t)throw Error(L);var e=this;return new vn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Be.skipWhile=function(e,n){var r=this;return new vn(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Be.take=function(t,e){if(0>t)throw Error(L);if(0===t)return Je(e);var n=this;return new vn(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Be.takeWhile=function(e,n){var r=this;return new vn(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Be.where=Be.filter=function(e,n){var r=this;return new vn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},He.fromCallback=function(e,n,r,i){return n||(n=_e),function(){var o=ae.call(arguments,0);return new vn(function(s){return n.schedule(function(){function n(e){var n=e;if(i)try{n=i(arguments)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},He.fromNodeCallback=function(e,n,r,i){return n||(n=_e),function(){var o=ae.call(arguments,0);return new vn(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t;var n=ae.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}};var on=D.angular&&angular.element?angular.element:D.jQuery?D.jQuery:D.Zepto?D.Zepto:null,sn=!!D.Ember&&"function"==typeof D.Ember.addListener;He.fromEvent=function(e,n,r){if(sn)return un(function(t){Ember.addListener(e,n,t)},function(t){Ember.removeListener(e,n,t)},r);if(on){var i=on(e);return un(function(t){i.on(n,t)},function(t){i.off(n,t)},r)}return new vn(function(i){return y(e,n,function(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)})}).publish().refCount()};var un=He.fromEventPattern=function(e,n,r){return new vn(function(i){function o(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)}var s=e(o);return ge(function(){n&&n(o,s)})}).publish().refCount()},cn=He.fromPromise=function(t){return new vn(function(e){return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),function(){t&&t.abort&&t.abort()}})};Be.toPromise=function(t){if(t||(t=O.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},He.startAsync=function(t){var e;try{e=t()}catch(n){return Ye(n)}return cn(e)},Be.multicast=function(t,e){var n=this;return"function"==typeof t?new vn(function(r){var i=n.multicast(t());return new me(e(i).subscribe(r),i.connect())}):new an(n,t)},Be.publish=function(t){return t?this.multicast(function(){return new wn},t):this.multicast(new wn)},Be.share=function(){return this.publish(null).refCount()},Be.publishLast=function(t){return t?this.multicast(function(){return new gn},t):this.multicast(new gn)},Be.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new xn(e)},t):this.multicast(new xn(t))},Be.shareValue=function(t){return this.publishValue(t).refCount()},Be.replay=function(t,e,n,r){return t?this.multicast(function(){return new Cn(e,n,r)},t):this.multicast(new Cn(e,n,r))},Be.shareReplay=function(t,e,n){return this.replay(null,t,e,n).refCount()};var an=O.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new me(i.source.subscribe(i.subject),ge(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return he(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new vn(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),ge(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(He),hn=He.interval=function(t,e){return e||(e=We),g(t,t,e)},ln=He.timer=function(e,n,r){var i;return r||(r=We),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===t?w(e,r):g(e,i,r)};Be.delay=function(t,e){e||(e=We);var n=this;return new vn(function(r){var i,o=!1,s=new De,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,h;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,h=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),h=!o,o=!0),h&&(null!==u?r.onError(u):(i=new Ce,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,h;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);h=!1,i=0,c.length>0?(h=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):h&&t(i)}}))))}),new me(i,s)})},Be.throttle=function(t,e){return e||(e=We),this.throttleWithSelector(function(){return ln(t,e)})},Be.timeInterval=function(t){var e=this;return t||(t=We),Ke(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Be.timestamp=function(t){return t||(t=We),this.select(function(e){return{value:e,timestamp:t.now()}})},Be.sample=function(t,e){return e||(e=We),"number"==typeof t?E(this,hn(t,e)):E(this,t)},Be.timeout=function(t,e,n){e||(e=Ye(Error("Timeout"))),n||(n=We);var r=this,i=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new vn(function(o){var s=0,u=new Ce,c=new De,a=!1,h=new De;c.setDisposable(u);var l=function(){var r=s;h.setDisposable(n[i](t,function(){s===r&&(T(e)&&(e=cn(e)),c.setDisposable(e.subscribe(o)))}))};return l(),u.setDisposable(r.subscribe(function(t){a||(s++,o.onNext(t),l())},function(t){a||(s++,o.onError(t))},function(){a||(s++,o.onCompleted())})),new me(c,h)})},He.generateWithRelativeTime=function(e,n,r,i,o,s){return s||(s=We),new vn(function(u){var c,a,h=!0,l=!1,f=e;return s.scheduleRecursiveWithRelative(0,function(e){l&&u.onNext(c);try{h?h=!1:f=r(f),l=n(f),l&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}l?e(a):u.onCompleted()})})},Be.delaySubscription=function(t,e){return e||(e=We),this.delayWithSelector(ln(t,e),function(){return Je()})},Be.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new vn(function(e){var n=new me,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new De,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new Ce;n.add(c),c.setDisposable(o.subscribe(function(){e.onNext(r),n.remove(c),u()},e.onError.bind(e),function(){e.onNext(r),n.remove(c),u()}))},e.onError.bind(e),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},e.onError.bind(e),function(){a()})):a(),new me(c,n)})},Be.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Xe()}r||(r=Ye(Error("Timeout")));var i=this;return new vn(function(o){var s=new De,u=new De,c=new Ce;s.setDisposable(c);var a=0,h=!1,l=function(t){var e=a,n=function(){return a===e},i=new Ce;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};l(e);var f=function(){var t=!h;return t&&a++,t};return c.setDisposable(i.subscribe(function(e){if(f()){o.onNext(e);var r;try{r=n(e)}catch(i){return o.onError(i),t}l(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new me(s,u)})},Be.throttleWithSelector=function(e){var n=this;return new vn(function(r){var i,o=!1,s=new De,u=0,c=n.subscribe(function(n){var c;try{c=e(n)}catch(a){return r.onError(a),t}o=!0,i=n,u++;var h=u,l=new Ce;s.setDisposable(l),l.setDisposable(c.subscribe(function(){o&&u===h&&r.onNext(i),o=!1,l.dispose()},r.onError.bind(r),function(){o&&u===h&&r.onNext(i),o=!1,l.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new me(c,s)})},Be.skipLastWithTime=function(t,e){e||(e=We);var n=this;return new vn(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},Be.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return Ze(t,n)})},Be.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=We),new vn(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},Be.takeWithTime=function(t,e){var n=this;return e||(e=We),new vn(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new me(i,n.subscribe(r))})},Be.skipWithTime=function(t,e){var n=this;return e||(e=We),new vn(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new me(o,s)})},Be.skipUntilWithTime=function(t,e){e||(e=We);var n=this,r=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new vn(function(i){var o=!1;return new me(e[r](t,function(){o=!0}),n.subscribe(function(t){o&&i.onNext(t)},i.onError.bind(i),i.onCompleted.bind(i)))})},Be.takeUntilWithTime=function(t,e){e||(e=We);var n=this,r=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new vn(function(i){return new me(e[r](t,function(){i.onCompleted()}),n.subscribe(i))})};var fn=function(t){function e(t){var e=this.source.publish(),n=e.subscribe(t),r=Ee,i=this.subject.distinctUntilChanged().subscribe(function(t){t?r=e.connect():(r.dispose(),r=Ee)});return new me(n,r,i)}function n(n,r){this.source=n,this.subject=r||new wn,this.isPaused=!0,t.call(this,e)}return he(n,t),n.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},n.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},n}(He);Be.pausable=function(t){return new fn(this,t)};var pn=function(t){function e(t){var e=[],n=!0,r=x(this.source,this.subject.distinctUntilChanged(),function(t,e){return{data:t,shouldFire:e}}).subscribe(function(r){if(r.shouldFire&&n&&t.onNext(r.data),r.shouldFire&&!n){for(;e.length>0;)t.onNext(e.shift());n=!0}else r.shouldFire||n?!r.shouldFire&&n&&(n=!1):e.push(r.data)},function(n){for(;e.length>0;)t.onNext(e.shift());t.onError(n)},function(){for(;e.length>0;)t.onNext(e.shift());t.onCompleted()});return this.subject.onNext(!1),r}function n(n,r){this.source=n,this.subject=r||new wn,this.isPaused=!0,t.call(this,e)}return he(n,t),n.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},n.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},n}(He);Be.pausableBuffered=function(t){return new pn(this,t)},Be.controlled=function(t){return null==t&&(t=!0),new dn(this,t)};var dn=function(t){function e(t){return this.source.subscribe(t)}function n(n,r){t.call(this,e),this.subject=new bn(r),this.source=n.multicast(this.subject).refCount()}return he(n,t),n.prototype.request=function(t){return null==t&&(t=-1),this.subject.request(t)},n}(He),bn=O.ControlledSubject=function(t){function n(t){return this.subject.subscribe(t)}function r(e){null==e&&(e=!0),t.call(this,n),this.subject=new wn,this.enableQueue=e,this.queue=e?[]:null,this.requestedCount=0,this.requestedDisposable=Ee,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=Ee}return he(r,t),le(r.prototype,Ie,{onCompleted:function(){e.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(t){e.call(this),this.hasFailed=!0,this.error=t,this.enableQueue&&0!==this.queue.length||this.subject.onError(t)},onNext:function(t){e.call(this);var n=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(t):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),n=!0),n&&this.subject.onNext(t)},_processRequest:function(t){if(this.enableQueue){for(;this.queue.length>=t&&t>0;)this.subject.onNext(this.queue.shift()),t--;return 0!==this.queue.length?{numberOfItems:t,returnValue:!0}:{numberOfItems:t,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=Ee):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=Ee),{numberOfItems:t,returnValue:!1}},request:function(t){e.call(this),this.disposeCurrentRequest();var n=this,r=this._processRequest(t);return t=r.numberOfItems,r.returnValue?Ee:(this.requestedCount=t,this.requestedDisposable=ge(function(){n.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=Ee},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),r}(He);Be.pairwise=function(){var t=this;return new vn(function(e){var n,r=!1;return t.subscribe(function(t){r?e.onNext([n,t]):r=!0,n=t},e.onError.bind(e),e.onCompleted.bind(e))})},Be.partition=function(t,e){var n=this.publish().refCount();return[n.filter(t,e),n.filter(function(n,r,i){return!t.call(e,n,r,i)})]},Be.exclusive=function(){var t=this;return new vn(function(e){var n=!1,r=!1,i=new Ce,o=new me;return o.add(i),i.setDisposable(t.subscribe(function(t){if(!n){n=!0,T(t)&&(t=cn(t));var i=new Ce;o.add(i),i.setDisposable(t.subscribe(e.onNext.bind(e),e.onError.bind(e),function(){o.remove(i),n=!1,r&&1===o.length&&e.onCompleted()}))}},e.onError.bind(e),function(){r=!0,n||1!==o.length||e.onCompleted()})),o})},Be.exclusiveMap=function(e,n){var r=this;return new vn(function(i){var o=0,s=!1,u=!0,c=new Ce,a=new me;return a.add(c),c.setDisposable(r.subscribe(function(r){s||(s=!0,innerSubscription=new Ce,a.add(innerSubscription),T(r)&&(r=cn(r)),innerSubscription.setDisposable(r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),function(){a.remove(innerSubscription),s=!1,u&&1===a.length&&i.onCompleted()})))},i.onError.bind(i),function(){u=!0,1!==a.length||s||i.onCompleted()})),a})};var vn=O.AnonymousObservable=function(e){function n(e){return e===t?e=Ee:"function"==typeof e&&(e=ge(e)),e}function r(i){function o(t){var e=function(){try{r.setDisposable(n(i(r)))}catch(t){if(!r.fail(t))throw t}},r=new mn(t);return Oe.scheduleRequired()?Oe.schedule(e):e(),r}return this instanceof r?(e.call(this,o),t):new r(i)}return he(r,e),r}(He),mn=function(t){function e(e){t.call(this),this.observer=e,this.m=new Ce}he(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ue),yn=function(t,e){this.subject=t,this.observer=e};yn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var wn=O.Subject=function(t){function n(t){return e.call(this),this.isStopped?this.exception?(t.onError(this.exception),Ee):(t.onCompleted(),Ee):(this.observers.push(t),new yn(this,t))}function r(){t.call(this,n),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return he(r,t),le(r.prototype,Ie,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(e.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var n=0,r=t.length;r>n;n++)t[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){if(e.call(this),!this.isStopped)for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)n[r].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(t,e){return new En(t,e)},r}(He),gn=O.AsyncSubject=function(t){function n(t){if(e.call(this),!this.isStopped)return this.observers.push(t),new yn(this,t);var n=this.exception,r=this.hasValue,i=this.value;return n?t.onError(n):r?(t.onNext(i),t.onCompleted()):t.onCompleted(),Ee}function r(){t.call(this,n),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return he(r,t),le(r.prototype,Ie,{hasObservers:function(){return e.call(this),this.observers.length>0},onCompleted:function(){var t,n,r;if(e.call(this),!this.isStopped){this.isStopped=!0;var i=this.observers.slice(0),o=this.value,s=this.hasValue;if(s)for(n=0,r=i.length;r>n;n++)t=i[n],t.onNext(o),t.onCompleted();else for(n=0,r=i.length;r>n;n++)i[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){e.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(He),En=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return he(n,t),le(n.prototype,Ie,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(He),xn=O.BehaviorSubject=function(t){function n(t){if(e.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new yn(this,t);var n=this.exception;return n?t.onError(n):t.onCompleted(),Ee}function r(e){t.call(this,n),this.value=e,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return he(r,t),le(r.prototype,Ie,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(e.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var n=0,r=t.length;r>n;n++)t[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){if(e.call(this),!this.isStopped){this.value=t;for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)n[r].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),r}(He),Cn=O.ReplaySubject=function(t){function n(t,e){this.subject=t,this.observer=e}function r(t){var r=new $e(this.scheduler,t),i=new n(this,r);e.call(this),this._trim(this.scheduler.now()),this.observers.push(r);for(var o=this.q.length,s=0,u=this.q.length;u>s;s++)r.onNext(this.q[s].value);return this.hasError?(o++,r.onError(this.error)):this.isStopped&&(o++,r.onCompleted()),r.ensureActive(o),i}function i(e,n,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==n?Number.MAX_VALUE:n,this.scheduler=i||Oe,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,r)}return n.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},he(i,t),le(i.prototype,Ie,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var n;if(e.call(this),!this.isStopped){var r=this.scheduler.now();this.q.push({interval:r,value:t}),this._trim(r);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)n=i[o],n.onNext(t),n.ensureActive()}},onError:function(t){var n;if(e.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var r=this.scheduler.now();this._trim(r);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)n=i[o],n.onError(t),n.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(e.call(this),!this.isStopped){this.isStopped=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)t=r[i],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),i}(He);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(D.Rx=O,define(function(){return O})):S&&N?A?(N.exports=O).Rx=O:S.Rx=O:D.Rx=O}).call(this); \ No newline at end of file +(function(t){function e(){if(this.isDisposed)throw Error(z)}function n(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function r(t){var e=[];if(!n(t))return e;ce.nonEnumArgs&&t.length&&u(t)&&(t=he.call(t));var r=ce.enumPrototypes&&"function"==typeof t,i=ce.enumErrorProps&&(t===ne||t instanceof Error);for(var o in t)r&&"prototype"==o||i&&("message"==o||"name"==o)||e.push(o);if(ce.nonEnumShadows&&t!==re){var s=t.constructor,c=-1,a=se.length;if(t===(s&&s.prototype))var h=t===stringProto?G:t===ne?$:Y.call(t),l=ue[h];for(;a>++c;)o=se[c],l&&l[o]||!te.call(t,o)||e.push(o)}return e}function i(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function o(t,e){return i(t,e,r)}function s(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function u(t){return t&&"object"==typeof t?Y.call(t)==B:!1}function c(t){return"function"==typeof t||!1}function a(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var h=typeof e,l=typeof n;if(e===e&&(null==e||null==n||"function"!=h&&"object"!=h&&"function"!=l&&"object"!=l))return!1;var f=Y.call(e),p=Y.call(n);if(f==B&&(f=Z),p==B&&(p=Z),f!=p)return!1;switch(f){case Q:case H:return+e==+n;case J:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case X:case G:return e==n+""}var d=f==U;if(!d){if(f!=Z||!ce.nodeClass&&(s(e)||s(n)))return!1;var b=!ce.argsObject&&u(e)?Object:e.constructor,v=!ce.argsObject&&u(n)?Object:n.constructor;if(!(b==v||te.call(e,"constructor")&&te.call(n,"constructor")||c(b)&&b instanceof b&&c(v)&&v instanceof v||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),d){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=a(e[y],w,r,i)))break}}else o(n,function(n,o,s){return te.call(s,o)?(y++,result=te.call(e,o)&&a(e[o],n,r,i)):t}),result&&o(e,function(e,n,r){return te.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function h(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:he.call(t)}function l(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function f(e,n){return new mn(function(r){var i=new De,o=new Se;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}L(s)&&(s=an(s)),i=new De,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function p(e,n){var r=this;return new mn(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function d(t){return this.map(function(e,n){var r=t(e,n);return L(r)?an(r):r}).concatAll()}function b(t){return this.select(function(e,n){var r=t(e,n);return L(r)?an(r):r}).mergeObservable()}function v(t){var e=function(){this.cancelBubble=!0},n=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(t){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(t||(t=S.event),!t.target)switch(t.target=t.target||t.srcElement,"mouseover"==t.type&&(t.relatedTarget=t.fromElement),"mouseout"==t.type&&(t.relatedTarget=t.toElement),t.stopPropagation||(t.stopPropagation=e,t.preventDefault=n),t.type){case"keypress":var r="charCode"in t?t.charCode:t.keyCode;10==r?(r=0,t.keyCode=13):13==r||27==r?r=0:3==r&&(r=99),t.charCode=r,t.keyChar=t.charCode?String.fromCharCode(t.charCode):""}return t}function m(t,e,n){if(t.addListener)return t.addListener(e,n),Ee(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),Ee(function(){t.removeEventListener(e,n,!1)});if(t.attachEvent){var r=function(t){n(v(t))};return t.attachEvent("on"+e,r),Ee(function(){t.detachEvent("on"+e,r)})}return t["on"+e]=n,Ee(function(){t["on"+e]=null})}function y(t,e,n){var r=new ye;if("function"==typeof t.item&&"number"==typeof t.length)for(var i=0,o=t.length;o>i;i++)r.add(y(t.item(i),e,n));else t&&r.add(m(t,e,n));return r}function w(t,e){var n=_e(t);return new mn(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function g(t,e,n){return t===e?new mn(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):Je(function(){return E(n.now()+t,e,n)})}function E(t,e,n){var r=_e(e);return new mn(function(e){var i=0,o=t;return n.scheduleRecursiveWithAbsolute(o,function(t){var s;r>0&&(s=n.now(),o+=r,s>=o&&(o=s+r)),e.onNext(i++),t(o)})})}function x(t,e){return new mn(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new ye(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}function C(e,n,r){return new mn(function(i){function o(e,n){h[n]=e;var o;if(u[n]=!0,c||(c=u.every(W))){try{o=r.apply(null,h)}catch(s){return i.onError(s),t}i.onNext(o)}else a&&i.onCompleted()}var s=2,u=[!1,!1],c=!1,a=!1,h=Array(s);return new ye(e.subscribe(function(t){o(t,0)},i.onError.bind(i),function(){a=!0,i.onCompleted()}),n.subscribe(function(t){o(t,1)},i.onError.bind(i)))})}var D={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},S=D[typeof window]&&window||this,N=D[typeof exports]&&exports&&!exports.nodeType&&exports,A=D[typeof module]&&module&&!module.nodeType&&module,_=A&&A.exports===N&&N,O=D[typeof global]&&global;!O||O.global!==O&&O.window!==O||(S=O);var j={internals:{},config:{Promise:S.Promise},helpers:{}},R=j.helpers.noop=function(){},W=j.helpers.identity=function(t){return t},k=(j.helpers.pluck=function(t){return function(e){return e[t]}},j.helpers.just=function(t){return function(){return t}},j.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),q=j.helpers.defaultComparer=function(t,e){return ae(t,e)},P=j.helpers.defaultSubComparer=function(t,e){return t>e?1:e>t?-1:0},T=(j.helpers.defaultKeySerializer=function(t){return""+t},j.helpers.defaultError=function(t){throw t}),L=j.helpers.isPromise=function(t){return!!t&&"function"==typeof t.then&&t.then!==j.Observable.prototype.then};j.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},j.helpers.not=function(t){return!t};var V="Argument out of range",z="Object has been disposed",M="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";S.Set&&"function"==typeof(new S.Set)["@@iterator"]&&(M="@@iterator");var I,F={done:!0,value:t},B="[object Arguments]",U="[object Array]",Q="[object Boolean]",H="[object Date]",$="[object Error]",K="[object Function]",J="[object Number]",Z="[object Object]",X="[object RegExp]",G="[object String]",Y=Object.prototype.toString,te=Object.prototype.hasOwnProperty,ee=Y.call(arguments)==B,ne=Error.prototype,re=Object.prototype,ie=re.propertyIsEnumerable;try{I=!(Y.call(document)==Z&&!({toString:0}+""))}catch(oe){I=!0}var se=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ue={};ue[U]=ue[H]=ue[J]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},ue[Q]=ue[G]={constructor:!0,toString:!0,valueOf:!0},ue[$]=ue[K]=ue[X]={constructor:!0,toString:!0},ue[Z]={constructor:!0};var ce={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);ce.enumErrorProps=ie.call(ne,"message")||ie.call(ne,"name"),ce.enumPrototypes=ie.call(t,"prototype"),ce.nonEnumArgs=0!=n,ce.nonEnumShadows=!/valueOf/.test(e)})(1),ee||(u=function(t){return t&&"object"==typeof t?te.call(t,"callee"):!1}),c(/x/)&&(c=function(t){return"function"==typeof t&&Y.call(t)==K});var ae=j.internals.isEqual=function(t,e){return a(t,e,[],[])},he=Array.prototype.slice;({}).hasOwnProperty;var le=this.inherits=j.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},fe=j.internals.addProperties=function(t){for(var e=he.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};j.internals.addRef=function(t,e){return new mn(function(n){return new ye(e.getDisposable(),t.subscribe(n))})},Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=he.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(he.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(he.call(arguments)))};return r});var pe=Object("a"),de="a"!=pe[0]||!(0 in pe);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=de&&{}.toString.call(this)==G?this.split(""):e,r=n.length>>>0,i=arguments[1];if({}.toString.call(t)!=K)throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=de&&{}.toString.call(this)==G?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if({}.toString.call(t)!=K)throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return Object.prototype.toString.call(t)==U}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var be=function(t,e){this.id=t,this.value=e};be.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var ve=j.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},me=ve.prototype;me.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},me.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},me.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},me.peek=function(){return this.items[0].value},me.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},me.dequeue=function(){var t=this.peek();return this.removeAt(0),t},me.enqueue=function(t){var e=this.length++;this.items[e]=new be(ve.count++,t),this.percolate(e)},me.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},ve.count=0;var ye=j.CompositeDisposable=function(){this.disposables=h(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},we=ye.prototype;we.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},we.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},we.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},we.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},we.contains=function(t){return-1!==this.disposables.indexOf(t)},we.toArray=function(){return this.disposables.slice(0)};var ge=j.Disposable=function(t){this.isDisposed=!1,this.action=t||R};ge.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Ee=ge.create=function(t){return new ge(t)},xe=ge.empty={dispose:R},Ce=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),De=j.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return le(e,t),e}(Ce),Se=j.SerialDisposable=function(t){function e(){t.call(this,!1)}return le(e,t),e}(Ce);j.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.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()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?xe:new t(this)},e}();var Ne=j.internals.ScheduledItem=function(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||P,this.disposable=new De};Ne.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ne.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},Ne.prototype.isCancelled=function(){return this.disposable.isDisposed},Ne.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ae=j.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new ye,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),xe});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new ye,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),xe});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),xe}var i=t.prototype;return i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return Ee(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=k,t.normalize=function(t){return 0>t&&(t=0),t},t}(),_e=Ae.normalize,Oe=Ae.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=_e(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ae(k,t,e,n)}(),je=Ae.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-Ae.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+Ae.normalize(n),s=new Ne(this,e,r,o);if(i)i.enqueue(s);else{i=new ve(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new Ae(k,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}();j.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new De;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var Re,We=R;(function(){function t(){if(!S.postMessage||S.importScripts)return!1;var t=!1,e=S.onmessage;return S.onmessage=function(){t=!0},S.postMessage("","*"),S.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(Y+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=O&&_&&O.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=O&&_&&O.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Re=process.nextTick;else if("function"==typeof r)Re=r,We=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;S.addEventListener?S.addEventListener("message",e,!1):S.attachEvent("onmessage",e,!1),Re=function(t){var e=u++;s[e]=t,S.postMessage(o+e,"*")}}else if(S.MessageChannel){var c=new S.MessageChannel,a={},h=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},Re=function(t){var e=h++;a[e]=t,c.port2.postMessage(e)}}else"document"in S&&"onreadystatechange"in S.document.createElement("script")?Re=function(t){var e=S.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},S.document.documentElement.appendChild(e)}:(Re=function(t){return setTimeout(t,0)},We=clearTimeout)})();var ke=Ae.timeout=function(){function t(t,e){var n=this,r=new De,i=Re(function(){r.isDisposed||r.setDisposable(e(n,t))});return new ye(r,Ee(function(){We(i)}))}function e(t,e,n){var r=this,i=Ae.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new De,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new ye(o,Ee(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ae(k,t,e,n)}(),qe=j.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=Oe),new mn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),Pe=qe.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new qe("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Te=qe.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new qe("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Le=qe.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new qe("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),Ve=j.internals.Enumerator=function(t){this._next=t};Ve.prototype.next=function(){return this._next()},Ve.prototype[M]=function(){return this};var ze=j.internals.Enumerable=function(t){this._iterator=t};ze.prototype[M]=function(){return this._iterator()},ze.prototype.concat=function(){var e=this;return new mn(function(n){var r;try{r=e[M]()}catch(i){return n.onError(),t}var o,s=new Se,u=Oe.scheduleRecursive(function(e){var i;if(!o){try{i=r.next()}catch(u){return n.onError(u),t}if(i.done)return n.onCompleted(),t;var c=i.value;L(c)&&(c=an(c));var a=new De;s.setDisposable(a),a.setDisposable(c.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new ye(s,u,Ee(function(){o=!0}))})},ze.prototype.catchException=function(){var e=this;return new mn(function(n){var r;try{r=e[M]()}catch(i){return n.onError(),t}var o,s,u=new Se,c=Oe.scheduleRecursive(function(e){if(!o){var i;try{i=r.next()}catch(c){return n.onError(c),t}if(i.done)return s?n.onError(s):n.onCompleted(),t;var a=i.value;L(a)&&(a=an(a));var h=new De;u.setDisposable(h),h.setDisposable(a.subscribe(n.onNext.bind(n),function(t){s=t,e()},n.onCompleted.bind(n)))}});return new ye(u,c,Ee(function(){o=!0}))})};var Me=ze.repeat=function(t,e){return null==e&&(e=-1),new ze(function(){var n=e;return new Ve(function(){return 0===n?F:(n>0&&n--,{done:!1,value:t})})})},Ie=ze.forEach=function(t,e,n){return e||(e=W),new ze(function(){var r=-1;return new Ve(function(){return++r0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Qe);Ue.toArray=function(){var t=this;return new mn(function(e){var n=[];return t.subscribe(n.push.bind(n),e.onError.bind(e),function(){e.onNext(n),e.onCompleted()})})},$e.create=$e.createWithDisposable=function(t){return new mn(t)};var Je=$e.defer=function(t){return new mn(function(e){var n;try{n=t()}catch(r){return tn(r).subscribe(e)}return L(n)&&(n=an(n)),n.subscribe(e)})},Ze=$e.empty=function(t){return t||(t=Oe),new mn(function(e){return t.schedule(function(){e.onCompleted()})})},Xe=$e.fromArray=function(t,e){return e||(e=je),new mn(function(n){var r=0,i=t.length;return e.scheduleRecursive(function(e){i>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};$e.fromIterable=function(e,n){return n||(n=je),new mn(function(r){var i;try{i=e[M]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},$e.generate=function(e,n,r,i,o){return o||(o=je),new mn(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Ge=$e.never=function(){return new mn(function(){return xe})};$e.of=function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return Xe(e)},$e.ofWithScheduler=function(t){for(var e=arguments.length-1,n=Array(e),r=0;e>r;r++)n[r]=arguments[r+1];return Xe(n,t)},$e.range=function(t,e,n){return n||(n=je),new mn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},$e.repeat=function(t,e,n){return n||(n=je),null==e&&(e=-1),Ye(t,n).repeat(e)};var Ye=$e["return"]=$e.returnValue=$e.just=function(t,e){return e||(e=Oe),new mn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},tn=$e["throw"]=$e.throwException=function(t,e){return e||(e=Oe),new mn(function(n){return e.schedule(function(){n.onError(t)})})};Ue["catch"]=Ue.catchException=function(t){return"function"==typeof t?f(this,t):en([this,t])};var en=$e.catchException=$e["catch"]=function(){var t=h(arguments,0);return Ie(t).catchException()};Ue.combineLatest=function(){var t=he.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),nn.apply(this,t)};var nn=$e.combineLatest=function(){var e=he.call(arguments),n=e.pop();return Array.isArray(e[0])&&(e=e[0]),new mn(function(r){function i(e){var i;if(c[e]=!0,a||(a=c.every(W))){try{i=n.apply(null,f)}catch(o){return r.onError(o),t}r.onNext(i)}else h.filter(function(t,n){return n!==e}).every(W)&&r.onCompleted()}function o(t){h[t]=!0,h.every(W)&&r.onCompleted()}for(var s=function(){return!1},u=e.length,c=l(u,s),a=!1,h=l(u,s),f=Array(u),p=Array(u),d=0;u>d;d++)(function(t){var n=e[t],s=new De;L(n)&&(n=an(n)),s.setDisposable(n.subscribe(function(e){f[t]=e,i(t)},r.onError.bind(r),function(){o(t)})),p[t]=s})(d);return new ye(p)})};Ue.concat=function(){var t=he.call(arguments,0);return t.unshift(this),rn.apply(this,t)};var rn=$e.concat=function(){var t=h(arguments,0);return Ie(t).concat()};Ue.concatObservable=Ue.concatAll=function(){return this.merge(1)},Ue.merge=function(t){if("number"!=typeof t)return on(this,t);var e=this;return new mn(function(n){var r=0,i=new ye,o=!1,s=[],u=function(t){var e=new De;i.add(e),L(t)&&(t=an(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var on=$e.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=he.call(arguments,1)):(t=Oe,e=he.call(arguments,0)):(t=Oe,e=he.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Xe(e,t).mergeObservable()};Ue.mergeObservable=Ue.mergeAll=function(){var t=this;return new mn(function(e){var n=new ye,r=!1,i=new De;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new De;n.add(i),L(t)&&(t=an(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Ue.skipUntil=function(t){var e=this;return new mn(function(n){var r=!1,i=new ye(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()}));L(t)&&(t=an(t));var o=new De;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Ue["switch"]=Ue.switchLatest=function(){var t=this;return new mn(function(e){var n=!1,r=new Se,i=!1,o=0,s=t.subscribe(function(t){var s=new De,u=++o;n=!0,r.setDisposable(s),L(t)&&(t=an(t)),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new ye(s,r)})},Ue.takeUntil=function(t){var e=this;return new mn(function(n){return L(t)&&(t=an(t)),new ye(e.subscribe(n),t.subscribe(n.onCompleted.bind(n),n.onError.bind(n),R))})},Ue.zip=function(){if(Array.isArray(arguments[0]))return p.apply(this,arguments);var e=this,n=he.call(arguments),r=n.pop();return n.unshift(e),new mn(function(i){function o(n){var o,s;if(c.every(function(t){return t.length>0})){try{s=c.map(function(t){return t.shift()}),o=r.apply(e,s)}catch(u){return i.onError(u),t}i.onNext(o)}else a.filter(function(t,e){return e!==n}).every(W)&&i.onCompleted()}function s(t){a[t]=!0,a.every(function(t){return t})&&i.onCompleted()}for(var u=n.length,c=l(u,function(){return[]}),a=l(u,function(){return!1}),h=Array(u),f=0;u>f;f++)(function(t){var e=n[t],r=new De;L(e)&&(e=an(e)),r.setDisposable(e.subscribe(function(e){c[t].push(e),o(t)},i.onError.bind(i),function(){s(t)})),h[t]=r})(f);return new ye(h)})},$e.zip=function(){var t=he.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},$e.zipArray=function(){var e=h(arguments,0);return new mn(function(n){function r(e){if(s.every(function(t){return t.length>0})){var r=s.map(function(t){return t.shift()});n.onNext(r)}else if(u.filter(function(t,n){return n!==e}).every(W))return n.onCompleted(),t}function i(e){return u[e]=!0,u.every(W)?(n.onCompleted(),t):t}for(var o=e.length,s=l(o,function(){return[]}),u=l(o,function(){return!1}),c=Array(o),a=0;o>a;a++)(function(t){c[t]=new De,c[t].setDisposable(e[t].subscribe(function(e){s[t].push(e),r(t)},n.onError.bind(n),function(){i(t)}))})(a);var h=new ye(c);return h.add(Ee(function(){for(var t=0,e=s.length;e>t;t++)s[t]=[]})),h})},Ue.asObservable=function(){var t=this;return new mn(function(e){return t.subscribe(e)})},Ue.dematerialize=function(){var t=this;return new mn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Ue.distinctUntilChanged=function(e,n){var r=this;return e||(e=W),n||(n=q),new mn(function(i){var o,s=!1;return r.subscribe(function(r){var u,c=!1;try{u=e(r)}catch(a){return i.onError(a),t}if(s)try{c=n(o,u)}catch(a){return i.onError(a),t}s&&c||(s=!0,o=u,i.onNext(r))},i.onError.bind(i),i.onCompleted.bind(i))})},Ue["do"]=Ue.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new mn(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Ue["finally"]=Ue.finallyAction=function(t){var e=this;return new mn(function(n){var r;try{r=e.subscribe(n)}catch(i){throw t(),i}return Ee(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Ue.ignoreElements=function(){var t=this;return new mn(function(e){return t.subscribe(R,e.onError.bind(e),e.onCompleted.bind(e)) +})},Ue.materialize=function(){var t=this;return new mn(function(e){return t.subscribe(function(t){e.onNext(Pe(t))},function(t){e.onNext(Te(t)),e.onCompleted()},function(){e.onNext(Le()),e.onCompleted()})})},Ue.repeat=function(t){return Me(this,t).concat()},Ue.retry=function(t){return Me(this,t).catchException()},Ue.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new mn(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},Ue.skipLast=function(t){var e=this;return new mn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Ue.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=Oe,t=he.call(arguments,n),Ie([Xe(t,e),this]).concat()},Ue.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Xe(t,e)})},Ue.takeLastBuffer=function(t){var e=this;return new mn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Ue.selectConcat=Ue.concatMap=function(t,e){return e?this.concatMap(function(n,r){var i=t(n,r),o=L(i)?an(i):i;return o.map(function(t){return e(n,t,r)})}):"function"==typeof t?d.call(this,t):d.call(this,function(){return t})},Ue.select=Ue.map=function(e,n){var r=this;return new mn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ue.pluck=function(t){return this.select(function(e){return e[t]})},Ue.selectMany=Ue.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=L(i)?an(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?b.call(this,t):b.call(this,function(){return t})},Ue.selectSwitch=Ue.flatMapLatest=Ue.switchMap=function(t,e){return this.select(t,e).switchLatest()},Ue.skip=function(t){if(0>t)throw Error(V);var e=this;return new mn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Ue.skipWhile=function(e,n){var r=this;return new mn(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ue.take=function(t,e){if(0>t)throw Error(V);if(0===t)return Ze(e);var n=this;return new mn(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Ue.takeWhile=function(e,n){var r=this;return new mn(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Ue.where=Ue.filter=function(e,n){var r=this;return new mn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},$e.fromCallback=function(e,n,r,i){return n||(n=Oe),function(){var o=he.call(arguments,0);return new mn(function(s){return n.schedule(function(){function n(e){var n=e;if(i)try{n=i(arguments)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},$e.fromNodeCallback=function(e,n,r,i){return n||(n=Oe),function(){var o=he.call(arguments,0);return new mn(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t;var n=he.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}};var sn=S.angular&&angular.element?angular.element:S.jQuery?S.jQuery:S.Zepto?S.Zepto:null,un=!!S.Ember&&"function"==typeof S.Ember.addListener;$e.fromEvent=function(e,n,r){if(un)return cn(function(t){Ember.addListener(e,n,t)},function(t){Ember.removeListener(e,n,t)},r);if(sn){var i=sn(e);return cn(function(t){i.on(n,t)},function(t){i.off(n,t)},r)}return new mn(function(i){return y(e,n,function(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)})}).publish().refCount()};var cn=$e.fromEventPattern=function(e,n,r){return new mn(function(i){function o(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)}var s=e(o);return Ee(function(){n&&n(o,s)})}).publish().refCount()},an=$e.fromPromise=function(t){return new mn(function(e){return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),function(){t&&t.abort&&t.abort()}})};Ue.toPromise=function(t){if(t||(t=j.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},$e.startAsync=function(t){var e;try{e=t()}catch(n){return tn(n)}return an(e)},Ue.multicast=function(t,e){var n=this;return"function"==typeof t?new mn(function(r){var i=n.multicast(t());return new ye(e(i).subscribe(r),i.connect())}):new hn(n,t)},Ue.publish=function(t){return t?this.multicast(function(){return new gn},t):this.multicast(new gn)},Ue.share=function(){return this.publish(null).refCount()},Ue.publishLast=function(t){return t?this.multicast(function(){return new En},t):this.multicast(new En)},Ue.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new Cn(e)},t):this.multicast(new Cn(t))},Ue.shareValue=function(t){return this.publishValue(t).refCount()},Ue.replay=function(t,e,n,r){return t?this.multicast(function(){return new Dn(e,n,r)},t):this.multicast(new Dn(e,n,r))},Ue.shareReplay=function(t,e,n){return this.replay(null,t,e,n).refCount()};var hn=j.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new ye(i.source.subscribe(i.subject),Ee(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return le(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new mn(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),Ee(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}($e),ln=$e.interval=function(t,e){return e||(e=ke),g(t,t,e)},fn=$e.timer=function(e,n,r){var i;return r||(r=ke),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===t?w(e,r):g(e,i,r)};Ue.delay=function(t,e){e||(e=ke);var n=this;return new mn(function(r){var i,o=!1,s=new Se,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,h;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,h=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),h=!o,o=!0),h&&(null!==u?r.onError(u):(i=new De,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,h;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);h=!1,i=0,c.length>0?(h=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):h&&t(i)}}))))}),new ye(i,s)})},Ue.throttle=function(t,e){return e||(e=ke),this.throttleWithSelector(function(){return fn(t,e)})},Ue.timeInterval=function(t){var e=this;return t||(t=ke),Je(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Ue.timestamp=function(t){return t||(t=ke),this.select(function(e){return{value:e,timestamp:t.now()}})},Ue.sample=function(t,e){return e||(e=ke),"number"==typeof t?x(this,ln(t,e)):x(this,t)},Ue.timeout=function(t,e,n){e||(e=tn(Error("Timeout"))),n||(n=ke);var r=this,i=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new mn(function(o){var s=0,u=new De,c=new Se,a=!1,h=new Se;c.setDisposable(u);var l=function(){var r=s;h.setDisposable(n[i](t,function(){s===r&&(L(e)&&(e=an(e)),c.setDisposable(e.subscribe(o)))}))};return l(),u.setDisposable(r.subscribe(function(t){a||(s++,o.onNext(t),l())},function(t){a||(s++,o.onError(t))},function(){a||(s++,o.onCompleted())})),new ye(c,h)})},$e.generateWithRelativeTime=function(e,n,r,i,o,s){return s||(s=ke),new mn(function(u){var c,a,h=!0,l=!1,f=e;return s.scheduleRecursiveWithRelative(0,function(e){l&&u.onNext(c);try{h?h=!1:f=r(f),l=n(f),l&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}l?e(a):u.onCompleted()})})},Ue.delaySubscription=function(t,e){return e||(e=ke),this.delayWithSelector(fn(t,e),function(){return Ze()})},Ue.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new mn(function(e){var n=new ye,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new Se,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new De;n.add(c),c.setDisposable(o.subscribe(function(){e.onNext(r),n.remove(c),u()},e.onError.bind(e),function(){e.onNext(r),n.remove(c),u()}))},e.onError.bind(e),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},e.onError.bind(e),function(){a()})):a(),new ye(c,n)})},Ue.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Ge()}r||(r=tn(Error("Timeout")));var i=this;return new mn(function(o){var s=new Se,u=new Se,c=new De;s.setDisposable(c);var a=0,h=!1,l=function(t){var e=a,n=function(){return a===e},i=new De;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};l(e);var f=function(){var t=!h;return t&&a++,t};return c.setDisposable(i.subscribe(function(e){if(f()){o.onNext(e);var r;try{r=n(e)}catch(i){return o.onError(i),t}l(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new ye(s,u)})},Ue.throttleWithSelector=function(e){var n=this;return new mn(function(r){var i,o=!1,s=new Se,u=0,c=n.subscribe(function(n){var c;try{c=e(n)}catch(a){return r.onError(a),t}o=!0,i=n,u++;var h=u,l=new De;s.setDisposable(l),l.setDisposable(c.subscribe(function(){o&&u===h&&r.onNext(i),o=!1,l.dispose()},r.onError.bind(r),function(){o&&u===h&&r.onNext(i),o=!1,l.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new ye(c,s)})},Ue.skipLastWithTime=function(t,e){e||(e=ke);var n=this;return new mn(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},Ue.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return Xe(t,n)})},Ue.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=ke),new mn(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},Ue.takeWithTime=function(t,e){var n=this;return e||(e=ke),new mn(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new ye(i,n.subscribe(r))})},Ue.skipWithTime=function(t,e){var n=this;return e||(e=ke),new mn(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new ye(o,s)})},Ue.skipUntilWithTime=function(t,e){e||(e=ke);var n=this,r=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new mn(function(i){var o=!1;return new ye(e[r](t,function(){o=!0}),n.subscribe(function(t){o&&i.onNext(t)},i.onError.bind(i),i.onCompleted.bind(i)))})},Ue.takeUntilWithTime=function(t,e){e||(e=ke);var n=this,r=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new mn(function(i){return new ye(e[r](t,function(){i.onCompleted()}),n.subscribe(i))})};var pn=function(t){function e(t){var e=this.source.publish(),n=e.subscribe(t),r=xe,i=this.subject.distinctUntilChanged().subscribe(function(t){t?r=e.connect():(r.dispose(),r=xe)});return new ye(n,r,i)}function n(n,r){this.source=n,this.subject=r||new gn,this.isPaused=!0,t.call(this,e)}return le(n,t),n.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},n.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},n}($e);Ue.pausable=function(t){return new pn(this,t)};var dn=function(t){function e(t){var e=[],n=!0,r=C(this.source,this.subject.distinctUntilChanged(),function(t,e){return{data:t,shouldFire:e}}).subscribe(function(r){if(r.shouldFire&&n&&t.onNext(r.data),r.shouldFire&&!n){for(;e.length>0;)t.onNext(e.shift());n=!0}else r.shouldFire||n?!r.shouldFire&&n&&(n=!1):e.push(r.data)},function(n){for(;e.length>0;)t.onNext(e.shift());t.onError(n)},function(){for(;e.length>0;)t.onNext(e.shift());t.onCompleted()});return this.subject.onNext(!1),r}function n(n,r){this.source=n,this.subject=r||new gn,this.isPaused=!0,t.call(this,e)}return le(n,t),n.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},n.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},n}($e);Ue.pausableBuffered=function(t){return new dn(this,t)},Ue.controlled=function(t){return null==t&&(t=!0),new bn(this,t)};var bn=function(t){function e(t){return this.source.subscribe(t)}function n(n,r){t.call(this,e),this.subject=new vn(r),this.source=n.multicast(this.subject).refCount()}return le(n,t),n.prototype.request=function(t){return null==t&&(t=-1),this.subject.request(t)},n}($e),vn=j.ControlledSubject=function(t){function n(t){return this.subject.subscribe(t)}function r(e){null==e&&(e=!0),t.call(this,n),this.subject=new gn,this.enableQueue=e,this.queue=e?[]:null,this.requestedCount=0,this.requestedDisposable=xe,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=xe}return le(r,t),fe(r.prototype,Fe,{onCompleted:function(){e.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(t){e.call(this),this.hasFailed=!0,this.error=t,this.enableQueue&&0!==this.queue.length||this.subject.onError(t)},onNext:function(t){e.call(this);var n=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(t):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),n=!0),n&&this.subject.onNext(t)},_processRequest:function(t){if(this.enableQueue){for(;this.queue.length>=t&&t>0;)this.subject.onNext(this.queue.shift()),t--;return 0!==this.queue.length?{numberOfItems:t,returnValue:!0}:{numberOfItems:t,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=xe):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=xe),{numberOfItems:t,returnValue:!1}},request:function(t){e.call(this),this.disposeCurrentRequest();var n=this,r=this._processRequest(t);return t=r.numberOfItems,r.returnValue?xe:(this.requestedCount=t,this.requestedDisposable=Ee(function(){n.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=xe},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),r}($e);Ue.pairwise=function(){var t=this;return new mn(function(e){var n,r=!1;return t.subscribe(function(t){r?e.onNext([n,t]):r=!0,n=t},e.onError.bind(e),e.onCompleted.bind(e))})},Ue.partition=function(t,e){var n=this.publish().refCount();return[n.filter(t,e),n.filter(function(n,r,i){return!t.call(e,n,r,i)})]},Ue.exclusive=function(){var t=this;return new mn(function(e){var n=!1,r=!1,i=new De,o=new ye;return o.add(i),i.setDisposable(t.subscribe(function(t){if(!n){n=!0,L(t)&&(t=an(t));var i=new De;o.add(i),i.setDisposable(t.subscribe(e.onNext.bind(e),e.onError.bind(e),function(){o.remove(i),n=!1,r&&1===o.length&&e.onCompleted()}))}},e.onError.bind(e),function(){r=!0,n||1!==o.length||e.onCompleted()})),o})},Ue.exclusiveMap=function(e,n){var r=this;return new mn(function(i){var o=0,s=!1,u=!0,c=new De,a=new ye;return a.add(c),c.setDisposable(r.subscribe(function(r){s||(s=!0,innerSubscription=new De,a.add(innerSubscription),L(r)&&(r=an(r)),innerSubscription.setDisposable(r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),function(){a.remove(innerSubscription),s=!1,u&&1===a.length&&i.onCompleted()})))},i.onError.bind(i),function(){u=!0,1!==a.length||s||i.onCompleted()})),a})};var mn=j.AnonymousObservable=function(e){function n(e){return e===t?e=xe:"function"==typeof e&&(e=Ee(e)),e}function r(i){function o(t){var e=function(){try{r.setDisposable(n(i(r)))}catch(t){if(!r.fail(t))throw t}},r=new yn(t);return je.scheduleRequired()?je.schedule(e):e(),r}return this instanceof r?(e.call(this,o),t):new r(i)}return le(r,e),r}($e),yn=function(t){function e(e){t.call(this),this.observer=e,this.m=new De}le(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Qe),wn=function(t,e){this.subject=t,this.observer=e};wn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var gn=j.Subject=function(t){function n(t){return e.call(this),this.isStopped?this.exception?(t.onError(this.exception),xe):(t.onCompleted(),xe):(this.observers.push(t),new wn(this,t))}function r(){t.call(this,n),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return le(r,t),fe(r.prototype,Fe,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(e.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var n=0,r=t.length;r>n;n++)t[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){if(e.call(this),!this.isStopped)for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)n[r].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(t,e){return new xn(t,e)},r}($e),En=j.AsyncSubject=function(t){function n(t){if(e.call(this),!this.isStopped)return this.observers.push(t),new wn(this,t);var n=this.exception,r=this.hasValue,i=this.value;return n?t.onError(n):r?(t.onNext(i),t.onCompleted()):t.onCompleted(),xe}function r(){t.call(this,n),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return le(r,t),fe(r.prototype,Fe,{hasObservers:function(){return e.call(this),this.observers.length>0},onCompleted:function(){var t,n,r;if(e.call(this),!this.isStopped){this.isStopped=!0;var i=this.observers.slice(0),o=this.value,s=this.hasValue;if(s)for(n=0,r=i.length;r>n;n++)t=i[n],t.onNext(o),t.onCompleted();else for(n=0,r=i.length;r>n;n++)i[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){e.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}($e),xn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return le(n,t),fe(n.prototype,Fe,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}($e),Cn=j.BehaviorSubject=function(t){function n(t){if(e.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new wn(this,t);var n=this.exception;return n?t.onError(n):t.onCompleted(),xe}function r(e){t.call(this,n),this.value=e,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return le(r,t),fe(r.prototype,Fe,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(e.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var n=0,r=t.length;r>n;n++)t[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){if(e.call(this),!this.isStopped){this.value=t;for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)n[r].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),r}($e),Dn=j.ReplaySubject=function(t){function n(t,e){this.subject=t,this.observer=e}function r(t){var r=new Ke(this.scheduler,t),i=new n(this,r);e.call(this),this._trim(this.scheduler.now()),this.observers.push(r);for(var o=this.q.length,s=0,u=this.q.length;u>s;s++)r.onNext(this.q[s].value);return this.hasError?(o++,r.onError(this.error)):this.isStopped&&(o++,r.onCompleted()),r.ensureActive(o),i}function i(e,n,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==n?Number.MAX_VALUE:n,this.scheduler=i||je,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,r)}return n.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},le(i,t),fe(i.prototype,Fe,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var n;if(e.call(this),!this.isStopped){var r=this.scheduler.now();this.q.push({interval:r,value:t}),this._trim(r);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)n=i[o],n.onNext(t),n.ensureActive()}},onError:function(t){var n;if(e.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var r=this.scheduler.now();this._trim(r);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)n=i[o],n.onError(t),n.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(e.call(this),!this.isStopped){this.isStopped=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)t=r[i],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),i}($e);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(S.Rx=j,define(function(){return j})):N&&A?_?(A.exports=j).Rx=j:N.Rx=j:S.Rx=j}).call(this); \ No newline at end of file diff --git a/dist/rx.lite.js b/dist/rx.lite.js index cddaf05b0..0988b3648 100644 --- a/dist/rx.lite.js +++ b/dist/rx.lite.js @@ -3856,19 +3856,38 @@ }); } - function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { - if (dueTime === period) { - return new AnonymousObservable(function (observer) { - return scheduler.schedulePeriodicWithState(0, period, function (count) { - observer.onNext(count); - return count + 1; - }); - }); - } - return observableDefer(function () { - return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { + if (dueTime === period) { + return new AnonymousObservable(function (observer) { + return scheduler.schedulePeriodicWithState(0, period, function (count) { + observer.onNext(count); + return count + 1; }); + }); } + return observableDefer(function () { + return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + }); + } + + function observableTimerDateAndPeriod(dueTime, period, scheduler) { + var p = normalizeTime(period); + return new AnonymousObservable(function (observer) { + var count = 0, d = dueTime; + return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { + var now; + if (p > 0) { + now = scheduler.now(); + d = d + p; + if (d <= now) { + d = now + p; + } + } + observer.onNext(count++); + self(d); + }); + }); + } /** * Returns an observable sequence that produces a value after each period. diff --git a/dist/rx.lite.min.js b/dist/rx.lite.min.js index ffb1fa501..34df4472a 100644 --- a/dist/rx.lite.min.js +++ b/dist/rx.lite.min.js @@ -1,2 +1,2 @@ -(function(t){function e(){if(this.isDisposed)throw Error(L)}function n(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function r(t){var e=[];if(!n(t))return e;se.nonEnumArgs&&t.length&&u(t)&&(t=ce.call(t));var r=se.enumPrototypes&&"function"==typeof t,i=se.enumErrorProps&&(t===te||t instanceof Error);for(var o in t)r&&"prototype"==o||i&&("message"==o||"name"==o)||e.push(o);if(se.nonEnumShadows&&t!==ee){var s=t.constructor,c=-1,a=ie.length;if(t===(s&&s.prototype))var h=t===stringProto?Z:t===te?H:X.call(t),l=oe[h];for(;a>++c;)o=ie[c],l&&l[o]||!G.call(t,o)||e.push(o)}return e}function i(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function o(t,e){return i(t,e,r)}function s(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function u(t){return t&&"object"==typeof t?X.call(t)==I:!1}function c(t){return"function"==typeof t||!1}function a(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var h=typeof e,l=typeof n;if(e===e&&(null==e||null==n||"function"!=h&&"object"!=h&&"function"!=l&&"object"!=l))return!1;var f=X.call(e),p=X.call(n);if(f==I&&(f=K),p==I&&(p=K),f!=p)return!1;switch(f){case B:case U:return+e==+n;case $:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case J:case Z:return e==n+""}var d=f==F;if(!d){if(f!=K||!se.nodeClass&&(s(e)||s(n)))return!1;var b=!se.argsObject&&u(e)?Object:e.constructor,v=!se.argsObject&&u(n)?Object:n.constructor;if(!(b==v||G.call(e,"constructor")&&G.call(n,"constructor")||c(b)&&b instanceof b&&c(v)&&v instanceof v||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),d){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=a(e[y],w,r,i)))break}}else o(n,function(n,o,s){return G.call(s,o)?(y++,result=G.call(e,o)&&a(e[o],n,r,i)):t}),result&&o(e,function(e,n,r){return G.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function h(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:ce.call(t)}function l(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function f(e,n){return new pn(function(r){var i=new ge,o=new Ee;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}P(s)&&(s=on(s)),i=new ge,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function p(e,n){var r=this;return new pn(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function d(t){return this.map(function(e,n){var r=t(e,n);return P(r)?on(r):r}).concatAll()}function b(t){return this.select(function(e,n){var r=t(e,n);return P(r)?on(r):r}).mergeObservable()}function v(t,e,n){if(t.addListener)return t.addListener(e,n),me(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),me(function(){t.removeEventListener(e,n,!1)});throw Error("No listener found")}function m(t,e,n){var r=new de;if("function"==typeof t.item&&"number"==typeof t.length)for(var i=0,o=t.length;o>i;i++)r.add(m(t.item(i),e,n));else t&&r.add(v(t,e,n));return r}function y(t,e){var n=De(t);return new pn(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function w(t,e,n){return t===e?new pn(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):He(function(){return observableTimerDateAndPeriod(n.now()+t,e,n)})}function g(t,e){return new pn(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new de(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}function E(e,n,r){return new pn(function(i){function o(e,n){h[n]=e;var o;if(u[n]=!0,c||(c=u.every(R))){try{o=r.apply(null,h)}catch(s){return i.onError(s),t}i.onNext(o)}else a&&i.onCompleted()}var s=2,u=[!1,!1],c=!1,a=!1,h=Array(s);return new de(e.subscribe(function(t){o(t,0)},i.onError.bind(i),function(){a=!0,i.onCompleted()}),n.subscribe(function(t){o(t,1)},i.onError.bind(i)))})}var x={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},C=x[typeof window]&&window||this,D=x[typeof exports]&&exports&&!exports.nodeType&&exports,S=x[typeof module]&&module&&!module.nodeType&&module,N=S&&S.exports===D&&D,A=x[typeof global]&&global;!A||A.global!==A&&A.window!==A||(C=A);var _={internals:{},config:{Promise:C.Promise},helpers:{}},O=_.helpers.noop=function(){},R=_.helpers.identity=function(t){return t},j=(_.helpers.pluck=function(t){return function(e){return e[t]}},_.helpers.just=function(t){return function(){return t}},_.helpers.defaultNow=Date.now),W=_.helpers.defaultComparer=function(t,e){return ue(t,e)},k=_.helpers.defaultSubComparer=function(t,e){return t>e?1:e>t?-1:0},q=(_.helpers.defaultKeySerializer=function(t){return""+t},_.helpers.defaultError=function(t){throw t}),P=_.helpers.isPromise=function(t){return!!t&&"function"==typeof t.then&&t.then!==_.Observable.prototype.then};_.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},_.helpers.not=function(t){return!t};var T="Argument out of range",L="Object has been disposed",V="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";C.Set&&"function"==typeof(new C.Set)["@@iterator"]&&(V="@@iterator");var z,M={done:!0,value:t},I="[object Arguments]",F="[object Array]",B="[object Boolean]",U="[object Date]",H="[object Error]",Q="[object Function]",$="[object Number]",K="[object Object]",J="[object RegExp]",Z="[object String]",X=Object.prototype.toString,G=Object.prototype.hasOwnProperty,Y=X.call(arguments)==I,te=Error.prototype,ee=Object.prototype,ne=ee.propertyIsEnumerable;try{z=!(X.call(document)==K&&!({toString:0}+""))}catch(re){z=!0}var ie=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],oe={};oe[F]=oe[U]=oe[$]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},oe[B]=oe[Z]={constructor:!0,toString:!0,valueOf:!0},oe[H]=oe[Q]=oe[J]={constructor:!0,toString:!0},oe[K]={constructor:!0};var se={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);se.enumErrorProps=ne.call(te,"message")||ne.call(te,"name"),se.enumPrototypes=ne.call(t,"prototype"),se.nonEnumArgs=0!=n,se.nonEnumShadows=!/valueOf/.test(e)})(1),Y||(u=function(t){return t&&"object"==typeof t?G.call(t,"callee"):!1}),c(/x/)&&(c=function(t){return"function"==typeof t&&X.call(t)==Q});var ue=_.internals.isEqual=function(t,e){return a(t,e,[],[])},ce=Array.prototype.slice;({}).hasOwnProperty;var ae=this.inherits=_.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},he=_.internals.addProperties=function(t){for(var e=ce.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};_.internals.addRef=function(t,e){return new pn(function(n){return new de(e.getDisposable(),t.subscribe(n))})};var le=function(t,e){this.id=t,this.value=e};le.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var fe=_.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},pe=fe.prototype;pe.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},pe.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},pe.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},pe.peek=function(){return this.items[0].value},pe.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},pe.dequeue=function(){var t=this.peek();return this.removeAt(0),t},pe.enqueue=function(t){var e=this.length++;this.items[e]=new le(fe.count++,t),this.percolate(e)},pe.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},fe.count=0;var de=_.CompositeDisposable=function(){this.disposables=h(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},be=de.prototype;be.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},be.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},be.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},be.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},be.contains=function(t){return-1!==this.disposables.indexOf(t)},be.toArray=function(){return this.disposables.slice(0)};var ve=_.Disposable=function(t){this.isDisposed=!1,this.action=t||O};ve.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var me=ve.create=function(t){return new ve(t)},ye=ve.empty={dispose:O},we=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),ge=_.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return ae(e,t),e}(we),Ee=_.SerialDisposable=function(t){function e(){t.call(this,!1)}return ae(e,t),e}(we);_.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.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()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ye:new t(this)},e}();var xe=_.internals.ScheduledItem=function(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||k,this.disposable=new ge};xe.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},xe.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},xe.prototype.isCancelled=function(){return this.disposable.isDisposed},xe.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ce=_.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new de,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ye});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new de,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ye});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),ye}var i=t.prototype;return i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return me(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=j,t.normalize=function(t){return 0>t&&(t=0),t},t}(),De=Ce.normalize,Se=Ce.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=De(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ce(j,t,e,n)}(),Ne=Ce.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-Ce.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+Ce.normalize(n),s=new xe(this,e,r,o);if(i)i.enqueue(s);else{i=new fe(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new Ce(j,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}();_.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ge;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var Ae,_e=O;(function(){function t(){if(!C.postMessage||C.importScripts)return!1;var t=!1,e=C.onmessage;return C.onmessage=function(){t=!0},C.postMessage("","*"),C.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(X+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=A&&N&&A.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=A&&N&&A.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Ae=process.nextTick;else if("function"==typeof r)Ae=r,_e=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;C.addEventListener?C.addEventListener("message",e,!1):C.attachEvent("onmessage",e,!1),Ae=function(t){var e=u++;s[e]=t,C.postMessage(o+e,"*")}}else if(C.MessageChannel){var c=new C.MessageChannel,a={},h=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},Ae=function(t){var e=h++;a[e]=t,c.port2.postMessage(e)}}else"document"in C&&"onreadystatechange"in C.document.createElement("script")?Ae=function(t){var e=C.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},C.document.documentElement.appendChild(e)}:(Ae=function(t){return setTimeout(t,0)},_e=clearTimeout)})();var Oe=Ce.timeout=function(){function t(t,e){var n=this,r=new ge,i=Ae(function(){r.isDisposed||r.setDisposable(e(n,t))});return new de(r,me(function(){_e(i)}))}function e(t,e,n){var r=this,i=Ce.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new ge,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new de(o,me(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ce(j,t,e,n)}(),Re=_.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=Se),new pn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),je=Re.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new Re("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),We=Re.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new Re("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ke=Re.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new Re("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),qe=_.internals.Enumerator=function(t){this._next=t};qe.prototype.next=function(){return this._next()},qe.prototype[V]=function(){return this};var Pe=_.internals.Enumerable=function(t){this._iterator=t};Pe.prototype[V]=function(){return this._iterator()},Pe.prototype.concat=function(){var e=this;return new pn(function(n){var r;try{r=e[V]()}catch(i){return n.onError(),t}var o,s=new Ee,u=Se.scheduleRecursive(function(e){var i;if(!o){try{i=r.next()}catch(u){return n.onError(u),t}if(i.done)return n.onCompleted(),t;var c=i.value;P(c)&&(c=on(c));var a=new ge;s.setDisposable(a),a.setDisposable(c.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new de(s,u,me(function(){o=!0}))})},Pe.prototype.catchException=function(){var e=this;return new pn(function(n){var r;try{r=e[V]()}catch(i){return n.onError(),t}var o,s,u=new Ee,c=Se.scheduleRecursive(function(e){if(!o){var i;try{i=r.next()}catch(c){return n.onError(c),t}if(i.done)return s?n.onError(s):n.onCompleted(),t;var a=i.value;P(a)&&(a=on(a));var h=new ge;u.setDisposable(h),h.setDisposable(a.subscribe(n.onNext.bind(n),function(t){s=t,e()},n.onCompleted.bind(n)))}});return new de(u,c,me(function(){o=!0}))})};var Te=Pe.repeat=function(t,e){return null==e&&(e=-1),new Pe(function(){var n=e;return new qe(function(){return 0===n?M:(n>0&&n--,{done:!1,value:t})})})},Le=Pe.forEach=function(t,e,n){return e||(e=R),new Pe(function(){var r=-1;return new qe(function(){return++r0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Ie);Me.toArray=function(){var t=this;return new pn(function(e){var n=[];return t.subscribe(n.push.bind(n),e.onError.bind(e),function(){e.onNext(n),e.onCompleted()})})},Be.create=Be.createWithDisposable=function(t){return new pn(t)};var He=Be.defer=function(t){return new pn(function(e){var n;try{n=t()}catch(r){return Ze(r).subscribe(e)}return P(n)&&(n=on(n)),n.subscribe(e)})},Qe=Be.empty=function(t){return t||(t=Se),new pn(function(e){return t.schedule(function(){e.onCompleted()})})},$e=Be.fromArray=function(t,e){return e||(e=Ne),new pn(function(n){var r=0,i=t.length;return e.scheduleRecursive(function(e){i>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Be.fromIterable=function(e,n){return n||(n=Ne),new pn(function(r){var i;try{i=e[V]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},Be.generate=function(e,n,r,i,o){return o||(o=Ne),new pn(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Ke=Be.never=function(){return new pn(function(){return ye})};Be.of=function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return $e(e)},Be.ofWithScheduler=function(t){for(var e=arguments.length-1,n=Array(e),r=0;e>r;r++)n[r]=arguments[r+1];return $e(n,t)},Be.range=function(t,e,n){return n||(n=Ne),new pn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Be.repeat=function(t,e,n){return n||(n=Ne),null==e&&(e=-1),Je(t,n).repeat(e)};var Je=Be["return"]=Be.returnValue=Be.just=function(t,e){return e||(e=Se),new pn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ze=Be["throw"]=Be.throwException=function(t,e){return e||(e=Se),new pn(function(n){return e.schedule(function(){n.onError(t)})})};Me["catch"]=Me.catchException=function(t){return"function"==typeof t?f(this,t):Xe([this,t])};var Xe=Be.catchException=Be["catch"]=function(){var t=h(arguments,0);return Le(t).catchException()};Me.combineLatest=function(){var t=ce.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ge.apply(this,t)};var Ge=Be.combineLatest=function(){var e=ce.call(arguments),n=e.pop();return Array.isArray(e[0])&&(e=e[0]),new pn(function(r){function i(e){var i;if(c[e]=!0,a||(a=c.every(R))){try{i=n.apply(null,f)}catch(o){return r.onError(o),t}r.onNext(i)}else h.filter(function(t,n){return n!==e}).every(R)&&r.onCompleted()}function o(t){h[t]=!0,h.every(R)&&r.onCompleted()}for(var s=function(){return!1},u=e.length,c=l(u,s),a=!1,h=l(u,s),f=Array(u),p=Array(u),d=0;u>d;d++)(function(t){var n=e[t],s=new ge;P(n)&&(n=on(n)),s.setDisposable(n.subscribe(function(e){f[t]=e,i(t)},r.onError.bind(r),function(){o(t)})),p[t]=s})(d);return new de(p)})};Me.concat=function(){var t=ce.call(arguments,0);return t.unshift(this),Ye.apply(this,t)};var Ye=Be.concat=function(){var t=h(arguments,0);return Le(t).concat()};Me.concatObservable=Me.concatAll=function(){return this.merge(1)},Me.merge=function(t){if("number"!=typeof t)return tn(this,t);var e=this;return new pn(function(n){var r=0,i=new de,o=!1,s=[],u=function(t){var e=new ge;i.add(e),P(t)&&(t=on(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var tn=Be.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=ce.call(arguments,1)):(t=Se,e=ce.call(arguments,0)):(t=Se,e=ce.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),$e(e,t).mergeObservable()};Me.mergeObservable=Me.mergeAll=function(){var t=this;return new pn(function(e){var n=new de,r=!1,i=new ge;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ge;n.add(i),P(t)&&(t=on(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Me.skipUntil=function(t){var e=this;return new pn(function(n){var r=!1,i=new de(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()}));P(t)&&(t=on(t));var o=new ge;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Me["switch"]=Me.switchLatest=function(){var t=this;return new pn(function(e){var n=!1,r=new Ee,i=!1,o=0,s=t.subscribe(function(t){var s=new ge,u=++o;n=!0,r.setDisposable(s),P(t)&&(t=on(t)),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new de(s,r)})},Me.takeUntil=function(t){var e=this;return new pn(function(n){return P(t)&&(t=on(t)),new de(e.subscribe(n),t.subscribe(n.onCompleted.bind(n),n.onError.bind(n),O))})},Me.zip=function(){if(Array.isArray(arguments[0]))return p.apply(this,arguments);var e=this,n=ce.call(arguments),r=n.pop();return n.unshift(e),new pn(function(i){function o(n){var o,s;if(c.every(function(t){return t.length>0})){try{s=c.map(function(t){return t.shift()}),o=r.apply(e,s)}catch(u){return i.onError(u),t}i.onNext(o)}else a.filter(function(t,e){return e!==n}).every(R)&&i.onCompleted()}function s(t){a[t]=!0,a.every(function(t){return t})&&i.onCompleted()}for(var u=n.length,c=l(u,function(){return[]}),a=l(u,function(){return!1}),h=Array(u),f=0;u>f;f++)(function(t){var e=n[t],r=new ge;P(e)&&(e=on(e)),r.setDisposable(e.subscribe(function(e){c[t].push(e),o(t)},i.onError.bind(i),function(){s(t)})),h[t]=r})(f);return new de(h)})},Be.zip=function(){var t=ce.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Be.zipArray=function(){var e=h(arguments,0);return new pn(function(n){function r(e){if(s.every(function(t){return t.length>0})){var r=s.map(function(t){return t.shift()});n.onNext(r)}else if(u.filter(function(t,n){return n!==e}).every(R))return n.onCompleted(),t}function i(e){return u[e]=!0,u.every(R)?(n.onCompleted(),t):t}for(var o=e.length,s=l(o,function(){return[]}),u=l(o,function(){return!1}),c=Array(o),a=0;o>a;a++)(function(t){c[t]=new ge,c[t].setDisposable(e[t].subscribe(function(e){s[t].push(e),r(t)},n.onError.bind(n),function(){i(t)}))})(a);var h=new de(c);return h.add(me(function(){for(var t=0,e=s.length;e>t;t++)s[t]=[]})),h})},Me.asObservable=function(){var t=this;return new pn(function(e){return t.subscribe(e)})},Me.dematerialize=function(){var t=this;return new pn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Me.distinctUntilChanged=function(e,n){var r=this;return e||(e=R),n||(n=W),new pn(function(i){var o,s=!1;return r.subscribe(function(r){var u,c=!1;try{u=e(r)}catch(a){return i.onError(a),t}if(s)try{c=n(o,u)}catch(a){return i.onError(a),t}s&&c||(s=!0,o=u,i.onNext(r))},i.onError.bind(i),i.onCompleted.bind(i))})},Me["do"]=Me.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new pn(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Me["finally"]=Me.finallyAction=function(t){var e=this;return new pn(function(n){var r;try{r=e.subscribe(n)}catch(i){throw t(),i}return me(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Me.ignoreElements=function(){var t=this;return new pn(function(e){return t.subscribe(O,e.onError.bind(e),e.onCompleted.bind(e))})},Me.materialize=function(){var t=this;return new pn(function(e){return t.subscribe(function(t){e.onNext(je(t))},function(t){e.onNext(We(t)),e.onCompleted()},function(){e.onNext(ke()),e.onCompleted()})})},Me.repeat=function(t){return Te(this,t).concat()},Me.retry=function(t){return Te(this,t).catchException()},Me.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new pn(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},Me.skipLast=function(t){var e=this;return new pn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Me.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=Se,t=ce.call(arguments,n),Le([$e(t,e),this]).concat()},Me.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return $e(t,e)})},Me.takeLastBuffer=function(t){var e=this;return new pn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Me.selectConcat=Me.concatMap=function(t,e){return e?this.concatMap(function(n,r){var i=t(n,r),o=P(i)?on(i):i;return o.map(function(t){return e(n,t,r)})}):"function"==typeof t?d.call(this,t):d.call(this,function(){return t})},Me.select=Me.map=function(e,n){var r=this;return new pn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Me.pluck=function(t){return this.select(function(e){return e[t]})},Me.selectMany=Me.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=P(i)?on(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?b.call(this,t):b.call(this,function(){return t})},Me.selectSwitch=Me.flatMapLatest=Me.switchMap=function(t,e){return this.select(t,e).switchLatest()},Me.skip=function(t){if(0>t)throw Error(T);var e=this;return new pn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Me.skipWhile=function(e,n){var r=this;return new pn(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t -}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Me.take=function(t,e){if(0>t)throw Error(T);if(0===t)return Qe(e);var n=this;return new pn(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Me.takeWhile=function(e,n){var r=this;return new pn(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Me.where=Me.filter=function(e,n){var r=this;return new pn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},Be.fromCallback=function(e,n,r,i){return n||(n=Se),function(){var o=ce.call(arguments,0);return new pn(function(s){return n.schedule(function(){function n(e){var n=e;if(i)try{n=i(arguments)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Be.fromNodeCallback=function(e,n,r,i){return n||(n=Se),function(){var o=ce.call(arguments,0);return new pn(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t;var n=ce.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}};var en=C.angular&&angular.element?angular.element:C.jQuery?C.jQuery:C.Zepto?C.Zepto:null,nn=!!C.Ember&&"function"==typeof C.Ember.addListener;Be.fromEvent=function(e,n,r){if(nn)return rn(function(t){Ember.addListener(e,n,t)},function(t){Ember.removeListener(e,n,t)},r);if(en){var i=en(e);return rn(function(t){i.on(n,t)},function(t){i.off(n,t)},r)}return new pn(function(i){return m(e,n,function(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)})}).publish().refCount()};var rn=Be.fromEventPattern=function(e,n,r){return new pn(function(i){function o(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)}var s=e(o);return me(function(){n&&n(o,s)})}).publish().refCount()},on=Be.fromPromise=function(t){return new pn(function(e){return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),function(){t&&t.abort&&t.abort()}})};Me.toPromise=function(t){if(t||(t=_.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},Be.startAsync=function(t){var e;try{e=t()}catch(n){return Ze(n)}return on(e)},Me.multicast=function(t,e){var n=this;return"function"==typeof t?new pn(function(r){var i=n.multicast(t());return new de(e(i).subscribe(r),i.connect())}):new sn(n,t)},Me.publish=function(t){return t?this.multicast(function(){return new vn},t):this.multicast(new vn)},Me.share=function(){return this.publish(null).refCount()},Me.publishLast=function(t){return t?this.multicast(function(){return new mn},t):this.multicast(new mn)},Me.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new wn(e)},t):this.multicast(new wn(t))},Me.shareValue=function(t){return this.publishValue(t).refCount()},Me.replay=function(t,e,n,r){return t?this.multicast(function(){return new gn(e,n,r)},t):this.multicast(new gn(e,n,r))},Me.shareReplay=function(t,e,n){return this.replay(null,t,e,n).refCount()};var sn=_.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new de(i.source.subscribe(i.subject),me(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return ae(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new pn(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),me(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(Be),un=Be.interval=function(t,e){return e||(e=Oe),w(t,t,e)},cn=Be.timer=function(e,n,r){var i;return r||(r=Oe),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===t?y(e,r):w(e,i,r)};Me.delay=function(t,e){e||(e=Oe);var n=this;return new pn(function(r){var i,o=!1,s=new Ee,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,h;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,h=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),h=!o,o=!0),h&&(null!==u?r.onError(u):(i=new ge,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,h;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);h=!1,i=0,c.length>0?(h=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):h&&t(i)}}))))}),new de(i,s)})},Me.throttle=function(t,e){return e||(e=Oe),this.throttleWithSelector(function(){return cn(t,e)})},Me.timeInterval=function(t){var e=this;return t||(t=Oe),He(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Me.timestamp=function(t){return t||(t=Oe),this.select(function(e){return{value:e,timestamp:t.now()}})},Me.sample=function(t,e){return e||(e=Oe),"number"==typeof t?g(this,un(t,e)):g(this,t)},Me.timeout=function(t,e,n){e||(e=Ze(Error("Timeout"))),n||(n=Oe);var r=this,i=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new pn(function(o){var s=0,u=new ge,c=new Ee,a=!1,h=new Ee;c.setDisposable(u);var l=function(){var r=s;h.setDisposable(n[i](t,function(){s===r&&(P(e)&&(e=on(e)),c.setDisposable(e.subscribe(o)))}))};return l(),u.setDisposable(r.subscribe(function(t){a||(s++,o.onNext(t),l())},function(t){a||(s++,o.onError(t))},function(){a||(s++,o.onCompleted())})),new de(c,h)})},Be.generateWithRelativeTime=function(e,n,r,i,o,s){return s||(s=Oe),new pn(function(u){var c,a,h=!0,l=!1,f=e;return s.scheduleRecursiveWithRelative(0,function(e){l&&u.onNext(c);try{h?h=!1:f=r(f),l=n(f),l&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}l?e(a):u.onCompleted()})})},Me.delaySubscription=function(t,e){return e||(e=Oe),this.delayWithSelector(cn(t,e),function(){return Qe()})},Me.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new pn(function(e){var n=new de,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new Ee,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new ge;n.add(c),c.setDisposable(o.subscribe(function(){e.onNext(r),n.remove(c),u()},e.onError.bind(e),function(){e.onNext(r),n.remove(c),u()}))},e.onError.bind(e),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},e.onError.bind(e),function(){a()})):a(),new de(c,n)})},Me.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Ke()}r||(r=Ze(Error("Timeout")));var i=this;return new pn(function(o){var s=new Ee,u=new Ee,c=new ge;s.setDisposable(c);var a=0,h=!1,l=function(t){var e=a,n=function(){return a===e},i=new ge;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};l(e);var f=function(){var t=!h;return t&&a++,t};return c.setDisposable(i.subscribe(function(e){if(f()){o.onNext(e);var r;try{r=n(e)}catch(i){return o.onError(i),t}l(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new de(s,u)})},Me.throttleWithSelector=function(e){var n=this;return new pn(function(r){var i,o=!1,s=new Ee,u=0,c=n.subscribe(function(n){var c;try{c=e(n)}catch(a){return r.onError(a),t}o=!0,i=n,u++;var h=u,l=new ge;s.setDisposable(l),l.setDisposable(c.subscribe(function(){o&&u===h&&r.onNext(i),o=!1,l.dispose()},r.onError.bind(r),function(){o&&u===h&&r.onNext(i),o=!1,l.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new de(c,s)})},Me.skipLastWithTime=function(t,e){e||(e=Oe);var n=this;return new pn(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},Me.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return $e(t,n)})},Me.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=Oe),new pn(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},Me.takeWithTime=function(t,e){var n=this;return e||(e=Oe),new pn(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new de(i,n.subscribe(r))})},Me.skipWithTime=function(t,e){var n=this;return e||(e=Oe),new pn(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new de(o,s)})},Me.skipUntilWithTime=function(t,e){e||(e=Oe);var n=this,r=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new pn(function(i){var o=!1;return new de(e[r](t,function(){o=!0}),n.subscribe(function(t){o&&i.onNext(t)},i.onError.bind(i),i.onCompleted.bind(i)))})},Me.takeUntilWithTime=function(t,e){e||(e=Oe);var n=this,r=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new pn(function(i){return new de(e[r](t,function(){i.onCompleted()}),n.subscribe(i))})};var an=function(t){function e(t){var e=this.source.publish(),n=e.subscribe(t),r=ye,i=this.subject.distinctUntilChanged().subscribe(function(t){t?r=e.connect():(r.dispose(),r=ye)});return new de(n,r,i)}function n(n,r){this.source=n,this.subject=r||new vn,this.isPaused=!0,t.call(this,e)}return ae(n,t),n.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},n.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},n}(Be);Me.pausable=function(t){return new an(this,t)};var hn=function(t){function e(t){var e=[],n=!0,r=E(this.source,this.subject.distinctUntilChanged(),function(t,e){return{data:t,shouldFire:e}}).subscribe(function(r){if(r.shouldFire&&n&&t.onNext(r.data),r.shouldFire&&!n){for(;e.length>0;)t.onNext(e.shift());n=!0}else r.shouldFire||n?!r.shouldFire&&n&&(n=!1):e.push(r.data)},function(n){for(;e.length>0;)t.onNext(e.shift());t.onError(n)},function(){for(;e.length>0;)t.onNext(e.shift());t.onCompleted()});return this.subject.onNext(!1),r}function n(n,r){this.source=n,this.subject=r||new vn,this.isPaused=!0,t.call(this,e)}return ae(n,t),n.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},n.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},n}(Be);Me.pausableBuffered=function(t){return new hn(this,t)},Me.controlled=function(t){return null==t&&(t=!0),new ln(this,t)};var ln=function(t){function e(t){return this.source.subscribe(t)}function n(n,r){t.call(this,e),this.subject=new fn(r),this.source=n.multicast(this.subject).refCount()}return ae(n,t),n.prototype.request=function(t){return null==t&&(t=-1),this.subject.request(t)},n}(Be),fn=_.ControlledSubject=function(t){function n(t){return this.subject.subscribe(t)}function r(e){null==e&&(e=!0),t.call(this,n),this.subject=new vn,this.enableQueue=e,this.queue=e?[]:null,this.requestedCount=0,this.requestedDisposable=ye,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=ye}return ae(r,t),he(r.prototype,Ve,{onCompleted:function(){e.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(t){e.call(this),this.hasFailed=!0,this.error=t,this.enableQueue&&0!==this.queue.length||this.subject.onError(t)},onNext:function(t){e.call(this);var n=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(t):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),n=!0),n&&this.subject.onNext(t)},_processRequest:function(t){if(this.enableQueue){for(;this.queue.length>=t&&t>0;)this.subject.onNext(this.queue.shift()),t--;return 0!==this.queue.length?{numberOfItems:t,returnValue:!0}:{numberOfItems:t,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=ye):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=ye),{numberOfItems:t,returnValue:!1}},request:function(t){e.call(this),this.disposeCurrentRequest();var n=this,r=this._processRequest(t);return t=r.numberOfItems,r.returnValue?ye:(this.requestedCount=t,this.requestedDisposable=me(function(){n.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=ye},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),r}(Be);Me.pairwise=function(){var t=this;return new pn(function(e){var n,r=!1;return t.subscribe(function(t){r?e.onNext([n,t]):r=!0,n=t},e.onError.bind(e),e.onCompleted.bind(e))})},Me.partition=function(t,e){var n=this.publish().refCount();return[n.filter(t,e),n.filter(function(n,r,i){return!t.call(e,n,r,i)})]},Me.exclusive=function(){var t=this;return new pn(function(e){var n=!1,r=!1,i=new ge,o=new de;return o.add(i),i.setDisposable(t.subscribe(function(t){if(!n){n=!0,P(t)&&(t=on(t));var i=new ge;o.add(i),i.setDisposable(t.subscribe(e.onNext.bind(e),e.onError.bind(e),function(){o.remove(i),n=!1,r&&1===o.length&&e.onCompleted()}))}},e.onError.bind(e),function(){r=!0,n||1!==o.length||e.onCompleted()})),o})},Me.exclusiveMap=function(e,n){var r=this;return new pn(function(i){var o=0,s=!1,u=!0,c=new ge,a=new de;return a.add(c),c.setDisposable(r.subscribe(function(r){s||(s=!0,innerSubscription=new ge,a.add(innerSubscription),P(r)&&(r=on(r)),innerSubscription.setDisposable(r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),function(){a.remove(innerSubscription),s=!1,u&&1===a.length&&i.onCompleted()})))},i.onError.bind(i),function(){u=!0,1!==a.length||s||i.onCompleted()})),a})};var pn=_.AnonymousObservable=function(e){function n(e){return e===t?e=ye:"function"==typeof e&&(e=me(e)),e}function r(i){function o(t){var e=function(){try{r.setDisposable(n(i(r)))}catch(t){if(!r.fail(t))throw t}},r=new dn(t);return Ne.scheduleRequired()?Ne.schedule(e):e(),r}return this instanceof r?(e.call(this,o),t):new r(i)}return ae(r,e),r}(Be),dn=function(t){function e(e){t.call(this),this.observer=e,this.m=new ge}ae(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ie),bn=function(t,e){this.subject=t,this.observer=e};bn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var vn=_.Subject=function(t){function n(t){return e.call(this),this.isStopped?this.exception?(t.onError(this.exception),ye):(t.onCompleted(),ye):(this.observers.push(t),new bn(this,t))}function r(){t.call(this,n),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return ae(r,t),he(r.prototype,Ve,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(e.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var n=0,r=t.length;r>n;n++)t[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){if(e.call(this),!this.isStopped)for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)n[r].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(t,e){return new yn(t,e)},r}(Be),mn=_.AsyncSubject=function(t){function n(t){if(e.call(this),!this.isStopped)return this.observers.push(t),new bn(this,t);var n=this.exception,r=this.hasValue,i=this.value;return n?t.onError(n):r?(t.onNext(i),t.onCompleted()):t.onCompleted(),ye}function r(){t.call(this,n),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return ae(r,t),he(r.prototype,Ve,{hasObservers:function(){return e.call(this),this.observers.length>0},onCompleted:function(){var t,n,r;if(e.call(this),!this.isStopped){this.isStopped=!0;var i=this.observers.slice(0),o=this.value,s=this.hasValue;if(s)for(n=0,r=i.length;r>n;n++)t=i[n],t.onNext(o),t.onCompleted();else for(n=0,r=i.length;r>n;n++)i[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){e.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(Be),yn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return ae(n,t),he(n.prototype,Ve,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Be),wn=_.BehaviorSubject=function(t){function n(t){if(e.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new bn(this,t);var n=this.exception;return n?t.onError(n):t.onCompleted(),ye}function r(e){t.call(this,n),this.value=e,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return ae(r,t),he(r.prototype,Ve,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(e.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var n=0,r=t.length;r>n;n++)t[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){if(e.call(this),!this.isStopped){this.value=t;for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)n[r].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),r}(Be),gn=_.ReplaySubject=function(t){function n(t,e){this.subject=t,this.observer=e}function r(t){var r=new Ue(this.scheduler,t),i=new n(this,r);e.call(this),this._trim(this.scheduler.now()),this.observers.push(r);for(var o=this.q.length,s=0,u=this.q.length;u>s;s++)r.onNext(this.q[s].value);return this.hasError?(o++,r.onError(this.error)):this.isStopped&&(o++,r.onCompleted()),r.ensureActive(o),i}function i(e,n,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==n?Number.MAX_VALUE:n,this.scheduler=i||Ne,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,r)}return n.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},ae(i,t),he(i.prototype,Ve,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var n;if(e.call(this),!this.isStopped){var r=this.scheduler.now();this.q.push({interval:r,value:t}),this._trim(r);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)n=i[o],n.onNext(t),n.ensureActive()}},onError:function(t){var n;if(e.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var r=this.scheduler.now();this._trim(r);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)n=i[o],n.onError(t),n.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(e.call(this),!this.isStopped){this.isStopped=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)t=r[i],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),i}(Be);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(C.Rx=_,define(function(){return _})):D&&S?N?(S.exports=_).Rx=_:D.Rx=_:C.Rx=_}).call(this); \ No newline at end of file +(function(t){function e(){if(this.isDisposed)throw Error(V)}function n(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function r(t){var e=[];if(!n(t))return e;ue.nonEnumArgs&&t.length&&u(t)&&(t=ae.call(t));var r=ue.enumPrototypes&&"function"==typeof t,i=ue.enumErrorProps&&(t===ee||t instanceof Error);for(var o in t)r&&"prototype"==o||i&&("message"==o||"name"==o)||e.push(o);if(ue.nonEnumShadows&&t!==ne){var s=t.constructor,c=-1,a=oe.length;if(t===(s&&s.prototype))var h=t===stringProto?X:t===ee?Q:G.call(t),l=se[h];for(;a>++c;)o=oe[c],l&&l[o]||!Y.call(t,o)||e.push(o)}return e}function i(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function o(t,e){return i(t,e,r)}function s(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function u(t){return t&&"object"==typeof t?G.call(t)==F:!1}function c(t){return"function"==typeof t||!1}function a(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var h=typeof e,l=typeof n;if(e===e&&(null==e||null==n||"function"!=h&&"object"!=h&&"function"!=l&&"object"!=l))return!1;var f=G.call(e),p=G.call(n);if(f==F&&(f=J),p==F&&(p=J),f!=p)return!1;switch(f){case U:case H:return+e==+n;case K:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case Z:case X:return e==n+""}var d=f==B;if(!d){if(f!=J||!ue.nodeClass&&(s(e)||s(n)))return!1;var b=!ue.argsObject&&u(e)?Object:e.constructor,v=!ue.argsObject&&u(n)?Object:n.constructor;if(!(b==v||Y.call(e,"constructor")&&Y.call(n,"constructor")||c(b)&&b instanceof b&&c(v)&&v instanceof v||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),d){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=a(e[y],w,r,i)))break}}else o(n,function(n,o,s){return Y.call(s,o)?(y++,result=Y.call(e,o)&&a(e[o],n,r,i)):t}),result&&o(e,function(e,n,r){return Y.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function h(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:ae.call(t)}function l(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function f(e,n){return new dn(function(r){var i=new Ee,o=new xe;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}T(s)&&(s=sn(s)),i=new Ee,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function p(e,n){var r=this;return new dn(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function d(t){return this.map(function(e,n){var r=t(e,n);return T(r)?sn(r):r}).concatAll()}function b(t){return this.select(function(e,n){var r=t(e,n);return T(r)?sn(r):r}).mergeObservable()}function v(t,e,n){if(t.addListener)return t.addListener(e,n),ye(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),ye(function(){t.removeEventListener(e,n,!1)});throw Error("No listener found")}function m(t,e,n){var r=new be;if("function"==typeof t.item&&"number"==typeof t.length)for(var i=0,o=t.length;o>i;i++)r.add(m(t.item(i),e,n));else t&&r.add(v(t,e,n));return r}function y(t,e){var n=Se(t);return new dn(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function w(t,e,n){return t===e?new dn(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):Qe(function(){return g(n.now()+t,e,n)})}function g(t,e,n){var r=Se(e);return new dn(function(e){var i=0,o=t;return n.scheduleRecursiveWithAbsolute(o,function(t){var s;r>0&&(s=n.now(),o+=r,s>=o&&(o=s+r)),e.onNext(i++),t(o)})})}function E(t,e){return new dn(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new be(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}function x(e,n,r){return new dn(function(i){function o(e,n){h[n]=e;var o;if(u[n]=!0,c||(c=u.every(j))){try{o=r.apply(null,h)}catch(s){return i.onError(s),t}i.onNext(o)}else a&&i.onCompleted()}var s=2,u=[!1,!1],c=!1,a=!1,h=Array(s);return new be(e.subscribe(function(t){o(t,0)},i.onError.bind(i),function(){a=!0,i.onCompleted()}),n.subscribe(function(t){o(t,1)},i.onError.bind(i)))})}var C={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D=C[typeof window]&&window||this,S=C[typeof exports]&&exports&&!exports.nodeType&&exports,N=C[typeof module]&&module&&!module.nodeType&&module,A=N&&N.exports===S&&S,_=C[typeof global]&&global;!_||_.global!==_&&_.window!==_||(D=_);var O={internals:{},config:{Promise:D.Promise},helpers:{}},R=O.helpers.noop=function(){},j=O.helpers.identity=function(t){return t},W=(O.helpers.pluck=function(t){return function(e){return e[t]}},O.helpers.just=function(t){return function(){return t}},O.helpers.defaultNow=Date.now),k=O.helpers.defaultComparer=function(t,e){return ce(t,e)},q=O.helpers.defaultSubComparer=function(t,e){return t>e?1:e>t?-1:0},P=(O.helpers.defaultKeySerializer=function(t){return""+t},O.helpers.defaultError=function(t){throw t}),T=O.helpers.isPromise=function(t){return!!t&&"function"==typeof t.then&&t.then!==O.Observable.prototype.then};O.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},O.helpers.not=function(t){return!t};var L="Argument out of range",V="Object has been disposed",z="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";D.Set&&"function"==typeof(new D.Set)["@@iterator"]&&(z="@@iterator");var M,I={done:!0,value:t},F="[object Arguments]",B="[object Array]",U="[object Boolean]",H="[object Date]",Q="[object Error]",$="[object Function]",K="[object Number]",J="[object Object]",Z="[object RegExp]",X="[object String]",G=Object.prototype.toString,Y=Object.prototype.hasOwnProperty,te=G.call(arguments)==F,ee=Error.prototype,ne=Object.prototype,re=ne.propertyIsEnumerable;try{M=!(G.call(document)==J&&!({toString:0}+""))}catch(ie){M=!0}var oe=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],se={};se[B]=se[H]=se[K]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},se[U]=se[X]={constructor:!0,toString:!0,valueOf:!0},se[Q]=se[$]=se[Z]={constructor:!0,toString:!0},se[J]={constructor:!0};var ue={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);ue.enumErrorProps=re.call(ee,"message")||re.call(ee,"name"),ue.enumPrototypes=re.call(t,"prototype"),ue.nonEnumArgs=0!=n,ue.nonEnumShadows=!/valueOf/.test(e)})(1),te||(u=function(t){return t&&"object"==typeof t?Y.call(t,"callee"):!1}),c(/x/)&&(c=function(t){return"function"==typeof t&&G.call(t)==$});var ce=O.internals.isEqual=function(t,e){return a(t,e,[],[])},ae=Array.prototype.slice;({}).hasOwnProperty;var he=this.inherits=O.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},le=O.internals.addProperties=function(t){for(var e=ae.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};O.internals.addRef=function(t,e){return new dn(function(n){return new be(e.getDisposable(),t.subscribe(n))})};var fe=function(t,e){this.id=t,this.value=e};fe.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var pe=O.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},de=pe.prototype;de.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},de.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},de.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},de.peek=function(){return this.items[0].value},de.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},de.dequeue=function(){var t=this.peek();return this.removeAt(0),t},de.enqueue=function(t){var e=this.length++;this.items[e]=new fe(pe.count++,t),this.percolate(e)},de.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},pe.count=0;var be=O.CompositeDisposable=function(){this.disposables=h(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},ve=be.prototype;ve.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},ve.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},ve.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},ve.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},ve.contains=function(t){return-1!==this.disposables.indexOf(t)},ve.toArray=function(){return this.disposables.slice(0)};var me=O.Disposable=function(t){this.isDisposed=!1,this.action=t||R};me.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ye=me.create=function(t){return new me(t)},we=me.empty={dispose:R},ge=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),Ee=O.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return he(e,t),e}(ge),xe=O.SerialDisposable=function(t){function e(){t.call(this,!1)}return he(e,t),e}(ge);O.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.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()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?we:new t(this)},e}();var Ce=O.internals.ScheduledItem=function(t,e,n,r,i){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=i||q,this.disposable=new Ee};Ce.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ce.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},Ce.prototype.isCancelled=function(){return this.disposable.isDisposed},Ce.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var De=O.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new be,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),we});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new be,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),we});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),we}var i=t.prototype;return i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return ye(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=W,t.normalize=function(t){return 0>t&&(t=0),t},t}(),Se=De.normalize,Ne=De.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=Se(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new De(W,t,e,n)}(),Ae=De.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-De.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+De.normalize(n),s=new Ce(this,e,r,o);if(i)i.enqueue(s);else{i=new pe(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new De(W,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}();O.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new Ee;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var _e,Oe=R;(function(){function t(){if(!D.postMessage||D.importScripts)return!1;var t=!1,e=D.onmessage;return D.onmessage=function(){t=!0},D.postMessage("","*"),D.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(G+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=_&&A&&_.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=_&&A&&_.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))_e=process.nextTick;else if("function"==typeof r)_e=r,Oe=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;D.addEventListener?D.addEventListener("message",e,!1):D.attachEvent("onmessage",e,!1),_e=function(t){var e=u++;s[e]=t,D.postMessage(o+e,"*")}}else if(D.MessageChannel){var c=new D.MessageChannel,a={},h=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},_e=function(t){var e=h++;a[e]=t,c.port2.postMessage(e)}}else"document"in D&&"onreadystatechange"in D.document.createElement("script")?_e=function(t){var e=D.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},D.document.documentElement.appendChild(e)}:(_e=function(t){return setTimeout(t,0)},Oe=clearTimeout)})();var Re=De.timeout=function(){function t(t,e){var n=this,r=new Ee,i=_e(function(){r.isDisposed||r.setDisposable(e(n,t))});return new be(r,ye(function(){Oe(i)}))}function e(t,e,n){var r=this,i=De.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new Ee,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new be(o,ye(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new De(W,t,e,n)}(),je=O.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=Ne),new dn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),We=je.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new je("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ke=je.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new je("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),qe=je.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new je("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),Pe=O.internals.Enumerator=function(t){this._next=t};Pe.prototype.next=function(){return this._next()},Pe.prototype[z]=function(){return this};var Te=O.internals.Enumerable=function(t){this._iterator=t};Te.prototype[z]=function(){return this._iterator()},Te.prototype.concat=function(){var e=this;return new dn(function(n){var r;try{r=e[z]()}catch(i){return n.onError(),t}var o,s=new xe,u=Ne.scheduleRecursive(function(e){var i;if(!o){try{i=r.next()}catch(u){return n.onError(u),t}if(i.done)return n.onCompleted(),t;var c=i.value;T(c)&&(c=sn(c));var a=new Ee;s.setDisposable(a),a.setDisposable(c.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new be(s,u,ye(function(){o=!0}))})},Te.prototype.catchException=function(){var e=this;return new dn(function(n){var r;try{r=e[z]()}catch(i){return n.onError(),t}var o,s,u=new xe,c=Ne.scheduleRecursive(function(e){if(!o){var i;try{i=r.next()}catch(c){return n.onError(c),t}if(i.done)return s?n.onError(s):n.onCompleted(),t;var a=i.value;T(a)&&(a=sn(a));var h=new Ee;u.setDisposable(h),h.setDisposable(a.subscribe(n.onNext.bind(n),function(t){s=t,e()},n.onCompleted.bind(n)))}});return new be(u,c,ye(function(){o=!0}))})};var Le=Te.repeat=function(t,e){return null==e&&(e=-1),new Te(function(){var n=e;return new Pe(function(){return 0===n?I:(n>0&&n--,{done:!1,value:t})})})},Ve=Te.forEach=function(t,e,n){return e||(e=j),new Te(function(){var r=-1;return new Pe(function(){return++r0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Fe);Ie.toArray=function(){var t=this;return new dn(function(e){var n=[];return t.subscribe(n.push.bind(n),e.onError.bind(e),function(){e.onNext(n),e.onCompleted()})})},Ue.create=Ue.createWithDisposable=function(t){return new dn(t)};var Qe=Ue.defer=function(t){return new dn(function(e){var n;try{n=t()}catch(r){return Xe(r).subscribe(e)}return T(n)&&(n=sn(n)),n.subscribe(e)})},$e=Ue.empty=function(t){return t||(t=Ne),new dn(function(e){return t.schedule(function(){e.onCompleted()})})},Ke=Ue.fromArray=function(t,e){return e||(e=Ae),new dn(function(n){var r=0,i=t.length;return e.scheduleRecursive(function(e){i>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Ue.fromIterable=function(e,n){return n||(n=Ae),new dn(function(r){var i;try{i=e[z]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},Ue.generate=function(e,n,r,i,o){return o||(o=Ae),new dn(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Je=Ue.never=function(){return new dn(function(){return we})};Ue.of=function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return Ke(e)},Ue.ofWithScheduler=function(t){for(var e=arguments.length-1,n=Array(e),r=0;e>r;r++)n[r]=arguments[r+1];return Ke(n,t)},Ue.range=function(t,e,n){return n||(n=Ae),new dn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Ue.repeat=function(t,e,n){return n||(n=Ae),null==e&&(e=-1),Ze(t,n).repeat(e)};var Ze=Ue["return"]=Ue.returnValue=Ue.just=function(t,e){return e||(e=Ne),new dn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Xe=Ue["throw"]=Ue.throwException=function(t,e){return e||(e=Ne),new dn(function(n){return e.schedule(function(){n.onError(t)})})};Ie["catch"]=Ie.catchException=function(t){return"function"==typeof t?f(this,t):Ge([this,t])};var Ge=Ue.catchException=Ue["catch"]=function(){var t=h(arguments,0);return Ve(t).catchException()};Ie.combineLatest=function(){var t=ae.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ye.apply(this,t)};var Ye=Ue.combineLatest=function(){var e=ae.call(arguments),n=e.pop();return Array.isArray(e[0])&&(e=e[0]),new dn(function(r){function i(e){var i;if(c[e]=!0,a||(a=c.every(j))){try{i=n.apply(null,f)}catch(o){return r.onError(o),t}r.onNext(i)}else h.filter(function(t,n){return n!==e}).every(j)&&r.onCompleted()}function o(t){h[t]=!0,h.every(j)&&r.onCompleted()}for(var s=function(){return!1},u=e.length,c=l(u,s),a=!1,h=l(u,s),f=Array(u),p=Array(u),d=0;u>d;d++)(function(t){var n=e[t],s=new Ee;T(n)&&(n=sn(n)),s.setDisposable(n.subscribe(function(e){f[t]=e,i(t)},r.onError.bind(r),function(){o(t)})),p[t]=s})(d);return new be(p)})};Ie.concat=function(){var t=ae.call(arguments,0);return t.unshift(this),tn.apply(this,t)};var tn=Ue.concat=function(){var t=h(arguments,0);return Ve(t).concat()};Ie.concatObservable=Ie.concatAll=function(){return this.merge(1)},Ie.merge=function(t){if("number"!=typeof t)return en(this,t);var e=this;return new dn(function(n){var r=0,i=new be,o=!1,s=[],u=function(t){var e=new Ee;i.add(e),T(t)&&(t=sn(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),u(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,u(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var en=Ue.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=ae.call(arguments,1)):(t=Ne,e=ae.call(arguments,0)):(t=Ne,e=ae.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Ke(e,t).mergeObservable()};Ie.mergeObservable=Ie.mergeAll=function(){var t=this;return new dn(function(e){var n=new be,r=!1,i=new Ee;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new Ee;n.add(i),T(t)&&(t=sn(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Ie.skipUntil=function(t){var e=this;return new dn(function(n){var r=!1,i=new be(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()}));T(t)&&(t=sn(t));var o=new Ee;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Ie["switch"]=Ie.switchLatest=function(){var t=this;return new dn(function(e){var n=!1,r=new xe,i=!1,o=0,s=t.subscribe(function(t){var s=new Ee,u=++o;n=!0,r.setDisposable(s),T(t)&&(t=sn(t)),s.setDisposable(t.subscribe(function(t){o===u&&e.onNext(t)},function(t){o===u&&e.onError(t)},function(){o===u&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new be(s,r)})},Ie.takeUntil=function(t){var e=this;return new dn(function(n){return T(t)&&(t=sn(t)),new be(e.subscribe(n),t.subscribe(n.onCompleted.bind(n),n.onError.bind(n),R))})},Ie.zip=function(){if(Array.isArray(arguments[0]))return p.apply(this,arguments);var e=this,n=ae.call(arguments),r=n.pop();return n.unshift(e),new dn(function(i){function o(n){var o,s;if(c.every(function(t){return t.length>0})){try{s=c.map(function(t){return t.shift()}),o=r.apply(e,s)}catch(u){return i.onError(u),t}i.onNext(o)}else a.filter(function(t,e){return e!==n}).every(j)&&i.onCompleted()}function s(t){a[t]=!0,a.every(function(t){return t})&&i.onCompleted()}for(var u=n.length,c=l(u,function(){return[]}),a=l(u,function(){return!1}),h=Array(u),f=0;u>f;f++)(function(t){var e=n[t],r=new Ee;T(e)&&(e=sn(e)),r.setDisposable(e.subscribe(function(e){c[t].push(e),o(t)},i.onError.bind(i),function(){s(t)})),h[t]=r})(f);return new be(h)})},Ue.zip=function(){var t=ae.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Ue.zipArray=function(){var e=h(arguments,0);return new dn(function(n){function r(e){if(s.every(function(t){return t.length>0})){var r=s.map(function(t){return t.shift()});n.onNext(r)}else if(u.filter(function(t,n){return n!==e}).every(j))return n.onCompleted(),t}function i(e){return u[e]=!0,u.every(j)?(n.onCompleted(),t):t}for(var o=e.length,s=l(o,function(){return[]}),u=l(o,function(){return!1}),c=Array(o),a=0;o>a;a++)(function(t){c[t]=new Ee,c[t].setDisposable(e[t].subscribe(function(e){s[t].push(e),r(t)},n.onError.bind(n),function(){i(t)}))})(a);var h=new be(c);return h.add(ye(function(){for(var t=0,e=s.length;e>t;t++)s[t]=[]})),h})},Ie.asObservable=function(){var t=this;return new dn(function(e){return t.subscribe(e)})},Ie.dematerialize=function(){var t=this;return new dn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Ie.distinctUntilChanged=function(e,n){var r=this;return e||(e=j),n||(n=k),new dn(function(i){var o,s=!1;return r.subscribe(function(r){var u,c=!1;try{u=e(r)}catch(a){return i.onError(a),t}if(s)try{c=n(o,u)}catch(a){return i.onError(a),t}s&&c||(s=!0,o=u,i.onNext(r))},i.onError.bind(i),i.onCompleted.bind(i))})},Ie["do"]=Ie.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new dn(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Ie["finally"]=Ie.finallyAction=function(t){var e=this;return new dn(function(n){var r;try{r=e.subscribe(n)}catch(i){throw t(),i}return ye(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Ie.ignoreElements=function(){var t=this;return new dn(function(e){return t.subscribe(R,e.onError.bind(e),e.onCompleted.bind(e))})},Ie.materialize=function(){var t=this;return new dn(function(e){return t.subscribe(function(t){e.onNext(We(t))},function(t){e.onNext(ke(t)),e.onCompleted()},function(){e.onNext(qe()),e.onCompleted()})})},Ie.repeat=function(t){return Le(this,t).concat()},Ie.retry=function(t){return Le(this,t).catchException()},Ie.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new dn(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},Ie.skipLast=function(t){var e=this;return new dn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Ie.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=Ne,t=ae.call(arguments,n),Ve([Ke(t,e),this]).concat()},Ie.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Ke(t,e)})},Ie.takeLastBuffer=function(t){var e=this;return new dn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Ie.selectConcat=Ie.concatMap=function(t,e){return e?this.concatMap(function(n,r){var i=t(n,r),o=T(i)?sn(i):i;return o.map(function(t){return e(n,t,r)})}):"function"==typeof t?d.call(this,t):d.call(this,function(){return t})},Ie.select=Ie.map=function(e,n){var r=this;return new dn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ie.pluck=function(t){return this.select(function(e){return e[t]})},Ie.selectMany=Ie.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=T(i)?sn(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?b.call(this,t):b.call(this,function(){return t})},Ie.selectSwitch=Ie.flatMapLatest=Ie.switchMap=function(t,e){return this.select(t,e).switchLatest()},Ie.skip=function(t){if(0>t)throw Error(L);var e=this;return new dn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n)) +})},Ie.skipWhile=function(e,n){var r=this;return new dn(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Ie.take=function(t,e){if(0>t)throw Error(L);if(0===t)return $e(e);var n=this;return new dn(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Ie.takeWhile=function(e,n){var r=this;return new dn(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Ie.where=Ie.filter=function(e,n){var r=this;return new dn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},Ue.fromCallback=function(e,n,r,i){return n||(n=Ne),function(){var o=ae.call(arguments,0);return new dn(function(s){return n.schedule(function(){function n(e){var n=e;if(i)try{n=i(arguments)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Ue.fromNodeCallback=function(e,n,r,i){return n||(n=Ne),function(){var o=ae.call(arguments,0);return new dn(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t;var n=ae.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}};var nn=D.angular&&angular.element?angular.element:D.jQuery?D.jQuery:D.Zepto?D.Zepto:null,rn=!!D.Ember&&"function"==typeof D.Ember.addListener;Ue.fromEvent=function(e,n,r){if(rn)return on(function(t){Ember.addListener(e,n,t)},function(t){Ember.removeListener(e,n,t)},r);if(nn){var i=nn(e);return on(function(t){i.on(n,t)},function(t){i.off(n,t)},r)}return new dn(function(i){return m(e,n,function(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)})}).publish().refCount()};var on=Ue.fromEventPattern=function(e,n,r){return new dn(function(i){function o(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)}var s=e(o);return ye(function(){n&&n(o,s)})}).publish().refCount()},sn=Ue.fromPromise=function(t){return new dn(function(e){return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),function(){t&&t.abort&&t.abort()}})};Ie.toPromise=function(t){if(t||(t=O.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},Ue.startAsync=function(t){var e;try{e=t()}catch(n){return Xe(n)}return sn(e)},Ie.multicast=function(t,e){var n=this;return"function"==typeof t?new dn(function(r){var i=n.multicast(t());return new be(e(i).subscribe(r),i.connect())}):new un(n,t)},Ie.publish=function(t){return t?this.multicast(function(){return new mn},t):this.multicast(new mn)},Ie.share=function(){return this.publish(null).refCount()},Ie.publishLast=function(t){return t?this.multicast(function(){return new yn},t):this.multicast(new yn)},Ie.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new gn(e)},t):this.multicast(new gn(t))},Ie.shareValue=function(t){return this.publishValue(t).refCount()},Ie.replay=function(t,e,n,r){return t?this.multicast(function(){return new En(e,n,r)},t):this.multicast(new En(e,n,r))},Ie.shareReplay=function(t,e,n){return this.replay(null,t,e,n).refCount()};var un=O.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new be(i.source.subscribe(i.subject),ye(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return he(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new dn(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),ye(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(Ue),cn=Ue.interval=function(t,e){return e||(e=Re),w(t,t,e)},an=Ue.timer=function(e,n,r){var i;return r||(r=Re),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===t?y(e,r):w(e,i,r)};Ie.delay=function(t,e){e||(e=Re);var n=this;return new dn(function(r){var i,o=!1,s=new xe,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,h;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,h=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),h=!o,o=!0),h&&(null!==u?r.onError(u):(i=new Ee,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,h;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);h=!1,i=0,c.length>0?(h=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):h&&t(i)}}))))}),new be(i,s)})},Ie.throttle=function(t,e){return e||(e=Re),this.throttleWithSelector(function(){return an(t,e)})},Ie.timeInterval=function(t){var e=this;return t||(t=Re),Qe(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Ie.timestamp=function(t){return t||(t=Re),this.select(function(e){return{value:e,timestamp:t.now()}})},Ie.sample=function(t,e){return e||(e=Re),"number"==typeof t?E(this,cn(t,e)):E(this,t)},Ie.timeout=function(t,e,n){e||(e=Xe(Error("Timeout"))),n||(n=Re);var r=this,i=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new dn(function(o){var s=0,u=new Ee,c=new xe,a=!1,h=new xe;c.setDisposable(u);var l=function(){var r=s;h.setDisposable(n[i](t,function(){s===r&&(T(e)&&(e=sn(e)),c.setDisposable(e.subscribe(o)))}))};return l(),u.setDisposable(r.subscribe(function(t){a||(s++,o.onNext(t),l())},function(t){a||(s++,o.onError(t))},function(){a||(s++,o.onCompleted())})),new be(c,h)})},Ue.generateWithRelativeTime=function(e,n,r,i,o,s){return s||(s=Re),new dn(function(u){var c,a,h=!0,l=!1,f=e;return s.scheduleRecursiveWithRelative(0,function(e){l&&u.onNext(c);try{h?h=!1:f=r(f),l=n(f),l&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}l?e(a):u.onCompleted()})})},Ie.delaySubscription=function(t,e){return e||(e=Re),this.delayWithSelector(an(t,e),function(){return $e()})},Ie.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new dn(function(e){var n=new be,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new xe,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new Ee;n.add(c),c.setDisposable(o.subscribe(function(){e.onNext(r),n.remove(c),u()},e.onError.bind(e),function(){e.onNext(r),n.remove(c),u()}))},e.onError.bind(e),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},e.onError.bind(e),function(){a()})):a(),new be(c,n)})},Ie.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Je()}r||(r=Xe(Error("Timeout")));var i=this;return new dn(function(o){var s=new xe,u=new xe,c=new Ee;s.setDisposable(c);var a=0,h=!1,l=function(t){var e=a,n=function(){return a===e},i=new Ee;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};l(e);var f=function(){var t=!h;return t&&a++,t};return c.setDisposable(i.subscribe(function(e){if(f()){o.onNext(e);var r;try{r=n(e)}catch(i){return o.onError(i),t}l(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new be(s,u)})},Ie.throttleWithSelector=function(e){var n=this;return new dn(function(r){var i,o=!1,s=new xe,u=0,c=n.subscribe(function(n){var c;try{c=e(n)}catch(a){return r.onError(a),t}o=!0,i=n,u++;var h=u,l=new Ee;s.setDisposable(l),l.setDisposable(c.subscribe(function(){o&&u===h&&r.onNext(i),o=!1,l.dispose()},r.onError.bind(r),function(){o&&u===h&&r.onNext(i),o=!1,l.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new be(c,s)})},Ie.skipLastWithTime=function(t,e){e||(e=Re);var n=this;return new dn(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},Ie.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return Ke(t,n)})},Ie.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=Re),new dn(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},Ie.takeWithTime=function(t,e){var n=this;return e||(e=Re),new dn(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new be(i,n.subscribe(r))})},Ie.skipWithTime=function(t,e){var n=this;return e||(e=Re),new dn(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new be(o,s)})},Ie.skipUntilWithTime=function(t,e){e||(e=Re);var n=this,r=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new dn(function(i){var o=!1;return new be(e[r](t,function(){o=!0}),n.subscribe(function(t){o&&i.onNext(t)},i.onError.bind(i),i.onCompleted.bind(i)))})},Ie.takeUntilWithTime=function(t,e){e||(e=Re);var n=this,r=t instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new dn(function(i){return new be(e[r](t,function(){i.onCompleted()}),n.subscribe(i))})};var hn=function(t){function e(t){var e=this.source.publish(),n=e.subscribe(t),r=we,i=this.subject.distinctUntilChanged().subscribe(function(t){t?r=e.connect():(r.dispose(),r=we)});return new be(n,r,i)}function n(n,r){this.source=n,this.subject=r||new mn,this.isPaused=!0,t.call(this,e)}return he(n,t),n.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},n.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},n}(Ue);Ie.pausable=function(t){return new hn(this,t)};var ln=function(t){function e(t){var e=[],n=!0,r=x(this.source,this.subject.distinctUntilChanged(),function(t,e){return{data:t,shouldFire:e}}).subscribe(function(r){if(r.shouldFire&&n&&t.onNext(r.data),r.shouldFire&&!n){for(;e.length>0;)t.onNext(e.shift());n=!0}else r.shouldFire||n?!r.shouldFire&&n&&(n=!1):e.push(r.data)},function(n){for(;e.length>0;)t.onNext(e.shift());t.onError(n)},function(){for(;e.length>0;)t.onNext(e.shift());t.onCompleted()});return this.subject.onNext(!1),r}function n(n,r){this.source=n,this.subject=r||new mn,this.isPaused=!0,t.call(this,e)}return he(n,t),n.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},n.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},n}(Ue);Ie.pausableBuffered=function(t){return new ln(this,t)},Ie.controlled=function(t){return null==t&&(t=!0),new fn(this,t)};var fn=function(t){function e(t){return this.source.subscribe(t)}function n(n,r){t.call(this,e),this.subject=new pn(r),this.source=n.multicast(this.subject).refCount()}return he(n,t),n.prototype.request=function(t){return null==t&&(t=-1),this.subject.request(t)},n}(Ue),pn=O.ControlledSubject=function(t){function n(t){return this.subject.subscribe(t)}function r(e){null==e&&(e=!0),t.call(this,n),this.subject=new mn,this.enableQueue=e,this.queue=e?[]:null,this.requestedCount=0,this.requestedDisposable=we,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=we}return he(r,t),le(r.prototype,ze,{onCompleted:function(){e.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(t){e.call(this),this.hasFailed=!0,this.error=t,this.enableQueue&&0!==this.queue.length||this.subject.onError(t)},onNext:function(t){e.call(this);var n=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(t):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),n=!0),n&&this.subject.onNext(t)},_processRequest:function(t){if(this.enableQueue){for(;this.queue.length>=t&&t>0;)this.subject.onNext(this.queue.shift()),t--;return 0!==this.queue.length?{numberOfItems:t,returnValue:!0}:{numberOfItems:t,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=we):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=we),{numberOfItems:t,returnValue:!1}},request:function(t){e.call(this),this.disposeCurrentRequest();var n=this,r=this._processRequest(t);return t=r.numberOfItems,r.returnValue?we:(this.requestedCount=t,this.requestedDisposable=ye(function(){n.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=we},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),r}(Ue);Ie.pairwise=function(){var t=this;return new dn(function(e){var n,r=!1;return t.subscribe(function(t){r?e.onNext([n,t]):r=!0,n=t},e.onError.bind(e),e.onCompleted.bind(e))})},Ie.partition=function(t,e){var n=this.publish().refCount();return[n.filter(t,e),n.filter(function(n,r,i){return!t.call(e,n,r,i)})]},Ie.exclusive=function(){var t=this;return new dn(function(e){var n=!1,r=!1,i=new Ee,o=new be;return o.add(i),i.setDisposable(t.subscribe(function(t){if(!n){n=!0,T(t)&&(t=sn(t));var i=new Ee;o.add(i),i.setDisposable(t.subscribe(e.onNext.bind(e),e.onError.bind(e),function(){o.remove(i),n=!1,r&&1===o.length&&e.onCompleted()}))}},e.onError.bind(e),function(){r=!0,n||1!==o.length||e.onCompleted()})),o})},Ie.exclusiveMap=function(e,n){var r=this;return new dn(function(i){var o=0,s=!1,u=!0,c=new Ee,a=new be;return a.add(c),c.setDisposable(r.subscribe(function(r){s||(s=!0,innerSubscription=new Ee,a.add(innerSubscription),T(r)&&(r=sn(r)),innerSubscription.setDisposable(r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),function(){a.remove(innerSubscription),s=!1,u&&1===a.length&&i.onCompleted()})))},i.onError.bind(i),function(){u=!0,1!==a.length||s||i.onCompleted()})),a})};var dn=O.AnonymousObservable=function(e){function n(e){return e===t?e=we:"function"==typeof e&&(e=ye(e)),e}function r(i){function o(t){var e=function(){try{r.setDisposable(n(i(r)))}catch(t){if(!r.fail(t))throw t}},r=new bn(t);return Ae.scheduleRequired()?Ae.schedule(e):e(),r}return this instanceof r?(e.call(this,o),t):new r(i)}return he(r,e),r}(Ue),bn=function(t){function e(e){t.call(this),this.observer=e,this.m=new Ee}he(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Fe),vn=function(t,e){this.subject=t,this.observer=e};vn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var mn=O.Subject=function(t){function n(t){return e.call(this),this.isStopped?this.exception?(t.onError(this.exception),we):(t.onCompleted(),we):(this.observers.push(t),new vn(this,t))}function r(){t.call(this,n),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return he(r,t),le(r.prototype,ze,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(e.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var n=0,r=t.length;r>n;n++)t[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){if(e.call(this),!this.isStopped)for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)n[r].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),r.create=function(t,e){return new wn(t,e)},r}(Ue),yn=O.AsyncSubject=function(t){function n(t){if(e.call(this),!this.isStopped)return this.observers.push(t),new vn(this,t);var n=this.exception,r=this.hasValue,i=this.value;return n?t.onError(n):r?(t.onNext(i),t.onCompleted()):t.onCompleted(),we}function r(){t.call(this,n),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return he(r,t),le(r.prototype,ze,{hasObservers:function(){return e.call(this),this.observers.length>0},onCompleted:function(){var t,n,r;if(e.call(this),!this.isStopped){this.isStopped=!0;var i=this.observers.slice(0),o=this.value,s=this.hasValue;if(s)for(n=0,r=i.length;r>n;n++)t=i[n],t.onNext(o),t.onCompleted();else for(n=0,r=i.length;r>n;n++)i[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){e.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),r}(Ue),wn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return he(n,t),le(n.prototype,ze,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Ue),gn=O.BehaviorSubject=function(t){function n(t){if(e.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new vn(this,t);var n=this.exception;return n?t.onError(n):t.onCompleted(),we}function r(e){t.call(this,n),this.value=e,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return he(r,t),le(r.prototype,ze,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(e.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var n=0,r=t.length;r>n;n++)t[n].onCompleted();this.observers=[]}},onError:function(t){if(e.call(this),!this.isStopped){var n=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var r=0,i=n.length;i>r;r++)n[r].onError(t);this.observers=[]}},onNext:function(t){if(e.call(this),!this.isStopped){this.value=t;for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)n[r].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),r}(Ue),En=O.ReplaySubject=function(t){function n(t,e){this.subject=t,this.observer=e}function r(t){var r=new He(this.scheduler,t),i=new n(this,r);e.call(this),this._trim(this.scheduler.now()),this.observers.push(r);for(var o=this.q.length,s=0,u=this.q.length;u>s;s++)r.onNext(this.q[s].value);return this.hasError?(o++,r.onError(this.error)):this.isStopped&&(o++,r.onCompleted()),r.ensureActive(o),i}function i(e,n,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==n?Number.MAX_VALUE:n,this.scheduler=i||Ae,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,r)}return n.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},he(i,t),le(i.prototype,ze,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var n;if(e.call(this),!this.isStopped){var r=this.scheduler.now();this.q.push({interval:r,value:t}),this._trim(r);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)n=i[o],n.onNext(t),n.ensureActive()}},onError:function(t){var n;if(e.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var r=this.scheduler.now();this._trim(r);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)n=i[o],n.onError(t),n.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(e.call(this),!this.isStopped){this.isStopped=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)t=r[i],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),i}(Ue);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(D.Rx=O,define(function(){return O})):S&&N?A?(N.exports=O).Rx=O:S.Rx=O:D.Rx=O}).call(this); \ No newline at end of file diff --git a/dist/rx.time.js b/dist/rx.time.js index 380d3a9fc..868079ce8 100644 --- a/dist/rx.time.js +++ b/dist/rx.time.js @@ -62,24 +62,24 @@ }); } - function observableTimerDateAndPeriod(dueTime, period, scheduler) { - var p = normalizeTime(period); - return new AnonymousObservable(function (observer) { - var count = 0, d = dueTime; - return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { - var now; - if (p > 0) { - now = scheduler.now(); - d = d + p; - if (d <= now) { - d = now + p; - } - } - observer.onNext(count++); - self(d); - }); - }); - } + function observableTimerDateAndPeriod(dueTime, period, scheduler) { + var p = normalizeTime(period); + return new AnonymousObservable(function (observer) { + var count = 0, d = dueTime; + return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { + var now; + if (p > 0) { + now = scheduler.now(); + d = d + p; + if (d <= now) { + d = now + p; + } + } + observer.onNext(count++); + self(d); + }); + }); + } function observableTimerTimeSpan(dueTime, scheduler) { var d = normalizeTime(dueTime); @@ -91,19 +91,19 @@ }); } - function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { - if (dueTime === period) { - return new AnonymousObservable(function (observer) { - return scheduler.schedulePeriodicWithState(0, period, function (count) { - observer.onNext(count); - return count + 1; - }); - }); - } - return observableDefer(function () { - return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { + if (dueTime === period) { + return new AnonymousObservable(function (observer) { + return scheduler.schedulePeriodicWithState(0, period, function (count) { + observer.onNext(count); + return count + 1; }); + }); } + return observableDefer(function () { + return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + }); + } /** * Returns an observable sequence that produces a value after each period. diff --git a/src/core/linq/observable/_observabletimerdateandperiod.js b/src/core/linq/observable/_observabletimerdateandperiod.js index ea220c813..20bf97208 100644 --- a/src/core/linq/observable/_observabletimerdateandperiod.js +++ b/src/core/linq/observable/_observabletimerdateandperiod.js @@ -1,18 +1,18 @@ - function observableTimerDateAndPeriod(dueTime, period, scheduler) { - var p = normalizeTime(period); - return new AnonymousObservable(function (observer) { - var count = 0, d = dueTime; - return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { - var now; - if (p > 0) { - now = scheduler.now(); - d = d + p; - if (d <= now) { - d = now + p; - } - } - observer.onNext(count++); - self(d); - }); - }); - } + function observableTimerDateAndPeriod(dueTime, period, scheduler) { + var p = normalizeTime(period); + return new AnonymousObservable(function (observer) { + var count = 0, d = dueTime; + return scheduler.scheduleRecursiveWithAbsolute(d, function (self) { + var now; + if (p > 0) { + now = scheduler.now(); + d = d + p; + if (d <= now) { + d = now + p; + } + } + observer.onNext(count++); + self(d); + }); + }); + } diff --git a/src/core/linq/observable/_observabletimertimespanandperiod.js b/src/core/linq/observable/_observabletimertimespanandperiod.js index fbcac15f6..a16d3d443 100644 --- a/src/core/linq/observable/_observabletimertimespanandperiod.js +++ b/src/core/linq/observable/_observabletimertimespanandperiod.js @@ -1,13 +1,13 @@ - function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { - if (dueTime === period) { - return new AnonymousObservable(function (observer) { - return scheduler.schedulePeriodicWithState(0, period, function (count) { - observer.onNext(count); - return count + 1; - }); - }); - } - return observableDefer(function () { - return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { + if (dueTime === period) { + return new AnonymousObservable(function (observer) { + return scheduler.schedulePeriodicWithState(0, period, function (count) { + observer.onNext(count); + return count + 1; }); + }); } + return observableDefer(function () { + return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); + }); + }