rxjs-rails 2.3.9 → 2.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rxjs/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/rx.aggregates.js +174 -204
  4. data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
  5. data/vendor/assets/javascripts/rx.all.compat.js +1626 -1528
  6. data/vendor/assets/javascripts/rx.all.compat.min.js +3 -3
  7. data/vendor/assets/javascripts/rx.all.js +1624 -1526
  8. data/vendor/assets/javascripts/rx.all.min.js +3 -3
  9. data/vendor/assets/javascripts/rx.async.compat.js +241 -0
  10. data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
  11. data/vendor/assets/javascripts/rx.async.js +241 -0
  12. data/vendor/assets/javascripts/rx.async.min.js +1 -1
  13. data/vendor/assets/javascripts/rx.backpressure.js +3 -3
  14. data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
  15. data/vendor/assets/javascripts/rx.binding.js +350 -378
  16. data/vendor/assets/javascripts/rx.binding.min.js +1 -1
  17. data/vendor/assets/javascripts/rx.coincidence.js +16 -21
  18. data/vendor/assets/javascripts/rx.compat.js +633 -683
  19. data/vendor/assets/javascripts/rx.compat.min.js +2 -2
  20. data/vendor/assets/javascripts/rx.js +633 -683
  21. data/vendor/assets/javascripts/rx.lite.compat.js +941 -1137
  22. data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
  23. data/vendor/assets/javascripts/rx.lite.extras.js +58 -74
  24. data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
  25. data/vendor/assets/javascripts/rx.lite.js +941 -1137
  26. data/vendor/assets/javascripts/rx.lite.min.js +2 -2
  27. data/vendor/assets/javascripts/rx.min.js +2 -2
  28. data/vendor/assets/javascripts/rx.time.js +182 -212
  29. data/vendor/assets/javascripts/rx.time.min.js +1 -1
  30. metadata +10 -10
