botframework-directlinejs
Advanced tools
Comparing version 0.6.4 to 0.7.0
@@ -61,3 +61,3 @@ // In order to keep file size down, only import the parts of rxjs that we use | ||
this.domain = "https://directline.botframework.com/v3/directline"; | ||
this.webSocket = false; | ||
this.webSocket = true; | ||
this.watermark = ''; | ||
@@ -64,0 +64,0 @@ this.secret = options.secret; |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.DirectLine=e():t.DirectLine=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){t.exports=r(25)},function(t,e,r){"use strict";var n=r(3),o=r(76),i=r(12),s=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=o.toSubscriber(t,e,r);if(n?n.call(i,this.source):i.add(this._subscribe(i)),i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype.forEach=function(t,e){var r=this;if(e||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?e=n.root.Rx.config.Promise:n.root.Promise&&(e=n.root.Promise)),!e)throw new Error("no Promise impl found");return new e(function(e,n){var o=r.subscribe(function(e){if(o)try{t(e)}catch(t){n(t),o.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[i.$$observable]=function(){return this},t.create=function(e){return new t(e)},t}();e.Observable=s},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(22),i=r(6),s=r(16),c=r(13),u=function(t){function e(r,n,o){switch(t.call(this),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=s.empty;break;case 1:if(!r){this.destination=s.empty;break}if("object"==typeof r){r instanceof e?(this.destination=r,this.destination.add(this)):(this.syncErrorThrowable=!0,this.destination=new a(this,r));break}default:this.syncErrorThrowable=!0,this.destination=new a(this,r,n,o)}}return n(e,t),e.prototype[c.$$rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e}(i.Subscription);e.Subscriber=u;var a=function(t){function e(e,r,n,i){t.call(this),this._parent=e;var s,c=this;o.isFunction(r)?s=r:r&&(c=r,s=r.next,n=r.error,i=r.complete,o.isFunction(c.unsubscribe)&&this.add(c.unsubscribe.bind(c)),c.unsubscribe=this.unsubscribe.bind(this)),this._context=c,this._next=s,this._error=n,this._complete=i}return n(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parent;e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parent;if(this._error)e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else{if(!e.syncErrorThrowable)throw this.unsubscribe(),t;e.syncErrorValue=t,e.syncErrorThrown=!0,this.unsubscribe()}}},e.prototype.complete=function(){if(!this.isStopped){var t=this._parent;this._complete?t.syncErrorThrowable?(this.__tryOrSetError(t,this._complete),this.unsubscribe()):(this.__tryOrUnsub(this._complete),this.unsubscribe()):this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){throw this.unsubscribe(),t}},e.prototype.__tryOrSetError=function(t,e,r){try{e.call(this._context,r)}catch(e){return t.syncErrorValue=e,t.syncErrorThrown=!0,!0}return!1},e.prototype._unsubscribe=function(){var t=this._parent;this._context=null,this._parent=null,t.unsubscribe()},e}(u)},function(t,e){(function(t){"use strict";if(e.root="object"==typeof window&&window.window===window&&window||"object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t,!e.root)throw new Error("RxJS could not find any global context (window, self, global)")}).call(e,function(){return this}())},function(t,e){"use strict";e.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(2),i=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,o){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(o.Subscriber);e.OuterSubscriber=i},function(t,e,r){"use strict";function n(t){return t.reduce(function(t,e){return t.concat(e instanceof h.UnsubscriptionError?e.errors:e)},[])}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(4),s=r(23),c=r(22),u=r(14),a=r(8),h=r(72),p=function(){function t(t){this.closed=!1,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){this.closed=!0;var r=this,o=r._unsubscribe,p=r._subscriptions;if(this._subscriptions=null,c.isFunction(o)){var l=u.tryCatch(o).call(this);l===a.errorObject&&(e=!0,t=t||(a.errorObject.e instanceof h.UnsubscriptionError?n(a.errorObject.e.errors):[a.errorObject.e]))}if(i.isArray(p))for(var f=-1,b=p.length;++f<b;){var d=p[f];if(s.isObject(d)){var l=u.tryCatch(d.unsubscribe).call(d);if(l===a.errorObject){e=!0,t=t||[];var y=a.errorObject.e;y instanceof h.UnsubscriptionError?t=t.concat(n(y.errors)):t.push(y)}}}if(e)throw new h.UnsubscriptionError(t)}},t.prototype.add=function(e){if(!e||e===t.EMPTY)return t.EMPTY;if(e===this)return this;var r=e;switch(typeof e){case"function":r=new t(e);case"object":if(r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var n=new l(r,this);return this._subscriptions=this._subscriptions||[],this._subscriptions.push(n),n},t.prototype.remove=function(e){if(null!=e&&e!==this&&e!==t.EMPTY){var r=this._subscriptions;if(r){var n=r.indexOf(e);n!==-1&&r.splice(n,1)}}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();e.Subscription=p;var l=function(t){function e(e,r){t.call(this),this._innerSub=e,this._parent=r}return o(e,t),e.prototype._unsubscribe=function(){var t=this,e=t._innerSub,r=t._parent;r.remove(this),e.unsubscribe()},e}(p);e.ChildSubscription=l},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(1),i=function(t){function e(e){t.call(this),this.scheduler=e}return n(e,t),e.create=function(t){return new e(t)},e.dispatch=function(t){var e=t.subscriber;e.complete()},e.prototype._subscribe=function(t){var r=this.scheduler;return r?r.schedule(e.dispatch,0,{subscriber:t}):void t.complete()},e}(o.Observable);e.EmptyObservable=i},function(t,e){"use strict";e.errorObject={e:{}}},function(t,e,r){"use strict";function n(t,e,r,n){var l=new h.InnerSubscriber(t,r,n);if(l.closed)return null;if(e instanceof u.Observable)return e._isScalar?(l.next(e.value),l.complete(),null):e.subscribe(l);if(i.isArray(e)){for(var f=0,b=e.length;f<b&&!l.closed;f++)l.next(e[f]);l.closed||l.complete()}else{if(s.isPromise(e))return e.then(function(t){l.closed||(l.next(t),l.complete())},function(t){return l.error(t)}).then(null,function(t){o.root.setTimeout(function(){throw t})}),l;if(e&&"function"==typeof e[a.$$iterator])for(var d=e[a.$$iterator]();;){var y=d.next();if(y.done){l.complete();break}if(l.next(y.value),l.closed)break}else if(e&&"function"==typeof e[p.$$observable]){var v=e[p.$$observable]();if("function"==typeof v.subscribe)return v.subscribe(new h.InnerSubscriber(t,r,n));l.error(new TypeError("Provided object does not correctly implement Symbol.observable"))}else{var w=c.isObject(e)?"an invalid object":"'"+e+"'",m="You provided "+w+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.";l.error(new TypeError(m))}}return null}var o=r(3),i=r(4),s=r(24),c=r(23),u=r(1),a=r(11),h=r(27),p=r(12);e.subscribeToResult=n},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(1),i=r(18),s=r(7),c=r(75),u=function(t){function e(e,r){t.call(this),this.array=e,this.scheduler=r,r||1!==e.length||(this._isScalar=!0,this.value=e[0])}return n(e,t),e.create=function(t,r){return new e(t,r)},e.of=function(){for(var t=[],r=0;r<arguments.length;r++)t[r-0]=arguments[r];var n=t[t.length-1];c.isScheduler(n)?t.pop():n=null;var o=t.length;return o>1?new e(t,n):1===o?new i.ScalarObservable(t[0],n):new s.EmptyObservable(n)},e.dispatch=function(t){var e=t.array,r=t.index,n=t.count,o=t.subscriber;return r>=n?void o.complete():(o.next(e[r]),void(o.closed||(t.index=r+1,this.schedule(t))))},e.prototype._subscribe=function(t){var r=0,n=this.array,o=n.length,i=this.scheduler;if(i)return i.schedule(e.dispatch,0,{array:n,index:r,count:o,subscriber:t});for(var s=0;s<o&&!t.closed;s++)t.next(n[s]);t.complete()},e}(o.Observable);e.ArrayObservable=u},function(t,e,r){"use strict";function n(t){var e=t.Symbol;if("function"==typeof e)return e.iterator||(e.iterator=e("iterator polyfill")),e.iterator;var r=t.Set;if(r&&"function"==typeof(new r)["@@iterator"])return"@@iterator";var n=t.Map;if(n)for(var o=Object.getOwnPropertyNames(n.prototype),i=0;i<o.length;++i){var s=o[i];if("entries"!==s&&"size"!==s&&n.prototype[s]===n.prototype.entries)return s}return"@@iterator"}var o=r(3);e.symbolIteratorPonyfill=n,e.$$iterator=n(o.root)},function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var o=r(3);e.getSymbolObservable=n,e.$$observable=n(o.root)},function(t,e,r){"use strict";var n=r(3),o=n.root.Symbol;e.$$rxSubscriber="function"==typeof o&&"function"==typeof o.for?o.for("rxSubscriber"):"@@rxSubscriber"},function(t,e,r){"use strict";function n(){try{return i.apply(this,arguments)}catch(t){return s.errorObject.e=t,s.errorObject}}function o(t){return i=t,n}var i,s=r(8);e.tryCatch=o},function(t,e,r){"use strict";var n=r(1),o=function(){function t(t,e,r){this.kind=t,this.value=e,this.error=r,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,r){var n=this.kind;switch(n){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return r&&r()}},t.prototype.accept=function(t,e,r){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,r)},t.prototype.toObservable=function(){var t=this.kind;switch(t){case"N":return n.Observable.of(this.value);case"E":return n.Observable.throw(this.error);case"C":return n.Observable.empty()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return"undefined"!=typeof e?new t("N",e):this.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return this.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();e.Notification=o},function(t,e){"use strict";e.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(1),i=r(2),s=r(6),c=r(21),u=r(29),a=r(13),h=function(t){function e(e){t.call(this,e),this.destination=e}return n(e,t),e}(i.Subscriber);e.SubjectSubscriber=h;var p=function(t){function e(){t.call(this),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}return n(e,t),e.prototype[a.$$rxSubscriber]=function(){return new h(this)},e.prototype.lift=function(t){var e=new l(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new c.ObjectUnsubscribedError;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].next(t)},e.prototype.error=function(t){if(this.closed)throw new c.ObjectUnsubscribedError;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new c.ObjectUnsubscribedError;this.isStopped=!0;for(var t=this.observers,e=t.length,r=t.slice(),n=0;n<e;n++)r[n].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._subscribe=function(t){if(this.closed)throw new c.ObjectUnsubscribedError;return this.hasError?(t.error(this.thrownError),s.Subscription.EMPTY):this.isStopped?(t.complete(),s.Subscription.EMPTY):(this.observers.push(t),new u.SubjectSubscription(this,t))},e.prototype.asObservable=function(){var t=new o.Observable;return t.source=this,t},e.create=function(t,e){return new l(t,e)},e}(o.Observable);e.Subject=p;var l=function(t){function e(e,r){t.call(this),this.destination=e,this.source=r}return n(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){var e=this.source;return e?this.source.subscribe(t):s.Subscription.EMPTY},e}(p);e.AnonymousSubject=l},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(1),i=function(t){function e(e,r){t.call(this),this.value=e,this.scheduler=r,this._isScalar=!0,r&&(this._isScalar=!1)}return n(e,t),e.create=function(t,r){return new e(t,r)},e.dispatch=function(t){var e=t.done,r=t.value,n=t.subscriber;return e?void n.complete():(n.next(r),void(n.closed||(t.done=!0,this.schedule(t))))},e.prototype._subscribe=function(t){var r=this.value,n=this.scheduler;return n?n.schedule(e.dispatch,0,{done:!1,value:r,subscriber:t}):(t.next(r),void(t.closed||t.complete()))},e}(o.Observable);e.ScalarObservable=i},function(t,e,r){"use strict";function n(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new s(t,e))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(2);e.map=n;var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.project,this.thisArg))},t}();e.MapOperator=s;var c=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return o(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},function(t,e,r){"use strict";var n=r(69),o=r(70);e.async=new o.AsyncScheduler(n.AsyncAction)},function(t,e){"use strict";var r=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},n=function(t){function e(){var e=t.call(this,"object unsubscribed");this.name=e.name="ObjectUnsubscribedError",this.stack=e.stack,this.message=e.message}return r(e,t),e}(Error);e.ObjectUnsubscribedError=n},function(t,e){"use strict";function r(t){return"function"==typeof t}e.isFunction=r},function(t,e){"use strict";function r(t){return null!=t&&"object"==typeof t}e.isObject=r},function(t,e){"use strict";function r(t){return t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}e.isPromise=r},function(t,e,r){"use strict";var n=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]]);return r},o=r(26),i=r(1);r(35),r(36),r(37),r(38),r(39),r(40),r(41),r(42),r(43),r(44),r(45),r(30),r(31),r(32),r(33),r(34);var s;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Connecting=1]="Connecting",t[t.Online=2]="Online",t[t.ExpiredToken=3]="ExpiredToken",t[t.FailedToConnect=4]="FailedToConnect",t[t.Ended=5]="Ended"}(s=e.ConnectionStatus||(e.ConnectionStatus={}));var c=18e5,u=c/2,a=2e4,h=(c-u)/a,p=new Error("expired token"),l=new Error("conversation ended"),f=new Error("failed to connect"),b={log:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];"undefined"!=typeof window&&window.botchatDebug&&t&&console.log.apply(console,[t].concat(e))}},d=function(){function t(t){this.connectionStatus$=new o.BehaviorSubject(s.Uninitialized),this.domain="https://directline.botframework.com/v3/directline",this.webSocket=!1,this.watermark="",this.secret=t.secret,this.token=t.secret||t.token,t.domain&&(this.domain=t.domain),t.webSocket&&(this.webSocket=t.webSocket),this.activity$=this.webSocket&&void 0!==WebSocket?this.webSocketActivity$():this.pollingGetActivity$()}return t.prototype.checkConnection=function(t){var e=this;void 0===t&&(t=!1);var r=this.connectionStatus$.flatMap(function(t){return t===s.Uninitialized?(e.connectionStatus$.next(s.Connecting),e.startConversation().do(function(t){e.conversationId=t.conversationId,e.token=e.secret||t.token,e.streamUrl=t.streamUrl,e.secret||e.refreshTokenLoop(),e.connectionStatus$.next(s.Online)},function(t){e.connectionStatus$.next(s.FailedToConnect)}).mapTo(t)):i.Observable.of(t)}).filter(function(t){return t!=s.Uninitialized&&t!=s.Connecting}).flatMap(function(t){switch(t){case s.Ended:return i.Observable.throw(l);case s.FailedToConnect:return i.Observable.throw(f);case s.ExpiredToken:return i.Observable.throw(p);default:return i.Observable.of(null)}});return t?r.take(1):r},t.prototype.startConversation=function(){return i.Observable.ajax({method:"POST",url:this.domain+"/conversations",timeout:a,headers:{Accept:"application/json",Authorization:"Bearer "+this.token}}).map(function(t){return t.response}).retryWhen(function(t){return t.mergeMap(function(t){return t.status>=400&&t.status<600?i.Observable.throw(t):i.Observable.of(t)}).delay(a).take(h)})},t.prototype.refreshTokenLoop=function(){var t=this;this.tokenRefreshSubscription=i.Observable.interval(u).flatMap(function(e){return t.refreshToken()}).subscribe(function(e){b.log("refreshing token",e,"at",new Date),t.token=e})},t.prototype.refreshToken=function(){var t=this;return this.checkConnection(!0).flatMap(function(e){return i.Observable.ajax({method:"POST",url:t.domain+"/tokens/refresh",timeout:a,headers:{Authorization:"Bearer "+t.token}}).map(function(t){return t.response.token}).retryWhen(function(e){return e.mergeMap(function(e){return 403===e.status?(t.connectionStatus$.next(s.ExpiredToken),i.Observable.throw(e)):i.Observable.of(e)}).delay(a).take(h)})})},t.prototype.reconnect=function(t){this.token=t.token,this.streamUrl=t.streamUrl,this.connectionStatus$.getValue()===s.ExpiredToken&&this.connectionStatus$.next(s.Online)},t.prototype.end=function(){this.tokenRefreshSubscription&&this.tokenRefreshSubscription.unsubscribe(),this.connectionStatus$.next(s.Ended)},t.prototype.postActivity=function(t){var e=this;return"message"===t.type&&t.attachments&&t.attachments.length>0?this.postMessageWithAttachments(t):(b.log("postActivity",t),this.checkConnection(!0).flatMap(function(r){return i.Observable.ajax({method:"POST",url:e.domain+"/conversations/"+e.conversationId+"/activities",body:t,timeout:a,headers:{"Content-Type":"application/json",Authorization:"Bearer "+e.token}}).map(function(t){return t.response.id}).catch(function(t){return e.catchPostError(t)})}).catch(function(t){return e.catchExpiredToken(t)}))},t.prototype.postMessageWithAttachments=function(t){var e,r=this,o=t.attachments,s=n(t,["attachments"]);return this.checkConnection(!0).flatMap(function(t){return e=new FormData,e.append("activity",new Blob([JSON.stringify(s)],{type:"application/vnd.microsoft.activity"})),i.Observable.from(o||[]).flatMap(function(t){return i.Observable.ajax({method:"GET",url:t.contentUrl,responseType:"arraybuffer"}).do(function(r){return e.append("file",new Blob([r.response],{type:t.contentType}),t.name)})}).count()}).flatMap(function(n){return i.Observable.ajax({method:"POST",url:r.domain+"/conversations/"+r.conversationId+"/upload?userId="+t.from.id,body:e,timeout:a,headers:{Authorization:"Bearer "+r.token}}).map(function(t){return t.response.id}).catch(function(t){return r.catchPostError(t)})}).catch(function(t){return r.catchPostError(t)})},t.prototype.catchPostError=function(t){if(403===t.status)this.connectionStatus$.next(s.ExpiredToken);else if(t.status>=400&&t.status<500)return i.Observable.throw(t);return i.Observable.of("retry")},t.prototype.catchExpiredToken=function(t){return t===p?i.Observable.of("retry"):i.Observable.throw(t)},t.prototype.pollingGetActivity$=function(){var t=this;return i.Observable.interval(1e3).combineLatest(this.checkConnection()).flatMap(function(e){return i.Observable.ajax({method:"GET",url:t.domain+"/conversations/"+t.conversationId+"/activities?watermark="+t.watermark,timeout:a,headers:{Accept:"application/json",Authorization:"Bearer "+t.token}}).catch(function(e){return 403===e.status&&t.connectionStatus$.next(s.ExpiredToken),i.Observable.empty()}).map(function(t){return t.response}).flatMap(function(e){return t.observableFromActivityGroup(e)})}).catch(function(t){return i.Observable.empty()})},t.prototype.observableFromActivityGroup=function(t){return t.watermark&&(this.watermark=t.watermark),i.Observable.from(t.activities)},t.prototype.webSocketActivity$=function(){var t=this;return this.checkConnection().flatMap(function(e){return t.observableWebSocket().retryWhen(function(e){return e.mergeMap(function(e){return t.reconnectToConversation()})})}).flatMap(function(e){return t.observableFromActivityGroup(e)})},t.prototype.observableWebSocket=function(){var t=this;return i.Observable.create(function(e){b.log("creating WebSocket",t.streamUrl);var r,n=new WebSocket(t.streamUrl);return n.onopen=function(t){b.log("WebSocket open",t),r=i.Observable.interval(a).subscribe(function(t){return n.send(null)})},n.onclose=function(t){b.log("WebSocket close",t),r&&r.unsubscribe(),e.error(t)},n.onmessage=function(t){return t.data&&e.next(JSON.parse(t.data))},function(){0!==n.readyState&&1!==n.readyState||n.close()}})},t.prototype.reconnectToConversation=function(){var t=this;return this.checkConnection(!0).flatMap(function(e){return i.Observable.ajax({method:"GET",url:t.domain+"/conversations/"+t.conversationId+"?watermark="+t.watermark,timeout:a,headers:{Accept:"application/json",Authorization:"Bearer "+t.token}}).do(function(e){t.token=e.response.token,t.streamUrl=e.response.streamUrl}).mapTo(null).retryWhen(function(e){return e.mergeMap(function(e){return 403===e.status&&t.connectionStatus$.next(s.ExpiredToken),i.Observable.of(e)}).delay(a).take(h)})})},t}();e.DirectLine=d},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(17),i=r(21),s=function(t){function e(e){t.call(this),this._value=e}return n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new i.ObjectUnsubscribedError;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(o.Subject);e.BehaviorSubject=s},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(2),i=function(t){function e(e,r,n){t.call(this),this.parent=e,this.outerValue=r,this.outerIndex=n,this.index=0}return n(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(o.Subscriber);e.InnerSubscriber=i},function(t,e){"use strict";var r=function(){function t(e,r){void 0===r&&(r=t.now),this.SchedulerAction=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(r,e)},t.now=Date.now?Date.now:function(){return+new Date},t}();e.Scheduler=r},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(6),i=function(t){function e(e,r){t.call(this),this.subject=e,this.subscriber=r,this.closed=!1}return n(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var r=e.indexOf(this.subscriber);r!==-1&&e.splice(r,1)}}},e}(o.Subscription);e.SubjectSubscription=i},function(t,e,r){"use strict";var n=r(1),o=r(52);n.Observable.ajax=o.ajax},function(t,e,r){"use strict";var n=r(1),o=r(53);n.Observable.empty=o.empty},function(t,e,r){"use strict";var n=r(1),o=r(54);n.Observable.from=o.from},function(t,e,r){"use strict";var n=r(1),o=r(55);n.Observable.interval=o.interval},function(t,e,r){"use strict";var n=r(1),o=r(56);n.Observable.of=o.of},function(t,e,r){"use strict";var n=r(1),o=r(57);n.Observable.prototype.catch=o._catch,n.Observable.prototype._catch=o._catch},function(t,e,r){"use strict";var n=r(1),o=r(58);n.Observable.prototype.combineLatest=o.combineLatest},function(t,e,r){"use strict";var n=r(1),o=r(59);n.Observable.prototype.count=o.count},function(t,e,r){"use strict";var n=r(1),o=r(60);n.Observable.prototype.delay=o.delay},function(t,e,r){"use strict";var n=r(1),o=r(61);n.Observable.prototype.do=o._do,n.Observable.prototype._do=o._do},function(t,e,r){"use strict";var n=r(1),o=r(62);n.Observable.prototype.filter=o.filter},function(t,e,r){"use strict";var n=r(1),o=r(19);n.Observable.prototype.map=o.map},function(t,e,r){"use strict";var n=r(1),o=r(63);n.Observable.prototype.mapTo=o.mapTo},function(t,e,r){"use strict";var n=r(1),o=r(64);n.Observable.prototype.mergeMap=o.mergeMap,n.Observable.prototype.flatMap=o.mergeMap},function(t,e,r){"use strict";var n=r(1),o=r(66);n.Observable.prototype.retryWhen=o.retryWhen},function(t,e,r){"use strict";var n=r(1),o=r(67);n.Observable.prototype.take=o.take},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(1),i=r(18),s=r(7),c=function(t){function e(e,r){t.call(this),this.arrayLike=e,this.scheduler=r,r||1!==e.length||(this._isScalar=!0,this.value=e[0])}return n(e,t),e.create=function(t,r){var n=t.length;return 0===n?new s.EmptyObservable:1===n?new i.ScalarObservable(t[0],r):new e(t,r)},e.dispatch=function(t){var e=t.arrayLike,r=t.index,n=t.length,o=t.subscriber;if(!o.closed){if(r>=n)return void o.complete();o.next(e[r]),t.index=r+1,this.schedule(t)}},e.prototype._subscribe=function(t){var r=0,n=this,o=n.arrayLike,i=n.scheduler,s=o.length;if(i)return i.schedule(e.dispatch,0,{arrayLike:o,index:r,length:s,subscriber:t});for(var c=0;c<s&&!t.closed;c++)t.next(o[c]);t.complete()},e}(o.Observable);e.ArrayLikeObservable=c},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(4),i=r(24),s=r(50),c=r(49),u=r(10),a=r(46),h=r(11),p=r(1),l=r(65),f=r(12),b=function(t){return t&&"number"==typeof t.length},d=function(t){function e(e,r){t.call(this,null),this.ish=e,this.scheduler=r}return n(e,t),e.create=function(t,r){if(null!=t){if("function"==typeof t[f.$$observable])return t instanceof p.Observable&&!r?t:new e(t,r);if(o.isArray(t))return new u.ArrayObservable(t,r);if(i.isPromise(t))return new s.PromiseObservable(t,r);if("function"==typeof t[h.$$iterator]||"string"==typeof t)return new c.IteratorObservable(t,r);if(b(t))return new a.ArrayLikeObservable(t,r)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")},e.prototype._subscribe=function(t){var e=this.ish,r=this.scheduler;return null==r?e[f.$$observable]().subscribe(t):e[f.$$observable]().subscribe(new l.ObserveOnSubscriber(t,r,0))},e}(p.Observable);e.FromObservable=d},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(74),i=r(1),s=r(20),c=function(t){function e(e,r){void 0===e&&(e=0),void 0===r&&(r=s.async),t.call(this),this.period=e,this.scheduler=r,(!o.isNumeric(e)||e<0)&&(this.period=0),r&&"function"==typeof r.schedule||(this.scheduler=s.async)}return n(e,t),e.create=function(t,r){return void 0===t&&(t=0),void 0===r&&(r=s.async),new e(t,r)},e.dispatch=function(t){var e=t.index,r=t.subscriber,n=t.period;r.next(e),r.closed||(t.index+=1,this.schedule(t,n))},e.prototype._subscribe=function(t){var r=0,n=this.period,o=this.scheduler;t.add(o.schedule(e.dispatch,n,{index:r,subscriber:t,period:n}))},e}(i.Observable);e.IntervalObservable=c},function(t,e,r){"use strict";function n(t){var e=t[h.$$iterator];if(!e&&"string"==typeof t)return new l(t);if(!e&&void 0!==t.length)return new f(t);if(!e)throw new TypeError("object is not iterable");return t[h.$$iterator]()}function o(t){var e=+t.length;return isNaN(e)?0:0!==e&&i(e)?(e=s(e)*Math.floor(Math.abs(e)),e<=0?0:e>b?b:e):e}function i(t){return"number"==typeof t&&u.root.isFinite(t)}function s(t){var e=+t;return 0===e?e:isNaN(e)?e:e<0?-1:1}var c=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},u=r(3),a=r(1),h=r(11),p=function(t){function e(e,r){if(t.call(this),this.scheduler=r,null==e)throw new Error("iterator cannot be null.");this.iterator=n(e)}return c(e,t),e.create=function(t,r){return new e(t,r)}, | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.DirectLine=e():t.DirectLine=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){t.exports=r(25)},function(t,e,r){"use strict";var n=r(3),o=r(76),i=r(12),s=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=o.toSubscriber(t,e,r);if(n?n.call(i,this.source):i.add(this._subscribe(i)),i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype.forEach=function(t,e){var r=this;if(e||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?e=n.root.Rx.config.Promise:n.root.Promise&&(e=n.root.Promise)),!e)throw new Error("no Promise impl found");return new e(function(e,n){var o=r.subscribe(function(e){if(o)try{t(e)}catch(t){n(t),o.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[i.$$observable]=function(){return this},t.create=function(e){return new t(e)},t}();e.Observable=s},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(22),i=r(6),s=r(16),c=r(13),u=function(t){function e(r,n,o){switch(t.call(this),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=s.empty;break;case 1:if(!r){this.destination=s.empty;break}if("object"==typeof r){r instanceof e?(this.destination=r,this.destination.add(this)):(this.syncErrorThrowable=!0,this.destination=new a(this,r));break}default:this.syncErrorThrowable=!0,this.destination=new a(this,r,n,o)}}return n(e,t),e.prototype[c.$$rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e}(i.Subscription);e.Subscriber=u;var a=function(t){function e(e,r,n,i){t.call(this),this._parent=e;var s,c=this;o.isFunction(r)?s=r:r&&(c=r,s=r.next,n=r.error,i=r.complete,o.isFunction(c.unsubscribe)&&this.add(c.unsubscribe.bind(c)),c.unsubscribe=this.unsubscribe.bind(this)),this._context=c,this._next=s,this._error=n,this._complete=i}return n(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parent;e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parent;if(this._error)e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else{if(!e.syncErrorThrowable)throw this.unsubscribe(),t;e.syncErrorValue=t,e.syncErrorThrown=!0,this.unsubscribe()}}},e.prototype.complete=function(){if(!this.isStopped){var t=this._parent;this._complete?t.syncErrorThrowable?(this.__tryOrSetError(t,this._complete),this.unsubscribe()):(this.__tryOrUnsub(this._complete),this.unsubscribe()):this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){throw this.unsubscribe(),t}},e.prototype.__tryOrSetError=function(t,e,r){try{e.call(this._context,r)}catch(e){return t.syncErrorValue=e,t.syncErrorThrown=!0,!0}return!1},e.prototype._unsubscribe=function(){var t=this._parent;this._context=null,this._parent=null,t.unsubscribe()},e}(u)},function(t,e){(function(t){"use strict";if(e.root="object"==typeof window&&window.window===window&&window||"object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t,!e.root)throw new Error("RxJS could not find any global context (window, self, global)")}).call(e,function(){return this}())},function(t,e){"use strict";e.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(2),i=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype.notifyNext=function(t,e,r,n,o){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(o.Subscriber);e.OuterSubscriber=i},function(t,e,r){"use strict";function n(t){return t.reduce(function(t,e){return t.concat(e instanceof h.UnsubscriptionError?e.errors:e)},[])}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(4),s=r(23),c=r(22),u=r(14),a=r(8),h=r(72),p=function(){function t(t){this.closed=!1,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){this.closed=!0;var r=this,o=r._unsubscribe,p=r._subscriptions;if(this._subscriptions=null,c.isFunction(o)){var l=u.tryCatch(o).call(this);l===a.errorObject&&(e=!0,t=t||(a.errorObject.e instanceof h.UnsubscriptionError?n(a.errorObject.e.errors):[a.errorObject.e]))}if(i.isArray(p))for(var f=-1,b=p.length;++f<b;){var d=p[f];if(s.isObject(d)){var l=u.tryCatch(d.unsubscribe).call(d);if(l===a.errorObject){e=!0,t=t||[];var y=a.errorObject.e;y instanceof h.UnsubscriptionError?t=t.concat(n(y.errors)):t.push(y)}}}if(e)throw new h.UnsubscriptionError(t)}},t.prototype.add=function(e){if(!e||e===t.EMPTY)return t.EMPTY;if(e===this)return this;var r=e;switch(typeof e){case"function":r=new t(e);case"object":if(r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var n=new l(r,this);return this._subscriptions=this._subscriptions||[],this._subscriptions.push(n),n},t.prototype.remove=function(e){if(null!=e&&e!==this&&e!==t.EMPTY){var r=this._subscriptions;if(r){var n=r.indexOf(e);n!==-1&&r.splice(n,1)}}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();e.Subscription=p;var l=function(t){function e(e,r){t.call(this),this._innerSub=e,this._parent=r}return o(e,t),e.prototype._unsubscribe=function(){var t=this,e=t._innerSub,r=t._parent;r.remove(this),e.unsubscribe()},e}(p);e.ChildSubscription=l},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(1),i=function(t){function e(e){t.call(this),this.scheduler=e}return n(e,t),e.create=function(t){return new e(t)},e.dispatch=function(t){var e=t.subscriber;e.complete()},e.prototype._subscribe=function(t){var r=this.scheduler;return r?r.schedule(e.dispatch,0,{subscriber:t}):void t.complete()},e}(o.Observable);e.EmptyObservable=i},function(t,e){"use strict";e.errorObject={e:{}}},function(t,e,r){"use strict";function n(t,e,r,n){var l=new h.InnerSubscriber(t,r,n);if(l.closed)return null;if(e instanceof u.Observable)return e._isScalar?(l.next(e.value),l.complete(),null):e.subscribe(l);if(i.isArray(e)){for(var f=0,b=e.length;f<b&&!l.closed;f++)l.next(e[f]);l.closed||l.complete()}else{if(s.isPromise(e))return e.then(function(t){l.closed||(l.next(t),l.complete())},function(t){return l.error(t)}).then(null,function(t){o.root.setTimeout(function(){throw t})}),l;if(e&&"function"==typeof e[a.$$iterator])for(var d=e[a.$$iterator]();;){var y=d.next();if(y.done){l.complete();break}if(l.next(y.value),l.closed)break}else if(e&&"function"==typeof e[p.$$observable]){var v=e[p.$$observable]();if("function"==typeof v.subscribe)return v.subscribe(new h.InnerSubscriber(t,r,n));l.error(new TypeError("Provided object does not correctly implement Symbol.observable"))}else{var w=c.isObject(e)?"an invalid object":"'"+e+"'",m="You provided "+w+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.";l.error(new TypeError(m))}}return null}var o=r(3),i=r(4),s=r(24),c=r(23),u=r(1),a=r(11),h=r(27),p=r(12);e.subscribeToResult=n},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(1),i=r(18),s=r(7),c=r(75),u=function(t){function e(e,r){t.call(this),this.array=e,this.scheduler=r,r||1!==e.length||(this._isScalar=!0,this.value=e[0])}return n(e,t),e.create=function(t,r){return new e(t,r)},e.of=function(){for(var t=[],r=0;r<arguments.length;r++)t[r-0]=arguments[r];var n=t[t.length-1];c.isScheduler(n)?t.pop():n=null;var o=t.length;return o>1?new e(t,n):1===o?new i.ScalarObservable(t[0],n):new s.EmptyObservable(n)},e.dispatch=function(t){var e=t.array,r=t.index,n=t.count,o=t.subscriber;return r>=n?void o.complete():(o.next(e[r]),void(o.closed||(t.index=r+1,this.schedule(t))))},e.prototype._subscribe=function(t){var r=0,n=this.array,o=n.length,i=this.scheduler;if(i)return i.schedule(e.dispatch,0,{array:n,index:r,count:o,subscriber:t});for(var s=0;s<o&&!t.closed;s++)t.next(n[s]);t.complete()},e}(o.Observable);e.ArrayObservable=u},function(t,e,r){"use strict";function n(t){var e=t.Symbol;if("function"==typeof e)return e.iterator||(e.iterator=e("iterator polyfill")),e.iterator;var r=t.Set;if(r&&"function"==typeof(new r)["@@iterator"])return"@@iterator";var n=t.Map;if(n)for(var o=Object.getOwnPropertyNames(n.prototype),i=0;i<o.length;++i){var s=o[i];if("entries"!==s&&"size"!==s&&n.prototype[s]===n.prototype.entries)return s}return"@@iterator"}var o=r(3);e.symbolIteratorPonyfill=n,e.$$iterator=n(o.root)},function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var o=r(3);e.getSymbolObservable=n,e.$$observable=n(o.root)},function(t,e,r){"use strict";var n=r(3),o=n.root.Symbol;e.$$rxSubscriber="function"==typeof o&&"function"==typeof o.for?o.for("rxSubscriber"):"@@rxSubscriber"},function(t,e,r){"use strict";function n(){try{return i.apply(this,arguments)}catch(t){return s.errorObject.e=t,s.errorObject}}function o(t){return i=t,n}var i,s=r(8);e.tryCatch=o},function(t,e,r){"use strict";var n=r(1),o=function(){function t(t,e,r){this.kind=t,this.value=e,this.error=r,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,r){var n=this.kind;switch(n){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return r&&r()}},t.prototype.accept=function(t,e,r){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,r)},t.prototype.toObservable=function(){var t=this.kind;switch(t){case"N":return n.Observable.of(this.value);case"E":return n.Observable.throw(this.error);case"C":return n.Observable.empty()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return"undefined"!=typeof e?new t("N",e):this.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return this.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();e.Notification=o},function(t,e){"use strict";e.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(1),i=r(2),s=r(6),c=r(21),u=r(29),a=r(13),h=function(t){function e(e){t.call(this,e),this.destination=e}return n(e,t),e}(i.Subscriber);e.SubjectSubscriber=h;var p=function(t){function e(){t.call(this),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}return n(e,t),e.prototype[a.$$rxSubscriber]=function(){return new h(this)},e.prototype.lift=function(t){var e=new l(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new c.ObjectUnsubscribedError;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].next(t)},e.prototype.error=function(t){if(this.closed)throw new c.ObjectUnsubscribedError;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,r=e.length,n=e.slice(),o=0;o<r;o++)n[o].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new c.ObjectUnsubscribedError;this.isStopped=!0;for(var t=this.observers,e=t.length,r=t.slice(),n=0;n<e;n++)r[n].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._subscribe=function(t){if(this.closed)throw new c.ObjectUnsubscribedError;return this.hasError?(t.error(this.thrownError),s.Subscription.EMPTY):this.isStopped?(t.complete(),s.Subscription.EMPTY):(this.observers.push(t),new u.SubjectSubscription(this,t))},e.prototype.asObservable=function(){var t=new o.Observable;return t.source=this,t},e.create=function(t,e){return new l(t,e)},e}(o.Observable);e.Subject=p;var l=function(t){function e(e,r){t.call(this),this.destination=e,this.source=r}return n(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){var e=this.source;return e?this.source.subscribe(t):s.Subscription.EMPTY},e}(p);e.AnonymousSubject=l},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(1),i=function(t){function e(e,r){t.call(this),this.value=e,this.scheduler=r,this._isScalar=!0,r&&(this._isScalar=!1)}return n(e,t),e.create=function(t,r){return new e(t,r)},e.dispatch=function(t){var e=t.done,r=t.value,n=t.subscriber;return e?void n.complete():(n.next(r),void(n.closed||(t.done=!0,this.schedule(t))))},e.prototype._subscribe=function(t){var r=this.value,n=this.scheduler;return n?n.schedule(e.dispatch,0,{done:!1,value:r,subscriber:t}):(t.next(r),void(t.closed||t.complete()))},e}(o.Observable);e.ScalarObservable=i},function(t,e,r){"use strict";function n(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new s(t,e))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(2);e.map=n;var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.project,this.thisArg))},t}();e.MapOperator=s;var c=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return o(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},function(t,e,r){"use strict";var n=r(69),o=r(70);e.async=new o.AsyncScheduler(n.AsyncAction)},function(t,e){"use strict";var r=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},n=function(t){function e(){var e=t.call(this,"object unsubscribed");this.name=e.name="ObjectUnsubscribedError",this.stack=e.stack,this.message=e.message}return r(e,t),e}(Error);e.ObjectUnsubscribedError=n},function(t,e){"use strict";function r(t){return"function"==typeof t}e.isFunction=r},function(t,e){"use strict";function r(t){return null!=t&&"object"==typeof t}e.isObject=r},function(t,e){"use strict";function r(t){return t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}e.isPromise=r},function(t,e,r){"use strict";var n=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]]);return r},o=r(26),i=r(1);r(35),r(36),r(37),r(38),r(39),r(40),r(41),r(42),r(43),r(44),r(45),r(30),r(31),r(32),r(33),r(34);var s;!function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Connecting=1]="Connecting",t[t.Online=2]="Online",t[t.ExpiredToken=3]="ExpiredToken",t[t.FailedToConnect=4]="FailedToConnect",t[t.Ended=5]="Ended"}(s=e.ConnectionStatus||(e.ConnectionStatus={}));var c=18e5,u=c/2,a=2e4,h=(c-u)/a,p=new Error("expired token"),l=new Error("conversation ended"),f=new Error("failed to connect"),b={log:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];"undefined"!=typeof window&&window.botchatDebug&&t&&console.log.apply(console,[t].concat(e))}},d=function(){function t(t){this.connectionStatus$=new o.BehaviorSubject(s.Uninitialized),this.domain="https://directline.botframework.com/v3/directline",this.webSocket=!0,this.watermark="",this.secret=t.secret,this.token=t.secret||t.token,t.domain&&(this.domain=t.domain),t.webSocket&&(this.webSocket=t.webSocket),this.activity$=this.webSocket&&void 0!==WebSocket?this.webSocketActivity$():this.pollingGetActivity$()}return t.prototype.checkConnection=function(t){var e=this;void 0===t&&(t=!1);var r=this.connectionStatus$.flatMap(function(t){return t===s.Uninitialized?(e.connectionStatus$.next(s.Connecting),e.startConversation().do(function(t){e.conversationId=t.conversationId,e.token=e.secret||t.token,e.streamUrl=t.streamUrl,e.secret||e.refreshTokenLoop(),e.connectionStatus$.next(s.Online)},function(t){e.connectionStatus$.next(s.FailedToConnect)}).mapTo(t)):i.Observable.of(t)}).filter(function(t){return t!=s.Uninitialized&&t!=s.Connecting}).flatMap(function(t){switch(t){case s.Ended:return i.Observable.throw(l);case s.FailedToConnect:return i.Observable.throw(f);case s.ExpiredToken:return i.Observable.throw(p);default:return i.Observable.of(null)}});return t?r.take(1):r},t.prototype.startConversation=function(){return i.Observable.ajax({method:"POST",url:this.domain+"/conversations",timeout:a,headers:{Accept:"application/json",Authorization:"Bearer "+this.token}}).map(function(t){return t.response}).retryWhen(function(t){return t.mergeMap(function(t){return t.status>=400&&t.status<600?i.Observable.throw(t):i.Observable.of(t)}).delay(a).take(h)})},t.prototype.refreshTokenLoop=function(){var t=this;this.tokenRefreshSubscription=i.Observable.interval(u).flatMap(function(e){return t.refreshToken()}).subscribe(function(e){b.log("refreshing token",e,"at",new Date),t.token=e})},t.prototype.refreshToken=function(){var t=this;return this.checkConnection(!0).flatMap(function(e){return i.Observable.ajax({method:"POST",url:t.domain+"/tokens/refresh",timeout:a,headers:{Authorization:"Bearer "+t.token}}).map(function(t){return t.response.token}).retryWhen(function(e){return e.mergeMap(function(e){return 403===e.status?(t.connectionStatus$.next(s.ExpiredToken),i.Observable.throw(e)):i.Observable.of(e)}).delay(a).take(h)})})},t.prototype.reconnect=function(t){this.token=t.token,this.streamUrl=t.streamUrl,this.connectionStatus$.getValue()===s.ExpiredToken&&this.connectionStatus$.next(s.Online)},t.prototype.end=function(){this.tokenRefreshSubscription&&this.tokenRefreshSubscription.unsubscribe(),this.connectionStatus$.next(s.Ended)},t.prototype.postActivity=function(t){var e=this;return"message"===t.type&&t.attachments&&t.attachments.length>0?this.postMessageWithAttachments(t):(b.log("postActivity",t),this.checkConnection(!0).flatMap(function(r){return i.Observable.ajax({method:"POST",url:e.domain+"/conversations/"+e.conversationId+"/activities",body:t,timeout:a,headers:{"Content-Type":"application/json",Authorization:"Bearer "+e.token}}).map(function(t){return t.response.id}).catch(function(t){return e.catchPostError(t)})}).catch(function(t){return e.catchExpiredToken(t)}))},t.prototype.postMessageWithAttachments=function(t){var e,r=this,o=t.attachments,s=n(t,["attachments"]);return this.checkConnection(!0).flatMap(function(t){return e=new FormData,e.append("activity",new Blob([JSON.stringify(s)],{type:"application/vnd.microsoft.activity"})),i.Observable.from(o||[]).flatMap(function(t){return i.Observable.ajax({method:"GET",url:t.contentUrl,responseType:"arraybuffer"}).do(function(r){return e.append("file",new Blob([r.response],{type:t.contentType}),t.name)})}).count()}).flatMap(function(n){return i.Observable.ajax({method:"POST",url:r.domain+"/conversations/"+r.conversationId+"/upload?userId="+t.from.id,body:e,timeout:a,headers:{Authorization:"Bearer "+r.token}}).map(function(t){return t.response.id}).catch(function(t){return r.catchPostError(t)})}).catch(function(t){return r.catchPostError(t)})},t.prototype.catchPostError=function(t){if(403===t.status)this.connectionStatus$.next(s.ExpiredToken);else if(t.status>=400&&t.status<500)return i.Observable.throw(t);return i.Observable.of("retry")},t.prototype.catchExpiredToken=function(t){return t===p?i.Observable.of("retry"):i.Observable.throw(t)},t.prototype.pollingGetActivity$=function(){var t=this;return i.Observable.interval(1e3).combineLatest(this.checkConnection()).flatMap(function(e){return i.Observable.ajax({method:"GET",url:t.domain+"/conversations/"+t.conversationId+"/activities?watermark="+t.watermark,timeout:a,headers:{Accept:"application/json",Authorization:"Bearer "+t.token}}).catch(function(e){return 403===e.status&&t.connectionStatus$.next(s.ExpiredToken),i.Observable.empty()}).map(function(t){return t.response}).flatMap(function(e){return t.observableFromActivityGroup(e)})}).catch(function(t){return i.Observable.empty()})},t.prototype.observableFromActivityGroup=function(t){return t.watermark&&(this.watermark=t.watermark),i.Observable.from(t.activities)},t.prototype.webSocketActivity$=function(){var t=this;return this.checkConnection().flatMap(function(e){return t.observableWebSocket().retryWhen(function(e){return e.mergeMap(function(e){return t.reconnectToConversation()})})}).flatMap(function(e){return t.observableFromActivityGroup(e)})},t.prototype.observableWebSocket=function(){var t=this;return i.Observable.create(function(e){b.log("creating WebSocket",t.streamUrl);var r,n=new WebSocket(t.streamUrl);return n.onopen=function(t){b.log("WebSocket open",t),r=i.Observable.interval(a).subscribe(function(t){return n.send(null)})},n.onclose=function(t){b.log("WebSocket close",t),r&&r.unsubscribe(),e.error(t)},n.onmessage=function(t){return t.data&&e.next(JSON.parse(t.data))},function(){0!==n.readyState&&1!==n.readyState||n.close()}})},t.prototype.reconnectToConversation=function(){var t=this;return this.checkConnection(!0).flatMap(function(e){return i.Observable.ajax({method:"GET",url:t.domain+"/conversations/"+t.conversationId+"?watermark="+t.watermark,timeout:a,headers:{Accept:"application/json",Authorization:"Bearer "+t.token}}).do(function(e){t.token=e.response.token,t.streamUrl=e.response.streamUrl}).mapTo(null).retryWhen(function(e){return e.mergeMap(function(e){return 403===e.status&&t.connectionStatus$.next(s.ExpiredToken),i.Observable.of(e)}).delay(a).take(h)})})},t}();e.DirectLine=d},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(17),i=r(21),s=function(t){function e(e){t.call(this),this._value=e}return n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return r&&!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new i.ObjectUnsubscribedError;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(o.Subject);e.BehaviorSubject=s},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(2),i=function(t){function e(e,r,n){t.call(this),this.parent=e,this.outerValue=r,this.outerIndex=n,this.index=0}return n(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(o.Subscriber);e.InnerSubscriber=i},function(t,e){"use strict";var r=function(){function t(e,r){void 0===r&&(r=t.now),this.SchedulerAction=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(r,e)},t.now=Date.now?Date.now:function(){return+new Date},t}();e.Scheduler=r},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(6),i=function(t){function e(e,r){t.call(this),this.subject=e,this.subscriber=r,this.closed=!1}return n(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var r=e.indexOf(this.subscriber);r!==-1&&e.splice(r,1)}}},e}(o.Subscription);e.SubjectSubscription=i},function(t,e,r){"use strict";var n=r(1),o=r(52);n.Observable.ajax=o.ajax},function(t,e,r){"use strict";var n=r(1),o=r(53);n.Observable.empty=o.empty},function(t,e,r){"use strict";var n=r(1),o=r(54);n.Observable.from=o.from},function(t,e,r){"use strict";var n=r(1),o=r(55);n.Observable.interval=o.interval},function(t,e,r){"use strict";var n=r(1),o=r(56);n.Observable.of=o.of},function(t,e,r){"use strict";var n=r(1),o=r(57);n.Observable.prototype.catch=o._catch,n.Observable.prototype._catch=o._catch},function(t,e,r){"use strict";var n=r(1),o=r(58);n.Observable.prototype.combineLatest=o.combineLatest},function(t,e,r){"use strict";var n=r(1),o=r(59);n.Observable.prototype.count=o.count},function(t,e,r){"use strict";var n=r(1),o=r(60);n.Observable.prototype.delay=o.delay},function(t,e,r){"use strict";var n=r(1),o=r(61);n.Observable.prototype.do=o._do,n.Observable.prototype._do=o._do},function(t,e,r){"use strict";var n=r(1),o=r(62);n.Observable.prototype.filter=o.filter},function(t,e,r){"use strict";var n=r(1),o=r(19);n.Observable.prototype.map=o.map},function(t,e,r){"use strict";var n=r(1),o=r(63);n.Observable.prototype.mapTo=o.mapTo},function(t,e,r){"use strict";var n=r(1),o=r(64);n.Observable.prototype.mergeMap=o.mergeMap,n.Observable.prototype.flatMap=o.mergeMap},function(t,e,r){"use strict";var n=r(1),o=r(66);n.Observable.prototype.retryWhen=o.retryWhen},function(t,e,r){"use strict";var n=r(1),o=r(67);n.Observable.prototype.take=o.take},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(1),i=r(18),s=r(7),c=function(t){function e(e,r){t.call(this),this.arrayLike=e,this.scheduler=r,r||1!==e.length||(this._isScalar=!0,this.value=e[0])}return n(e,t),e.create=function(t,r){var n=t.length;return 0===n?new s.EmptyObservable:1===n?new i.ScalarObservable(t[0],r):new e(t,r)},e.dispatch=function(t){var e=t.arrayLike,r=t.index,n=t.length,o=t.subscriber;if(!o.closed){if(r>=n)return void o.complete();o.next(e[r]),t.index=r+1,this.schedule(t)}},e.prototype._subscribe=function(t){var r=0,n=this,o=n.arrayLike,i=n.scheduler,s=o.length;if(i)return i.schedule(e.dispatch,0,{arrayLike:o,index:r,length:s,subscriber:t});for(var c=0;c<s&&!t.closed;c++)t.next(o[c]);t.complete()},e}(o.Observable);e.ArrayLikeObservable=c},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(4),i=r(24),s=r(50),c=r(49),u=r(10),a=r(46),h=r(11),p=r(1),l=r(65),f=r(12),b=function(t){return t&&"number"==typeof t.length},d=function(t){function e(e,r){t.call(this,null),this.ish=e,this.scheduler=r}return n(e,t),e.create=function(t,r){if(null!=t){if("function"==typeof t[f.$$observable])return t instanceof p.Observable&&!r?t:new e(t,r);if(o.isArray(t))return new u.ArrayObservable(t,r);if(i.isPromise(t))return new s.PromiseObservable(t,r);if("function"==typeof t[h.$$iterator]||"string"==typeof t)return new c.IteratorObservable(t,r);if(b(t))return new a.ArrayLikeObservable(t,r)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")},e.prototype._subscribe=function(t){var e=this.ish,r=this.scheduler;return null==r?e[f.$$observable]().subscribe(t):e[f.$$observable]().subscribe(new l.ObserveOnSubscriber(t,r,0))},e}(p.Observable);e.FromObservable=d},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(74),i=r(1),s=r(20),c=function(t){function e(e,r){void 0===e&&(e=0),void 0===r&&(r=s.async),t.call(this),this.period=e,this.scheduler=r,(!o.isNumeric(e)||e<0)&&(this.period=0),r&&"function"==typeof r.schedule||(this.scheduler=s.async)}return n(e,t),e.create=function(t,r){return void 0===t&&(t=0),void 0===r&&(r=s.async),new e(t,r)},e.dispatch=function(t){var e=t.index,r=t.subscriber,n=t.period;r.next(e),r.closed||(t.index+=1,this.schedule(t,n))},e.prototype._subscribe=function(t){var r=0,n=this.period,o=this.scheduler;t.add(o.schedule(e.dispatch,n,{index:r,subscriber:t,period:n}))},e}(i.Observable);e.IntervalObservable=c},function(t,e,r){"use strict";function n(t){var e=t[h.$$iterator];if(!e&&"string"==typeof t)return new l(t);if(!e&&void 0!==t.length)return new f(t);if(!e)throw new TypeError("object is not iterable");return t[h.$$iterator]()}function o(t){var e=+t.length;return isNaN(e)?0:0!==e&&i(e)?(e=s(e)*Math.floor(Math.abs(e)),e<=0?0:e>b?b:e):e}function i(t){return"number"==typeof t&&u.root.isFinite(t)}function s(t){var e=+t;return 0===e?e:isNaN(e)?e:e<0?-1:1}var c=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},u=r(3),a=r(1),h=r(11),p=function(t){function e(e,r){if(t.call(this),this.scheduler=r,null==e)throw new Error("iterator cannot be null.");this.iterator=n(e)}return c(e,t),e.create=function(t,r){return new e(t,r)}, | ||
e.dispatch=function(t){var e=t.index,r=t.hasError,n=t.iterator,o=t.subscriber;if(r)return void o.error(t.error);var i=n.next();return i.done?void o.complete():(o.next(i.value),t.index=e+1,o.closed?void("function"==typeof n.return&&n.return()):void this.schedule(t))},e.prototype._subscribe=function(t){var r=0,n=this,o=n.iterator,i=n.scheduler;if(i)return i.schedule(e.dispatch,0,{index:r,iterator:o,subscriber:t});for(;;){var s=o.next();if(s.done){t.complete();break}if(t.next(s.value),t.closed){"function"==typeof o.return&&o.return();break}}},e}(a.Observable);e.IteratorObservable=p;var l=function(){function t(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length),this.str=t,this.idx=e,this.len=r}return t.prototype[h.$$iterator]=function(){return this},t.prototype.next=function(){return this.idx<this.len?{done:!1,value:this.str.charAt(this.idx++)}:{done:!0,value:void 0}},t}(),f=function(){function t(t,e,r){void 0===e&&(e=0),void 0===r&&(r=o(t)),this.arr=t,this.idx=e,this.len=r}return t.prototype[h.$$iterator]=function(){return this},t.prototype.next=function(){return this.idx<this.len?{done:!1,value:this.arr[this.idx++]}:{done:!0,value:void 0}},t}(),b=Math.pow(2,53)-1},function(t,e,r){"use strict";function n(t){var e=t.value,r=t.subscriber;r.closed||(r.next(e),r.complete())}function o(t){var e=t.err,r=t.subscriber;r.closed||r.error(e)}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},s=r(3),c=r(1),u=function(t){function e(e,r){t.call(this),this.promise=e,this.scheduler=r}return i(e,t),e.create=function(t,r){return new e(t,r)},e.prototype._subscribe=function(t){var e=this,r=this.promise,i=this.scheduler;if(null==i)this._isScalar?t.closed||(t.next(this.value),t.complete()):r.then(function(r){e.value=r,e._isScalar=!0,t.closed||(t.next(r),t.complete())},function(e){t.closed||t.error(e)}).then(null,function(t){s.root.setTimeout(function(){throw t})});else if(this._isScalar){if(!t.closed)return i.schedule(n,0,{value:this.value,subscriber:t})}else r.then(function(r){e.value=r,e._isScalar=!0,t.closed||t.add(i.schedule(n,0,{value:r,subscriber:t}))},function(e){t.closed||t.add(i.schedule(o,0,{err:e,subscriber:t}))}).then(null,function(t){s.root.setTimeout(function(){throw t})})},e}(c.Observable);e.PromiseObservable=u},function(t,e,r){"use strict";function n(){if(p.root.XMLHttpRequest){var t=new p.root.XMLHttpRequest;return"withCredentials"in t&&(t.withCredentials=!!this.withCredentials),t}if(p.root.XDomainRequest)return new p.root.XDomainRequest;throw new Error("CORS is not supported by your browser")}function o(){if(p.root.XMLHttpRequest)return new p.root.XMLHttpRequest;var t=void 0;try{for(var e=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],r=0;r<3;r++)try{if(t=e[r],new p.root.ActiveXObject(t))break}catch(t){}return new p.root.ActiveXObject(t)}catch(t){throw new Error("XMLHttpRequest is not supported by your browser")}}function i(t,e){return void 0===e&&(e=null),new v({method:"GET",url:t,headers:e})}function s(t,e,r){return new v({method:"POST",url:t,body:e,headers:r})}function c(t,e){return new v({method:"DELETE",url:t,headers:e})}function u(t,e,r){return new v({method:"PUT",url:t,body:e,headers:r})}function a(t,e){return new v({method:"GET",url:t,responseType:"json",headers:e}).lift(new y.MapOperator(function(t,e){return t.response},null))}var h=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},p=r(3),l=r(14),f=r(8),b=r(1),d=r(2),y=r(19);e.ajaxGet=i,e.ajaxPost=s,e.ajaxDelete=c,e.ajaxPut=u,e.ajaxGetJSON=a;var v=function(t){function e(e){t.call(this);var r={async:!0,createXHR:function(){return this.crossDomain?n.call(this):o()},crossDomain:!1,withCredentials:!1,headers:{},method:"GET",responseType:"json",timeout:0};if("string"==typeof e)r.url=e;else for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);this.request=r}return h(e,t),e.prototype._subscribe=function(t){return new w(t,this.request)},e.create=function(){var t=function(t){return new e(t)};return t.get=i,t.post=s,t.delete=c,t.put=u,t.getJSON=a,t}(),e}(b.Observable);e.AjaxObservable=v;var w=function(t){function e(e,r){t.call(this,e),this.request=r,this.done=!1;var n=r.headers=r.headers||{};r.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest"),"Content-Type"in n||p.root.FormData&&r.body instanceof p.root.FormData||"undefined"==typeof r.body||(n["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8"),r.body=this.serializeBody(r.body,r.headers["Content-Type"]),this.send()}return h(e,t),e.prototype.next=function(t){this.done=!0;var e=this,r=e.xhr,n=e.request,o=e.destination,i=new m(t,r,n);o.next(i)},e.prototype.send=function(){var t=this,e=t.request,r=t.request,n=r.user,o=r.method,i=r.url,s=r.async,c=r.password,u=r.headers,a=r.body,h=e.createXHR,p=l.tryCatch(h).call(e);if(p===f.errorObject)this.error(f.errorObject.e);else{this.xhr=p,this.setupEvents(p,e);var b=void 0;if(b=n?l.tryCatch(p.open).call(p,o,i,s,n,c):l.tryCatch(p.open).call(p,o,i,s),b===f.errorObject)return this.error(f.errorObject.e),null;if(p.timeout=e.timeout,p.responseType=e.responseType,this.setHeaders(p,u),b=a?l.tryCatch(p.send).call(p,a):l.tryCatch(p.send).call(p),b===f.errorObject)return this.error(f.errorObject.e),null}return p},e.prototype.serializeBody=function(t,e){if(!t||"string"==typeof t)return t;if(p.root.FormData&&t instanceof p.root.FormData)return t;if(e){var r=e.indexOf(";");r!==-1&&(e=e.substring(0,r))}switch(e){case"application/x-www-form-urlencoded":return Object.keys(t).map(function(e){return encodeURI(e)+"="+encodeURI(t[e])}).join("&");case"application/json":return JSON.stringify(t);default:return t}},e.prototype.setHeaders=function(t,e){for(var r in e)e.hasOwnProperty(r)&&t.setRequestHeader(r,e[r])},e.prototype.setupEvents=function(t,e){function r(t){var e=r,n=e.subscriber,o=e.progressSubscriber,i=e.request;o&&o.error(t),n.error(new x(this,i))}function n(t){var e=n,r=e.subscriber,o=e.progressSubscriber,i=e.request;if(4===this.readyState){var s=1223===this.status?204:this.status,c="text"===this.responseType?this.response||this.responseText:this.response;0===s&&(s=c?200:0),200<=s&&s<300?(o&&o.complete(),r.next(t),r.complete()):(o&&o.error(t),r.error(new O("ajax error "+s,this,i)))}}var o=e.progressSubscriber;if(t.ontimeout=r,r.request=e,r.subscriber=this,r.progressSubscriber=o,t.upload&&"withCredentials"in t){if(o){var i;i=function(t){var e=i.progressSubscriber;e.next(t)},p.root.XDomainRequest?t.onprogress=i:t.upload.onprogress=i,i.progressSubscriber=o}var s;s=function(t){var e=s,r=e.progressSubscriber,n=e.subscriber,o=e.request;r&&r.error(t),n.error(new O("ajax error",this,o))},t.onerror=s,s.request=e,s.subscriber=this,s.progressSubscriber=o}t.onreadystatechange=n,n.subscriber=this,n.progressSubscriber=o,n.request=e},e.prototype.unsubscribe=function(){var e=this,r=e.done,n=e.xhr;!r&&n&&4!==n.readyState&&"function"==typeof n.abort&&n.abort(),t.prototype.unsubscribe.call(this)},e}(d.Subscriber);e.AjaxSubscriber=w;var m=function(){function t(t,e,r){switch(this.originalEvent=t,this.xhr=e,this.request=r,this.status=e.status,this.responseType=e.responseType||r.responseType,this.responseType){case"json":"response"in e?this.response=e.responseType?e.response:JSON.parse(e.response||e.responseText||"null"):this.response=JSON.parse(e.responseText||"null");break;case"xml":this.response=e.responseXML;break;case"text":default:this.response="response"in e?e.response:e.responseText}}return t}();e.AjaxResponse=m;var O=function(t){function e(e,r,n){t.call(this,e),this.message=e,this.xhr=r,this.request=n,this.status=r.status}return h(e,t),e}(Error);e.AjaxError=O;var x=function(t){function e(e,r){t.call(this,"ajax timeout",e,r)}return h(e,t),e}(O);e.AjaxTimeoutError=x},function(t,e,r){"use strict";var n=r(51);e.ajax=n.AjaxObservable.create},function(t,e,r){"use strict";var n=r(7);e.empty=n.EmptyObservable.create},function(t,e,r){"use strict";var n=r(47);e.from=n.FromObservable.create},function(t,e,r){"use strict";var n=r(48);e.interval=n.IntervalObservable.create},function(t,e,r){"use strict";var n=r(10);e.of=n.ArrayObservable.of},function(t,e,r){"use strict";function n(t){var e=new c(t),r=this.lift(e);return e.caught=r}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(5),s=r(9);e._catch=n;var c=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.selector,this.caught))},t}(),u=function(t){function e(e,r,n){t.call(this,e),this.selector=r,this.caught=n}return o(e,t),e.prototype.error=function(t){if(!this.isStopped){var e=void 0;try{e=this.selector(t,this.caught)}catch(t){return void this.destination.error(t)}this.unsubscribe(),this.destination.remove(this),s.subscribeToResult(this,e)}},e}(i.OuterSubscriber)},function(t,e,r){"use strict";function n(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];var r=null;return"function"==typeof t[t.length-1]&&(r=t.pop()),1===t.length&&s.isArray(t[0])&&(t=t[0]),t.unshift(this),this.lift.call(new i.ArrayObservable(t),new h(r))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(10),s=r(4),c=r(5),u=r(9),a={};e.combineLatest=n;var h=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new p(t,this.project))},t}();e.CombineLatestOperator=h;var p=function(t){function e(e,r){t.call(this,e),this.project=r,this.active=0,this.values=[],this.observables=[]}return o(e,t),e.prototype._next=function(t){this.values.push(a),this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{this.active=e,this.toRespond=e;for(var r=0;r<e;r++){var n=t[r];this.add(u.subscribeToResult(this,n,n,r))}}},e.prototype.notifyComplete=function(t){0===(this.active-=1)&&this.destination.complete()},e.prototype.notifyNext=function(t,e,r,n,o){var i=this.values,s=i[r],c=this.toRespond?s===a?--this.toRespond:this.toRespond:0;i[r]=e,0===c&&(this.project?this._tryProject(i):this.destination.next(i.slice()))},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(c.OuterSubscriber);e.CombineLatestSubscriber=p},function(t,e,r){"use strict";function n(t){return this.lift(new s(t,this))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(2);e.count=n;var s=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.predicate,this.source))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.source=n,this.count=0,this.index=0}return o(e,t),e.prototype._next=function(t){this.predicate?this._tryPredicate(t):this.count++},e.prototype._tryPredicate=function(t){var e;try{e=this.predicate(t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e&&this.count++},e.prototype._complete=function(){this.destination.next(this.count),this.destination.complete()},e}(i.Subscriber)},function(t,e,r){"use strict";function n(t,e){void 0===e&&(e=i.async);var r=s.isDate(t),n=r?+t-e.now():Math.abs(t);return this.lift(new a(n,e))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(20),s=r(73),c=r(2),u=r(15);e.delay=n;var a=function(){function t(t,e){this.delay=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new h(t,this.delay,this.scheduler))},t}(),h=function(t){function e(e,r,n){t.call(this,e),this.delay=r,this.scheduler=n,this.queue=[],this.active=!1,this.errored=!1}return o(e,t),e.dispatch=function(t){for(var e=t.source,r=e.queue,n=t.scheduler,o=t.destination;r.length>0&&r[0].time-n.now()<=0;)r.shift().notification.observe(o);if(r.length>0){var i=Math.max(0,r[0].time-n.now());this.schedule(t,i)}else e.active=!1},e.prototype._schedule=function(t){this.active=!0,this.add(t.schedule(e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},e.prototype.scheduleNotification=function(t){if(this.errored!==!0){var e=this.scheduler,r=new p(e.now()+this.delay,t);this.queue.push(r),this.active===!1&&this._schedule(e)}},e.prototype._next=function(t){this.scheduleNotification(u.Notification.createNext(t))},e.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t)},e.prototype._complete=function(){this.scheduleNotification(u.Notification.createComplete())},e}(c.Subscriber),p=function(){function t(t,e){this.time=t,this.notification=e}return t}()},function(t,e,r){"use strict";function n(t,e,r){return this.lift(new s(t,e,r))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(2);e._do=n;var s=function(){function t(t,e,r){this.nextOrObserver=t,this.error=e,this.complete=r}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.nextOrObserver,this.error,this.complete))},t}(),c=function(t){function e(e,r,n,o){t.call(this,e);var s=new i.Subscriber(r,n,o);s.syncErrorThrowable=!0,this.add(s),this.safeSubscriber=s}return o(e,t),e.prototype._next=function(t){var e=this.safeSubscriber;e.next(t),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.next(t)},e.prototype._error=function(t){var e=this.safeSubscriber;e.error(t),e.syncErrorThrown?this.destination.error(e.syncErrorValue):this.destination.error(t)},e.prototype._complete=function(){var t=this.safeSubscriber;t.complete(),t.syncErrorThrown?this.destination.error(t.syncErrorValue):this.destination.complete()},e}(i.Subscriber)},function(t,e,r){"use strict";function n(t,e){return this.lift(new s(t,e))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(2);e.filter=n;var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.predicate,this.thisArg))},t}(),c=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.thisArg=n,this.count=0,this.predicate=r}return o(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},function(t,e,r){"use strict";function n(t){return this.lift(new s(t))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(2);e.mapTo=n;var s=function(){function t(t){this.value=t}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.value))},t}(),c=function(t){function e(e,r){t.call(this,e),this.value=r}return o(e,t),e.prototype._next=function(t){this.destination.next(this.value)},e}(i.Subscriber)},function(t,e,r){"use strict";function n(t,e,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"number"==typeof e&&(r=e,e=null),this.lift(new c(t,e,r))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(9),s=r(5);e.mergeMap=n;var c=function(){function t(t,e,r){void 0===r&&(r=Number.POSITIVE_INFINITY),this.project=t,this.resultSelector=e,this.concurrent=r}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.resultSelector,this.concurrent))},t}();e.MergeMapOperator=c;var u=function(t){function e(e,r,n,o){void 0===o&&(o=Number.POSITIVE_INFINITY),t.call(this,e),this.project=r,this.resultSelector=n,this.concurrent=o,this.hasCompleted=!1,this.buffer=[],this.active=0,this.index=0}return o(e,t),e.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.project(t,r)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e,t,r)},e.prototype._innerSub=function(t,e,r){this.add(i.subscribeToResult(this,t,e,r))},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete()},e.prototype.notifyNext=function(t,e,r,n,o){this.resultSelector?this._notifyResultSelector(t,e,r,n):this.destination.next(e)},e.prototype._notifyResultSelector=function(t,e,r,n){var o;try{o=this.resultSelector(t,e,r,n)}catch(t){return void this.destination.error(t)}this.destination.next(o)},e.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(s.OuterSubscriber);e.MergeMapSubscriber=u},function(t,e,r){"use strict";function n(t,e){return void 0===e&&(e=0),this.lift(new c(t,e))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(2),s=r(15);e.observeOn=n;var c=function(){function t(t,e){void 0===e&&(e=0),this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.scheduler,this.delay))},t}();e.ObserveOnOperator=c;var u=function(t){function e(e,r,n){void 0===n&&(n=0),t.call(this,e),this.scheduler=r,this.delay=n}return o(e,t),e.dispatch=function(t){var e=t.notification,r=t.destination,n=t.subscription;e.observe(r),n&&n.unsubscribe()},e.prototype.scheduleMessage=function(t){var r=new a(t,this.destination);r.subscription=this.add(this.scheduler.schedule(e.dispatch,this.delay,r))},e.prototype._next=function(t){this.scheduleMessage(s.Notification.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(s.Notification.createError(t))},e.prototype._complete=function(){this.scheduleMessage(s.Notification.createComplete())},e}(i.Subscriber);e.ObserveOnSubscriber=u;var a=function(){function t(t,e){this.notification=t,this.destination=e}return t}();e.ObserveOnMessage=a},function(t,e,r){"use strict";function n(t){return this.lift(new h(t,this))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(17),s=r(14),c=r(8),u=r(5),a=r(9);e.retryWhen=n;var h=function(){function t(t,e){this.notifier=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new p(t,this.notifier,this.source))},t}(),p=function(t){function e(e,r,n){t.call(this,e),this.notifier=r,this.source=n}return o(e,t),e.prototype.error=function(e){if(!this.isStopped){var r=this.errors,n=this.retries,o=this.retriesSubscription;if(n)this.errors=null,this.retriesSubscription=null;else{if(r=new i.Subject,n=s.tryCatch(this.notifier)(r),n===c.errorObject)return t.prototype.error.call(this,c.errorObject.e);o=a.subscribeToResult(this,n)}this.unsubscribe(),this.closed=!1,this.errors=r,this.retries=n,this.retriesSubscription=o,r.next(e)}},e.prototype._unsubscribe=function(){var t=this,e=t.errors,r=t.retriesSubscription;e&&(e.unsubscribe(),this.errors=null),r&&(r.unsubscribe(),this.retriesSubscription=null),this.retries=null},e.prototype.notifyNext=function(t,e,r,n,o){var i=this,s=i.errors,c=i.retries,u=i.retriesSubscription;this.errors=null,this.retries=null,this.retriesSubscription=null,this.unsubscribe(),this.isStopped=!1,this.closed=!1,this.errors=s,this.retries=c,this.retriesSubscription=u,this.source.subscribe(this)},e}(u.OuterSubscriber)},function(t,e,r){"use strict";function n(t){return 0===t?new c.EmptyObservable:this.lift(new u(t))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(2),s=r(71),c=r(7);e.take=n;var u=function(){function t(t){if(this.total=t,this.total<0)throw new s.ArgumentOutOfRangeError}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.total))},t}(),a=function(t){function e(e,r){t.call(this,e),this.total=r,this.count=0}return o(e,t),e.prototype._next=function(t){var e=this.total,r=++this.count;r<=e&&(this.destination.next(t),r===e&&(this.destination.complete(),this.unsubscribe()))},e}(i.Subscriber)},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(6),i=function(t){function e(e,r){t.call(this)}return n(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(o.Subscription);e.Action=i},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(3),i=r(68),s=function(t){function e(e,r){t.call(this,e,r),this.scheduler=e,this.work=r,this.pending=!1}return n(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t,this.pending=!0;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,e)),this.delay=e,this.id=this.id||this.requestAsyncId(n,this.id,e),this},e.prototype.requestAsyncId=function(t,e,r){return void 0===r&&(r=0),o.root.setInterval(t.flush.bind(t,this),r)},e.prototype.recycleAsyncId=function(t,e,r){return void 0===r&&(r=0),null!==r&&this.delay===r?e:o.root.clearInterval(e)&&void 0||void 0},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,e);return r?r:void(this.pending===!1&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null)))},e.prototype._execute=function(t,e){var r=!1,n=void 0;try{this.work(t)}catch(t){r=!0,n=!!t&&t||new Error(t)}if(r)return this.unsubscribe(),n},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,r=e.actions,n=r.indexOf(this);this.work=null,this.delay=null,this.state=null,this.pending=!1,this.scheduler=null,n!==-1&&r.splice(n,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null))},e}(i.Action);e.AsyncAction=s},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=r(28),i=function(t){function e(){t.apply(this,arguments),this.actions=[],this.active=!1,this.scheduled=void 0}return n(e,t),e.prototype.flush=function(t){var e=this.actions;if(this.active)return void e.push(t);var r;this.active=!0;do if(r=t.execute(t.state,t.delay))break;while(t=e.shift());if(this.active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}},e}(o.Scheduler);e.AsyncScheduler=i},function(t,e){"use strict";var r=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},n=function(t){function e(){var e=t.call(this,"argument out of range");this.name=e.name="ArgumentOutOfRangeError",this.stack=e.stack,this.message=e.message}return r(e,t),e}(Error);e.ArgumentOutOfRangeError=n},function(t,e){"use strict";var r=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},n=function(t){function e(e){t.call(this),this.errors=e;var r=Error.call(this,e?e.length+" errors occurred during unsubscription:\n "+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"");this.name=r.name="UnsubscriptionError",this.stack=r.stack,this.message=r.message}return r(e,t),e}(Error);e.UnsubscriptionError=n},function(t,e){"use strict";function r(t){return t instanceof Date&&!isNaN(+t)}e.isDate=r},function(t,e,r){"use strict";function n(t){return!o.isArray(t)&&t-parseFloat(t)+1>=0}var o=r(4);e.isNumeric=n},function(t,e){"use strict";function r(t){return t&&"function"==typeof t.schedule}e.isScheduler=r},function(t,e,r){"use strict";function n(t,e,r){if(t){if(t instanceof o.Subscriber)return t;if(t[i.$$rxSubscriber])return t[i.$$rxSubscriber]()}return t||e||r?new o.Subscriber(t,e,r):new o.Subscriber(s.empty)}var o=r(2),i=r(13),s=r(16);e.toSubscriber=n}])}); |
{ | ||
"name": "botframework-directlinejs", | ||
"version": "0.6.4", | ||
"version": "0.7.0", | ||
"description": "client library for the Microsoft Bot Framework Direct Line 3.0 protocol", | ||
@@ -5,0 +5,0 @@ "main": "built/directLine.js", |
@@ -58,3 +58,3 @@ # BotFramework-DirectLineJS | ||
domain: /* optional: if you are not using the default Direct Line endpoint, e.g. if you are using a region-specific endpoint, put its full URL here */ | ||
webSocket: /* optional: true if you want to use WebSocket to receive messages. Currently defaults to false. */, | ||
webSocket: /* optional: false if you want to use polling GET to receive messages. Defaults to true (use WebSocket). */, | ||
}); | ||
@@ -61,0 +61,0 @@ ``` |
@@ -256,3 +256,3 @@ // In order to keep file size down, only import the parts of rxjs that we use | ||
private domain = "https://directline.botframework.com/v3/directline"; | ||
private webSocket = false; | ||
private webSocket = true; | ||
@@ -259,0 +259,0 @@ private conversationId: string; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123046