UNPKG

agora-rtm

Version:
7 lines 1.46 MB
/*! @preserve * AgoraRTM Web SDK 2.2.4 - commit: v2.2.4-0-gfd60c918 - fusion: false * Copyright (C) 2018-2026 Agora Lab. * This file is licensed under the AGORA, INC. SDK LICENSE AGREEMENT * A copy of this license may be found at https://www.agora.io/en/sdk-license-agreement/ */ !function(A,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("agora-rtc-sdk-ng")):"function"==typeof define&&define.amd?define(["agora-rtc-sdk-ng"],e):(A="undefined"!=typeof globalThis?globalThis:A||self).AgoraRTM=e(A.AgoraRTC)}(this,function(AgoraRTC){"use strict";let AreaCodeMap=function(A){return A.CHINA="CN",A.ASIA="AS",A.NORTH_AMERICA="NA",A.EUROPE="EU",A.JAPAN="JP",A.INDIA="IN",A.OCEANIA="OC",A.SOUTH_AMERICA="SA",A.AFRICA="AF",A.GLOBAL="GLOBAL",A.OVERSEA="OVERSEA",A.SOUTH_KOREA="KR",A.UNITED_STATES="US",A}({});AreaCodeMap.CHINA,AreaCodeMap.NORTH_AMERICA,AreaCodeMap.EUROPE,AreaCodeMap.ASIA,AreaCodeMap.JAPAN,AreaCodeMap.INDIA,AreaCodeMap.OCEANIA,AreaCodeMap.OVERSEA,AreaCodeMap.SOUTH_AMERICA,AreaCodeMap.AFRICA,AreaCodeMap.SOUTH_KOREA,AreaCodeMap.UNITED_STATES,AreaCodeMap.GLOBAL;const AREA_DOMAIN_MAP$1={[AreaCodeMap.ASIA]:{CODE:AreaCodeMap.ASIA,AP_DOMAINS:["ap-web-1-asia.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-asia.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-asia.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-asia.agora.io"],LOG_UPLOAD_SERVER:["logservice-asia.agora.io"],PROXY_AP:["proxy-ap-web-asia.agora.io"],PROXY_NGINX:["southeast-asia.webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.NORTH_AMERICA]:{CODE:AreaCodeMap.NORTH_AMERICA,AP_DOMAINS:["ap-web-1-north-america.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-north-america.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-north-america.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-north-america.agora.io"],LOG_UPLOAD_SERVER:["logservice-north-america.agora.io"],PROXY_AP:["proxy-ap-web-america.agora.io"],PROXY_NGINX:["east-usa.webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.EUROPE]:{CODE:AreaCodeMap.EUROPE,AP_DOMAINS:["ap-web-1-europe.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-europe.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-europe.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-europe.agora.io"],LOG_UPLOAD_SERVER:["logservice-europe.agora.io"],PROXY_AP:["proxy-ap-web-europe.agora.io"],PROXY_NGINX:["europe.webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.JAPAN]:{CODE:AreaCodeMap.JAPAN,AP_DOMAINS:["ap-web-1-japan.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-japan.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-japan.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-japan.agora.io"],LOG_UPLOAD_SERVER:["logservice-japan.agora.io"],PROXY_AP:["proxy-ap-web-japan.agora.io"],PROXY_NGINX:["japan.webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.INDIA]:{CODE:AreaCodeMap.INDIA,AP_DOMAINS:["ap-web-1-india.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-india.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-india.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-india.agora.io"],LOG_UPLOAD_SERVER:["logservice-india.agora.io"],PROXY_AP:["proxy-ap-web-india.agora.io"],PROXY_NGINX:["india.webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.OVERSEA]:{CODE:AreaCodeMap.OVERSEA,AP_DOMAINS:["ap-web-1-oversea.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-oversea.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-oversea.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-oversea.agora.io"],LOG_UPLOAD_SERVER:["logservice-oversea.agora.io"],PROXY_AP:["proxy-ap-web-oversea.agora.io"],PROXY_NGINX:["webrtc-cloud-proxy.agora.io"]},[AreaCodeMap.GLOBAL]:{CODE:AreaCodeMap.GLOBAL,AP_DOMAINS:["ap-web-1.agora.io","ap-web-2.agora.io"],AP_BACKUP_DOMAINS:["ap-web-3.agora.io","ap-web-4.agora.io"],EVENT_REPORT_DOMAIN:["webcollector-rtm.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["webcollector-1.agora.io"],LOG_UPLOAD_SERVER:["logservice-rtm.agora.io"],PROXY_AP:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],PROXY_NGINX:["webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.OCEANIA]:{CODE:AreaCodeMap.OCEANIA,AP_DOMAINS:["ap-web-1-oceania.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-oceania.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-oceania.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-oceania.agora.io"],LOG_UPLOAD_SERVER:["logservice-oceania.agora.io"],PROXY_AP:["proxy-ap-web-oceania.agora.io"],PROXY_NGINX:["oceania.webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.SOUTH_AMERICA]:{CODE:AreaCodeMap.SOUTH_AMERICA,AP_DOMAINS:["ap-web-1-south-america.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-south-america.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-south-america.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-south-america.agora.io"],LOG_UPLOAD_SERVER:["logservice-south-america.agora.io"],PROXY_AP:["proxy-ap-web-south-america.agora.io"],PROXY_NGINX:["south-america.webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.AFRICA]:{CODE:AreaCodeMap.AFRICA,AP_DOMAINS:["ap-web-1-africa.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-africa.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-africa.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-africa.agora.io"],LOG_UPLOAD_SERVER:["logservice-south-africa.agora.io"],PROXY_AP:["proxy-ap-web-africa.agora.io"],PROXY_NGINX:["africa.webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.CHINA]:{CODE:AreaCodeMap.CHINA,AP_DOMAINS:["webrtc2-2.ap.sd-rtn.com"],AP_BACKUP_DOMAINS:["webrtc2-4.ap.sd-rtn.com"],EVENT_REPORT_DOMAIN:["statscollector-1-china.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-china.agora.io"],LOG_UPLOAD_SERVER:["logservice-china.agora.io"],PROXY_AP:["proxy-ap-web.agoraio.cn"],PROXY_NGINX:["east-cn.webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.SOUTH_KOREA]:{CODE:AreaCodeMap.SOUTH_KOREA,AP_DOMAINS:["ap-web-1-korea.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-korea.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-korea.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-korea.agora.io"],LOG_UPLOAD_SERVER:["logservice-korea.agora.io"],PROXY_AP:["proxy-ap-web-korea.agora.io"],PROXY_NGINX:["korea.webrtc-cloud-proxy.sd-rtn.com"]},[AreaCodeMap.UNITED_STATES]:{CODE:AreaCodeMap.UNITED_STATES,AP_DOMAINS:["ap-web-1-us.agora.io"],AP_BACKUP_DOMAINS:["ap-web-2-us.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-us.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-us.agora.io"],LOG_UPLOAD_SERVER:["logservice-us.agora.io"],PROXY_AP:["proxy-ap-web-us.agora.io"],PROXY_NGINX:["us.webrtc-cloud-proxy.sd-rtn.com"]}},continentCountryMap={[AreaCodeMap.ASIA]:[AreaCodeMap.CHINA,AreaCodeMap.JAPAN,AreaCodeMap.INDIA],[AreaCodeMap.EUROPE]:[],[AreaCodeMap.NORTH_AMERICA]:[],[AreaCodeMap.SOUTH_AMERICA]:[],[AreaCodeMap.OCEANIA]:[],[AreaCodeMap.AFRICA]:[]},areaWeights=[AreaCodeMap.GLOBAL,AreaCodeMap.CHINA,AreaCodeMap.NORTH_AMERICA,AreaCodeMap.EUROPE,AreaCodeMap.ASIA,AreaCodeMap.JAPAN,AreaCodeMap.INDIA,AreaCodeMap.OCEANIA,AreaCodeMap.SOUTH_AMERICA,AreaCodeMap.AFRICA];function _applyDecoratedDescriptor(A,e,t,g,I){var o={};return Object.keys(g).forEach(function(A){o[A]=g[A]}),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=t.slice().reverse().reduce(function(t,g){return g(A,e,t)||t},o),I&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(I):void 0,o.initializer=void 0),void 0===o.initializer?(Object.defineProperty(A,e,o),null):o}function _defineProperty$1(A,e,t){return(e=_toPropertyKey(e))in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function ownKeys(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(A);e&&(g=g.filter(function(e){return Object.getOwnPropertyDescriptor(A,e).enumerable})),t.push.apply(t,g)}return t}function _objectSpread2(A){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(t),!0).forEach(function(e){_defineProperty$1(A,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(e){Object.defineProperty(A,e,Object.getOwnPropertyDescriptor(t,e))})}return A}function _objectWithoutProperties(A,e){if(null==A)return{};var t,g,I=_objectWithoutPropertiesLoose(A,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(A);for(g=0;g<o.length;g++)t=o[g],-1===e.indexOf(t)&&{}.propertyIsEnumerable.call(A,t)&&(I[t]=A[t])}return I}function _objectWithoutPropertiesLoose(A,e){if(null==A)return{};var t={};for(var g in A)if({}.hasOwnProperty.call(A,g)){if(-1!==e.indexOf(g))continue;t[g]=A[g]}return t}function _toPrimitive(A,e){if("object"!=typeof A||!A)return A;var t=A[Symbol.toPrimitive];if(void 0!==t){var g=t.call(A,e);if("object"!=typeof g)return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(A)}function _toPropertyKey(A){var e=_toPrimitive(A,"string");return"symbol"==typeof e?e:e+""}let subscribedState=function(A){return A.UNSUBSCRIBED="UNSUBSCRIBED",A.SUBSCRIBED="SUBSCRIBED",A}({}),MessageType$1=function(A){return A.STRING="STRING",A.BINARY="BINARY",A}({}),LegacyAreaCode=function(A){return A.CN="CN",A.NA="NA",A.EU="EU",A.AS="AS",A.JP="JP",A.IN="IN",A.GLOB="GLOB",A.OC="OC",A.SA="SA",A.AF="AF",A.KR="KR",A.US="US",A.OVS="OVS",A}({}),AreaCode=function(A){return A.GLOBAL="GLOBAL",A.INDIA="INDIA",A.JAPAN="JAPAN",A.ASIA="ASIA",A.EUROPE="EUROPE",A.CHINA="CHINA",A.NORTH_AMERICA="NORTH_AMERICA",A}({}),LinkStateChangeReason4Report=function(A){return A[A.UNKNOWN=0]="UNKNOWN",A[A.LOGIN=1]="LOGIN",A[A.LOGIN_SUCCESS=2]="LOGIN_SUCCESS",A[A.LOGIN_TIMEOUT=3]="LOGIN_TIMEOUT",A[A.LOGIN_NOT_AUTHORIZED=4]="LOGIN_NOT_AUTHORIZED",A[A.LOGIN_REJECTED=5]="LOGIN_REJECTED",A[A.RELOGIN=6]="RELOGIN",A[A.LOGOUT=7]="LOGOUT",A[A.AUTO_RECONNECT=8]="AUTO_RECONNECT",A[A.RECONNECT_TIMEOUT=9]="RECONNECT_TIMEOUT",A[A.RECONNECT_SUCCESS=10]="RECONNECT_SUCCESS",A[A.JOIN=11]="JOIN",A[A.JOIN_SUCCESS=12]="JOIN_SUCCESS",A[A.JOIN_FAILED=13]="JOIN_FAILED",A[A.REJOIN=14]="REJOIN",A[A.LEAVE=15]="LEAVE",A[A.INVALID_TOKEN=16]="INVALID_TOKEN",A[A.TOKEN_EXPIRED=17]="TOKEN_EXPIRED",A[A.INCONSISTENT_APP_ID=18]="INCONSISTENT_APP_ID",A[A.INVALID_CHANNEL_NAME=19]="INVALID_CHANNEL_NAME",A[A.INVALID_USER_ID=20]="INVALID_USER_ID",A[A.NOT_INITIALIZED=21]="NOT_INITIALIZED",A[A.RTM_SERVICE_NOT_CONNECTED=22]="RTM_SERVICE_NOT_CONNECTED",A[A.CHANNEL_INSTANCE_EXCEED_LIMITATION=23]="CHANNEL_INSTANCE_EXCEED_LIMITATION",A[A.OPERATION_RATE_EXCEED_LIMITATION=24]="OPERATION_RATE_EXCEED_LIMITATION",A[A.CHANNEL_IN_ERROR_STATE=25]="CHANNEL_IN_ERROR_STATE",A[A.PRESENCE_NOT_CONNECTED=26]="PRESENCE_NOT_CONNECTED",A[A.SAME_UID_LOGIN=27]="SAME_UID_LOGIN",A[A.KICKED_OUT_BY_SERVER=28]="KICKED_OUT_BY_SERVER",A[A.KEEP_ALIVE_TIMEOUT=29]="KEEP_ALIVE_TIMEOUT",A[A.CONNECTION_ERROR=30]="CONNECTION_ERROR",A[A.PRESENCE_NOT_READY=31]="PRESENCE_NOT_READY",A[A.NETWORK_CHANGE=32]="NETWORK_CHANGE",A[A.SERVICE_NOT_SUPPORTED=33]="SERVICE_NOT_SUPPORTED",A[A.STREAM_CHANNEL_NOT_AVAILABLE=34]="STREAM_CHANNEL_NOT_AVAILABLE",A[A.STORAGE_NOT_AVAILABLE=35]="STORAGE_NOT_AVAILABLE",A[A.LOCK_NOT_AVAILABLE=36]="LOCK_NOT_AVAILABLE",A[A.LOGIN_TOO_FREQUENT=37]="LOGIN_TOO_FREQUENT",A}({}),LinkStateChangeReasonDescription=function(A){return A.UNKNOWN="Unknown",A.LOGIN="Perform login operation",A.LOGIN_SUCCESS="Login success",A.LOGIN_TIMEOUT="Login timeout",A.LOGIN_NOT_AUTHORIZED="Login not authorized",A.LOGIN_REJECTED="Login rejected",A.RELOGIN="Perform login operation again",A.LOGOUT="Logout success",A.AUTO_RECONNECT="Reconnecting",A.RECONNECT_TIMEOUT="Reconnect timeout",A.RECONNECT_SUCCESS="Reconnect success",A.JOIN="Perform join operation",A.JOIN_SUCCESS="Join channel success",A.JOIN_FAILED="Join channel failed",A.REJOIN="Perform join operation again",A.LEAVE="Leave channel success",A.INVALID_TOKEN="Invalid token",A.TOKEN_EXPIRED="Token expired",A.INCONSISTENT_APP_ID="Inconsistent app ID",A.INVALID_CHANNEL_NAME="Invalid channel name",A.INVALID_USER_ID="Invalid user id",A.NOT_INITIALIZED="Not initialized",A.RTM_SERVICE_NOT_CONNECTED="RTM service not connected",A.CHANNEL_INSTANCE_EXCEED_LIMITATION="Channel instance exceed limitation",A.OPERATION_RATE_EXCEED_LIMITATION="Operation rate exceed limitation",A.CHANNEL_IN_ERROR_STATE="Channel in error state",A.PRESENCE_NOT_CONNECTED="Presence not connected",A.SAME_UID_LOGIN="The same uid login on another device",A.KICKED_OUT_BY_SERVER="Kicked out by server",A.KEEP_ALIVE_TIMEOUT="Keep alive timeout",A.CONNECTION_ERROR="Connection error",A.PRESENCE_NOT_READY="Presence not ready",A.NETWORK_CHANGE="Network change",A.SERVICE_NOT_SUPPORTED="Service not supported",A.STREAM_CHANNEL_NOT_AVAILABLE="Stream channel not available",A.STORAGE_NOT_AVAILABLE="Storage service is not available",A.LOCK_NOT_AVAILABLE="Lock service is not available",A.LOGIN_TOO_FREQUENT="Login operation is too frequent",A}({}),TokenEventReason=function(A){return A.WILL_EXPIRE="The token is about to expire",A.READ_PERMISSION_REVOKED="The token read permission is revoked",A}({}),ChannelTypeEnum=function(A){return A[A.MESSAGE=1]="MESSAGE",A[A.STREAM=2]="STREAM",A[A.USER=3]="USER",A}({});var ConstantsType=Object.freeze({__proto__:null,AreaCode:AreaCode,ChannelTypeEnum:ChannelTypeEnum,LegacyAreaCode:LegacyAreaCode,LinkStateChangeReason4Report:LinkStateChangeReason4Report,LinkStateChangeReasonDescription:LinkStateChangeReasonDescription,MessageType:MessageType$1,TokenEventReason:TokenEventReason,subscribedState:subscribedState}),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}function getAugmentedNamespace(A){if(A.__esModule)return A;var e=A.default;if("function"==typeof e){var t=function A(){return this instanceof A?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(A).forEach(function(e){var g=Object.getOwnPropertyDescriptor(A,e);Object.defineProperty(t,e,g.get?g:{enumerable:!0,get:function(){return A[e]}})}),t}function format(A){var e=Array.prototype.slice.call(arguments,1);return e.length&&(A=A.replace(/(%?)(%([jds]))/g,function(A,t,g,I){var o=e.shift();switch(I){case"s":o=""+o;break;case"d":o=Number(o);break;case"j":o=JSON.stringify(o)}return t?(e.unshift(o),A):o})),e.length&&(A+=" "+e.join(" ")),""+(A=A.replace(/%{2,2}/g,"%"))}var format_1=format,format$1=getDefaultExportFromCjs(format_1),_extendStatics=function(A,e){return _extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,e){A.__proto__=e}||function(A,e){for(var t in e)e.hasOwnProperty(t)&&(A[t]=e[t])},_extendStatics(A,e)};function __extends$3(A,e){function t(){this.constructor=A}_extendStatics(A,e),A.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}function isFunction$7(A){return"function"==typeof A}var _enable_super_gross_mode_that_will_cause_bad_things=!1,config$1={set useDeprecatedSynchronousErrorHandling(A){A&&(new Error).stack;_enable_super_gross_mode_that_will_cause_bad_things=A},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};function hostReportError(A){setTimeout(function(){throw A},0)}var empty$1={closed:!0,next:function(A){},error:function(A){if(config$1.useDeprecatedSynchronousErrorHandling)throw A;hostReportError(A)},complete:function(){}},isArray$g=function(){return Array.isArray||function(A){return A&&"number"==typeof A.length}}();function isObject$e(A){return null!==A&&"object"==typeof A}var UnsubscriptionErrorImpl$1=function(){function A(A){return Error.call(this),this.message=A?A.length+" errors occurred during unsubscription:\n"+A.map(function(A,e){return e+1+") "+A.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=A,this}return A.prototype=Object.create(Error.prototype),A}(),UnsubscriptionError$1=UnsubscriptionErrorImpl$1,Subscription$2=function(){function A(A){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,A&&(this._ctorUnsubscribe=!0,this._unsubscribe=A)}return A.prototype.unsubscribe=function(){var e;if(!this.closed){var t=this,g=t._parentOrParents,I=t._ctorUnsubscribe,o=t._unsubscribe,i=t._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,g instanceof A)g.remove(this);else if(null!==g)for(var r=0;r<g.length;++r){g[r].remove(this)}if(isFunction$7(o)){I&&(this._unsubscribe=void 0);try{o.call(this)}catch(A){e=A instanceof UnsubscriptionError$1?flattenUnsubscriptionErrors$1(A.errors):[A]}}if(isArray$g(i)){r=-1;for(var C=i.length;++r<C;){var n=i[r];if(isObject$e(n))try{n.unsubscribe()}catch(A){e=e||[],A instanceof UnsubscriptionError$1?e=e.concat(flattenUnsubscriptionErrors$1(A.errors)):e.push(A)}}}if(e)throw new UnsubscriptionError$1(e)}},A.prototype.add=function(e){var t=e;if(!e)return A.EMPTY;switch(typeof e){case"function":t=new A(e);case"object":if(t===this||t.closed||"function"!=typeof t.unsubscribe)return t;if(this.closed)return t.unsubscribe(),t;if(!(t instanceof A)){var g=t;(t=new A)._subscriptions=[g]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var I=t._parentOrParents;if(null===I)t._parentOrParents=this;else if(I instanceof A){if(I===this)return t;t._parentOrParents=[I,this]}else{if(-1!==I.indexOf(this))return t;I.push(this)}var o=this._subscriptions;return null===o?this._subscriptions=[t]:o.push(t),t},A.prototype.remove=function(A){var e=this._subscriptions;if(e){var t=e.indexOf(A);-1!==t&&e.splice(t,1)}},A.EMPTY=function(A){return A.closed=!0,A}(new A),A}();function flattenUnsubscriptionErrors$1(A){return A.reduce(function(A,e){return A.concat(e instanceof UnsubscriptionError$1?e.errors:e)},[])}var rxSubscriber=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),Subscriber=function(A){function e(t,g,I){var o=A.call(this)||this;switch(o.syncErrorValue=null,o.syncErrorThrown=!1,o.syncErrorThrowable=!1,o.isStopped=!1,arguments.length){case 0:o.destination=empty$1;break;case 1:if(!t){o.destination=empty$1;break}if("object"==typeof t){t instanceof e?(o.syncErrorThrowable=t.syncErrorThrowable,o.destination=t,t.add(o)):(o.syncErrorThrowable=!0,o.destination=new SafeSubscriber(o,t));break}default:o.syncErrorThrowable=!0,o.destination=new SafeSubscriber(o,t,g,I)}return o}return __extends$3(e,A),e.prototype[rxSubscriber]=function(){return this},e.create=function(A,t,g){var I=new e(A,t,g);return I.syncErrorThrowable=!1,I},e.prototype.next=function(A){this.isStopped||this._next(A)},e.prototype.error=function(A){this.isStopped||(this.isStopped=!0,this._error(A))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,A.prototype.unsubscribe.call(this))},e.prototype._next=function(A){this.destination.next(A)},e.prototype._error=function(A){this.destination.error(A),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var A=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=A,this},e}(Subscription$2),SafeSubscriber=function(A){function e(e,t,g,I){var o,i=A.call(this)||this;i._parentSubscriber=e;var r=i;return isFunction$7(t)?o=t:t&&(o=t.next,g=t.error,I=t.complete,t!==empty$1&&(isFunction$7((r=Object.create(t)).unsubscribe)&&i.add(r.unsubscribe.bind(r)),r.unsubscribe=i.unsubscribe.bind(i))),i._context=r,i._next=o,i._error=g,i._complete=I,i}return __extends$3(e,A),e.prototype.next=function(A){if(!this.isStopped&&this._next){var e=this._parentSubscriber;config$1.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,A)&&this.unsubscribe():this.__tryOrUnsub(this._next,A)}},e.prototype.error=function(A){if(!this.isStopped){var e=this._parentSubscriber,t=config$1.useDeprecatedSynchronousErrorHandling;if(this._error)t&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,A),this.unsubscribe()):(this.__tryOrUnsub(this._error,A),this.unsubscribe());else if(e.syncErrorThrowable)t?(e.syncErrorValue=A,e.syncErrorThrown=!0):hostReportError(A),this.unsubscribe();else{if(this.unsubscribe(),t)throw A;hostReportError(A)}}},e.prototype.complete=function(){var A=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var t=function(){return A._complete.call(A._context)};config$1.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,t),this.unsubscribe()):(this.__tryOrUnsub(t),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(A,e){try{A.call(this._context,e)}catch(A){if(this.unsubscribe(),config$1.useDeprecatedSynchronousErrorHandling)throw A;hostReportError(A)}},e.prototype.__tryOrSetError=function(A,e,t){if(!config$1.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,t)}catch(e){return config$1.useDeprecatedSynchronousErrorHandling?(A.syncErrorValue=e,A.syncErrorThrown=!0,!0):(hostReportError(e),!0)}return!1},e.prototype._unsubscribe=function(){var A=this._parentSubscriber;this._context=null,this._parentSubscriber=null,A.unsubscribe()},e}(Subscriber);function canReportError(A){for(;A;){var e=A,t=e.closed,g=e.destination,I=e.isStopped;if(t||I)return!1;A=g&&g instanceof Subscriber?g:null}return!0}function toSubscriber(A,e,t){if(A){if(A instanceof Subscriber)return A;if(A[rxSubscriber])return A[rxSubscriber]()}return A||e||t?new Subscriber(A,e,t):new Subscriber(empty$1)}var observable=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function identity$5(A){return A}function pipe(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];return pipeFromArray(A)}function pipeFromArray(A){return 0===A.length?identity$5:1===A.length?A[0]:function(e){return A.reduce(function(A,e){return e(A)},e)}}var Observable=function(){function A(A){this._isScalar=!1,A&&(this._subscribe=A)}return A.prototype.lift=function(e){var t=new A;return t.source=this,t.operator=e,t},A.prototype.subscribe=function(A,e,t){var g=this.operator,I=toSubscriber(A,e,t);if(g?I.add(g.call(I,this.source)):I.add(this.source||config$1.useDeprecatedSynchronousErrorHandling&&!I.syncErrorThrowable?this._subscribe(I):this._trySubscribe(I)),config$1.useDeprecatedSynchronousErrorHandling&&I.syncErrorThrowable&&(I.syncErrorThrowable=!1,I.syncErrorThrown))throw I.syncErrorValue;return I},A.prototype._trySubscribe=function(A){try{return this._subscribe(A)}catch(e){config$1.useDeprecatedSynchronousErrorHandling&&(A.syncErrorThrown=!0,A.syncErrorValue=e),canReportError(A)?A.error(e):console.warn(e)}},A.prototype.forEach=function(A,e){var t=this;return new(e=getPromiseCtor(e))(function(e,g){var I;I=t.subscribe(function(e){try{A(e)}catch(A){g(A),I&&I.unsubscribe()}},g,e)})},A.prototype._subscribe=function(A){var e=this.source;return e&&e.subscribe(A)},A.prototype[observable]=function(){return this},A.prototype.pipe=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];return 0===A.length?this:pipeFromArray(A)(this)},A.prototype.toPromise=function(A){var e=this;return new(A=getPromiseCtor(A))(function(A,t){var g;e.subscribe(function(A){return g=A},function(A){return t(A)},function(){return A(g)})})},A.create=function(e){return new A(e)},A}();function getPromiseCtor(A){if(A||(A=Promise),!A)throw new Error("no Promise impl found");return A}var ObjectUnsubscribedErrorImpl=function(){function A(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return A.prototype=Object.create(Error.prototype),A}(),ObjectUnsubscribedError=ObjectUnsubscribedErrorImpl,SubjectSubscription=function(A){function e(e,t){var g=A.call(this)||this;return g.subject=e,g.subscriber=t,g.closed=!1,g}return __extends$3(e,A),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var A=this.subject,e=A.observers;if(this.subject=null,e&&0!==e.length&&!A.isStopped&&!A.closed){var t=e.indexOf(this.subscriber);-1!==t&&e.splice(t,1)}}},e}(Subscription$2),SubjectSubscriber=function(A){function e(e){var t=A.call(this,e)||this;return t.destination=e,t}return __extends$3(e,A),e}(Subscriber),Subject=function(A){function e(){var e=A.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return __extends$3(e,A),e.prototype[rxSubscriber]=function(){return new SubjectSubscriber(this)},e.prototype.lift=function(A){var e=new AnonymousSubject(this,this);return e.operator=A,e},e.prototype.next=function(A){if(this.closed)throw new ObjectUnsubscribedError;if(!this.isStopped)for(var e=this.observers,t=e.length,g=e.slice(),I=0;I<t;I++)g[I].next(A)},e.prototype.error=function(A){if(this.closed)throw new ObjectUnsubscribedError;this.hasError=!0,this.thrownError=A,this.isStopped=!0;for(var e=this.observers,t=e.length,g=e.slice(),I=0;I<t;I++)g[I].error(A);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new ObjectUnsubscribedError;this.isStopped=!0;for(var A=this.observers,e=A.length,t=A.slice(),g=0;g<e;g++)t[g].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new ObjectUnsubscribedError;return A.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(A){if(this.closed)throw new ObjectUnsubscribedError;return this.hasError?(A.error(this.thrownError),Subscription$2.EMPTY):this.isStopped?(A.complete(),Subscription$2.EMPTY):(this.observers.push(A),new SubjectSubscription(this,A))},e.prototype.asObservable=function(){var A=new Observable;return A.source=this,A},e.create=function(A,e){return new AnonymousSubject(A,e)},e}(Observable),AnonymousSubject=function(A){function e(e,t){var g=A.call(this)||this;return g.destination=e,g.source=t,g}return __extends$3(e,A),e.prototype.next=function(A){var e=this.destination;e&&e.next&&e.next(A)},e.prototype.error=function(A){var e=this.destination;e&&e.error&&this.destination.error(A)},e.prototype.complete=function(){var A=this.destination;A&&A.complete&&this.destination.complete()},e.prototype._subscribe=function(A){return this.source?this.source.subscribe(A):Subscription$2.EMPTY},e}(Subject);function refCount(){return function(A){return A.lift(new RefCountOperator(A))}}var RefCountOperator=function(){function A(A){this.connectable=A}return A.prototype.call=function(A,e){var t=this.connectable;t._refCount++;var g=new RefCountSubscriber(A,t),I=e.subscribe(g);return g.closed||(g.connection=t.connect()),I},A}(),RefCountSubscriber=function(A){function e(e,t){var g=A.call(this,e)||this;return g.connectable=t,g}return __extends$3(e,A),e.prototype._unsubscribe=function(){var A=this.connectable;if(A){this.connectable=null;var e=A._refCount;if(e<=0)this.connection=null;else if(A._refCount=e-1,e>1)this.connection=null;else{var t=this.connection,g=A._connection;this.connection=null,!g||t&&g!==t||g.unsubscribe()}}else this.connection=null},e}(Subscriber),ConnectableObservable=function(A){function e(e,t){var g=A.call(this)||this;return g.source=e,g.subjectFactory=t,g._refCount=0,g._isComplete=!1,g}return __extends$3(e,A),e.prototype._subscribe=function(A){return this.getSubject().subscribe(A)},e.prototype.getSubject=function(){var A=this._subject;return A&&!A.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var A=this._connection;return A||(this._isComplete=!1,(A=this._connection=new Subscription$2).add(this.source.subscribe(new ConnectableSubscriber(this.getSubject(),this))),A.closed&&(this._connection=null,A=Subscription$2.EMPTY)),A},e.prototype.refCount=function(){return refCount()(this)},e}(Observable),connectableObservableDescriptor=function(){var A=ConnectableObservable.prototype;return{operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:A._subscribe},_isComplete:{value:A._isComplete,writable:!0},getSubject:{value:A.getSubject},connect:{value:A.connect},refCount:{value:A.refCount}}}(),ConnectableSubscriber=function(A){function e(e,t){var g=A.call(this,e)||this;return g.connectable=t,g}return __extends$3(e,A),e.prototype._error=function(e){this._unsubscribe(),A.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),A.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var A=this.connectable;if(A){this.connectable=null;var e=A._connection;A._refCount=0,A._subject=null,A._connection=null,e&&e.unsubscribe()}},e}(SubjectSubscriber),Action$2=function(A){function e(e,t){return A.call(this)||this}return __extends$3(e,A),e.prototype.schedule=function(A,e){return this},e}(Subscription$2),AsyncAction$2=function(A){function e(e,t){var g=A.call(this,e,t)||this;return g.scheduler=e,g.work=t,g.pending=!1,g}return __extends$3(e,A),e.prototype.schedule=function(A,e){if(void 0===e&&(e=0),this.closed)return this;this.state=A;var t=this.id,g=this.scheduler;return null!=t&&(this.id=this.recycleAsyncId(g,t,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(g,this.id,e),this},e.prototype.requestAsyncId=function(A,e,t){return void 0===t&&(t=0),setInterval(A.flush.bind(A,this),t)},e.prototype.recycleAsyncId=function(A,e,t){if(void 0===t&&(t=0),null!==t&&this.delay===t&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(A,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var t=this._execute(A,e);if(t)return t;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(A,e){var t=!1,g=void 0;try{this.work(A)}catch(A){t=!0,g=!!A&&A||new Error(A)}if(t)return this.unsubscribe(),g},e.prototype._unsubscribe=function(){var A=this.id,e=this.scheduler,t=e.actions,g=t.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==g&&t.splice(g,1),null!=A&&(this.id=this.recycleAsyncId(e,A,null)),this.delay=null},e}(Action$2),QueueAction=function(A){function e(e,t){var g=A.call(this,e,t)||this;return g.scheduler=e,g.work=t,g}return __extends$3(e,A),e.prototype.schedule=function(e,t){return void 0===t&&(t=0),t>0?A.prototype.schedule.call(this,e,t):(this.delay=t,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,t){return t>0||this.closed?A.prototype.execute.call(this,e,t):this._execute(e,t)},e.prototype.requestAsyncId=function(e,t,g){return void 0===g&&(g=0),null!==g&&g>0||null===g&&this.delay>0?A.prototype.requestAsyncId.call(this,e,t,g):e.flush(this)},e}(AsyncAction$2),Scheduler$2=function(){function A(e,t){void 0===t&&(t=A.now),this.SchedulerAction=e,this.now=t}return A.prototype.schedule=function(A,e,t){return void 0===e&&(e=0),new this.SchedulerAction(this,A).schedule(t,e)},A.now=function(){return Date.now()},A}(),AsyncScheduler$2=function(A){function e(t,g){void 0===g&&(g=Scheduler$2.now);var I=A.call(this,t,function(){return e.delegate&&e.delegate!==I?e.delegate.now():g()})||this;return I.actions=[],I.active=!1,I.scheduled=void 0,I}return __extends$3(e,A),e.prototype.schedule=function(t,g,I){return void 0===g&&(g=0),e.delegate&&e.delegate!==this?e.delegate.schedule(t,g,I):A.prototype.schedule.call(this,t,g,I)},e.prototype.flush=function(A){var e=this.actions;if(this.active)e.push(A);else{var t;this.active=!0;do{if(t=A.execute(A.state,A.delay))break}while(A=e.shift());if(this.active=!1,t){for(;A=e.shift();)A.unsubscribe();throw t}}},e}(Scheduler$2),QueueScheduler=function(A){function e(){return null!==A&&A.apply(this,arguments)||this}return __extends$3(e,A),e}(AsyncScheduler$2),queueScheduler=new QueueScheduler(QueueAction),queue=queueScheduler,EMPTY=new Observable(function(A){return A.complete()});function empty(A){return A?emptyScheduled(A):EMPTY}function emptyScheduled(A){return new Observable(function(e){return A.schedule(function(){return e.complete()})})}function isScheduler(A){return A&&"function"==typeof A.schedule}var subscribeToArray=function(A){return function(e){for(var t=0,g=A.length;t<g&&!e.closed;t++)e.next(A[t]);e.complete()}};function scheduleArray(A,e){return new Observable(function(t){var g=new Subscription$2,I=0;return g.add(e.schedule(function(){I!==A.length?(t.next(A[I++]),t.closed||g.add(this.schedule())):t.complete()})),g})}function fromArray(A,e){return e?scheduleArray(A,e):new Observable(subscribeToArray(A))}function of(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];var t=A[A.length-1];return isScheduler(t)?(A.pop(),scheduleArray(A,t)):fromArray(A)}function throwError(A,e){return new Observable(function(e){return e.error(A)})}var Notification=function(){function A(A,e,t){this.kind=A,this.value=e,this.error=t,this.hasValue="N"===A}return A.prototype.observe=function(A){switch(this.kind){case"N":return A.next&&A.next(this.value);case"E":return A.error&&A.error(this.error);case"C":return A.complete&&A.complete()}},A.prototype.do=function(A,e,t){switch(this.kind){case"N":return A&&A(this.value);case"E":return e&&e(this.error);case"C":return t&&t()}},A.prototype.accept=function(A,e,t){return A&&"function"==typeof A.next?this.observe(A):this.do(A,e,t)},A.prototype.toObservable=function(){switch(this.kind){case"N":return of(this.value);case"E":return throwError(this.error);case"C":return empty()}throw new Error("unexpected notification kind value")},A.createNext=function(e){return void 0!==e?new A("N",e):A.undefinedValueNotification},A.createError=function(e){return new A("E",void 0,e)},A.createComplete=function(){return A.completeNotification},A.completeNotification=new A("C"),A.undefinedValueNotification=new A("N",void 0),A}();function observeOn(A,e){return void 0===e&&(e=0),function(t){return t.lift(new ObserveOnOperator(A,e))}}var ObserveOnOperator=function(){function A(A,e){void 0===e&&(e=0),this.scheduler=A,this.delay=e}return A.prototype.call=function(A,e){return e.subscribe(new ObserveOnSubscriber(A,this.scheduler,this.delay))},A}(),ObserveOnSubscriber=function(A){function e(e,t,g){void 0===g&&(g=0);var I=A.call(this,e)||this;return I.scheduler=t,I.delay=g,I}return __extends$3(e,A),e.dispatch=function(A){var e=A.notification,t=A.destination;e.observe(t),this.unsubscribe()},e.prototype.scheduleMessage=function(A){this.destination.add(this.scheduler.schedule(e.dispatch,this.delay,new ObserveOnMessage(A,this.destination)))},e.prototype._next=function(A){this.scheduleMessage(Notification.createNext(A))},e.prototype._error=function(A){this.scheduleMessage(Notification.createError(A)),this.unsubscribe()},e.prototype._complete=function(){this.scheduleMessage(Notification.createComplete()),this.unsubscribe()},e}(Subscriber),ObserveOnMessage=function(){return function(A,e){this.notification=A,this.destination=e}}(),ReplaySubject=function(A){function e(e,t,g){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===t&&(t=Number.POSITIVE_INFINITY);var I=A.call(this)||this;return I.scheduler=g,I._events=[],I._infiniteTimeWindow=!1,I._bufferSize=e<1?1:e,I._windowTime=t<1?1:t,t===Number.POSITIVE_INFINITY?(I._infiniteTimeWindow=!0,I.next=I.nextInfiniteTimeWindow):I.next=I.nextTimeWindow,I}return __extends$3(e,A),e.prototype.nextInfiniteTimeWindow=function(e){if(!this.isStopped){var t=this._events;t.push(e),t.length>this._bufferSize&&t.shift()}A.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this.isStopped||(this._events.push(new ReplayEvent(this._getNow(),e)),this._trimBufferThenGetEvents()),A.prototype.next.call(this,e)},e.prototype._subscribe=function(A){var e,t=this._infiniteTimeWindow,g=t?this._events:this._trimBufferThenGetEvents(),I=this.scheduler,o=g.length;if(this.closed)throw new ObjectUnsubscribedError;if(this.isStopped||this.hasError?e=Subscription$2.EMPTY:(this.observers.push(A),e=new SubjectSubscription(this,A)),I&&A.add(A=new ObserveOnSubscriber(A,I)),t)for(var i=0;i<o&&!A.closed;i++)A.next(g[i]);else for(i=0;i<o&&!A.closed;i++)A.next(g[i].value);return this.hasError?A.error(this.thrownError):this.isStopped&&A.complete(),e},e.prototype._getNow=function(){return(this.scheduler||queue).now()},e.prototype._trimBufferThenGetEvents=function(){for(var A=this._getNow(),e=this._bufferSize,t=this._windowTime,g=this._events,I=g.length,o=0;o<I&&!(A-g[o].time<t);)o++;return I>e&&(o=Math.max(o,I-e)),o>0&&g.splice(0,o),g},e}(Subject),ReplayEvent=function(){return function(A,e){this.time=A,this.value=e}}(),nextHandle=1,RESOLVED=function(){return Promise.resolve()}(),activeHandles={};function findAndClearHandle(A){return A in activeHandles&&(delete activeHandles[A],!0)}var Immediate={setImmediate:function(A){var e=nextHandle++;return activeHandles[e]=!0,RESOLVED.then(function(){return findAndClearHandle(e)&&A()}),e},clearImmediate:function(A){findAndClearHandle(A)}},AsapAction=function(A){function e(e,t){var g=A.call(this,e,t)||this;return g.scheduler=e,g.work=t,g}return __extends$3(e,A),e.prototype.requestAsyncId=function(e,t,g){return void 0===g&&(g=0),null!==g&&g>0?A.prototype.requestAsyncId.call(this,e,t,g):(e.actions.push(this),e.scheduled||(e.scheduled=Immediate.setImmediate(e.flush.bind(e,null))))},e.prototype.recycleAsyncId=function(e,t,g){if(void 0===g&&(g=0),null!==g&&g>0||null===g&&this.delay>0)return A.prototype.recycleAsyncId.call(this,e,t,g);0===e.actions.length&&(Immediate.clearImmediate(t),e.scheduled=void 0)},e}(AsyncAction$2),AsapScheduler=function(A){function e(){return null!==A&&A.apply(this,arguments)||this}return __extends$3(e,A),e.prototype.flush=function(A){this.active=!0,this.scheduled=void 0;var e,t=this.actions,g=-1,I=t.length;A=A||t.shift();do{if(e=A.execute(A.state,A.delay))break}while(++g<I&&(A=t.shift()));if(this.active=!1,e){for(;++g<I&&(A=t.shift());)A.unsubscribe();throw e}},e}(AsyncScheduler$2),asapScheduler=new AsapScheduler(AsapAction),asyncScheduler=new AsyncScheduler$2(AsyncAction$2),async=asyncScheduler;function noop$3(){}var ArgumentOutOfRangeErrorImpl=function(){function A(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return A.prototype=Object.create(Error.prototype),A}(),ArgumentOutOfRangeError=ArgumentOutOfRangeErrorImpl,EmptyErrorImpl=function(){function A(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}return A.prototype=Object.create(Error.prototype),A}(),EmptyError=EmptyErrorImpl,TimeoutErrorImpl=function(){function A(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}return A.prototype=Object.create(Error.prototype),A}(),TimeoutError=TimeoutErrorImpl;function map$1(A,e){return function(t){if("function"!=typeof A)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return t.lift(new MapOperator(A,e))}}var MapOperator=function(){function A(A,e){this.project=A,this.thisArg=e}return A.prototype.call=function(A,e){return e.subscribe(new MapSubscriber(A,this.project,this.thisArg))},A}(),MapSubscriber=function(A){function e(e,t,g){var I=A.call(this,e)||this;return I.project=t,I.count=0,I.thisArg=g||I,I}return __extends$3(e,A),e.prototype._next=function(A){var e;try{e=this.project.call(this.thisArg,A,this.count++)}catch(A){return void this.destination.error(A)}this.destination.next(e)},e}(Subscriber),OuterSubscriber=function(A){function e(){return null!==A&&A.apply(this,arguments)||this}return __extends$3(e,A),e.prototype.notifyNext=function(A,e,t,g,I){this.destination.next(e)},e.prototype.notifyError=function(A,e){this.destination.error(A)},e.prototype.notifyComplete=function(A){this.destination.complete()},e}(Subscriber),InnerSubscriber=function(A){function e(e,t,g){var I=A.call(this)||this;return I.parent=e,I.outerValue=t,I.outerIndex=g,I.index=0,I}return __extends$3(e,A),e.prototype._next=function(A){this.parent.notifyNext(this.outerValue,A,this.outerIndex,this.index++,this)},e.prototype._error=function(A){this.parent.notifyError(A,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(Subscriber),subscribeToPromise=function(A){return function(e){return A.then(function(A){e.closed||(e.next(A),e.complete())},function(A){return e.error(A)}).then(null,hostReportError),e}};function getSymbolIterator(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var iterator=getSymbolIterator(),subscribeToIterable=function(A){return function(e){for(var t=A[iterator]();;){var g=void 0;try{g=t.next()}catch(A){return e.error(A),e}if(g.done){e.complete();break}if(e.next(g.value),e.closed)break}return"function"==typeof t.return&&e.add(function(){t.return&&t.return()}),e}},subscribeToObservable=function(A){return function(e){var t=A[observable]();if("function"!=typeof t.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return t.subscribe(e)}},isArrayLike$9=function(A){return A&&"number"==typeof A.length&&"function"!=typeof A};function isPromise(A){return!!A&&"function"!=typeof A.subscribe&&"function"==typeof A.then}var subscribeTo=function(A){if(A&&"function"==typeof A[observable])return subscribeToObservable(A);if(isArrayLike$9(A))return subscribeToArray(A);if(isPromise(A))return subscribeToPromise(A);if(A&&"function"==typeof A[iterator])return subscribeToIterable(A);var e=isObject$e(A)?"an invalid object":"'"+A+"'";throw new TypeError("You provided "+e+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")};function subscribeToResult(A,e,t,g,I){if(void 0===I&&(I=new InnerSubscriber(A,t,g)),!I.closed)return e instanceof Observable?e.subscribe(I):subscribeTo(e)(I)}function from(A,e){return A instanceof Observable?A:new Observable(subscribeTo(A))}var SimpleInnerSubscriber=function(A){function e(e){var t=A.call(this)||this;return t.parent=e,t}return __extends$3(e,A),e.prototype._next=function(A){this.parent.notifyNext(A)},e.prototype._error=function(A){this.parent.notifyError(A),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},e}(Subscriber),SimpleOuterSubscriber=function(A){function e(){return null!==A&&A.apply(this,arguments)||this}return __extends$3(e,A),e.prototype.notifyNext=function(A){this.destination.next(A)},e.prototype.notifyError=function(A){this.destination.error(A)},e.prototype.notifyComplete=function(){this.destination.complete()},e}(Subscriber);function innerSubscribe(A,e){if(!e.closed){if(A instanceof Observable)return A.subscribe(e);var t;try{t=subscribeTo(A)(e)}catch(A){e.error(A)}return t}}function mergeMap(A,e,t){return void 0===t&&(t=Number.POSITIVE_INFINITY),"function"==typeof e?function(g){return g.pipe(mergeMap(function(t,g){return from(A(t,g)).pipe(map$1(function(A,I){return e(t,A,g,I)}))},t))}:("number"==typeof e&&(t=e),function(e){return e.lift(new MergeMapOperator(A,t))})}var MergeMapOperator=function(){function A(A,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.project=A,this.concurrent=e}return A.prototype.call=function(A,e){return e.subscribe(new MergeMapSubscriber(A,this.project,this.concurrent))},A}(),MergeMapSubscriber=function(A){function e(e,t,g){void 0===g&&(g=Number.POSITIVE_INFINITY);var I=A.call(this,e)||this;return I.project=t,I.concurrent=g,I.hasCompleted=!1,I.buffer=[],I.active=0,I.index=0,I}return __extends$3(e,A),e.prototype._next=function(A){this.active<this.concurrent?this._tryNext(A):this.buffer.push(A)},e.prototype._tryNext=function(A){var e,t=this.index++;try{e=this.project(A,t)}catch(A){return void this.destination.error(A)}this.active++,this._innerSub(e)},e.prototype._innerSub=function(A){var e=new SimpleInnerSubscriber(this),t=this.destination;t.add(e);var g=innerSubscribe(A,e);g!==e&&t.add(g)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(A){this.destination.next(A)},e.prototype.notifyComplete=function(){var A=this.buffer;this.active--,A.length>0?this._next(A.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(SimpleOuterSubscriber);function mergeAll(A){return void 0===A&&(A=Number.POSITIVE_INFINITY),mergeMap(identity$5,A)}function concatAll(){return mergeAll(1)}function concat(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];return concatAll()(of.apply(void 0,A))}function defer(A){return new Observable(function(e){var t;try{t=A()}catch(A){return void e.error(A)}return(t?from(t):empty()).subscribe(e)})}function fromEvent(A,e,t,g){return isFunction$7(t)&&(g=t,t=void 0),g?fromEvent(A,e,t).pipe(map$1(function(A){return isArray$g(A)?g.apply(void 0,A):g(A)})):new Observable(function(g){setupSubscription(A,e,function(A){arguments.length>1?g.next(Array.prototype.slice.call(arguments)):g.next(A)},g,t)})}function setupSubscription(A,e,t,g,I){var o;if(isEventTarget(A)){var i=A;A.addEventListener(e,t,I),o=function(){return i.removeEventListener(e,t,I)}}else if(isJQueryStyleEventEmitter(A)){var r=A;A.on(e,t),o=function(){return r.off(e,t)}}else if(isNodeStyleEventEmitter(A)){var C=A;A.addListener(e,t),o=function(){return C.removeListener(e,t)}}else{if(!A||!A.length)throw new TypeError("Invalid event target");for(var n=0,E=A.length;n<E;n++)setupSubscription(A[n],e,t,g,I)}g.add(o)}function isNodeStyleEventEmitter(A){return A&&"function"==typeof A.addListener&&"function"==typeof A.removeListener}function isJQueryStyleEventEmitter(A){return A&&"function"==typeof A.on&&"function"==typeof A.off}function isEventTarget(A){return A&&"function"==typeof A.addEventListener&&"function"==typeof A.removeEventListener}function isNumeric(A){return!isArray$g(A)&&A-parseFloat(A)+1>=0}function interval(A,e){return void 0===A&&(A=0),void 0===e&&(e=async),(!isNumeric(A)||A<0)&&(A=0),e&&"function"==typeof e.schedule||(e=async),new Observable(function(t){return t.add(e.schedule(dispatch$1,A,{subscriber:t,counter:0,period:A})),t})}function dispatch$1(A){var e=A.subscriber,t=A.counter,g=A.period;e.next(t),this.schedule({subscriber:e,counter:t+1,period:g},g)}function merge(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];var t=Number.POSITIVE_INFINITY,g=null,I=A[A.length-1];return isScheduler(I)?(g=A.pop(),A.length>1&&"number"==typeof A[A.length-1]&&(t=A.pop())):"number"==typeof I&&(t=A.pop()),null===g&&1===A.length&&A[0]instanceof Observable?A[0]:mergeAll(t)(fromArray(A,g))}var NEVER=new Observable(noop$3);function filter(A,e){return function(t){return t.lift(new FilterOperator(A,e))}}var FilterOperator=function(){function A(A,e){this.predicate=A,this.thisArg=e}return A.prototype.call=function(A,e){return e.subscribe(new FilterSubscriber(A,this.predicate,this.thisArg))},A}(),FilterSubscriber=function(A){function e(e,t,g){var I=A.call(this,e)||this;return I.predicate=t,I.thisArg=g,I.count=0,I}return __extends$3(e,A),e.prototype._next=function(A){var e;try{e=this.predicate.call(this.thisArg,A,this.count++)}catch(A){return void this.destination.error(A)}e&&this.destination.next(A)},e}(Subscriber);function race(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(1===A.length){if(!isArray$g(A[0]))return A[0];A=A[0]}return fromArray(A,void 0).lift(new RaceOperator)}var RaceOperator=function(){function A(){}return A.prototype.call=function(A,e){return e.subscribe(new RaceSubscriber(A))},A}(),RaceSubscriber=function(A){function e(e){var t=A.call(this,e)||this;return t.hasFirst=!1,t.observables=[],t.subscriptions=[],t}return __extends$3(e,A),e.prototype._next=function(A){this.observables.push(A)},e.prototype._complete=function(){var A=this.observables,e=A.length;if(0===e)this.destination.complete();else{for(var t=0;t<e&&!this.hasFirst;t++){var g=subscribeToResult(this,A[t],void 0,t);this.subscriptions&&this.subscriptions.push(g),this.add(g)}this.observables=null}},e.prototype.notifyNext=function(A,e,t){if(!this.hasFirst){this.hasFirst=!0;for(var g=0;g<this.subscriptions.length;g++)if(g!==t){var I=this.subscriptions[g];I.unsubscribe(),this.remove(I)}this.subscriptions=null}this.destination.next(e)},e}(OuterSubscriber);function timer(A,e,t){void 0===A&&(A=0);var g=-1;return isNumeric(e)?g=Number(e)<1?1:Number(e):isScheduler(e)&&(t=e),isScheduler(t)||(t=async),new Observable(function(e){var I=isNumeric(A)?A:+A-t.now();return t.schedule(dispatch,I,{index:0,period:g,subscriber:e})})}function dispatch(A){var e=A.index,t=A.period,g=A.subscriber;if(g.next(e),!g.closed){if(-1===t)return g.complete();A.index=e+1,this.schedule(A,t)}}function zip(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];var t=A[A.length-1];return"function"==typeof t&&A.pop(),fromArray(A,void 0).lift(new ZipOperator(t))}var ZipOperator=function(){function A(A){this.resultSelector=A}return A.prototype.call=function(A,e){return e.subscribe(new ZipSubscriber(A,this.resultSelector))},A}(),ZipSubscriber=function(A){function e(e,t,g){var I=A.call(this,e)||this;return I.resultSelector=t,I.iterators=[],I.active=0,I.resultSelector="function"==typeof t?t:void 0,I}return __extends$3(e,A),e.prototype._next=function(A){var e=this.iterators;isArray$g(A)?e.push(new StaticArrayIterator(A)):"function"==typeof A[iterator]?e.push(new StaticIterator(A[iterator]())):e.push(new ZipBufferIterator(this.destination,this,A))},e.prototype._complete=function(){var A=this.iterators,e=A.length;if(this.unsubscribe(),0!==e){this.active=e;for(var t=0;t<e;t++){var g=A[t];if(g.stillUnsubscribed)this.destination.add(g.subscribe());else this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var A=this.iterators,e=A.length,t=this.destination,g=0;g<e;g++){if("function"==typeof(i=A[g]).hasValue&&!i.hasValue())return}var I=!