@@ -1,2 +1,2 @@
1
- (function(a){function b(){if(this.isDisposed)throw new Error(V)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;qb.nonEnumArgs&&a.length&&h(a)&&(a=sb.call(a));var d=qb.enumPrototypes&&"function"==typeof a,e=qb.enumErrorProps&&(a===kb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(qb.nonEnumShadows&&a!==lb){var g=a.constructor,i=-1,j=ob.length;if(a===(g&&g.prototype))var k=a===stringProto?gb:a===kb?bb:hb.call(a),l=pb[k];for(;++i<j;)f=ob[i],l&&l[f]||!ib.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?hb.call(a)==Z:!1}function i(a){return"function"==typeof a||!1}function j(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,k=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=k&&"object"!=k))return!1;var l=hb.call(a),m=hb.call(b);if(l==Z&&(l=eb),m==Z&&(m=eb),l!=m)return!1;switch(l){case _:case ab:return+a==+b;case db:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case fb:case gb:return a==String(b)}var n=l==$;if(!n){if(l!=eb||!qb.nodeClass&&(g(a)||g(b)))return!1;var o=!qb.argsObject&&h(a)?Object:a.constructor,p=!qb.argsObject&&h(b)?Object:b.constructor;if(!(o==p||ib.call(a,"constructor")&&ib.call(b,"constructor")||i(o)&&o instanceof o&&i(p)&&p instanceof p||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(result=!0,c.push(a),d.push(b),n){if(q=a.length,r=b.length,result=r==q)for(;r--;){var s=b[r];if(!(result=j(a[r],s,c,d)))break}}else f(b,function(b,e,f){return ib.call(f,e)?(r++,result=ib.call(a,e)&&j(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return ib.call(c,b)?result=--r>-1:void 0});return c.pop(),d.pop(),result}function k(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:sb.call(a)}function l(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function m(a){return"number"==typeof a&&G.isFinite(a)}function n(b){return b[W]!==a}function o(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function p(a){var b=+a.length;return isNaN(b)?0:0!==b&&m(b)?(b=o(b)*Math.floor(Math.abs(b)),0>=b?0:b>bc?bc:b):b}function q(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function r(a,b){return new wc(function(c){var d=new Db,e=new SerialDisposable;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}T(f)&&(f=oc(f)),d=new Db,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function s(a,b){var c=this;return new wc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function t(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return T(e)?oc(e):e}).concatAll()}function u(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return T(e)?oc(e):e}).mergeObservable()}function v(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),Bb(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function w(a,b,c){var d=new yb;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(w(a.item(e),b,c));else a&&d.add(v(a,b,c));return d}function x(a,b){return new wc(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function y(a,b,c){return new wc(function(d){var e=0,f=a,g=Gb(b);return c.scheduleRecursiveWithAbsolute(f,function(a){if(g>0){var b=c.now();f+=g,b>=f&&(f=b+g)}d.onNext(e++),a(f)})})}function z(a,b){return new wc(function(c){return b.scheduleWithRelative(Gb(a),function(){c.onNext(0),c.onCompleted()})})}function A(a,b,c){return a===b?new wc(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):_b(function(){return y(c.now()+a,b,c)})}function B(a,b,c){return new wc(function(d){var e,f=!1,g=new SerialDisposable,h=null,i=[],j=!1;return e=a.materialize().timestamp(c).subscribe(function(a){var e,k;"E"===a.value.kind?(i=[],i.push(a),h=a.value.exception,k=!j):(i.push({value:a.value,timestamp:a.timestamp+b}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new Db,g.setDisposable(e),e.setDisposable(c.scheduleRecursiveWithRelative(b,function(a){var b,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-c.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-c.now())):f=!1,b=h,j=!1,null!==b?d.onError(b):k&&a(e)}}))))}),new yb(e,g)})}function C(a,b,c){return _b(function(){return B(a,b-c.now(),c)})}function D(a,b){return new wc(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new yb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}function E(a,b,c){return new wc(function(d){function e(a,b){j[b]=a;var e;if(g[b]=!0,h||(h=g.every(O))){try{e=c.apply(null,j)}catch(f){return void d.onError(f)}d.onNext(e)}else i&&d.onCompleted()}var f=2,g=[!1,!1],h=!1,i=!1,j=new Array(f);return new yb(a.subscribe(function(a){e(a,0)},d.onError.bind(d),function(){i=!0,d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d)))})}var F={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},G=F[typeof window]&&window||this,H=F[typeof exports]&&exports&&!exports.nodeType&&exports,I=F[typeof module]&&module&&!module.nodeType&&module,J=I&&I.exports===H&&H,K=F[typeof global]&&global;!K||K.global!==K&&K.window!==K||(G=K);var L={internals:{},config:{Promise:G.Promise},helpers:{}},M=L.helpers.noop=function(){},N=(L.helpers.notDefined=function(a){return"undefined"==typeof a},L.helpers.isScheduler=function(a){return a instanceof L.Scheduler}),O=L.helpers.identity=function(a){return a},P=(L.helpers.pluck=function(a){return function(b){return b[a]}},L.helpers.just=function(a){return function(){return a}},L.helpers.defaultNow=Date.now),Q=L.helpers.defaultComparer=function(a,b){return rb(a,b)},R=L.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},S=(L.helpers.defaultKeySerializer=function(a){return a.toString()},L.helpers.defaultError=function(a){throw a}),T=L.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},U=(L.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},L.helpers.not=function(a){return!a},"Argument out of range"),V="Object has been disposed",W="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";G.Set&&"function"==typeof(new G.Set)["@@iterator"]&&(W="@@iterator");var X,Y={done:!0,value:a},Z="[object Arguments]",$="[object Array]",_="[object Boolean]",ab="[object Date]",bb="[object Error]",cb="[object Function]",db="[object Number]",eb="[object Object]",fb="[object RegExp]",gb="[object String]",hb=Object.prototype.toString,ib=Object.prototype.hasOwnProperty,jb=hb.call(arguments)==Z,kb=Error.prototype,lb=Object.prototype,mb=lb.propertyIsEnumerable;try{X=!(hb.call(document)==eb&&!({toString:0}+""))}catch(nb){X=!0}var ob=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],pb={};pb[$]=pb[ab]=pb[db]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},pb[_]=pb[gb]={constructor:!0,toString:!0,valueOf:!0},pb[bb]=pb[cb]=pb[fb]={constructor:!0,toString:!0},pb[eb]={constructor:!0};var qb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);qb.enumErrorProps=mb.call(kb,"message")||mb.call(kb,"name"),qb.enumPrototypes=mb.call(a,"prototype"),qb.nonEnumArgs=0!=c,qb.nonEnumShadows=!/valueOf/.test(b)}(1),jb||(h=function(a){return a&&"object"==typeof a?ib.call(a,"callee"):!1}),i(/x/)&&(i=function(a){return"function"==typeof a&&hb.call(a)==cb});var rb=L.internals.isEqual=function(a,b){return j(a,b,[],[])},sb=Array.prototype.slice,tb=({}.hasOwnProperty,this.inherits=L.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),ub=L.internals.addProperties=function(a){for(var b=sb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},vb=(L.internals.addRef=function(a,b){return new wc(function(c){return new yb(b.getDisposable(),a.subscribe(c))})},function(a,b){this.id=a,this.value=b});vb.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var wb=L.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},xb=wb.prototype;xb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},xb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},xb.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},xb.peek=function(){return this.items[0].value},xb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},xb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},xb.enqueue=function(a){var b=this.length++;this.items[b]=new vb(wb.count++,a),this.percolate(b)},xb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},wb.count=0;var yb=L.CompositeDisposable=function(){this.disposables=k(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},zb=yb.prototype;zb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},zb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},zb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},zb.toArray=function(){return this.disposables.slice(0)};var Ab=L.Disposable=function(a){this.isDisposed=!1,this.action=a||M};Ab.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Bb=Ab.create=function(a){return new Ab(a)},Cb=Ab.empty={dispose:M},Db=L.SingleAssignmentDisposable=SerialDisposable=L.SerialDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Eb=(L.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?Cb:new a(this)},b}(),L.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||R,this.disposable=new Db});Eb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Eb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Eb.prototype.isCancelled=function(){return this.disposable.isDisposed},Eb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Fb=L.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),Cb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=P,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Gb=Fb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new yb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),Cb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new yb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),Cb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Fb.prototype),function(){Fb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Fb.prototype.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return Bb(function(){clearInterval(e)})}}(Fb.prototype);var Hb,Ib=Fb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Gb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Fb(P,a,b,c)}(),Jb=Fb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Fb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Fb.normalize(c),g=new Eb(this,b,d,f);if(e)e.enqueue(g);else{e=new wb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Fb(P,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Kb=(L.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new Db;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),M);!function(){function a(){if(!G.postMessage||G.importScripts)return!1;var a=!1,b=G.onmessage;return G.onmessage=function(){a=!0},G.postMessage("","*"),G.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(hb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=K&&J&&K.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=K&&J&&K.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Hb=process.nextTick;else if("function"==typeof d)Hb=d,Kb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;G.addEventListener?G.addEventListener("message",b,!1):G.attachEvent("onmessage",b,!1),Hb=function(a){var b=h++;g[b]=a,G.postMessage(f+b,"*")}}else if(G.MessageChannel){var i=new G.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Hb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in G&&"onreadystatechange"in G.document.createElement("script")?Hb=function(a){var b=G.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},G.document.documentElement.appendChild(b)}:(Hb=function(a){return setTimeout(a,0)},Kb=clearTimeout)}();var Lb=Fb.timeout=function(){function a(a,b){var c=this,d=new Db,e=Hb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new yb(d,Bb(function(){Kb(e)}))}function b(a,b,c){var d=this,e=Fb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Db,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new yb(f,Bb(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Fb(P,a,b,c)}(),Mb=L.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return N(a)||(a=Ib),new wc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Nb=Mb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Mb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Ob=Mb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Mb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Pb=Mb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Mb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Qb=L.internals.Enumerator=function(a){this._next=a};Qb.prototype.next=function(){return this._next()},Qb.prototype[W]=function(){return this};var Rb=L.internals.Enumerable=function(a){this._iterator=a};Rb.prototype[W]=function(){return this._iterator()},Rb.prototype.concat=function(){var a=this;return new wc(function(b){var c;try{c=a[W]()}catch(d){return void b.onError()}var e,f=new SerialDisposable,g=Ib.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;T(h)&&(h=oc(h));var i=new Db;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new yb(f,g,Bb(function(){e=!0}))})},Rb.prototype.catchException=function(){var a=this;return new wc(function(b){var c;try{c=a[W]()}catch(d){return void b.onError()}var e,f,g=new SerialDisposable,h=Ib.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;T(i)&&(i=oc(i));var j=new Db;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new yb(g,h,Bb(function(){e=!0}))})};var Sb=Rb.repeat=function(a,b){return null==b&&(b=-1),new Rb(function(){var c=b;return new Qb(function(){return 0===c?Y:(c>0&&c--,{done:!1,value:a})})})},Tb=Rb.forEach=function(a,b,c){return b||(b=O),new Rb(function(){var d=-1;return new Qb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:Y})})},Ub=L.Observer=function(){};Ub.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Ub.prototype.asObserver=function(){return new Yb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var Vb=Ub.create=function(a,b,c){return a||(a=M),b||(b=S),c||(c=M),new Yb(a,b,c)};Ub.fromNotifier=function(a){return new Yb(function(b){return a(Nb(b))},function(b){return a(Ob(b))},function(){return a(Pb())})};var Wb,Xb=L.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return tb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Ub),Yb=L.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return tb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Xb),Zb=L.Observable=function(){function a(a){this._subscribe=a}return Wb=a.prototype,Wb.subscribe=Wb.forEach=function(a,b,c){var d="object"==typeof a?a:Vb(a,b,c);return this._subscribe(d)},a}(),$b=L.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new SerialDisposable}return tb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Xb);Wb.toArray=function(){var a=this;return new wc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},Zb.create=Zb.createWithDisposable=function(a){return new wc(a)};var _b=Zb.defer=function(a){return new wc(function(b){var c;try{c=a()}catch(d){return fc(d).subscribe(b)}return T(c)&&(c=oc(c)),c.subscribe(b)})},ac=Zb.empty=function(a){return N(a)||(a=Ib),new wc(function(b){return a.schedule(function(){b.onCompleted()})})},bc=Math.pow(2,53)-1;Zb.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!q(b))throw new Error("mapFn when provided must be a function");return N(d)||(d=Jb),new wc(function(e){var f=Object(a),g=n(f),h=g?0:p(f),i=g?f[W]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&q(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};var cc=Zb.fromArray=function(a,b){return N(b)||(b=Jb),new wc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})},dc=Zb.never=function(){return new wc(function(){return Cb})};Zb.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return cc(b)};Zb.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return cc(c,a)};Zb.range=function(a,b,c){return N(c)||(c=Jb),new wc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Zb.repeat=function(a,b,c){return N(c)||(c=Jb),ec(a,c).repeat(null==b?-1:b)};var ec=Zb["return"]=Zb.returnValue=Zb.just=function(a,b){return N(b)||(b=Ib),new wc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},fc=Zb["throw"]=Zb.throwException=function(a,b){return N(b)||(b=Ib),new wc(function(c){return b.schedule(function(){c.onError(a)})})};Wb["catch"]=Wb.catchException=function(a){return"function"==typeof a?r(this,a):gc([this,a])};var gc=Zb.catchException=Zb["catch"]=function(){var a=k(arguments,0);return Tb(a).catchException()};Wb.combineLatest=function(){var a=sb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),hc.apply(this,a)};var hc=Zb.combineLatest=function(){var a=sb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new wc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(O))){try{d=b.apply(null,k)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(O)&&c.onCompleted()}function e(a){j[a]=!0,j.every(O)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=l(g,f),i=!1,j=l(g,f),k=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new Db;T(f)&&(f=oc(f)),g.setDisposable(f.subscribe(function(a){k[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new yb(m)})};Wb.concat=function(){var a=sb.call(arguments,0);return a.unshift(this),ic.apply(this,a)};var ic=Zb.concat=function(){var a=k(arguments,0);return Tb(a).concat()};Wb.concatObservable=Wb.concatAll=function(){return this.merge(1)},Wb.merge=function(a){if("number"!=typeof a)return jc(this,a);var b=this;return new wc(function(c){function d(a){var b=new Db;f.add(b),T(a)&&(a=oc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new yb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var jc=Zb.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=sb.call(arguments,1)):(a=Ib,b=sb.call(arguments,0)):(a=Ib,b=sb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),cc(b,a).mergeObservable()};Wb.mergeObservable=Wb.mergeAll=function(){var a=this;return new wc(function(b){var c=new yb,d=!1,e=new Db;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new Db;c.add(e),T(a)&&(a=oc(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Wb.skipUntil=function(a){var b=this;return new wc(function(c){var d=!1,e=new yb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));T(a)&&(a=oc(a));var f=new Db;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Wb["switch"]=Wb.switchLatest=function(){var a=this;return new wc(function(b){var c=!1,d=new SerialDisposable,e=!1,f=0,g=a.subscribe(function(a){var g=new Db,h=++f;c=!0,d.setDisposable(g),T(a)&&(a=oc(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new yb(g,d)})},Wb.takeUntil=function(a){var b=this;return new wc(function(c){return T(a)&&(a=oc(a)),new yb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),M))})},Wb.zip=function(){if(Array.isArray(arguments[0]))return s.apply(this,arguments);var a=this,b=sb.call(arguments),c=b.pop();return b.unshift(a),new wc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(O)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=l(g,function(){return[]}),i=l(g,function(){return!1}),j=new Array(g),k=0;g>k;k++)!function(a){var c=b[a],g=new Db;T(c)&&(c=oc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(k);return new yb(j)})},Zb.zip=function(){var a=sb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Zb.zipArray=function(){var a=k(arguments,0);return new wc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(O))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(O)?void b.onCompleted():void 0}for(var e=a.length,f=l(e,function(){return[]}),g=l(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new Db,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new yb(h);return j.add(Bb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Wb.asObservable=function(){var a=this;return new wc(function(b){return a.subscribe(b)})},Wb.dematerialize=function(){var a=this;return new wc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Wb.distinctUntilChanged=function(a,b){var c=this;return a||(a=O),b||(b=Q),new wc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Wb["do"]=Wb.doAction=Wb.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new wc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Wb["finally"]=Wb.finallyAction=function(a){var b=this;return new wc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return Bb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Wb.ignoreElements=function(){var a=this;return new wc(function(b){return a.subscribe(M,b.onError.bind(b),b.onCompleted.bind(b))})},Wb.materialize=function(){var a=this;return new wc(function(b){return a.subscribe(function(a){b.onNext(Nb(a))},function(a){b.onNext(Ob(a)),b.onCompleted()},function(){b.onNext(Pb()),b.onCompleted()})})},Wb.repeat=function(a){return Sb(this,a).concat()},Wb.retry=function(a){return Sb(this,a).catchException()},Wb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new wc(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Wb.skipLast=function(a){var b=this;return new wc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Wb.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=Ib,a=sb.call(arguments,c),Tb([cc(a,b),this]).concat()},Wb.takeLast=function(a){var b=this;return new wc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},Wb.selectConcat=Wb.concatMap=function(a,b,c){return b?this.concatMap(function(c,d){var e=a(c,d),f=T(e)?oc(e):e;
2
- return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?t(this,a,c):t(this,function(){return a})},Wb.select=Wb.map=function(a,b){var c=this;return new wc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Wb.pluck=function(a){return this.select(function(b){return b[a]})},Wb.selectMany=Wb.flatMap=function(a,b,c){return b?this.flatMap(function(c,d){var e=a(c,d),f=T(e)?oc(e):e;return f.map(function(a){return b(c,a,d)})},c):"function"==typeof a?u(this,a,c):u(this,function(){return a})},Wb.selectSwitch=Wb.flatMapLatest=Wb.switchMap=function(a,b){return this.select(a,b).switchLatest()},Wb.skip=function(a){if(0>a)throw new Error(U);var b=this;return new wc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Wb.skipWhile=function(a,b){var c=this;return new wc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Wb.take=function(a,b){if(0>a)throw new Error(U);if(0===a)return ac(b);var c=this;return new wc(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Wb.takeWhile=function(a,b){var c=this;return new wc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Wb.where=Wb.filter=function(a,b){var c=this;return new wc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Zb.fromCallback=function(a,b,c){return function(){var d=sb.call(arguments,0);return new wc(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},Zb.fromNodeCallback=function(a,b,c){return function(){var d=sb.call(arguments,0);return new wc(function(e){function f(a){if(a)return void e.onError(a);var b=sb.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},L.config.useNativeEvents=!1;var kc=G.angular&&angular.element?angular.element:G.jQuery?G.jQuery:G.Zepto?G.Zepto:null,lc=!!G.Ember&&"function"==typeof G.Ember.addListener,mc=!!G.Backbone&&!!G.Backbone.Marionette;Zb.fromEvent=function(a,b,c){if(a.addListener)return nc(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c);if(!L.config.useNativeEvents){if(mc)return nc(function(c){a.on(b,c)},function(c){a.off(b,c)},c);if(lc)return nc(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},c);if(kc){var d=kc(a);return nc(function(a){d.on(b,a)},function(a){d.off(b,a)},c)}}return new wc(function(d){return w(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)})}).publish().refCount()};var nc=Zb.fromEventPattern=function(a,b,c){return new wc(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return Bb(function(){b&&b(e,f)})}).publish().refCount()},oc=Zb.fromPromise=function(a){return _b(function(){var b=new L.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};Wb.toPromise=function(a){if(a||(a=L.config.Promise),!a)throw new Error("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},function(a){c(a)},function(){e&&a(d)})})},Zb.startAsync=function(a){var b;try{b=a()}catch(c){return fc(c)}return oc(b)},Wb.multicast=function(a,b){var c=this;return"function"==typeof a?new wc(function(d){var e=c.multicast(a());return new yb(b(e).subscribe(d),e.connect())}):new pc(c,a)},Wb.publish=function(a){return a?this.multicast(function(){return new zc},a):this.multicast(new zc)},Wb.share=function(){return this.publish(null).refCount()},Wb.publishLast=function(a){return a?this.multicast(function(){return new Ac},a):this.multicast(new Ac)},Wb.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Cc(b)},a):this.multicast(new Cc(a))},Wb.shareValue=function(a){return this.publishValue(a).refCount()},Wb.replay=function(a,b,c,d){return a?this.multicast(function(){return new Dc(b,c,d)},a):this.multicast(new Dc(b,c,d))},Wb.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var pc=L.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new yb(f.subscribe(c),Bb(function(){e=!1}))),d},a.call(this,c.subscribe.bind(c))}return tb(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new wc(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(Zb),qc=Zb.interval=function(a,b){return A(a,a,N(b)?b:Lb)},rc=Zb.timer=function(b,c,d){var e;return N(d)||(d=Lb),c!==a&&"number"==typeof c?e=c:c!==a&&"object"==typeof c&&(d=c),b instanceof Date&&e===a?x(b.getTime(),d):b instanceof Date&&e!==a?(e=c,y(b.getTime(),e,d)):e===a?z(b,d):A(b,e,d)};Wb.delay=function(a,b){return N(b)||(b=Lb),a instanceof Date?C(this,a.getTime(),b):B(this,a,b)},Wb.throttle=function(a,b){return N(b)||(b=Lb),this.throttleWithSelector(function(){return rc(a,b)})},Wb.timestamp=function(a){return N(a)||(a=Lb),this.map(function(b){return{value:b,timestamp:a.now()}})},Wb.sample=function(a,b){return N(b)||(b=Lb),"number"==typeof a?D(this,qc(a,b)):D(this,a)},Wb.timeout=function(a,b,c){b||(b=fc(new Error("Timeout"))),N(c)||(c=Lb);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new wc(function(f){var g=0,h=new Db,i=new SerialDisposable,j=!1,k=new SerialDisposable;i.setDisposable(h);var l=function(){var d=g;k.setDisposable(c[e](a,function(){g===d&&(T(b)&&(b=oc(b)),i.setDisposable(b.subscribe(f)))}))};return l(),h.setDisposable(d.subscribe(function(a){j||(g++,f.onNext(a),l())},function(a){j||(g++,f.onError(a))},function(){j||(g++,f.onCompleted())})),new yb(i,k)})},Wb.delaySubscription=function(a,b){return this.delayWithSelector(rc(a,N(b)?b:Lb),ac)},Wb.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new wc(function(a){var b=new yb,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new SerialDisposable,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return void a.onError(f)}var h=new Db;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new yb(h,b)})},Wb.timeoutWithSelector=function(a,b,c){if(1===arguments.length){b=a;var a=dc()}c||(c=fc(new Error("Timeout")));var d=this;return new wc(function(e){var f=new SerialDisposable,g=new SerialDisposable,h=new Db;f.setDisposable(h);var i=0,j=!1,k=function(a){var b=i,d=function(){return i===b},h=new Db;g.setDisposable(h),h.setDisposable(a.subscribe(function(){d()&&f.setDisposable(c.subscribe(e)),h.dispose()},function(a){d()&&e.onError(a)},function(){d()&&f.setDisposable(c.subscribe(e))}))};k(a);var l=function(){var a=!j;return a&&i++,a};return h.setDisposable(d.subscribe(function(a){if(l()){e.onNext(a);var c;try{c=b(a)}catch(d){return void e.onError(d)}k(c)}},function(a){l()&&e.onError(a)},function(){l()&&e.onCompleted()})),new yb(f,g)})},Wb.throttleWithSelector=function(a){var b=this;return new wc(function(c){var d,e=!1,f=new SerialDisposable,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return void c.onError(i)}e=!0,d=b,g++;var j=g,k=new Db;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new yb(h,f)})},Wb.skipLastWithTime=function(a,b){N(b)||(b=Lb);var c=this;return new wc(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},Wb.takeLastWithTime=function(a,b){var c=this;return N(b)||(b=Lb),new wc(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now();e.length>0;){var f=e.shift();c-f.interval<=a&&d.onNext(f.value)}d.onCompleted()})})},Wb.takeWithTime=function(a,b){var c=this;return N(b)||(b=Lb),new wc(function(d){return new yb(b.scheduleWithRelative(a,d.onCompleted.bind(d)),c.subscribe(d))})},Wb.skipWithTime=function(a,b){var c=this;return N(b)||(b=Lb),new wc(function(d){var e=!1;return new yb(b.scheduleWithRelative(a,function(){e=!0}),c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d)))})};var sc=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=Cb,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=Cb)});return new yb(c,d,e)}function c(c,d){this.source=c,this.controller=new zc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return tb(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(Zb);Wb.pausable=function(a){return new sc(this,a)};var tc=function(b){function c(b){var c,d=[],e=E(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(c!==a&&e.shouldFire!=c){if(e.shouldFire)for(;d.length>0;)b.onNext(d.shift())}else e.shouldFire?b.onNext(e.data):d.push(e.data);c=e.shouldFire},function(a){for(;d.length>0;)b.onNext(d.shift());b.onError(a)},function(){for(;d.length>0;)b.onNext(d.shift());b.onCompleted()});return e}function d(a,d){this.source=a,this.controller=new zc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,b.call(this,c)}return tb(d,b),d.prototype.pause=function(){this.controller.onNext(!1)},d.prototype.resume=function(){this.controller.onNext(!0)},d}(Zb);Wb.pausableBuffered=function(a){return new tc(this,a)},Wb.controlled=function(a){return null==a&&(a=!0),new uc(this,a)};var uc=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new vc(d),this.source=c.multicast(this.subject).refCount()}return tb(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(Zb),vc=L.ControlledSubject=function(a){function c(a){return this.subject.subscribe(a)}function d(b){null==b&&(b=!0),a.call(this,c),this.subject=new zc,this.enableQueue=b,this.queue=b?[]:null,this.requestedCount=0,this.requestedDisposable=Cb,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=Cb}return tb(d,a),ub(d.prototype,Ub,{onCompleted:function(){b.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){b.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){b.call(this);var c=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),c=!0),c&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=Cb):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=Cb),{numberOfItems:a,returnValue:!1}},request:function(a){b.call(this),this.disposeCurrentRequest();var c=this,d=this._processRequest(a);return a=d.numberOfItems,d.returnValue?Cb:(this.requestedCount=a,this.requestedDisposable=Bb(function(){c.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=Cb},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),d}(Zb);Wb.exclusive=function(){var a=this;return new wc(function(b){var c=!1,d=!1,e=new Db,f=new yb;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,T(a)&&(a=oc(a));var e=new Db;f.add(e),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){f.remove(e),c=!1,d&&1===f.length&&b.onCompleted()}))}},b.onError.bind(b),function(){d=!0,c||1!==f.length||b.onCompleted()})),f})},Wb.exclusiveMap=function(a,b){var c=this;return new wc(function(d){var e=0,f=!1,g=!0,h=new Db,i=new yb;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new Db,i.add(innerSubscription),T(c)&&(c=oc(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var wc=L.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Bb(a):Cb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new xc(a);return Jb.scheduleRequired()?Jb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return tb(c,a),c}(Zb),xc=function(a){function b(b){a.call(this),this.observer=b,this.m=new Db}tb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Xb),yc=function(a,b){this.subject=a,this.observer=b};yc.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var zc=L.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),Cb):(a.onCompleted(),Cb):(this.observers.push(a),new yc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return tb(d,a),ub(d.prototype,Ub,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Bc(a,b)},d}(Zb),Ac=L.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new yc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),Cb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return tb(d,a),ub(d.prototype,Ub,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(Zb),Bc=L.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return tb(b,a),ub(b.prototype,Ub,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(Zb),Cc=L.BehaviorSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new yc(this,a);var c=this.exception;return c?a.onError(c):a.onCompleted(),Cb}function d(b){a.call(this,c),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return tb(d,a),ub(d.prototype,Ub,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped){this.value=a;for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),d}(Zb),Dc=L.ReplaySubject=function(a){function c(a,b){this.subject=a,this.observer=b}function d(a){var d=new $b(this.scheduler,a),e=new c(this,d);b.call(this),this._trim(this.scheduler.now()),this.observers.push(d);for(var f=this.q.length,g=0,h=this.q.length;h>g;g++)d.onNext(this.q[g].value);return this.hasError?(f++,d.onError(this.error)):this.isStopped&&(f++,d.onCompleted()),d.ensureActive(f),e}function e(b,c,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==c?Number.MAX_VALUE:c,this.scheduler=e||Jb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,d)}return c.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1)}},tb(e,a),ub(e.prototype,Ub,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){var c;if(b.call(this),!this.isStopped){var d=this.scheduler.now();this.q.push({interval:d,value:a}),this._trim(d);for(var e=this.observers.slice(0),f=0,g=e.length;g>f;f++)c=e[f],c.onNext(a),c.ensureActive()}},onError:function(a){var c;if(b.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var d=this.scheduler.now();this._trim(d);for(var e=this.observers.slice(0),f=0,g=e.length;g>f;f++)c=e[f],c.onError(a),c.ensureActive();this.observers=[]}},onCompleted:function(){var a;if(b.call(this),!this.isStopped){this.isStopped=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++)a=d[e],a.onCompleted(),a.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(Zb);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(G.Rx=L,define(function(){return L})):H&&I?J?(I.exports=L).Rx=L:H.Rx=L:G.Rx=L}).call(this);
1
+ (function(a){function b(){if(this.isDisposed)throw new Error(W)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;rb.nonEnumArgs&&a.length&&h(a)&&(a=tb.call(a));var d=rb.enumPrototypes&&"function"==typeof a,e=rb.enumErrorProps&&(a===lb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(rb.nonEnumShadows&&a!==mb){var g=a.constructor,i=-1,j=pb.length;if(a===(g&&g.prototype))var k=a===stringProto?hb:a===lb?cb:ib.call(a),l=qb[k];for(;++i<j;)f=pb[i],l&&l[f]||!jb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?ib.call(a)==$:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=ib.call(a),l=ib.call(b);if(k==$&&(k=fb),l==$&&(l=fb),k!=l)return!1;switch(k){case ab:case bb:return+a==+b;case eb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case gb:case hb:return a==String(b)}var m=k==_;if(!m){if(k!=fb||!rb.nodeClass&&(g(a)||g(b)))return!1;var n=!rb.argsObject&&h(a)?Object:a.constructor,o=!rb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||jb.call(a,"constructor")&&jb.call(b,"constructor")||U(n)&&n instanceof n&&U(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0;if(result=!0,c.push(a),d.push(b),m){if(p=a.length,q=b.length,result=q==p)for(;q--;){var r=b[q];if(!(result=i(a[q],r,c,d)))break}}else f(b,function(b,e,f){return jb.call(f,e)?(q++,result=jb.call(a,e)&&i(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return jb.call(c,b)?result=--q>-1:void 0});return c.pop(),d.pop(),result}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:tb.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a){return"number"==typeof a&&G.isFinite(a)}function n(b){return b[X]!==a}function o(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function p(a){var b=+a.length;return isNaN(b)?0:0!==b&&m(b)?(b=o(b)*Math.floor(Math.abs(b)),0>=b?0:b>fc?fc:b):b}function q(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function r(a,b){return new zc(function(c){var d=new Db,e=new Eb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}T(f)&&(f=rc(f)),d=new Db,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function s(a,b){var c=this;return new zc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function t(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return T(e)?rc(e):e}).concatAll()}function u(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return T(e)?rc(e):e}).mergeObservable()}function v(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),Bb(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function w(a,b,c){var d=new yb;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(w(a.item(e),b,c));else a&&d.add(v(a,b,c));return d}function x(a,b){return new zc(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function y(a,b,c){return new zc(function(d){var e=0,f=a,g=Hb(b);return c.scheduleRecursiveWithAbsolute(f,function(a){if(g>0){var b=c.now();f+=g,b>=f&&(f=b+g)}d.onNext(e++),a(f)})})}function z(a,b){return new zc(function(c){return b.scheduleWithRelative(Hb(a),function(){c.onNext(0),c.onCompleted()})})}function A(a,b,c){return a===b?new zc(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):dc(function(){return y(c.now()+a,b,c)})}function B(a,b,c){return new zc(function(d){var e,f=!1,g=new Eb,h=null,i=[],j=!1;return e=a.materialize().timestamp(c).subscribe(function(a){var e,k;"E"===a.value.kind?(i=[],i.push(a),h=a.value.exception,k=!j):(i.push({value:a.value,timestamp:a.timestamp+b}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new Db,g.setDisposable(e),e.setDisposable(c.scheduleRecursiveWithRelative(b,function(a){var b,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-c.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-c.now())):f=!1,b=h,j=!1,null!==b?d.onError(b):k&&a(e)}}))))}),new yb(e,g)})}function C(a,b,c){return dc(function(){return B(a,b-c.now(),c)})}function D(a,b){return new zc(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new yb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}function E(a,b,c){return new zc(function(d){function e(a,b){j[b]=a;var e;if(g[b]=!0,h||(h=g.every(O))){try{e=c.apply(null,j)}catch(f){return void d.onError(f)}d.onNext(e)}else i&&d.onCompleted()}var f=2,g=[!1,!1],h=!1,i=!1,j=new Array(f);return new yb(a.subscribe(function(a){e(a,0)},d.onError.bind(d),function(){i=!0,d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d)))})}var F={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},G=F[typeof window]&&window||this,H=F[typeof exports]&&exports&&!exports.nodeType&&exports,I=F[typeof module]&&module&&!module.nodeType&&module,J=I&&I.exports===H&&H,K=F[typeof global]&&global;!K||K.global!==K&&K.window!==K||(G=K);var L={internals:{},config:{Promise:G.Promise},helpers:{}},M=L.helpers.noop=function(){},N=(L.helpers.notDefined=function(a){return"undefined"==typeof a},L.helpers.isScheduler=function(a){return a instanceof L.Scheduler}),O=L.helpers.identity=function(a){return a},P=(L.helpers.pluck=function(a){return function(b){return b[a]}},L.helpers.just=function(a){return function(){return a}},L.helpers.defaultNow=Date.now),Q=L.helpers.defaultComparer=function(a,b){return sb(a,b)},R=L.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},S=(L.helpers.defaultKeySerializer=function(a){return a.toString()},L.helpers.defaultError=function(a){throw a}),T=L.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},U=(L.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},L.helpers.not=function(a){return!a},L.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==ib.call(a)}),a}()),V="Argument out of range",W="Object has been disposed",X="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";G.Set&&"function"==typeof(new G.Set)["@@iterator"]&&(X="@@iterator");var Y,Z={done:!0,value:a},$="[object Arguments]",_="[object Array]",ab="[object Boolean]",bb="[object Date]",cb="[object Error]",db="[object Function]",eb="[object Number]",fb="[object Object]",gb="[object RegExp]",hb="[object String]",ib=Object.prototype.toString,jb=Object.prototype.hasOwnProperty,kb=ib.call(arguments)==$,lb=Error.prototype,mb=Object.prototype,nb=mb.propertyIsEnumerable;try{Y=!(ib.call(document)==fb&&!({toString:0}+""))}catch(ob){Y=!0}var pb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],qb={};qb[_]=qb[bb]=qb[eb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},qb[ab]=qb[hb]={constructor:!0,toString:!0,valueOf:!0},qb[cb]=qb[db]=qb[gb]={constructor:!0,toString:!0},qb[fb]={constructor:!0};var rb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);rb.enumErrorProps=nb.call(lb,"message")||nb.call(lb,"name"),rb.enumPrototypes=nb.call(a,"prototype"),rb.nonEnumArgs=0!=c,rb.nonEnumShadows=!/valueOf/.test(b)}(1),kb||(h=function(a){return a&&"object"==typeof a?jb.call(a,"callee"):!1});{var sb=L.internals.isEqual=function(a,b){return i(a,b,[],[])},tb=Array.prototype.slice,ub=({}.hasOwnProperty,this.inherits=L.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),vb=L.internals.addProperties=function(a){for(var b=tb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}};L.internals.addRef=function(a,b){return new zc(function(c){return new yb(b.getDisposable(),a.subscribe(c))})}}l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var wb=L.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},xb=wb.prototype;xb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},xb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},xb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},xb.peek=function(){return this.items[0].value},xb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},xb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},xb.enqueue=function(a){var b=this.length++;this.items[b]=new l(wb.count++,a),this.percolate(b)},xb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},wb.count=0;var yb=L.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},zb=yb.prototype;zb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},zb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},zb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},zb.toArray=function(){return this.disposables.slice(0)};var Ab=L.Disposable=function(a){this.isDisposed=!1,this.action=a||M};Ab.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Bb=Ab.create=function(a){return new Ab(a)},Cb=Ab.empty={dispose:M},Db=L.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Eb=L.SerialDisposable=Db,Fb=(L.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?Cb:new a(this)},b}(),L.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||R,this.disposable=new Db});Fb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Fb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Fb.prototype.isCancelled=function(){return this.disposable.isDisposed},Fb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Gb=L.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),Cb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=P,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Hb=Gb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new yb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),Cb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new yb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),Cb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Gb.prototype),function(){Gb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Gb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof G.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=G.setInterval(function(){d=c(d)},b);return Bb(function(){G.clearInterval(e)})}}(Gb.prototype);var Ib,Jb=Gb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Hb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Gb(P,a,b,c)}(),Kb=Gb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Gb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Gb.normalize(c),g=new Fb(this,b,d,f);if(e)e.enqueue(g);else{e=new wb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Gb(P,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Lb=(L.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new Db;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),M),Mb=function(){var a,b=M;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!G.setTimeout)throw new Error("No concurrency detected!");a=G.setTimeout,b=G.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Nb=Mb.setTimeout,Ob=Mb.clearTimeout;!function(){function a(){if(!G.postMessage||G.importScripts)return!1;var a=!1,b=G.onmessage;return G.onmessage=function(){a=!0},G.postMessage("","*"),G.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(ib).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=K&&J&&K.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=K&&J&&K.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Ib=process.nextTick;else if("function"==typeof d)Ib=d,Lb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;G.addEventListener?G.addEventListener("message",b,!1):G.attachEvent("onmessage",b,!1),Ib=function(a){var b=h++;g[b]=a,G.postMessage(f+b,"*")}}else if(G.MessageChannel){var i=new G.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Ib=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in G&&"onreadystatechange"in G.document.createElement("script")?Ib=function(a){var b=G.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},G.document.documentElement.appendChild(b)}:(Ib=function(a){return Nb(a,0)},Lb=Ob)}();var Pb=Gb.timeout=function(){function a(a,b){var c=this,d=new Db,e=Ib(function(){d.isDisposed||d.setDisposable(b(c,a))});return new yb(d,Bb(function(){Lb(e)}))}function b(a,b,c){var d=this,e=Gb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Db,g=Nb(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new yb(f,Bb(function(){Ob(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Gb(P,a,b,c)}(),Qb=L.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return N(a)||(a=Jb),new zc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Rb=Qb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Qb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Sb=Qb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Qb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Tb=Qb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Qb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Ub=L.internals.Enumerator=function(a){this._next=a};Ub.prototype.next=function(){return this._next()},Ub.prototype[X]=function(){return this};var Vb=L.internals.Enumerable=function(a){this._iterator=a};Vb.prototype[X]=function(){return this._iterator()},Vb.prototype.concat=function(){var a=this;return new zc(function(b){var c;try{c=a[X]()}catch(d){return void b.onError()}var e,f=new Eb,g=Jb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;T(h)&&(h=rc(h));var i=new Db;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new yb(f,g,Bb(function(){e=!0}))})},Vb.prototype.catchException=function(){var a=this;return new zc(function(b){var c;try{c=a[X]()}catch(d){return void b.onError()}var e,f,g=new Eb,h=Jb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;T(i)&&(i=rc(i));var j=new Db;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new yb(g,h,Bb(function(){e=!0}))})};var Wb=Vb.repeat=function(a,b){return null==b&&(b=-1),new Vb(function(){var c=b;return new Ub(function(){return 0===c?Z:(c>0&&c--,{done:!1,value:a})})})},Xb=Vb.forEach=function(a,b,c){return b||(b=O),new Vb(function(){var d=-1;return new Ub(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:Z})})},Yb=L.Observer=function(){};Yb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Yb.prototype.asObserver=function(){return new ac(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var Zb=Yb.create=function(a,b,c){return a||(a=M),b||(b=S),c||(c=M),new ac(a,b,c)};Yb.fromNotifier=function(a){return new ac(function(b){return a(Rb(b))},function(b){return a(Sb(b))},function(){return a(Tb())})};var $b,_b=L.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return ub(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Yb),ac=L.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return ub(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(_b),bc=L.Observable=function(){function a(a){this._subscribe=a}return $b=a.prototype,$b.subscribe=$b.forEach=function(a,b,c){var d="object"==typeof a?a:Zb(a,b,c);return this._subscribe(d)},a}(),cc=L.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Eb}return ub(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(_b);$b.toArray=function(){var a=this;return new zc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},bc.create=bc.createWithDisposable=function(a){return new zc(a)};var dc=bc.defer=function(a){return new zc(function(b){var c;try{c=a()}catch(d){return ic(d).subscribe(b)}return T(c)&&(c=rc(c)),c.subscribe(b)})},ec=bc.empty=function(a){return N(a)||(a=Jb),new zc(function(b){return a.schedule(function(){b.onCompleted()})})},fc=Math.pow(2,53)-1;bc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!q(b))throw new Error("mapFn when provided must be a function");return N(d)||(d=Kb),new zc(function(e){var f=Object(a),g=n(f),h=g?0:p(f),i=g?f[X]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&q(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};{var gc=bc.fromArray=function(a,b){return N(b)||(b=Kb),new zc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};bc.never=function(){return new zc(function(){return Cb})}}bc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return gc(b)};bc.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return gc(c,a)};bc.range=function(a,b,c){return N(c)||(c=Kb),new zc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},bc.repeat=function(a,b,c){return N(c)||(c=Kb),hc(a,c).repeat(null==b?-1:b)};var hc=bc["return"]=bc.returnValue=bc.just=function(a,b){return N(b)||(b=Jb),new zc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},ic=bc["throw"]=bc.throwException=bc.throwError=function(a,b){return N(b)||(b=Jb),new zc(function(c){return b.schedule(function(){c.onError(a)})})};$b["catch"]=$b.catchException=function(a){return"function"==typeof a?r(this,a):jc([this,a])};var jc=bc.catchException=bc["catch"]=function(){var a=j(arguments,0);return Xb(a).catchException()};$b.combineLatest=function(){var a=tb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),kc.apply(this,a)};var kc=bc.combineLatest=function(){var a=tb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new zc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(O))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(O)&&c.onCompleted()}function e(a){j[a]=!0,j.every(O)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new Db;T(f)&&(f=rc(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new yb(m)})};$b.concat=function(){var a=tb.call(arguments,0);return a.unshift(this),lc.apply(this,a)};var lc=bc.concat=function(){var a=j(arguments,0);return Xb(a).concat()};$b.concatObservable=$b.concatAll=function(){return this.merge(1)},$b.merge=function(a){if("number"!=typeof a)return mc(this,a);var b=this;return new zc(function(c){function d(a){var b=new Db;f.add(b),T(a)&&(a=rc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new yb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var mc=bc.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=tb.call(arguments,1)):(a=Jb,b=tb.call(arguments,0)):(a=Jb,b=tb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),gc(b,a).mergeObservable()};$b.mergeObservable=$b.mergeAll=function(){var a=this;return new zc(function(b){var c=new yb,d=!1,e=new Db;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new Db;c.add(e),T(a)&&(a=rc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},$b.skipUntil=function(a){var b=this;return new zc(function(c){var d=!1,e=new yb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));T(a)&&(a=rc(a));var f=new Db;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},$b["switch"]=$b.switchLatest=function(){var a=this;return new zc(function(b){var c=!1,d=new Eb,e=!1,f=0,g=a.subscribe(function(a){var g=new Db,h=++f;c=!0,d.setDisposable(g),T(a)&&(a=rc(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new yb(g,d)})},$b.takeUntil=function(a){var b=this;return new zc(function(c){return T(a)&&(a=rc(a)),new yb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),M))})},$b.zip=function(){if(Array.isArray(arguments[0]))return s.apply(this,arguments);var a=this,b=tb.call(arguments),c=b.pop();return b.unshift(a),new zc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(O)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new Db;T(c)&&(c=rc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new yb(j)})},bc.zip=function(){var a=tb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},bc.zipArray=function(){var a=j(arguments,0);return new zc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(O))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(O)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new Db,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new yb(h);return j.add(Bb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},$b.asObservable=function(){return new zc(this.subscribe.bind(this))},$b.dematerialize=function(){var a=this;return new zc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},$b.distinctUntilChanged=function(a,b){var c=this;return a||(a=O),b||(b=Q),new zc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},$b["do"]=$b.doAction=$b.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new zc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},$b["finally"]=$b.finallyAction=function(a){var b=this;return new zc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return Bb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},$b.ignoreElements=function(){var a=this;return new zc(function(b){return a.subscribe(M,b.onError.bind(b),b.onCompleted.bind(b))})},$b.materialize=function(){var a=this;return new zc(function(b){return a.subscribe(function(a){b.onNext(Rb(a))},function(a){b.onNext(Sb(a)),b.onCompleted()},function(){b.onNext(Tb()),b.onCompleted()})})},$b.repeat=function(a){return Wb(this,a).concat()},$b.retry=function(a){return Wb(this,a).catchException()},$b.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new zc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},$b.skipLast=function(a){var b=this;return new zc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},$b.startWith=function(){var a,b,c=0;return arguments.length&&N(arguments[0])?(b=arguments[0],c=1):b=Jb,a=tb.call(arguments,c),Xb([gc(a,b),this]).concat()},$b.takeLast=function(a){var b=this;
2
+ return new zc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},$b.selectConcat=$b.concatMap=function(a,b,c){return b?this.concatMap(function(c,d){var e=a(c,d),f=T(e)?rc(e):e;return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?t(this,a,c):t(this,function(){return a})},$b.select=$b.map=function(a,b){var c=this;return new zc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},$b.pluck=function(a){return this.map(function(b){return b[a]})},$b.selectMany=$b.flatMap=function(a,b,c){return b?this.flatMap(function(c,d){var e=a(c,d),f=T(e)?rc(e):e;return f.map(function(a){return b(c,a,d)})},c):"function"==typeof a?u(this,a,c):u(this,function(){return a})},$b.selectSwitch=$b.flatMapLatest=$b.switchMap=function(a,b){return this.select(a,b).switchLatest()},$b.skip=function(a){if(0>a)throw new Error(V);var b=this;return new zc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},$b.skipWhile=function(a,b){var c=this;return new zc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},$b.take=function(a,b){if(0>a)throw new RangeError(V);if(0===a)return ec(b);var c=this;return new zc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},$b.takeWhile=function(a,b){var c=this;return new zc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},$b.where=$b.filter=function(a,b){var c=this;return new zc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},bc.fromCallback=function(a,b,c){return function(){var d=tb.call(arguments,0);return new zc(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},bc.fromNodeCallback=function(a,b,c){return function(){var d=tb.call(arguments,0);return new zc(function(e){function f(a){if(a)return void e.onError(a);var b=tb.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},L.config.useNativeEvents=!1;var nc=G.angular&&angular.element?angular.element:G.jQuery?G.jQuery:G.Zepto?G.Zepto:null,oc=!!G.Ember&&"function"==typeof G.Ember.addListener,pc=!!G.Backbone&&!!G.Backbone.Marionette;bc.fromEvent=function(a,b,c){if(a.addListener)return qc(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c);if(!L.config.useNativeEvents){if(pc)return qc(function(c){a.on(b,c)},function(c){a.off(b,c)},c);if(oc)return qc(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},c);if(nc){var d=nc(a);return qc(function(a){d.on(b,a)},function(a){d.off(b,a)},c)}}return new zc(function(d){return w(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)})}).publish().refCount()};var qc=bc.fromEventPattern=function(a,b,c){return new zc(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return Bb(function(){b&&b(e,f)})}).publish().refCount()},rc=bc.fromPromise=function(a){return dc(function(){var b=new L.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};$b.toPromise=function(a){if(a||(a=L.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},bc.startAsync=function(a){var b;try{b=a()}catch(c){return ic(c)}return rc(b)},$b.multicast=function(a,b){var c=this;return"function"==typeof a?new zc(function(d){var e=c.multicast(a());return new yb(b(e).subscribe(d),e.connect())}):new sc(c,a)},$b.publish=function(a){return a&&U(a)?this.multicast(function(){return new Cc},a):this.multicast(new Cc)},$b.share=function(){return this.publish().refCount()},$b.publishLast=function(a){return a&&U(a)?this.multicast(function(){return new Dc},a):this.multicast(new Dc)},$b.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Fc(b)},a):this.multicast(new Fc(a))},$b.shareValue=function(a){return this.publishValue(a).refCount()},$b.replay=function(a,b,c,d){return a&&U(a)?this.multicast(function(){return new Gc(b,c,d)},a):this.multicast(new Gc(b,c,d))},$b.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var sc=L.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new yb(f.subscribe(c),Bb(function(){e=!1}))),d},a.call(this,c.subscribe.bind(c))}return ub(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new zc(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(bc),tc=bc.interval=function(a,b){return A(a,a,N(b)?b:Pb)},uc=bc.timer=function(b,c,d){var e;return N(d)||(d=Pb),c!==a&&"number"==typeof c?e=c:N(c)&&(d=c),b instanceof Date&&e===a?x(b.getTime(),d):b instanceof Date&&e!==a?(e=c,y(b.getTime(),e,d)):e===a?z(b,d):A(b,e,d)};$b.delay=function(a,b){return N(b)||(b=Pb),a instanceof Date?C(this,a.getTime(),b):B(this,a,b)},$b.throttle=function(a,b){N(b)||(b=Pb);var c=this;return new zc(function(d){var e,f=new Eb,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new Db;f.setDisposable(j),j.setDisposable(b.scheduleWithRelative(a,function(){hasValue&&h===i&&d.onNext(e),g=!1}))},function(a){f.dispose(),d.onError(a),g=!1,h++},function(){f.dispose(),g&&d.onNext(e),d.onCompleted(),g=!1,h++});return new yb(i,f)})},$b.timestamp=function(a){return N(a)||(a=Pb),this.map(function(b){return{value:b,timestamp:a.now()}})},$b.sample=function(a,b){return N(b)||(b=Pb),"number"==typeof a?D(this,tc(a,b)):D(this,a)},$b.timeout=function(a,b,c){b||(b=ic(new Error("Timeout"))),N(c)||(c=Pb);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new zc(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(T(b)&&(b=rc(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new Db,j=new Eb,k=!1,l=new Eb;return j.setDisposable(i),g(),i.setDisposable(d.subscribe(function(a){k||(h++,f.onNext(a),g())},function(a){k||(h++,f.onError(a))},function(){k||(h++,f.onCompleted())})),new yb(j,l)})},$b.delaySubscription=function(a,b){return this.delayWithSelector(uc(a,N(b)?b:Pb),ec)},$b.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new zc(function(a){var b=new yb,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new Eb,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return void a.onError(f)}var h=new Db;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new yb(h,b)})},$b.skipLastWithTime=function(a,b){N(b)||(b=Pb);var c=this;return new zc(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},$b.takeLastWithTime=function(a,b){var c=this;return N(b)||(b=Pb),new zc(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},d.onError.bind(d),function(){for(var c=b.now();e.length>0;){var f=e.shift();c-f.interval<=a&&d.onNext(f.value)}d.onCompleted()})})},$b.takeWithTime=function(a,b){var c=this;return N(b)||(b=Pb),new zc(function(d){return new yb(b.scheduleWithRelative(a,d.onCompleted.bind(d)),c.subscribe(d))})},$b.skipWithTime=function(a,b){var c=this;return N(b)||(b=Pb),new zc(function(d){var e=!1;return new yb(b.scheduleWithRelative(a,function(){e=!0}),c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d)))})};var vc=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=Cb,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=Cb)});return new yb(c,d,e)}function c(c,d){this.source=c,this.controller=new Cc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return ub(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(bc);$b.pausable=function(a){return new vc(this,a)};var wc=function(b){function c(b){var c,d=[],e=E(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(c!==a&&e.shouldFire!=c){if(c=e.shouldFire,e.shouldFire)for(;d.length>0;)b.onNext(d.shift())}else c=e.shouldFire,e.shouldFire?b.onNext(e.data):d.push(e.data)},function(a){for(;d.length>0;)b.onNext(d.shift());b.onError(a)},function(){for(;d.length>0;)b.onNext(d.shift());b.onCompleted()});return e}function d(a,d){this.source=a,this.controller=new Cc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,b.call(this,c)}return ub(d,b),d.prototype.pause=function(){this.controller.onNext(!1)},d.prototype.resume=function(){this.controller.onNext(!0)},d}(bc);$b.pausableBuffered=function(a){return new wc(this,a)},$b.controlled=function(a){return null==a&&(a=!0),new xc(this,a)};var xc=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new yc(d),this.source=c.multicast(this.subject).refCount()}return ub(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(bc),yc=L.ControlledSubject=function(a){function c(a){return this.subject.subscribe(a)}function d(b){null==b&&(b=!0),a.call(this,c),this.subject=new Cc,this.enableQueue=b,this.queue=b?[]:null,this.requestedCount=0,this.requestedDisposable=Cb,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=Cb}return ub(d,a),vb(d.prototype,Yb,{onCompleted:function(){b.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){b.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){b.call(this);var c=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),c=!0),c&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=Cb):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=Cb),{numberOfItems:a,returnValue:!1}},request:function(a){b.call(this),this.disposeCurrentRequest();var c=this,d=this._processRequest(a);return a=d.numberOfItems,d.returnValue?Cb:(this.requestedCount=a,this.requestedDisposable=Bb(function(){c.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=Cb},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),d}(bc);$b.exclusive=function(){var a=this;return new zc(function(b){var c=!1,d=!1,e=new Db,f=new yb;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,T(a)&&(a=rc(a));var e=new Db;f.add(e),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){f.remove(e),c=!1,d&&1===f.length&&b.onCompleted()}))}},b.onError.bind(b),function(){d=!0,c||1!==f.length||b.onCompleted()})),f})},$b.exclusiveMap=function(a,b){var c=this;return new zc(function(d){var e=0,f=!1,g=!0,h=new Db,i=new yb;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new Db,i.add(innerSubscription),T(c)&&(c=rc(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var zc=L.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Bb(a):Cb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new Ac(a);return Kb.scheduleRequired()?Kb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return ub(c,a),c}(bc),Ac=function(a){function b(b){a.call(this),this.observer=b,this.m=new Db}ub(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(_b),Bc=function(a,b){this.subject=a,this.observer=b};Bc.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var Cc=L.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),Cb):(a.onCompleted(),Cb):(this.observers.push(a),new Bc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return ub(d,a),vb(d.prototype,Yb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Ec(a,b)},d}(bc),Dc=L.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new Bc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),Cb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return ub(d,a),vb(d.prototype,Yb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(bc),Ec=L.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return ub(b,a),vb(b.prototype,Yb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(bc),Fc=L.BehaviorSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new Bc(this,a);var c=this.exception;return c?a.onError(c):a.onCompleted(),Cb}function d(b){a.call(this,c),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return ub(d,a),vb(d.prototype,Yb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;for(var a=0,c=this.observers.slice(0),d=c.length;d>a;a++)c[a].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.exception=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped){this.value=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),d}(bc),Gc=L.ReplaySubject=function(a){function c(a,b){return Bb(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function d(a){var d=new cc(this.scheduler,a),e=c(this,d);b.call(this),this._trim(this.scheduler.now()),this.observers.push(d);for(var f=this.q.length,g=0,h=this.q.length;h>g;g++)d.onNext(this.q[g].value);return this.hasError?(f++,d.onError(this.error)):this.isStopped&&(f++,d.onCompleted()),d.ensureActive(f),e}function e(b,c,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==c?Number.MAX_VALUE:c,this.scheduler=e||Kb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,d)}return ub(e,a),vb(e.prototype,Yb,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){if(b.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onNext(a),g.ensureActive()}}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onError(a),g.ensureActive()}this.observers=[]}},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++){var f=c[d];f.onCompleted(),f.ensureActive()}this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(bc);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(G.Rx=L,define(function(){return L})):H&&I?J?(I.exports=L).Rx=L:H.Rx=L:G.Rx=L}).call(this);
@@ -1,2 +1,2 @@
1
- (function(a){function b(){if(this.isDisposed)throw new Error(O)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;jb.nonEnumArgs&&a.length&&h(a)&&(a=lb.call(a));var d=jb.enumPrototypes&&"function"==typeof a,e=jb.enumErrorProps&&(a===db||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(jb.nonEnumShadows&&a!==eb){var g=a.constructor,i=-1,j=hb.length;if(a===(g&&g.prototype))var k=a===stringProto?_:a===db?W:ab.call(a),l=ib[k];for(;++i<j;)f=hb[i],l&&l[f]||!bb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?ab.call(a)==S:!1}function i(a){return"function"==typeof a||!1}function j(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,k=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=k&&"object"!=k))return!1;var l=ab.call(a),m=ab.call(b);if(l==S&&(l=Z),m==S&&(m=Z),l!=m)return!1;switch(l){case U:case V:return+a==+b;case Y:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case $:case _:return a==String(b)}var n=l==T;if(!n){if(l!=Z||!jb.nodeClass&&(g(a)||g(b)))return!1;var o=!jb.argsObject&&h(a)?Object:a.constructor,p=!jb.argsObject&&h(b)?Object:b.constructor;if(!(o==p||bb.call(a,"constructor")&&bb.call(b,"constructor")||i(o)&&o instanceof o&&i(p)&&p instanceof p||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(result=!0,c.push(a),d.push(b),n){if(q=a.length,r=b.length,result=r==q)for(;r--;){var s=b[r];if(!(result=j(a[r],s,c,d)))break}}else f(b,function(b,e,f){return bb.call(f,e)?(r++,result=bb.call(a,e)&&j(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return bb.call(c,b)?result=--r>-1:void 0});return c.pop(),d.pop(),result}function k(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:lb.call(a)}function l(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function m(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function n(a){return"number"==typeof a&&z.isFinite(a)}function o(b){return b[P]!==a}function p(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function q(a){var b=+a.length;return isNaN(b)?0:0!==b&&n(b)?(b=p(b)*Math.floor(Math.abs(b)),0>=b?0:b>_b?_b:b):b}function r(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function s(a,b){return new jc(function(c){var d=new xb,e=new SerialDisposable;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}M(f)&&(f=Yb(f)),d=new xb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new jc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?Yb(e):e}).concatAll()}function v(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function w(a){this.comparer=a,this.set=[]}function x(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?Yb(e):e}).mergeObservable()}var y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z=y[typeof window]&&window||this,A=y[typeof exports]&&exports&&!exports.nodeType&&exports,B=y[typeof module]&&module&&!module.nodeType&&module,C=B&&B.exports===A&&A,D=y[typeof global]&&global;!D||D.global!==D&&D.window!==D||(z=D);var E={internals:{},config:{Promise:z.Promise},helpers:{}},F=E.helpers.noop=function(){},G=(E.helpers.notDefined=function(a){return"undefined"==typeof a},E.helpers.isScheduler=function(a){return a instanceof E.Scheduler}),H=E.helpers.identity=function(a){return a},I=(E.helpers.pluck=function(a){return function(b){return b[a]}},E.helpers.just=function(a){return function(){return a}},E.helpers.defaultNow=Date.now),J=E.helpers.defaultComparer=function(a,b){return kb(a,b)},K=E.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},L=(E.helpers.defaultKeySerializer=function(a){return a.toString()},E.helpers.defaultError=function(a){throw a}),M=E.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},N=(E.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},E.helpers.not=function(a){return!a},"Argument out of range"),O="Object has been disposed",P="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";z.Set&&"function"==typeof(new z.Set)["@@iterator"]&&(P="@@iterator");var Q,R={done:!0,value:a},S="[object Arguments]",T="[object Array]",U="[object Boolean]",V="[object Date]",W="[object Error]",X="[object Function]",Y="[object Number]",Z="[object Object]",$="[object RegExp]",_="[object String]",ab=Object.prototype.toString,bb=Object.prototype.hasOwnProperty,cb=ab.call(arguments)==S,db=Error.prototype,eb=Object.prototype,fb=eb.propertyIsEnumerable;try{Q=!(ab.call(document)==Z&&!({toString:0}+""))}catch(gb){Q=!0}var hb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ib={};ib[T]=ib[V]=ib[Y]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},ib[U]=ib[_]={constructor:!0,toString:!0,valueOf:!0},ib[W]=ib[X]=ib[$]={constructor:!0,toString:!0},ib[Z]={constructor:!0};var jb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);jb.enumErrorProps=fb.call(db,"message")||fb.call(db,"name"),jb.enumPrototypes=fb.call(a,"prototype"),jb.nonEnumArgs=0!=c,jb.nonEnumShadows=!/valueOf/.test(b)}(1),cb||(h=function(a){return a&&"object"==typeof a?bb.call(a,"callee"):!1}),i(/x/)&&(i=function(a){return"function"==typeof a&&ab.call(a)==X});var kb=E.internals.isEqual=function(a,b){return j(a,b,[],[])},lb=Array.prototype.slice,mb=({}.hasOwnProperty,this.inherits=E.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),nb=E.internals.addProperties=function(a){for(var b=lb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},ob=E.internals.addRef=function(a,b){return new jc(function(c){return new sb(b.getDisposable(),a.subscribe(c))})},pb=function(a,b){this.id=a,this.value=b};pb.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var qb=E.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},rb=qb.prototype;rb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},rb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},rb.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},rb.peek=function(){return this.items[0].value},rb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},rb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},rb.enqueue=function(a){var b=this.length++;this.items[b]=new pb(qb.count++,a),this.percolate(b)},rb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},qb.count=0;var sb=E.CompositeDisposable=function(){this.disposables=k(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},tb=sb.prototype;tb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},tb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},tb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},tb.toArray=function(){return this.disposables.slice(0)};var ub=E.Disposable=function(a){this.isDisposed=!1,this.action=a||F};ub.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var vb=ub.create=function(a){return new ub(a)},wb=ub.empty={dispose:F},xb=E.SingleAssignmentDisposable=SerialDisposable=E.SerialDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),yb=E.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?wb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var zb=E.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||K,this.disposable=new xb};zb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},zb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},zb.prototype.isCancelled=function(){return this.disposable.isDisposed},zb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ab=E.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),wb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=I,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Bb=Ab.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new sb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),wb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new sb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),wb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Ab.prototype),function(){Ab.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Ab.prototype.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return vb(function(){clearInterval(e)})}}(Ab.prototype),function(a){a.catchError=a["catch"]=function(a){return new Gb(this,a)}}(Ab.prototype);var Cb,Db=(E.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new xb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Ab.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Bb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Ab(I,a,b,c)}()),Eb=Ab.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Ab.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Ab.normalize(c),g=new zb(this,b,d,f);if(e)e.enqueue(g);else{e=new qb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Ab(I,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Fb=F;!function(){function a(){if(!z.postMessage||z.importScripts)return!1;var a=!1,b=z.onmessage;return z.onmessage=function(){a=!0},z.postMessage("","*"),z.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(ab).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=D&&C&&D.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=D&&C&&D.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Cb=process.nextTick;else if("function"==typeof d)Cb=d,Fb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;z.addEventListener?z.addEventListener("message",b,!1):z.attachEvent("onmessage",b,!1),Cb=function(a){var b=h++;g[b]=a,z.postMessage(f+b,"*")}}else if(z.MessageChannel){var i=new z.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Cb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in z&&"onreadystatechange"in z.document.createElement("script")?Cb=function(a){var b=z.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},z.document.documentElement.appendChild(b)}:(Cb=function(a){return setTimeout(a,0)},Fb=clearTimeout)}();var Gb=(Ab.timeout=function(){function a(a,b){var c=this,d=new xb,e=Cb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new sb(d,vb(function(){Fb(e)}))}function b(a,b,c){var d=this,e=Ab.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new xb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new sb(f,vb(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Ab(I,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return mb(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return wb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new xb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(Ab)),Hb=E.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return G(a)||(a=Db),new jc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Ib=Hb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Hb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Jb=Hb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Hb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Kb=Hb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Hb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Lb=E.internals.Enumerator=function(a){this._next=a};Lb.prototype.next=function(){return this._next()},Lb.prototype[P]=function(){return this};var Mb=E.internals.Enumerable=function(a){this._iterator=a};Mb.prototype[P]=function(){return this._iterator()},Mb.prototype.concat=function(){var a=this;return new jc(function(b){var c;try{c=a[P]()}catch(d){return void b.onError()}var e,f=new SerialDisposable,g=Db.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;M(h)&&(h=Yb(h));var i=new xb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new sb(f,g,vb(function(){e=!0}))})},Mb.prototype.catchException=function(){var a=this;return new jc(function(b){var c;try{c=a[P]()}catch(d){return void b.onError()}var e,f,g=new SerialDisposable,h=Db.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;M(i)&&(i=Yb(i));var j=new xb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new sb(g,h,vb(function(){e=!0}))})};var Nb=Mb.repeat=function(a,b){return null==b&&(b=-1),new Mb(function(){var c=b;return new Lb(function(){return 0===c?R:(c>0&&c--,{done:!1,value:a})})})},Ob=Mb.forEach=function(a,b,c){return b||(b=H),new Mb(function(){var d=-1;return new Lb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:R})})},Pb=E.Observer=function(){};Pb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Pb.prototype.asObserver=function(){return new Tb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Pb.prototype.checked=function(){return new Ub(this)};var Qb=Pb.create=function(a,b,c){return a||(a=F),b||(b=L),c||(c=F),new Tb(a,b,c)};Pb.fromNotifier=function(a){return new Tb(function(b){return a(Ib(b))},function(b){return a(Jb(b))},function(){return a(Kb())})},Pb.notifyOn=function(a){return new Wb(a,this)};var Rb,Sb=E.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return mb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Pb),Tb=E.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return mb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Sb),Ub=function(a){function b(b){a.call(this),this._observer=b,this._state=0}mb(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(Pb),Vb=E.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new SerialDisposable}return mb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Sb),Wb=function(a){function b(){a.apply(this,arguments)}return mb(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b}(Vb),Xb=E.Observable=function(){function a(a){this._subscribe=a}return Rb=a.prototype,Rb.subscribe=Rb.forEach=function(a,b,c){var d="object"==typeof a?a:Qb(a,b,c);return this._subscribe(d)},a}();Rb.observeOn=function(a){var b=this;return new jc(function(c){return b.subscribe(new Wb(a,c))})},Rb.subscribeOn=function(a){var b=this;return new jc(function(c){var d=new xb,e=new SerialDisposable;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var Yb=Xb.fromPromise=function(a){return Zb(function(){var b=new E.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};Rb.toPromise=function(a){if(a||(a=E.config.Promise),!a)throw new Error("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},function(a){c(a)},function(){e&&a(d)})})},Rb.toArray=function(){var a=this;return new jc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},Xb.create=Xb.createWithDisposable=function(a){return new jc(a)};var Zb=Xb.defer=function(a){return new jc(function(b){var c;try{c=a()}catch(d){return dc(d).subscribe(b)}return M(c)&&(c=Yb(c)),c.subscribe(b)})},$b=Xb.empty=function(a){return G(a)||(a=Db),new jc(function(b){return a.schedule(function(){b.onCompleted()})})},_b=Math.pow(2,53)-1;Xb.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!r(b))throw new Error("mapFn when provided must be a function");return G(d)||(d=Eb),new jc(function(e){var f=Object(a),g=o(f),h=g?0:q(f),i=g?f[P]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&r(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};var ac=Xb.fromArray=function(a,b){return G(b)||(b=Eb),new jc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};Xb.generate=function(a,b,c,d,e){return G(e)||(e=Eb),new jc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})};var bc=Xb.never=function(){return new jc(function(){return wb})};Xb.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return ac(b)};Xb.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return ac(c,a)};Xb.range=function(a,b,c){return G(c)||(c=Eb),new jc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Xb.repeat=function(a,b,c){return G(c)||(c=Eb),cc(a,c).repeat(null==b?-1:b)};var cc=Xb["return"]=Xb.returnValue=Xb.just=function(a,b){return G(b)||(b=Db),new jc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},dc=Xb["throw"]=Xb.throwException=function(a,b){return G(b)||(b=Db),new jc(function(c){return b.schedule(function(){c.onError(a)})})};Xb.using=function(a,b){return new jc(function(c){var d,e,f=wb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new sb(dc(g).subscribe(c),f)}return new sb(e.subscribe(c),f)})},Rb.amb=function(a){var b=this;return new jc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new xb,j=new xb;return M(a)&&(a=Yb(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new sb(i,j)})},Xb.amb=function(){function a(a,b){return a.amb(b)}for(var b=bc(),c=k(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Rb["catch"]=Rb.catchException=function(a){return"function"==typeof a?s(this,a):ec([this,a])};var ec=Xb.catchException=Xb["catch"]=function(){var a=k(arguments,0);return Ob(a).catchException()};Rb.combineLatest=function(){var a=lb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),fc.apply(this,a)};var fc=Xb.combineLatest=function(){var a=lb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new jc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(H))){try{d=b.apply(null,k)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(H)&&c.onCompleted()}function e(a){j[a]=!0,j.every(H)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=l(g,f),i=!1,j=l(g,f),k=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new xb;M(f)&&(f=Yb(f)),g.setDisposable(f.subscribe(function(a){k[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new sb(m)})};Rb.concat=function(){var a=lb.call(arguments,0);return a.unshift(this),gc.apply(this,a)};var gc=Xb.concat=function(){var a=k(arguments,0);return Ob(a).concat()};Rb.concatObservable=Rb.concatAll=function(){return this.merge(1)},Rb.merge=function(a){if("number"!=typeof a)return hc(this,a);var b=this;return new jc(function(c){function d(a){var b=new xb;f.add(b),M(a)&&(a=Yb(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new sb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var hc=Xb.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=lb.call(arguments,1)):(a=Db,b=lb.call(arguments,0)):(a=Db,b=lb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),ac(b,a).mergeObservable()};Rb.mergeObservable=Rb.mergeAll=function(){var a=this;return new jc(function(b){var c=new sb,d=!1,e=new xb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new xb;c.add(e),M(a)&&(a=Yb(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Rb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return ic([this,a])};var ic=Xb.onErrorResumeNext=function(){var a=k(arguments,0);return new jc(function(b){var c=0,d=new SerialDisposable,e=Db.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],M(f)&&(f=Yb(f)),g=new xb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),function(){e()},function(){e()}))):b.onCompleted()});return new sb(d,e)})};Rb.skipUntil=function(a){var b=this;return new jc(function(c){var d=!1,e=new sb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));M(a)&&(a=Yb(a));var f=new xb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Rb["switch"]=Rb.switchLatest=function(){var a=this;return new jc(function(b){var c=!1,d=new SerialDisposable,e=!1,f=0,g=a.subscribe(function(a){var g=new xb,h=++f;c=!0,d.setDisposable(g),M(a)&&(a=Yb(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new sb(g,d)})},Rb.takeUntil=function(a){var b=this;return new jc(function(c){return M(a)&&(a=Yb(a)),new sb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),F))})},Rb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=lb.call(arguments),c=b.pop();return b.unshift(a),new jc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(H)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=l(g,function(){return[]}),i=l(g,function(){return!1}),j=new Array(g),k=0;g>k;k++)!function(a){var c=b[a],g=new xb;M(c)&&(c=Yb(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(k);return new sb(j)})},Xb.zip=function(){var a=lb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Xb.zipArray=function(){var a=k(arguments,0);return new jc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(H))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(H)?void b.onCompleted():void 0}for(var e=a.length,f=l(e,function(){return[]}),g=l(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new xb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new sb(h);return j.add(vb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Rb.asObservable=function(){var a=this;return new jc(function(b){return a.subscribe(b)
2
- })},Rb.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},Rb.dematerialize=function(){var a=this;return new jc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Rb.distinctUntilChanged=function(a,b){var c=this;return a||(a=H),b||(b=J),new jc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Rb["do"]=Rb.doAction=Rb.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new jc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Rb["finally"]=Rb.finallyAction=function(a){var b=this;return new jc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return vb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Rb.ignoreElements=function(){var a=this;return new jc(function(b){return a.subscribe(F,b.onError.bind(b),b.onCompleted.bind(b))})},Rb.materialize=function(){var a=this;return new jc(function(b){return a.subscribe(function(a){b.onNext(Ib(a))},function(a){b.onNext(Jb(a)),b.onCompleted()},function(){b.onNext(Kb()),b.onCompleted()})})},Rb.repeat=function(a){return Nb(this,a).concat()},Rb.retry=function(a){return Nb(this,a).catchException()},Rb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new jc(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Rb.skipLast=function(a){var b=this;return new jc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Rb.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=Db,a=lb.call(arguments,c),Ob([ac(a,b),this]).concat()},Rb.takeLast=function(a){var b=this;return new jc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},Rb.takeLastBuffer=function(a){var b=this;return new jc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Rb.windowWithCount=function(a,b){var c=this;if(0>=a)throw new Error(N);if(1===arguments.length&&(b=a),0>=b)throw new Error(N);return new jc(function(d){var e=new xb,f=new yb(e),g=0,h=[],i=function(){var a=new mc;h.push(a),d.onNext(ob(a,f))};return i(),e.setDisposable(c.subscribe(function(c){for(var d,e=0,f=h.length;f>e;e++)h[e].onNext(c);var j=g-a+1;j>=0&&j%b===0&&(d=h.shift(),d.onCompleted()),g++,g%b===0&&i()},function(a){for(;h.length>0;)h.shift().onError(a);d.onError(a)},function(){for(;h.length>0;)h.shift().onCompleted();d.onCompleted()})),f})},Rb.selectConcat=Rb.concatMap=function(a,b,c){return b?this.concatMap(function(c,d){var e=a(c,d),f=M(e)?Yb(e):e;return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?u(this,a,c):u(this,function(){return a})},Rb.concatMapObserver=Rb.selectConcatObserver=function(a,b,c,d){var e=this;return new jc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=Yb(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=Yb(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=Yb(a)),f.onNext(a),f.onCompleted()})}).concatAll()},Rb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new jc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},w.prototype.push=function(a){var b=-1===v(this.set,a,this.comparer);return b&&this.set.push(a),b},Rb.distinct=function(a,b){var c=this;return b||(b=J),new jc(function(d){var e=new w(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},d.onError.bind(d),d.onCompleted.bind(d))})},Rb.select=Rb.map=function(a,b){var c=this;return new jc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Rb.pluck=function(a){return this.select(function(b){return b[a]})},Rb.flatMapObserver=Rb.selectManyObserver=function(a,b,c,d){var e=this;return new jc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=Yb(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=Yb(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=Yb(a)),f.onNext(a),f.onCompleted()})}).mergeAll()},Rb.selectMany=Rb.flatMap=function(a,b,c){return b?this.flatMap(function(c,d){var e=a(c,d),f=M(e)?Yb(e):e;return f.map(function(a){return b(c,a,d)})},c):"function"==typeof a?x(this,a,c):x(this,function(){return a})},Rb.selectSwitch=Rb.flatMapLatest=Rb.switchMap=function(a,b){return this.select(a,b).switchLatest()},Rb.skip=function(a){if(0>a)throw new Error(N);var b=this;return new jc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Rb.skipWhile=function(a,b){var c=this;return new jc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Rb.take=function(a,b){if(0>a)throw new Error(N);if(0===a)return $b(b);var c=this;return new jc(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Rb.takeWhile=function(a,b){var c=this;return new jc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Rb.where=Rb.filter=function(a,b){var c=this;return new jc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Rb.exclusive=function(){var a=this;return new jc(function(b){var c=!1,d=!1,e=new xb,f=new sb;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,M(a)&&(a=Yb(a));var e=new xb;f.add(e),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){f.remove(e),c=!1,d&&1===f.length&&b.onCompleted()}))}},b.onError.bind(b),function(){d=!0,c||1!==f.length||b.onCompleted()})),f})},Rb.exclusiveMap=function(a,b){var c=this;return new jc(function(d){var e=0,f=!1,g=!0,h=new xb,i=new sb;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new xb,i.add(innerSubscription),M(c)&&(c=Yb(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var jc=E.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?vb(a):wb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new kc(a);return Eb.scheduleRequired()?Eb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return mb(c,a),c}(Xb),kc=function(a){function b(b){a.call(this),this.observer=b,this.m=new xb}mb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Sb),lc=function(a,b){this.subject=a,this.observer=b};lc.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var mc=E.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),wb):(a.onCompleted(),wb):(this.observers.push(a),new lc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return mb(d,a),nb(d.prototype,Pb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new nc(a,b)},d}(Xb),nc=(E.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new lc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),wb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return mb(d,a),nb(d.prototype,Pb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(Xb),E.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return mb(b,a),nb(b.prototype,Pb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(Xb));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(z.Rx=E,define(function(){return E})):A&&B?C?(B.exports=E).Rx=E:A.Rx=E:z.Rx=E}).call(this);
1
+ (function(a){function b(){if(this.isDisposed)throw new Error(P)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;kb.nonEnumArgs&&a.length&&h(a)&&(a=mb.call(a));var d=kb.enumPrototypes&&"function"==typeof a,e=kb.enumErrorProps&&(a===eb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(kb.nonEnumShadows&&a!==fb){var g=a.constructor,i=-1,j=ib.length;if(a===(g&&g.prototype))var k=a===stringProto?ab:a===eb?X:bb.call(a),l=jb[k];for(;++i<j;)f=ib[i],l&&l[f]||!cb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?bb.call(a)==T:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=bb.call(a),l=bb.call(b);if(k==T&&(k=$),l==T&&(l=$),k!=l)return!1;switch(k){case V:case W:return+a==+b;case Z:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case _:case ab:return a==String(b)}var m=k==U;if(!m){if(k!=$||!kb.nodeClass&&(g(a)||g(b)))return!1;var n=!kb.argsObject&&h(a)?Object:a.constructor,o=!kb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||cb.call(a,"constructor")&&cb.call(b,"constructor")||N(n)&&n instanceof n&&N(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0;if(result=!0,c.push(a),d.push(b),m){if(p=a.length,q=b.length,result=q==p)for(;q--;){var r=b[q];if(!(result=i(a[q],r,c,d)))break}}else f(b,function(b,e,f){return cb.call(f,e)?(q++,result=cb.call(a,e)&&i(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return cb.call(c,b)?result=--q>-1:void 0});return c.pop(),d.pop(),result}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:mb.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function n(a){return"number"==typeof a&&z.isFinite(a)}function o(b){return b[Q]!==a}function p(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function q(a){var b=+a.length;return isNaN(b)?0:0!==b&&n(b)?(b=p(b)*Math.floor(Math.abs(b)),0>=b?0:b>dc?dc:b):b}function r(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function s(a,b){return new nc(function(c){var d=new xb,e=new yb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}M(f)&&(f=ac(f)),d=new xb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new nc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?ac(e):e}).concatAll()}function v(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function w(a){this.comparer=a,this.set=[]}function x(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?ac(e):e}).mergeObservable()}var y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z=y[typeof window]&&window||this,A=y[typeof exports]&&exports&&!exports.nodeType&&exports,B=y[typeof module]&&module&&!module.nodeType&&module,C=B&&B.exports===A&&A,D=y[typeof global]&&global;!D||D.global!==D&&D.window!==D||(z=D);var E={internals:{},config:{Promise:z.Promise},helpers:{}},F=E.helpers.noop=function(){},G=(E.helpers.notDefined=function(a){return"undefined"==typeof a},E.helpers.isScheduler=function(a){return a instanceof E.Scheduler}),H=E.helpers.identity=function(a){return a},I=(E.helpers.pluck=function(a){return function(b){return b[a]}},E.helpers.just=function(a){return function(){return a}},E.helpers.defaultNow=Date.now),J=E.helpers.defaultComparer=function(a,b){return lb(a,b)},K=E.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},L=(E.helpers.defaultKeySerializer=function(a){return a.toString()},E.helpers.defaultError=function(a){throw a}),M=E.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},N=(E.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},E.helpers.not=function(a){return!a},E.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==bb.call(a)}),a}()),O="Argument out of range",P="Object has been disposed",Q="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";z.Set&&"function"==typeof(new z.Set)["@@iterator"]&&(Q="@@iterator");var R,S={done:!0,value:a},T="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",X="[object Error]",Y="[object Function]",Z="[object Number]",$="[object Object]",_="[object RegExp]",ab="[object String]",bb=Object.prototype.toString,cb=Object.prototype.hasOwnProperty,db=bb.call(arguments)==T,eb=Error.prototype,fb=Object.prototype,gb=fb.propertyIsEnumerable;try{R=!(bb.call(document)==$&&!({toString:0}+""))}catch(hb){R=!0}var ib=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],jb={};jb[U]=jb[W]=jb[Z]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},jb[V]=jb[ab]={constructor:!0,toString:!0,valueOf:!0},jb[X]=jb[Y]=jb[_]={constructor:!0,toString:!0},jb[$]={constructor:!0};var kb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);kb.enumErrorProps=gb.call(eb,"message")||gb.call(eb,"name"),kb.enumPrototypes=gb.call(a,"prototype"),kb.nonEnumArgs=0!=c,kb.nonEnumShadows=!/valueOf/.test(b)}(1),db||(h=function(a){return a&&"object"==typeof a?cb.call(a,"callee"):!1});var lb=E.internals.isEqual=function(a,b){return i(a,b,[],[])},mb=Array.prototype.slice,nb=({}.hasOwnProperty,this.inherits=E.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),ob=E.internals.addProperties=function(a){for(var b=mb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},pb=E.internals.addRef=function(a,b){return new nc(function(c){return new sb(b.getDisposable(),a.subscribe(c))})};l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var qb=E.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},rb=qb.prototype;rb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},rb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},rb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},rb.peek=function(){return this.items[0].value},rb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},rb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},rb.enqueue=function(a){var b=this.length++;this.items[b]=new l(qb.count++,a),this.percolate(b)},rb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},qb.count=0;var sb=E.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},tb=sb.prototype;tb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},tb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},tb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},tb.toArray=function(){return this.disposables.slice(0)};var ub=E.Disposable=function(a){this.isDisposed=!1,this.action=a||F};ub.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var vb=ub.create=function(a){return new ub(a)},wb=ub.empty={dispose:F},xb=E.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),yb=E.SerialDisposable=xb,zb=E.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?wb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Ab=E.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||K,this.disposable=new xb};Ab.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ab.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Ab.prototype.isCancelled=function(){return this.disposable.isDisposed},Ab.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Bb=E.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),wb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=I,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Cb=Bb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new sb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),wb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new sb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),wb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Bb.prototype),function(){Bb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Bb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof z.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=z.setInterval(function(){d=c(d)},b);return vb(function(){z.clearInterval(e)})}}(Bb.prototype),function(a){a.catchError=a["catch"]=function(a){return new Kb(this,a)}}(Bb.prototype);var Db,Eb=(E.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new xb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Bb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Cb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Bb(I,a,b,c)}()),Fb=Bb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Bb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Bb.normalize(c),g=new Ab(this,b,d,f);if(e)e.enqueue(g);else{e=new qb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Bb(I,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Gb=F,Hb=function(){var a,b=F;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!z.setTimeout)throw new Error("No concurrency detected!");a=z.setTimeout,b=z.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Ib=Hb.setTimeout,Jb=Hb.clearTimeout;!function(){function a(){if(!z.postMessage||z.importScripts)return!1;var a=!1,b=z.onmessage;return z.onmessage=function(){a=!0},z.postMessage("","*"),z.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(bb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=D&&C&&D.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=D&&C&&D.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Db=process.nextTick;else if("function"==typeof d)Db=d,Gb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;z.addEventListener?z.addEventListener("message",b,!1):z.attachEvent("onmessage",b,!1),Db=function(a){var b=h++;g[b]=a,z.postMessage(f+b,"*")}}else if(z.MessageChannel){var i=new z.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Db=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in z&&"onreadystatechange"in z.document.createElement("script")?Db=function(a){var b=z.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},z.document.documentElement.appendChild(b)}:(Db=function(a){return Ib(a,0)},Gb=Jb)}();var Kb=(Bb.timeout=function(){function a(a,b){var c=this,d=new xb,e=Db(function(){d.isDisposed||d.setDisposable(b(c,a))});return new sb(d,vb(function(){Gb(e)}))}function b(a,b,c){var d=this,e=Bb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new xb,g=Ib(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new sb(f,vb(function(){Jb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Bb(I,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return nb(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return wb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new xb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(Bb)),Lb=E.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return G(a)||(a=Eb),new nc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Mb=Lb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Lb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Nb=Lb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Lb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Ob=Lb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Lb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Pb=E.internals.Enumerator=function(a){this._next=a};Pb.prototype.next=function(){return this._next()},Pb.prototype[Q]=function(){return this};var Qb=E.internals.Enumerable=function(a){this._iterator=a};Qb.prototype[Q]=function(){return this._iterator()},Qb.prototype.concat=function(){var a=this;return new nc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f=new yb,g=Eb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;M(h)&&(h=ac(h));var i=new xb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new sb(f,g,vb(function(){e=!0}))})},Qb.prototype.catchException=function(){var a=this;return new nc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f,g=new yb,h=Eb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;M(i)&&(i=ac(i));var j=new xb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new sb(g,h,vb(function(){e=!0}))})};var Rb=Qb.repeat=function(a,b){return null==b&&(b=-1),new Qb(function(){var c=b;return new Pb(function(){return 0===c?S:(c>0&&c--,{done:!1,value:a})})})},Sb=Qb.forEach=function(a,b,c){return b||(b=H),new Qb(function(){var d=-1;return new Pb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:S})})},Tb=E.Observer=function(){};Tb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Tb.prototype.asObserver=function(){return new Xb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Tb.prototype.checked=function(){return new Yb(this)};var Ub=Tb.create=function(a,b,c){return a||(a=F),b||(b=L),c||(c=F),new Xb(a,b,c)};Tb.fromNotifier=function(a){return new Xb(function(b){return a(Mb(b))},function(b){return a(Nb(b))},function(){return a(Ob())})},Tb.notifyOn=function(a){return new $b(a,this)};var Vb,Wb=E.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return nb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Tb),Xb=E.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return nb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Wb),Yb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}nb(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(Tb),Zb=E.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new yb}return nb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Wb),$b=function(a){function b(){a.apply(this,arguments)}return nb(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b}(Zb),_b=E.Observable=function(){function a(a){this._subscribe=a}return Vb=a.prototype,Vb.subscribe=Vb.forEach=function(a,b,c){var d="object"==typeof a?a:Ub(a,b,c);return this._subscribe(d)},a}();Vb.observeOn=function(a){var b=this;return new nc(function(c){return b.subscribe(new $b(a,c))})},Vb.subscribeOn=function(a){var b=this;return new nc(function(c){var d=new xb,e=new yb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var ac=_b.fromPromise=function(a){return bc(function(){var b=new E.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};Vb.toPromise=function(a){if(a||(a=E.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},Vb.toArray=function(){var a=this;return new nc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},_b.create=_b.createWithDisposable=function(a){return new nc(a)};var bc=_b.defer=function(a){return new nc(function(b){var c;try{c=a()}catch(d){return hc(d).subscribe(b)}return M(c)&&(c=ac(c)),c.subscribe(b)})},cc=_b.empty=function(a){return G(a)||(a=Eb),new nc(function(b){return a.schedule(function(){b.onCompleted()})})},dc=Math.pow(2,53)-1;_b.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!r(b))throw new Error("mapFn when provided must be a function");return G(d)||(d=Fb),new nc(function(e){var f=Object(a),g=o(f),h=g?0:q(f),i=g?f[Q]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&r(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};var ec=_b.fromArray=function(a,b){return G(b)||(b=Fb),new nc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};_b.generate=function(a,b,c,d,e){return G(e)||(e=Fb),new nc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})};var fc=_b.never=function(){return new nc(function(){return wb})};_b.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return ec(b)};_b.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return ec(c,a)};_b.range=function(a,b,c){return G(c)||(c=Fb),new nc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},_b.repeat=function(a,b,c){return G(c)||(c=Fb),gc(a,c).repeat(null==b?-1:b)};var gc=_b["return"]=_b.returnValue=_b.just=function(a,b){return G(b)||(b=Eb),new nc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},hc=_b["throw"]=_b.throwException=_b.throwError=function(a,b){return G(b)||(b=Eb),new nc(function(c){return b.schedule(function(){c.onError(a)})})};_b.using=function(a,b){return new nc(function(c){var d,e,f=wb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new sb(hc(g).subscribe(c),f)}return new sb(e.subscribe(c),f)})},Vb.amb=function(a){var b=this;return new nc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new xb,j=new xb;return M(a)&&(a=ac(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new sb(i,j)})},_b.amb=function(){function a(a,b){return a.amb(b)}for(var b=fc(),c=j(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Vb["catch"]=Vb.catchException=function(a){return"function"==typeof a?s(this,a):ic([this,a])};var ic=_b.catchException=_b["catch"]=function(){var a=j(arguments,0);return Sb(a).catchException()};Vb.combineLatest=function(){var a=mb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),jc.apply(this,a)};var jc=_b.combineLatest=function(){var a=mb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new nc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(H))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(H)&&c.onCompleted()}function e(a){j[a]=!0,j.every(H)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new xb;M(f)&&(f=ac(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new sb(m)})};Vb.concat=function(){var a=mb.call(arguments,0);return a.unshift(this),kc.apply(this,a)};var kc=_b.concat=function(){var a=j(arguments,0);return Sb(a).concat()};Vb.concatObservable=Vb.concatAll=function(){return this.merge(1)},Vb.merge=function(a){if("number"!=typeof a)return lc(this,a);var b=this;return new nc(function(c){function d(a){var b=new xb;f.add(b),M(a)&&(a=ac(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new sb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var lc=_b.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=mb.call(arguments,1)):(a=Eb,b=mb.call(arguments,0)):(a=Eb,b=mb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),ec(b,a).mergeObservable()};Vb.mergeObservable=Vb.mergeAll=function(){var a=this;return new nc(function(b){var c=new sb,d=!1,e=new xb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new xb;c.add(e),M(a)&&(a=ac(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Vb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return mc([this,a])};var mc=_b.onErrorResumeNext=function(){var a=j(arguments,0);return new nc(function(b){var c=0,d=new yb,e=Eb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],M(f)&&(f=ac(f)),g=new xb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new sb(d,e)})};Vb.skipUntil=function(a){var b=this;return new nc(function(c){var d=!1,e=new sb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));M(a)&&(a=ac(a));var f=new xb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Vb["switch"]=Vb.switchLatest=function(){var a=this;return new nc(function(b){var c=!1,d=new yb,e=!1,f=0,g=a.subscribe(function(a){var g=new xb,h=++f;c=!0,d.setDisposable(g),M(a)&&(a=ac(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new sb(g,d)})},Vb.takeUntil=function(a){var b=this;return new nc(function(c){return M(a)&&(a=ac(a)),new sb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),F))})},Vb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=mb.call(arguments),c=b.pop();return b.unshift(a),new nc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(H)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new xb;M(c)&&(c=ac(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new sb(j)})},_b.zip=function(){var a=mb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},_b.zipArray=function(){var a=j(arguments,0);return new nc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(H))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(H)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new xb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)
2
+ },b.onError.bind(b),function(){d(e)}))}(i);var j=new sb(h);return j.add(vb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Vb.asObservable=function(){return new nc(this.subscribe.bind(this))},Vb.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},Vb.dematerialize=function(){var a=this;return new nc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Vb.distinctUntilChanged=function(a,b){var c=this;return a||(a=H),b||(b=J),new nc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Vb["do"]=Vb.doAction=Vb.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new nc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Vb["finally"]=Vb.finallyAction=function(a){var b=this;return new nc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return vb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Vb.ignoreElements=function(){var a=this;return new nc(function(b){return a.subscribe(F,b.onError.bind(b),b.onCompleted.bind(b))})},Vb.materialize=function(){var a=this;return new nc(function(b){return a.subscribe(function(a){b.onNext(Mb(a))},function(a){b.onNext(Nb(a)),b.onCompleted()},function(){b.onNext(Ob()),b.onCompleted()})})},Vb.repeat=function(a){return Rb(this,a).concat()},Vb.retry=function(a){return Rb(this,a).catchException()},Vb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new nc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Vb.skipLast=function(a){var b=this;return new nc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Vb.startWith=function(){var a,b,c=0;return arguments.length&&G(arguments[0])?(b=arguments[0],c=1):b=Eb,a=mb.call(arguments,c),Sb([ec(a,b),this]).concat()},Vb.takeLast=function(a){var b=this;return new nc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},Vb.takeLastBuffer=function(a){var b=this;return new nc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Vb.windowWithCount=function(a,b){var c=this;if(0>=a)throw new Error(O);if(1===arguments.length&&(b=a),0>=b)throw new Error(O);return new nc(function(d){var e=new xb,f=new zb(e),g=0,h=[],i=function(){var a=new qc;h.push(a),d.onNext(pb(a,f))};return i(),e.setDisposable(c.subscribe(function(c){for(var d,e=0,f=h.length;f>e;e++)h[e].onNext(c);var j=g-a+1;j>=0&&j%b===0&&(d=h.shift(),d.onCompleted()),g++,g%b===0&&i()},function(a){for(;h.length>0;)h.shift().onError(a);d.onError(a)},function(){for(;h.length>0;)h.shift().onCompleted();d.onCompleted()})),f})},Vb.selectConcat=Vb.concatMap=function(a,b,c){return b?this.concatMap(function(c,d){var e=a(c,d),f=M(e)?ac(e):e;return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?u(this,a,c):u(this,function(){return a})},Vb.concatMapObserver=Vb.selectConcatObserver=function(a,b,c,d){var e=this;return new nc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=ac(a)),f.onNext(a),f.onCompleted()})}).concatAll()},Vb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new nc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},w.prototype.push=function(a){var b=-1===v(this.set,a,this.comparer);return b&&this.set.push(a),b},Vb.distinct=function(a,b){var c=this;return b||(b=J),new nc(function(d){var e=new w(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.select=Vb.map=function(a,b){var c=this;return new nc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.pluck=function(a){return this.map(function(b){return b[a]})},Vb.flatMapObserver=Vb.selectManyObserver=function(a,b,c,d){var e=this;return new nc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=ac(a)),f.onNext(a),f.onCompleted()})}).mergeAll()},Vb.selectMany=Vb.flatMap=function(a,b,c){return b?this.flatMap(function(c,d){var e=a(c,d),f=M(e)?ac(e):e;return f.map(function(a){return b(c,a,d)})},c):"function"==typeof a?x(this,a,c):x(this,function(){return a})},Vb.selectSwitch=Vb.flatMapLatest=Vb.switchMap=function(a,b){return this.select(a,b).switchLatest()},Vb.skip=function(a){if(0>a)throw new Error(O);var b=this;return new nc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Vb.skipWhile=function(a,b){var c=this;return new nc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.take=function(a,b){if(0>a)throw new RangeError(O);if(0===a)return cc(b);var c=this;return new nc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Vb.takeWhile=function(a,b){var c=this;return new nc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.where=Vb.filter=function(a,b){var c=this;return new nc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.exclusive=function(){var a=this;return new nc(function(b){var c=!1,d=!1,e=new xb,f=new sb;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,M(a)&&(a=ac(a));var e=new xb;f.add(e),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){f.remove(e),c=!1,d&&1===f.length&&b.onCompleted()}))}},b.onError.bind(b),function(){d=!0,c||1!==f.length||b.onCompleted()})),f})},Vb.exclusiveMap=function(a,b){var c=this;return new nc(function(d){var e=0,f=!1,g=!0,h=new xb,i=new sb;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new xb,i.add(innerSubscription),M(c)&&(c=ac(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var nc=E.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?vb(a):wb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new oc(a);return Fb.scheduleRequired()?Fb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return nb(c,a),c}(_b),oc=function(a){function b(b){a.call(this),this.observer=b,this.m=new xb}nb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Wb),pc=function(a,b){this.subject=a,this.observer=b};pc.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var qc=E.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),wb):(a.onCompleted(),wb):(this.observers.push(a),new pc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return nb(d,a),ob(d.prototype,Tb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new rc(a,b)},d}(_b),rc=(E.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new pc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),wb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return nb(d,a),ob(d.prototype,Tb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(_b),E.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return nb(b,a),ob(b.prototype,Tb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(_b));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(z.Rx=E,define(function(){return E})):A&&B?C?(B.exports=E).Rx=E:A.Rx=E:z.Rx=E}).call(this);