4 lines
54 KiB
JavaScript
4 lines
54 KiB
JavaScript
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
|
|
(function(a){function b(){if(this.isDisposed)throw new Error(db)}function c(a,b){if(eb&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(ib)){for(var c=[],e=b;e;e=e.source)e.stack&&c.unshift(e.stack);c.unshift(a.stack);var f=c.join("\n"+ib+"\n");a.stack=d(f)}}function d(a){for(var b=a.split("\n"),c=[],d=0,g=b.length;g>d;d++){var h=b[d];e(h)||f(h)||!h||c.push(h)}return c.join("\n")}function e(a){var b=h(a);if(!b)return!1;var c=b[0],d=b[1];return c===gb&&d>=hb&&Yc>=d}function f(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function g(){if(eb)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=h(c);if(!d)return;return gb=d[0],d[1]}}function h(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function i(a){var b=[];if(!Kb(a))return b;Jb.nonEnumArgs&&a.length&&Lb(a)&&(a=Nb.call(a));var c=Jb.enumPrototypes&&"function"==typeof a,d=Jb.enumErrorProps&&(a===Eb||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Jb.nonEnumShadows&&a!==Fb){var f=a.constructor,g=-1,h=qb;if(a===(f&&f.prototype))var i=a===Gb?Ab:a===Eb?vb:Bb.call(a),j=Ib[i];for(;++g<h;)e=pb[g],j&&j[e]||!Cb.call(a,e)||b.push(e)}return b}function j(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function k(a,b){return j(a,b,i)}function l(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function m(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=Bb.call(a),h=Bb.call(b);if(g==rb&&(g=yb),h==rb&&(h=yb),g!=h)return!1;switch(g){case tb:case ub:return+a==+b;case xb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case zb:case Ab:return a==String(b)}var i=g==sb;if(!i){if(g!=yb||!Jb.nodeClass&&(l(a)||l(b)))return!1;var j=!Jb.argsObject&&Lb(a)?Object:a.constructor,n=!Jb.argsObject&&Lb(b)?Object:b.constructor;if(!(j==n||Cb.call(a,"constructor")&&Cb.call(b,"constructor")||bb(j)&&j instanceof j&&bb(n)&&n instanceof n||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var o=c.length;o--;)if(c[o]==a)return d[o]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(o=a.length,p=b.length,q=p==o)for(;p--;){var r=b[p];if(!(q=m(a[p],r,c,d)))break}}else k(b,function(b,e,f){return Cb.call(f,e)?(p++,q=Cb.call(a,e)&&m(a[e],b,c,d)):void 0}),q&&k(a,function(a,b,c){return Cb.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function n(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:Nb.call(a)}function o(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function p(a,b){this.id=a,this.value=b}function q(){this._s=s}function r(){this._s=s,this._l=s.length,this._i=0}function t(a){this._a=a}function u(a){this._a=a,this._l=y(a),this._i=0}function v(a){return"number"==typeof a&&P.isFinite(a)}function w(b){var c,d=b[jb];if(!d&&"string"==typeof b)return c=new q(b),c[jb]();if(!d&&b.length!==a)return c=new t(b),c[jb]();if(!d)throw new TypeError("Object is not iterable");return b[jb]()}function x(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function y(a){var b=+a.length;return isNaN(b)?0:0!==b&&v(b)?(b=x(b)*Math.floor(Math.abs(b)),0>=b?0:b>zc?zc:b):b}function z(a,b){return W(a)||(a=cc),new Qc(function(c){var d=0,e=b.length;return a.scheduleRecursive(function(a){e>d?(c.onNext(b[d++]),a()):c.onCompleted()})})}function A(a,b){return new Qc(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)}ab(f)&&(f=Jc(f)),d=new Xb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e},a)}function B(a,b){var c=this;return new Qc(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()},function(a){d.onError(a)},function(){d.onCompleted()})},c)}function C(a,b,c){var d=ob(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return ab(e)&&(e=Jc(e)),(mb(e)||lb(e))&&(e=Ac(e)),e}).concatAll()}function D(a,b,c){var d=ob(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return ab(e)&&(e=Jc(e)),(mb(e)||lb(e))&&(e=Ac(e)),e}).mergeAll()}function E(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),Vb(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function F(a,b,c){var d=new Sb;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(F(a.item(e),b,c));else a&&d.add(E(a,b,c));return d}function G(a,b){return new Qc(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function H(a,b,c){return new Qc(function(d){var e=0,f=a,g=_b(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 I(a,b){return new Qc(function(c){return b.scheduleWithRelative(_b(a),function(){c.onNext(0),c.onCompleted()})})}function J(a,b,c){return a===b?new Qc(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):xc(function(){return H(c.now()+a,b,c)})}function K(a,b,c){return new Qc(function(d){var e,f=!1,g=new Yb,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 Xb,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 Sb(e,g)},a)}function L(a,b,c){return xc(function(){return K(a,b-c.now(),c)})}function M(a,b){return new Qc(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new Sb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))},a)}function N(a,b,c){return new Qc(function(d){function e(a,b){j[b]=a;var e;if(g[b]=!0,h||(h=g.every(X))){if(f)return void d.onError(f);try{e=c.apply(null,j)}catch(k){return void d.onError(k)}d.onNext(e)}i&&j[1]&&d.onCompleted()}var f,g=[!1,!1],h=!1,i=!1,j=new Array(2);return new Sb(a.subscribe(function(a){e(a,0)},function(a){j[1]?d.onError(a):f=a},function(){i=!0,j[1]&&d.onCompleted()}),b.subscribe(function(a){e(a,1)},function(a){d.onError(a)},function(){i=!0,e(!0,1)}))},a)}var O={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},P=O[typeof window]&&window||this,Q=O[typeof exports]&&exports&&!exports.nodeType&&exports,R=O[typeof module]&&module&&!module.nodeType&&module,S=R&&R.exports===Q&&Q,T=O[typeof global]&&global;!T||T.global!==T&&T.window!==T||(P=T);var U={internals:{},config:{Promise:P.Promise},helpers:{}},V=U.helpers.noop=function(){},W=(U.helpers.notDefined=function(a){return"undefined"==typeof a},U.helpers.isScheduler=function(a){return a instanceof U.Scheduler}),X=U.helpers.identity=function(a){return a},Y=(U.helpers.pluck=function(a){return function(b){return b[a]}},U.helpers.just=function(a){return function(){return a}},U.helpers.defaultNow=Date.now),Z=U.helpers.defaultComparer=function(a,b){return Mb(a,b)},$=U.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},_=(U.helpers.defaultKeySerializer=function(a){return a.toString()},U.helpers.defaultError=function(a){throw a}),ab=U.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},bb=(U.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},U.helpers.not=function(a){return!a},U.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}()),cb="Argument out of range",db="Object has been disposed";U.config.longStackSupport=!1;var eb=!1;try{throw new Error}catch(fb){eb=!!fb.stack}var gb,hb=g(),ib="From previous event:",jb="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";P.Set&&"function"==typeof(new P.Set)["@@iterator"]&&(jb="@@iterator");var kb=U.doneEnumerator={done:!0,value:a},lb=U.helpers.isIterable=function(b){return b[jb]!==a},mb=U.helpers.isArrayLike=function(b){return b&&b.length!==a};U.helpers.iterator=jb;var nb,ob=U.internals.bindCallback=function(a,b,c){if("undefined"==typeof b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}},pb=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],qb=pb.length,rb="[object Arguments]",sb="[object Array]",tb="[object Boolean]",ub="[object Date]",vb="[object Error]",wb="[object Function]",xb="[object Number]",yb="[object Object]",zb="[object RegExp]",Ab="[object String]",Bb=Object.prototype.toString,Cb=Object.prototype.hasOwnProperty,Db=Bb.call(arguments)==rb,Eb=Error.prototype,Fb=Object.prototype,Gb=String.prototype,Hb=Fb.propertyIsEnumerable;try{nb=!(Bb.call(document)==yb&&!({toString:0}+""))}catch(fb){nb=!0}var Ib={};Ib[sb]=Ib[ub]=Ib[xb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Ib[tb]=Ib[Ab]={constructor:!0,toString:!0,valueOf:!0},Ib[vb]=Ib[wb]=Ib[zb]={constructor:!0,toString:!0},Ib[yb]={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=Hb.call(Eb,"message")||Hb.call(Eb,"name"),Jb.enumPrototypes=Hb.call(a,"prototype"),Jb.nonEnumArgs=0!=c,Jb.nonEnumShadows=!/valueOf/.test(b)}(1);var Kb=U.internals.isObject=function(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1},Lb=function(a){return a&&"object"==typeof a?Bb.call(a)==rb:!1};Db||(Lb=function(a){return a&&"object"==typeof a?Cb.call(a,"callee"):!1});{var Mb=U.internals.isEqual=function(a,b){return m(a,b,[],[])},Nb=Array.prototype.slice,Ob=({}.hasOwnProperty,this.inherits=U.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),Pb=U.internals.addProperties=function(a){for(var b=Nb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}};U.internals.addRef=function(a,b){return new Qc(function(c){return new Sb(b.getDisposable(),a.subscribe(c))})}}p.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Qb=U.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 p(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=U.CompositeDisposable=function(){this.disposables=n(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=U.Disposable=function(a){this.isDisposed=!1,this.action=a||V};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:V},Xb=U.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=U.SerialDisposable=Xb,Zb=(U.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}(),U.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||$,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 $b=U.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=Y,a.normalize=function(a){return 0>a&&(a=0),a},a}(),_b=$b.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")})}}($b.prototype),function(){$b.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},$b.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof P.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=P.setInterval(function(){d=c(d)},b);return Vb(function(){P.clearInterval(e)})}}($b.prototype);var ac,bc=$b.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=this.now()+_b(b);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new $b(Y,a,b,c)}(),cc=$b.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-$b.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()+$b.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 $b(Y,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),dc=(U.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}(),V),ec=function(){var a,b=V;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!P.setTimeout)throw new Error("No concurrency detected!");a=P.setTimeout,b=P.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),fc=ec.setTimeout,gc=ec.clearTimeout;!function(){function a(){if(!P.postMessage||P.importScripts)return!1;var a=!1,b=P.onmessage;return P.onmessage=function(){a=!0},P.postMessage("","*"),P.onmessage=b,a}var b=RegExp("^"+String(Bb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),c="function"==typeof(c=T&&S&&T.setImmediate)&&!b.test(c)&&c,d="function"==typeof(d=T&&S&&T.clearImmediate)&&!b.test(d)&&d;if("function"==typeof c)ac=c,dc=d;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))ac=process.nextTick;else if(a()){var e="ms.rx.schedule"+Math.random(),f={},g=0,h=function(a){if("string"==typeof a.data&&a.data.substring(0,e.length)===e){var b=a.data.substring(e.length),c=f[b];c(),delete f[b]}};P.addEventListener?P.addEventListener("message",h,!1):P.attachEvent("onmessage",h,!1),ac=function(a){var b=g++;f[b]=a,P.postMessage(e+b,"*")}}else if(P.MessageChannel){var i=new P.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},ac=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in P&&"onreadystatechange"in P.document.createElement("script")?ac=function(a){var b=P.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},P.document.documentElement.appendChild(b)}:(ac=function(a){return fc(a,0)},dc=gc)}();var hc=$b.timeout=function(){function a(a,b){var c=this,d=new Xb,e=ac(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Sb(d,Vb(function(){dc(e)}))}function b(a,b,c){var d=this,e=$b.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Xb,g=fc(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Sb(f,Vb(function(){gc(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new $b(Y,a,b,c)}(),ic=U.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 W(a)||(a=bc),new Qc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),jc=ic.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 ic("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),kc=ic.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 ic("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),lc=ic.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new ic("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),mc=U.internals.Enumerator=function(a){this._next=a};mc.prototype.next=function(){return this._next()},mc.prototype[jb]=function(){return this};var nc=U.internals.Enumerable=function(a){this._iterator=a};nc.prototype[jb]=function(){return this._iterator()},nc.prototype.concat=function(){var a=this;return new Qc(function(b){var c;try{c=a[jb]()}catch(d){return void b.onError(d)}var e,f=new Yb,g=bc.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;ab(h)&&(h=Jc(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}))})},nc.prototype.catchError=function(){var a=this;return new Qc(function(b){var c;try{c=a[jb]()}catch(d){return void b.onError(d)}var e,f,g=new Yb,h=bc.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;ab(i)&&(i=Jc(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}))})},nc.prototype.catchErrorWhen=function(a){var b=this;return new Qc(function(c){var d,e=new Tc,f=a(e),g=new Tc,h=f.subscribe(g);try{d=b[jb]()}catch(i){return void c.onError(i)}var j,k,l=new Yb,m=bc.scheduleRecursive(function(a){if(!j){var b;try{b=d.next()}catch(f){return void c.onError(f)}if(b.done)return void(k?c.onError(k):c.onCompleted());var h=b.value;ab(h)&&(h=Jc(h));var i=new Xb,m=new Xb;l.setDisposable(new Sb(m,i)),i.setDisposable(h.subscribe(c.onNext.bind(c),function(b){m.setDisposable(g.subscribe(function(){a()},function(a){c.onError(a)},function(){c.onCompleted()})),e.onNext(b)},c.onCompleted.bind(c)))}});return new Sb(h,l,m,Vb(function(){j=!0}))})};var oc,pc=nc.repeat=function(a,b){return null==b&&(b=-1),new nc(function(){var c=b;return new mc(function(){return 0===c?kb:(c>0&&c--,{done:!1,value:a})})})},qc=nc.of=function(a,b,c){return b||(b=X),new nc(function(){var d=-1;return new mc(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:kb})})},rc=U.Observer=function(){},sc=rc.create=function(a,b,c){return a||(a=V),b||(b=_),c||(c=V),new uc(a,b,c)},tc=U.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return Ob(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}(rc),uc=U.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return Ob(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}(tc),vc=U.Observable=function(){function a(a){if(U.config.longStackSupport&&eb){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var d=this;this._subscribe=function(b){var e=b.onError.bind(b);return b.onError=function(a){c(a,d),e(a)},a.call(d,b)}}else this._subscribe=a}return oc=a.prototype,oc.subscribe=oc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:sc(a,b,c))},oc.subscribeOnNext=function(a,b){return this._subscribe(sc(2===arguments.length?function(c){a.call(b,c)}:a))},oc.subscribeOnError=function(a,b){return this._subscribe(sc(null,2===arguments.length?function(c){a.call(b,c)}:a))},oc.subscribeOnCompleted=function(a,b){return this._subscribe(sc(null,null,2===arguments.length?function(){a.call(b)}:a))},a}(),wc=U.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 Ob(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}(tc);oc.toArray=function(){var a=this;return new Qc(function(b){var c=[];return a.subscribe(function(a){c.push(a)},function(a){b.onError(a)},function(){b.onNext(c),b.onCompleted()})},a)},vc.create=vc.createWithDisposable=function(a,b){return new Qc(a,b)};var xc=vc.defer=function(a){return new Qc(function(b){var c;try{c=a()}catch(d){return Dc(d).subscribe(b)}return ab(c)&&(c=Jc(c)),c.subscribe(b)})},yc=vc.empty=function(a){return W(a)||(a=bc),new Qc(function(b){return a.schedule(function(){b.onCompleted()})})},zc=Math.pow(2,53)-1;q.prototype[jb]=function(){return new r(this._s)},r.prototype[jb]=function(){return this},r.prototype.next=function(){if(this._i<this._l){var a=this._s.charAt(this._i++);return{done:!1,value:a}}return kb},t.prototype[jb]=function(){return new u(this._a)},u.prototype[jb]=function(){return this},u.prototype.next=function(){if(this._i<this._l){var a=this._a[this._i++];return{done:!1,value:a}}return kb};{var Ac=vc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!bb(b))throw new Error("mapFn when provided must be a function");if(b)var e=ob(b,c,2);W(d)||(d=cc);var f=Object(a),g=w(f);return new Qc(function(a){var b=0;return d.scheduleRecursive(function(c){var d;try{d=g.next()}catch(f){return void a.onError(f)}if(d.done)return void a.onCompleted();var h=d.value;if(e)try{h=e(h,b)}catch(f){return void a.onError(f)}a.onNext(h),b++,c()})})},Bc=vc.fromArray=function(a,b){return W(b)||(b=cc),new Qc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};vc.never=function(){return new Qc(function(){return Wb})}}vc.of=function(){return z(null,arguments)},vc.ofWithScheduler=function(a){return z(a,Nb.call(arguments,1))},vc.pairs=function(a,b){return b||(b=U.Scheduler.currentThread),new Qc(function(c){var d=0,e=Object.keys(a),f=e.length;return b.scheduleRecursive(function(b){if(f>d){var g=e[d++];c.onNext([g,a[g]]),b()}else c.onCompleted()})})},vc.range=function(a,b,c){return W(c)||(c=cc),new Qc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},vc.repeat=function(a,b,c){return W(c)||(c=cc),Cc(a,c).repeat(null==b?-1:b)};var Cc=vc["return"]=vc.just=function(a,b){return W(b)||(b=bc),new Qc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})};vc.returnValue=function(){return Cc.apply(null,arguments)};var Dc=vc["throw"]=vc.throwError=function(a,b){return W(b)||(b=bc),new Qc(function(c){return b.schedule(function(){c.onError(a)})})};vc.throwException=function(){return vc.throwError.apply(null,arguments)},oc["catch"]=oc.catchError=function(a){return"function"==typeof a?A(this,a):Ec([this,a])},oc.catchException=function(a){return this.catchError(a)};var Ec=vc.catchError=vc["catch"]=function(){return qc(n(arguments,0)).catchError()};vc.catchException=function(){return Ec.apply(null,arguments)},oc.combineLatest=function(){var a=Nb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Fc.apply(this,a)};var Fc=vc.combineLatest=function(){var a=Nb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Qc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(X))){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(X)&&c.onCompleted()}function e(a){j[a]=!0,j.every(X)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=o(g,f),i=!1,j=o(g,f),k=new Array(g),l=new Array(g),m=0;g>m;m++)!function(b){var f=a[b],g=new Xb;ab(f)&&(f=Jc(f)),g.setDisposable(f.subscribe(function(a){k[b]=a,d(b)},function(a){c.onError(a)},function(){e(b)})),l[b]=g}(m);return new Sb(l)},this)};oc.concat=function(){var a=Nb.call(arguments,0);return a.unshift(this),Gc.apply(this,a)};var Gc=vc.concat=function(){return qc(n(arguments,0)).concat()};oc.concatAll=function(){return this.merge(1)},oc.concatObservable=function(){return this.merge(1)},oc.merge=function(a){if("number"!=typeof a)return Hc(this,a);var b=this;return new Qc(function(c){function d(a){var b=new Xb;f.add(b),ab(a)&&(a=Jc(a)),b.setDisposable(a.subscribe(function(a){c.onNext(a)},function(a){c.onError(a)},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)},function(a){c.onError(a)},function(){g=!0,0===e&&c.onCompleted()})),f},b)};var Hc=vc.merge=function(){var a,b;return arguments[0]?W(arguments[0])?(a=arguments[0],b=Nb.call(arguments,1)):(a=bc,b=Nb.call(arguments,0)):(a=bc,b=Nb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),z(a,b).mergeAll()};oc.mergeAll=function(){var a=this;return new Qc(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),ab(a)&&(a=Jc(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},function(a){b.onError(a)},function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},function(a){b.onError(a)},function(){d=!0,1===c.length&&b.onCompleted()})),c},a)},oc.mergeObservable=function(){return this.mergeAll.apply(this,arguments)},oc.skipUntil=function(a){var b=this;return new Qc(function(c){var d=!1,e=new Sb(b.subscribe(function(a){d&&c.onNext(a)},function(a){c.onError(a)},function(){d&&c.onCompleted()}));ab(a)&&(a=Jc(a));var f=new Xb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},function(a){c.onError(a)},function(){f.dispose()})),e},b)},oc["switch"]=oc.switchLatest=function(){var a=this;return new Qc(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),ab(a)&&(a=Jc(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)},a)},oc.takeUntil=function(a){var b=this;return new Qc(function(c){return ab(a)&&(a=Jc(a)),new Sb(b.subscribe(c),a.subscribe(function(){c.onCompleted()
|
|
},function(a){c.onError(a)},V))},b)},oc.withLatestFrom=function(){var a=this,b=Nb.call(arguments),c=b.pop();if("undefined"==typeof a)throw new Error("Source observable not found for withLatestFrom().");if("function"!=typeof c)throw new Error("withLatestFrom() expects a resultSelector function.");return Array.isArray(b[0])&&(b=b[0]),new Qc(function(d){for(var e=function(){return!1},f=b.length,g=o(f,e),h=!1,i=new Array(f),j=new Array(f+1),k=0;f>k;k++)!function(a){var c=b[a],e=new Xb;ab(c)&&(c=Jc(c)),e.setDisposable(c.subscribe(function(b){i[a]=b,g[a]=!0,h=g.every(X)},d.onError.bind(d),function(){})),j[a]=e}(k);var l=new Xb;return l.setDisposable(a.subscribe(function(a){var b,e=[a].concat(i);if(h){try{b=c.apply(null,e)}catch(f){return void d.onError(f)}d.onNext(b)}},d.onError.bind(d),function(){d.onCompleted()})),j[f]=l,new Sb(j)},this)},oc.zip=function(){if(Array.isArray(arguments[0]))return B.apply(this,arguments);var a=this,b=Nb.call(arguments),c=b.pop();return b.unshift(a),new Qc(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(X)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=o(g,function(){return[]}),i=o(g,function(){return!1}),j=new Array(g),k=0;g>k;k++)!function(a){var c=b[a],g=new Xb;ab(c)&&(c=Jc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},function(a){d.onError(a)},function(){f(a)})),j[a]=g}(k);return new Sb(j)},a)},vc.zip=function(){var a=Nb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},vc.zipArray=function(){var a=n(arguments,0);return new Qc(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(X))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(X)?void b.onCompleted():void 0}for(var e=a.length,f=o(e,function(){return[]}),g=o(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)},function(a){b.onError(a)},function(){d(e)}))}(i);return new Sb(h)})},oc.asObservable=function(){var a=this;return new Qc(function(b){return a.subscribe(b)},this)},oc.dematerialize=function(){var a=this;return new Qc(function(b){return a.subscribe(function(a){return a.accept(b)},function(a){b.onError(a)},function(){b.onCompleted()})},this)},oc.distinctUntilChanged=function(a,b){var c=this;return a||(a=X),b||(b=Z),new Qc(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))},function(a){d.onError(a)},function(){d.onCompleted()})},this)},oc["do"]=oc.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=function(b){a.onNext(b)},b=function(b){a.onError(b)},c=function(){a.onCompleted()}),new Qc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})},this)},oc.doAction=function(){return this.tap.apply(this,arguments)},oc.doOnNext=oc.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},oc.doOnError=oc.tapOnError=function(a,b){return this.tap(V,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},oc.doOnCompleted=oc.tapOnCompleted=function(a,b){return this.tap(V,null,"undefined"!=typeof b?function(){a.call(b)}:a)},oc["finally"]=oc.ensure=function(a){var b=this;return new Qc(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()}})},this)},oc.finallyAction=function(a){return this.ensure(a)},oc.ignoreElements=function(){var a=this;return new Qc(function(b){return a.subscribe(V,function(a){b.onError(a)},function(){b.onCompleted()})},a)},oc.materialize=function(){var a=this;return new Qc(function(b){return a.subscribe(function(a){b.onNext(jc(a))},function(a){b.onNext(kc(a)),b.onCompleted()},function(){b.onNext(lc()),b.onCompleted()})},a)},oc.repeat=function(a){return pc(this,a).concat()},oc.retry=function(a){return pc(this,a).catchError()},oc.retryWhen=function(a){return pc(this).catchErrorWhen(a)},oc.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 Qc(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)},function(a){e.onError(a)},function(){!h&&c&&e.onNext(a),e.onCompleted()})},d)},oc.skipLast=function(a){var b=this;return new Qc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},function(a){c.onError(a)},function(){c.onCompleted()})},b)},oc.startWith=function(){var a,b,c=0;return arguments.length&&W(arguments[0])?(b=arguments[0],c=1):b=bc,a=Nb.call(arguments,c),qc([Bc(a,b),this]).concat()},oc.takeLast=function(a){var b=this;return new Qc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})},b)},oc.selectConcat=oc.concatMap=function(a,b,c){return bb(a)&&bb(b)?this.concatMap(function(c,d){var e=a(c,d);return ab(e)&&(e=Jc(e)),(mb(e)||lb(e))&&(e=Ac(e)),e.map(function(a,e){return b(c,a,d,e)})}):bb(a)?C(this,a,c):C(this,function(){return a})},oc.select=oc.map=function(a,b){var c=bb(a)?ob(a,b,3):function(){return a},d=this;return new Qc(function(a){var b=0;return d.subscribe(function(e){try{var f=c(e,b++,d)}catch(g){return void a.onError(g)}a.onNext(f)},function(b){a.onError(b)},function(){a.onCompleted()})},d)},oc.pluck=function(a){return this.map(function(b){return b[a]})},oc.selectMany=oc.flatMap=function(a,b,c){return bb(a)&&bb(b)?this.flatMap(function(c,d){var e=a(c,d);return ab(e)&&(e=Jc(e)),(mb(e)||lb(e))&&(e=Ac(e)),e.map(function(a,e){return b(c,a,d,e)})},c):bb(a)?D(this,a,c):D(this,function(){return a})},oc.selectSwitch=oc.flatMapLatest=oc.switchMap=function(a,b){return this.select(a,b).switchLatest()},oc.skip=function(a){if(0>a)throw new Error(cb);var b=this;return new Qc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},function(a){c.onError(a)},function(){c.onCompleted()})},b)},oc.skipWhile=function(a,b){var c=this,d=ob(a,b,3);return new Qc(function(a){var b=0,e=!1;return c.subscribe(function(f){if(!e)try{e=!d(f,b++,c)}catch(g){return void a.onError(g)}e&&a.onNext(f)},function(b){a.onError(b)},function(){a.onCompleted()})},c)},oc.take=function(a,b){if(0>a)throw new RangeError(cb);if(0===a)return yc(b);var c=this;return new Qc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},function(a){b.onError(a)},function(){b.onCompleted()})},c)},oc.takeWhile=function(a,b){var c=this,d=ob(a,b,3);return new Qc(function(a){var b=0,e=!0;return c.subscribe(function(f){if(e){try{e=d(f,b++,c)}catch(g){return void a.onError(g)}e?a.onNext(f):a.onCompleted()}},function(b){a.onError(b)},function(){a.onCompleted()})},c)},oc.where=oc.filter=function(a,b){var c=this;return a=ob(a,b,3),new Qc(function(b){var d=0;return c.subscribe(function(e){try{var f=a(e,d++,c)}catch(g){return void b.onError(g)}f&&b.onNext(e)},function(a){b.onError(a)},function(){b.onCompleted()})},c)},vc.fromCallback=function(a,b,c){return function(){var d=Nb.call(arguments,0);return new Qc(function(e){function f(){var a=arguments;if(c){try{a=c(a)}catch(b){return void e.onError(b)}e.onNext(a)}else a.length<=1?e.onNext.apply(e,a):e.onNext(a);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},vc.fromNodeCallback=function(a,b,c){return function(){var d=Nb.call(arguments,0);return new Qc(function(e){function f(a){if(a)return void e.onError(a);var b=Nb.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()}},U.config.useNativeEvents=!1,vc.fromEvent=function(a,b,c){if(a.addListener)return Ic(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c);if(!U.config.useNativeEvents){if("function"==typeof a.on&&"function"==typeof a.off)return Ic(function(c){a.on(b,c)},function(c){a.off(b,c)},c);if(P.Ember&&"function"==typeof P.Ember.addListener)return Ic(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},c)}return new Qc(function(d){return F(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 Ic=vc.fromEventPattern=function(a,b,c){return new Qc(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 Vb(function(){b&&b(e,f)})}).publish().refCount()},Jc=vc.fromPromise=function(a){return xc(function(){var b=new U.AsyncSubject;return a.then(function(a){b.onNext(a),b.onCompleted()},b.onError.bind(b)),b})};oc.toPromise=function(a){if(a||(a=U.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)})})},vc.startAsync=function(a){var b;try{b=a()}catch(c){return Dc(c)}return Jc(b)},oc.multicast=function(a,b){var c=this;return"function"==typeof a?new Qc(function(d){var e=c.multicast(a());return new Sb(b(e).subscribe(d),e.connect())},c):new Kc(c,a)},oc.publish=function(a){return a&&bb(a)?this.multicast(function(){return new Tc},a):this.multicast(new Tc)},oc.share=function(){return this.publish().refCount()},oc.publishLast=function(a){return a&&bb(a)?this.multicast(function(){return new Uc},a):this.multicast(new Uc)},oc.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Wc(b)},a):this.multicast(new Wc(a))},oc.shareValue=function(a){return this.publishValue(a).refCount()},oc.replay=function(a,b,c,d){return a&&bb(a)?this.multicast(function(){return new Xc(b,c,d)},a):this.multicast(new Xc(b,c,d))},oc.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};{var Kc=U.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new Sb(f.subscribe(c),Vb(function(){e=!1}))),d},a.call(this,function(a){return c.subscribe(a)})}return Ob(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new Qc(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(vc),Lc=vc.interval=function(a,b){return J(a,a,W(b)?b:hc)};vc.timer=function(b,c,d){var e;return W(d)||(d=hc),c!==a&&"number"==typeof c?e=c:W(c)&&(d=c),b instanceof Date&&e===a?G(b.getTime(),d):b instanceof Date&&e!==a?(e=c,H(b.getTime(),e,d)):e===a?I(b,d):J(b,e,d)}}oc.delay=function(a,b){return W(b)||(b=hc),a instanceof Date?L(this,a.getTime(),b):K(this,a,b)},oc.debounce=oc.throttleWithTimeout=function(a,b){W(b)||(b=hc);var c=this;return new Qc(function(d){var e,f=new Yb,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new Xb;f.setDisposable(j),j.setDisposable(b.scheduleWithRelative(a,function(){g&&h===i&&d.onNext(e),g=!1}))},function(a){f.dispose(),d.onError(a),g=!1,h++},function(){f.dispose(),g&&d.onNext(e),d.onCompleted(),g=!1,h++});return new Sb(i,f)},this)},oc.throttle=function(a,b){return this.debounce(a,b)},oc.timestamp=function(a){return W(a)||(a=hc),this.map(function(b){return{value:b,timestamp:a.now()}})},oc.sample=oc.throttleLatest=function(a,b){return W(b)||(b=hc),"number"==typeof a?M(this,Lc(a,b)):M(this,a)},oc.timeout=function(a,b,c){(null==b||"string"==typeof b)&&(b=Dc(new Error(b||"Timeout"))),W(c)||(c=hc);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new Qc(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(ab(b)&&(b=Jc(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new Xb,j=new Yb,k=!1,l=new Yb;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 Sb(j,l)},d)},oc.throttleFirst=function(a,b){W(b)||(b=hc);var c=+a||0;if(0>=c)throw new RangeError("windowDuration cannot be less or equal zero.");var d=this;return new Qc(function(a){var e=0;return d.subscribe(function(d){var f=b.now();(0===e||f-e>=c)&&(e=f,a.onNext(d))},function(b){a.onError(b)},function(){a.onCompleted()})},d)};var Mc=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=Wb,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=Wb)});return new Sb(c,d,e)}function c(c,d){this.source=c,this.controller=new Tc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b,c)}return Ob(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(vc);oc.pausable=function(a){return new Mc(this,a)};var Nc=function(b){function c(b){var c,d=[],e=N(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 Tc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,b.call(this,c,a)}return Ob(d,b),d.prototype.pause=function(){this.controller.onNext(!1)},d.prototype.resume=function(){this.controller.onNext(!0)},d}(vc);oc.pausableBuffered=function(a){return new Nc(this,a)};var Oc=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b,c),this.subject=new Pc(d),this.source=c.multicast(this.subject).refCount()}return Ob(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(vc),Pc=function(a){function b(a){return this.subject.subscribe(a)}function c(c){null==c&&(c=!0),a.call(this,b),this.subject=new Tc,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=Wb,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=Wb}return Ob(c,a),Pb(c.prototype,rc,{onCompleted:function(){this.hasCompleted=!0,(!this.enableQueue||0===this.queue.length)&&this.subject.onCompleted()},onError:function(a){this.hasFailed=!0,this.error=a,(!this.enableQueue||0===this.queue.length)&&this.subject.onError(a)},onNext:function(a){var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.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=Wb):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=Wb),{numberOfItems:a,returnValue:!1}},request:function(a){this.disposeCurrentRequest();var b=this,c=this._processRequest(a),a=c.numberOfItems;return c.returnValue?Wb:(this.requestedCount=a,this.requestedDisposable=Vb(function(){b.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=Wb}}),c}(vc);oc.controlled=function(a){return null==a&&(a=!0),new Oc(this,a)},oc.transduce=function(a){function b(a){return{init:function(){return a},step:function(a,b){return a.onNext(b)},result:function(a){return a.onCompleted()}}}var c=this;return new Qc(function(d){var e=a(b(d));return c.subscribe(function(a){try{e.step(d,a)}catch(b){d.onError(b)}},d.onError.bind(d),function(){e.result(d)})},c)};var Qc=U.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Vb(a):Wb}function c(d,e){function f(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new Rc(a);return cc.scheduleRequired()?cc.schedule(c):c(),e}return this.source=e,this instanceof c?void a.call(this,f):new c(d)}return Ob(c,a),c}(vc),Rc=function(a){function b(b){a.call(this),this.observer=b,this.m=new Xb}Ob(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.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(tc),Sc=function(a,b){this.subject=a,this.observer=b};Sc.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 Tc=U.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.hasError?(a.onError(this.error),Wb):(a.onCompleted(),Wb):(this.observers.push(a),new Sc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Ob(d,a),Pb(d.prototype,rc.prototype,{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.length=0}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.error=a,this.hasError=!0;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers.length=0}},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 Vc(a,b)},d}(vc),Uc=U.AsyncSubject=function(a){function c(a){return b.call(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),Wb):(this.observers.push(a),new Sc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Ob(d,a),Pb(d.prototype,rc,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c;if(b.call(this),!this.isStopped){this.isStopped=!0;var d=this.observers.slice(0),c=d.length;if(this.hasValue)for(a=0;c>a;a++){var e=d[a];e.onNext(this.value),e.onCompleted()}else for(a=0;c>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.hasError=!0,this.error=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers.length=0}},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}(vc),Vc=U.AnonymousSubject=function(a){function b(a){this.observable.subscribe(a)}function c(c,d){this.observer=c,this.observable=d,a.call(this,b)}return Ob(c,a),Pb(c.prototype,rc.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(vc),Wc=U.BehaviorSubject=function(a){function c(a){return b.call(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),Wb):(this.observers.push(a),a.onNext(this.value),new Sc(this,a))}function d(b){a.call(this,c),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return Ob(d,a),Pb(d.prototype,rc,{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.length=0}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onError(a);this.observers.length=0}},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}(vc),Xc=U.ReplaySubject=function(a){function c(a,b){return Vb(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function d(a){var d=new wc(this.scheduler,a),e=c(this,d);b.call(this),this._trim(this.scheduler.now()),this.observers.push(d);for(var f=0,g=this.q.length;g>f;f++)d.onNext(this.q[f].value);return this.hasError?d.onError(this.error):this.isStopped&&d.onCompleted(),d.ensureActive(),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||cc,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,d)}return Ob(e,a),Pb(e.prototype,rc.prototype,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){if(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}(vc);U.Pauser=function(a){function b(){a.call(this)}return Ob(b,a),b.prototype.pause=function(){this.onNext(!1)},b.prototype.resume=function(){this.onNext(!0)},b}(Tc),"function"==typeof define&&"object"==typeof define.amd&&define.amd?(P.Rx=U,define(function(){return U})):Q&&R?S?(R.exports=U).Rx=U:Q.Rx=U:P.Rx=U;var Yc=g()}).call(this);
|
|
//# sourceMappingURL=rx.lite.map
|