@iotize/device-com-ble.cordova 3.4.1 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,5 +12,5 @@
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var l=function(e,t){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function f(e,t){function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function d(e,t){var n,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,r=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(i=c.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){c.label=o[1];break}if(6===o[0]&&c.label<i[1]){c.label=i[1],i=o;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(o);break}i[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function h(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.invalidErrorResult=function(e){return new t("Internal error: ble cordova plugin returned an unexpected error object",t.Code.InternalError)},t.invalidErrorCode=function(e){return new t("Internal error: ble cordova plugin returned an invalid error code "+e.code+" with message "+e.message,t.Code.InternalError)},t.invalidNativeCallResult=function(e,n){return new t("Internal error: native call returned an invalid data type. "+n.message,t.Code.InternalError)},t.isValidErrorCode=function(e){return e in t.Code},t.iotizeBLEMissing=function(){return new t("iotizeBLE global variable does not exist. Are you sure app is running inside a Cordova application ?",t.Code.InternalError)},t}(o.CodeError);!function(e){!function(e){e.InternalError="CordovaBLEErrorInternalError",e.IllegalArgument="CordovaBLEErrorIllegalArgument",e.BLENotAvailable="CordovaBLEErrorBLENotAvailable",e.InvalidMacAddress="InvalidMacAddressInvalidMacAddress",e.ConnectionError="CordovaBLEErrorConnectionError",e.RequestError="CordovaBLEErrorRequestError",e.LocationServiceDisabled="CordovaBLEErrorLocationServiceDisabled",e.DisconnectError="CordovaBLEErrorDisconnectError",e.IllegalAction="CordovaBLEErrorIllegalAction",e.NotConnectedError="CordovaBLEErrorNotConnectedError",e.StatusCodeError="CordovaBLEErrorStatusCodeError"}(e.Code||(e.Code={}))}(p||(p={}));var v=c.createDebugger("@iotize/device-com-ble.cordova");function b(){if("object"!=typeof iotizeBLE)throw p.iotizeBLEMissing();return iotizeBLE}var g=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function c(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}s((r=r.apply(e,t||[])).next())}))},y=function(e){function n(t,n,r){var i=e.call(this)||this;return i.deviceId=t,i.cordovaInterfaceOverwrite=r,n?i.options=n:i.options.connect.timeout=6e4,i}return f(n,e),Object.defineProperty(n.prototype,"pluginInterface",{get:function(){return this.cordovaInterfaceOverwrite||b()},enumerable:!1,configurable:!0}),n.prototype._connect=function(e){var n=this;return v("_connect",e),this.pluginInterface.connectAndDiscoverTapServices(this.deviceId).pipe(i.tap((function(e){n.setConnectionState(e)})),i.filter((function(e){return e===t.ConnectionState.CONNECTED})),i.first())},n.prototype._disconnect=function(e){var t=this;return v("_disconnect",e),r.defer((function(){return t.pluginInterface.disConnect(t.deviceId)}))},n.prototype.write=function(e){return g(this,void 0,void 0,(function(){return d(this,(function(e){throw new Error("Method not implemented.")}))}))},n.prototype.read=function(){return g(this,void 0,void 0,(function(){return d(this,(function(e){throw new Error("Method not implemented.")}))}))},n.prototype.send=function(e,n){var o=this;return r.defer((function(){return o.pluginInterface.send(o.deviceId,e)})).pipe(i.catchError((function(e){var n;return(null===(n=e)||void 0===n?void 0:n.code)===p.Code.NotConnectedError&&o.setConnectionState(t.ConnectionState.DISCONNECTED),r.throwError(e)})))},n}(n.QueueComProtocol),m=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function c(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}s((r=r.apply(e,t||[])).next())}))},S=function(){function e(e,n){void 0===n&&(n=b()),this.deviceId=e,this.cordovaPlugin=n,this._stateChange=new r.BehaviorSubject(t.ConnectionState.DISCONNECTED)}return Object.defineProperty(e.prototype,"stateChange",{get:function(){return this._stateChange.asObservable().pipe(i.distinctUntilChanged())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this.deviceId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return t.ConnectionState[this._stateChange.value]},enumerable:!1,configurable:!0}),e.prototype.discoverServices=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,c,u,s,a,l,f,p,v,b;return d(this,(function(d){switch(d.label){case 0:return t=this,[4,this.cordovaPlugin.discoverServices(this.deviceId)];case 1:if(t.serviceListCache=d.sent(),n={},e){r=function(e){var t=i.serviceListCache.find((function(t){return t.uuid===e}));t&&(n[e]=new C(t,i))},i=this;try{for(o=h(e),c=o.next();!c.done;c=o.next())u=c.value,r(u)}catch(e){f={error:e}}finally{try{c&&!c.done&&(p=o.return)&&p.call(o)}finally{if(f)throw f.error}}}else try{for(s=h(this.serviceListCache),a=s.next();!a.done;a=s.next())l=a.value,n[l.uuid]=new C(l,this)}catch(e){v={error:e}}finally{try{a&&!a.done&&(b=s.return)&&b.call(s)}finally{if(v)throw v.error}}return[2,n]}}))}))},e.prototype.connect=function(){var e;return m(this,void 0,void 0,(function(){var n,r=this;return d(this,(function(o){switch(o.label){case 0:return null===(e=this.connectionStateSubscription)||void 0===e||e.unsubscribe(),n=this.cordovaPlugin.connect(this.deviceId).pipe(i.shareReplay()),this.connectionStateSubscription=n.subscribe((function(e){r._stateChange.next(e)})),[4,n.pipe(i.filter((function(e){return e===t.ConnectionState.CONNECTED})),i.first()).toPromise()];case 1:return o.sent(),[2]}}))}))},e.prototype.disconnect=function(){var e;return m(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return[4,this.cordovaPlugin.disConnect(this.deviceId)];case 1:return n.sent(),this._stateChange.next(t.ConnectionState.DISCONNECTED),null===(e=this.connectionStateSubscription)||void 0===e||e.unsubscribe(),[2]}}))}))},e.prototype.close=function(){var e;return m(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return[4,this.cordovaPlugin.close(this.deviceId)];case 1:return n.sent(),this._stateChange.next(t.ConnectionState.DISCONNECTED),null===(e=this.connectionStateSubscription)||void 0===e||e.unsubscribe(),[2]}}))}))},e.prototype.getService=function(e){return m(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return this.serviceListCache?[3,2]:[4,this.discoverServices([e])];case 1:n.sent(),n.label=2;case 2:if(!(t=this.serviceListCache.find((function(t){return t.uuid===e}))))throw u.BleComError.serviceNotFound(e);return[2,new C(t,this)]}}))}))},e}(),C=function(){function e(e,t){this.config=e,this.peripheral=t}return Object.defineProperty(e.prototype,"uuid",{get:function(){return this.config.uuid},enumerable:!1,configurable:!0}),e.prototype.getCharacteristic=function(e){var t;return m(this,void 0,void 0,(function(){var n;return d(this,(function(r){if(!(n=null===(t=this.config.characteristics)||void 0===t?void 0:t.find((function(t){return t.uuid===e}))))throw u.BleComError.charcacteristicNotFound(e);return[2,new E(this,n)]}))}))},e.prototype.getCharacteristics=function(){return m(this,void 0,void 0,(function(){var e=this;return d(this,(function(t){return this.config.characteristics?[2,this.config.characteristics.map((function(t){return new E(e,t)}))]:[2,[]]}))}))},e}(),E=function(){function e(e,t){this.service=e,this.config=t}return Object.defineProperty(e.prototype,"uuid",{get:function(){return this.config.uuid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"properties",{get:function(){return this.config.properties},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.setupDataStreamIfRequired().pipe(i.map((function(e){return{data:e,isNotification:!0}})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deviceId",{get:function(){return this.service.peripheral.deviceId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pluginInterface",{get:function(){return this.service.peripheral.cordovaPlugin},enumerable:!1,configurable:!0}),e.prototype.read=function(){return m(this,void 0,void 0,(function(){return d(this,(function(e){return[2,this.pluginInterface.characteristicReadValue(this.deviceId,this.service.uuid,this.uuid)]}))}))},e.prototype.getDescriptor=function(){return m(this,void 0,void 0,(function(){return d(this,(function(e){throw new Error("Not implemented yet")}))}))},e.prototype.getDescriptors=function(){return m(this,void 0,void 0,(function(){var e=this;return d(this,(function(t){return this.config.descriptors?[2,this.config.descriptors.map((function(t){return new w(t,e)}))]:[2,[]]}))}))},e.prototype.write=function(e,t){return m(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return t?[4,this.pluginInterface.characteristicWriteWithoutResponse(this.deviceId,this.service.uuid,this.uuid,e)]:[3,2];case 1:return n.sent(),[3,4];case 2:return[4,this.pluginInterface.characteristicWrite(this.deviceId,this.service.uuid,this.uuid,e)];case 3:n.sent(),n.label=4;case 4:return[2,e]}}))}))},e.prototype.enableNotifications=function(e){return m(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return e?(this.setupDataStreamIfRequired(),[4,this.pluginInterface.characteristicStartNotification(this.deviceId,this.service.uuid,this.uuid)]):[3,2];case 1:return t.sent(),[3,4];case 2:return[4,this.pluginInterface.characteristicStopNotification(this.deviceId,this.service.uuid,this.uuid)];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},e.prototype.setupDataStreamIfRequired=function(){return this._dataStream||(this._dataStream=this.pluginInterface.characteristicChanged(this.deviceId,this.service.uuid,this.uuid)),this._dataStream},e}(),w=function(){function e(e,t){this.config=e,this.characteristic=t}return Object.defineProperty(e.prototype,"uuid",{get:function(){return this.config.uuid},enumerable:!1,configurable:!0}),e.prototype.readValue=function(){return m(this,void 0,void 0,(function(){return d(this,(function(e){throw new Error("Reading descriptor value is not implemented yet")}))}))},e.prototype.writeValue=function(e){return m(this,void 0,void 0,(function(){return d(this,(function(e){throw new Error("Writing descriptor value is not implemented yet")}))}))},e}(),x=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function c(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}s((r=r.apply(e,t||[])).next())}))},I=function(){function e(e,t){this.cordovaInterfaceOverwrite=e,this.requestDeviceOptions=t,this._results=new r.BehaviorSubject([]),this._scanning$=new r.BehaviorSubject(!1)}return Object.defineProperty(e.prototype,"cordovaInterface",{get:function(){return this.cordovaInterfaceOverwrite||b()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scanning",{get:function(){return this._scanning$.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isScanning",{get:function(){return this._scanning$.value},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"results",{get:function(){return this._results.asObservable()},enumerable:!1,configurable:!0}),e.prototype.start=function(e){var t;return x(this,void 0,void 0,(function(){var e=this;return d(this,(function(n){switch(n.label){case 0:return null===(t=this.scanSubscription)||void 0===t||t.unsubscribe(),this.scanSubscription=void 0,this.clearResults(),[4,this.checkAvailable()];case 1:if(!n.sent())throw u.BleComError.bleNotAvailable("BLE is not available. Make sure that BLE is enabled on your device");return v("Start Scanning ..."),this._scanning$.next(!0),[2,new Promise((function(t,n){e.scanSubscription=e.cordovaInterface.startScan(e.requestDeviceOptions).subscribe((function(n){"Ok"!=n?e.addOrRefreshDevice(n):t()}),(function(t){v("Start scan failed with error: ",t),e.cordovaInterface.getLastError().then((function(e){v("Last BLE error "+e)})).catch((function(e){v("Cannot get last BLE error: ",e)})),n(t),e._scanning$.next(!1)}))}))]}}))}))},e.prototype.stop=function(){var e;return x(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:v("Stop Scanning ..."),n.label=1;case 1:return n.trys.push([1,3,,4]),null===(e=this.scanSubscription)||void 0===e||e.unsubscribe(),this.scanSubscription=void 0,[4,this.cordovaInterface.stopScan()];case 2:return n.sent(),this._scanning$.next(!1),[2];case 3:throw t=n.sent(),this._scanning$.next(!1),t;case 4:return[2]}}))}))},e.prototype.checkAvailable=function(){return this.cordovaInterface.checkAvailable()},Object.defineProperty(e.prototype,"devices",{get:function(){return this._results.value},enumerable:!1,configurable:!0}),e.prototype.clearResults=function(){this._results.next([])},e.prototype.addOrRefreshDevice=function(e){var t=this.devices.findIndex((function(t){return t.address==e.address}));if(t>=0){var n=this.devices[t];n.name==e.name&&n.rssi==e.rssi||(v("Updating device at index "+t+", name="+n.name+" with rssi="+n.rssi),this.devices[t]=e,this._results.next(this.devices))}else v("Adding new device name="+e.name+" with rssi="+e.rssi),this.devices.push(e),this._results.next(this.devices)},e}(),_=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function c(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}s((r=r.apply(e,t||[])).next())}))};function O(e){try{return s.hexStringToBuffer(e)}catch(t){throw p.invalidNativeCallResult(e,t)}}var R=function(){function e(){}return e.prototype.checkAvailable=function(){return this.execSingleResult("checkAvailable",[])},e.prototype.requestEnableBle=function(){return this.execSingleResult("enable",[])},e.prototype.startScan=function(e){return this.execMultipleResult("startScan",[JSON.stringify(e)])},e.prototype.stopScan=function(){return this.execSingleResult("stopScan",[])},e.prototype.connect=function(e,n){var r=this;return void 0===n&&(n=!0),this.askBleEnable(n).pipe(i.switchMap((function(){return r.execMultipleResult("connect",[e]).pipe(i.map((function(e){return e in t.ConnectionState||console.warn('Plugin native code returned an invalid connection state: "'+e+'".'),a.safeEnumValue(t.ConnectionState,e)})))})))},e.prototype.askBleEnable=function(e){var t=this;return r.defer((function(){return _(t,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return e?[4,this.checkAvailable()]:[3,3];case 1:return t.sent()?[3,3]:[4,this.requestEnableBle()];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))}))},e.prototype.requestMTU=function(e,t){return this.execSingleResult("requestMTU",[e,t])},e.prototype.connectAndDiscoverTapServices=function(e,n){var r=this;return void 0===n&&(n=!0),this.askBleEnable(n).pipe(i.switchMap((function(){return r.execMultipleResult("connectAndDiscoverTapServices",[e]).pipe(i.map((function(e){return e in t.ConnectionState||console.warn('Plugin native code returned an invalid connection state: "'+e+'".'),a.safeEnumValue(t.ConnectionState,e)})))})))},e.prototype.disConnect=function(e){return this.execSingleResult("disConnect",[e])},e.prototype.close=function(e){return this.execSingleResult("close",[e])},e.prototype.isConnected=function(e){return this.execSingleResult("isConnected",[e])},e.prototype.send=function(e,t){return _(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return[4,this.execSingleResult("sendRequest",[e,s.bufferToHexString(t)])];case 1:return[2,O(n.sent())]}}))}))},e.prototype.getLastError=function(){return this.execSingleResult("getLastError",[])},e.prototype.characteristicStartNotification=function(e,t,n){return this.execSingleResult("characteristicStartNotification",[e,t,n])},e.prototype.characteristicChanged=function(e,t,n){return this.execMultipleResult("characteristicChanged",[e,t,n]).pipe(i.map((function(e){return O(e)})))},e.prototype.characteristicStopNotification=function(e,t,n){return this.execSingleResult("characteristicStopNotification",[e,t,n])},e.prototype.characteristicReadValue=function(e,t,n){return _(this,void 0,void 0,(function(){return d(this,(function(r){switch(r.label){case 0:return[4,this.execSingleResult("characteristicRead",[e,t,n])];case 1:return[2,O(r.sent())]}}))}))},e.prototype.characteristicWrite=function(e,t,n,r){return this.execSingleResult("characteristicWrite",[e,t,n,s.bufferToHexString(r)])},e.prototype.characteristicWriteWithoutResponse=function(e,t,n,r){return this.execSingleResult("characteristicWriteWithoutResponse",[e,t,n,s.bufferToHexString(r)])},e.prototype.discoverServices=function(e){return _(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this.execSingleResult("discoverServices",[e])];case 1:return[2,t.sent()]}}))}))},e.prototype.execSingleResult=function(e,t){return new Promise((function(n,r){cordova.exec(n,(function(e){r(P(e))}),"BLECom",e,t)}))},e.prototype.execMultipleResult=function(e,t){var n=new r.Subject;return cordova.exec((function(e){n.next(e)}),(function(e){n.error(P(e))}),"BLECom",e,t),n.asObservable()},e}();function P(e){return"object"==typeof e&&e.code&&e.message?p.isValidErrorCode(e.code)?new p(e.message,p.Code[e.code]):p.invalidErrorCode(e):p.invalidErrorResult(e)}e.BLEComProtocol=y,e.BLEScanner=I,e.CordovaCharacteristicAdapter=E,e.CordovaPeripheralAdapter=S,e.CordovaServiceAdapter=C,e.getIoTizeBleCordovaPlugin=b,e["ɵc"]=R,Object.defineProperty(e,"__esModule",{value:!0})}));
15
+ ***************************************************************************** */var l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},l(e,t)};function f(e,t){function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function d(e,t){var n,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,r=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(i=c.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){c.label=o[1];break}if(6===o[0]&&c.label<i[1]){c.label=i[1],i=o;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(o);break}i[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function h(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.invalidErrorResult=function(e){return new t("Internal error: ble cordova plugin returned an unexpected error object",t.Code.InternalError)},t.invalidErrorCode=function(e){return new t("Internal error: ble cordova plugin returned an invalid error code "+e.code+" with message "+e.message,t.Code.InternalError)},t.invalidNativeCallResult=function(e,n){return new t("Internal error: native call returned an invalid data type. "+n.message,t.Code.InternalError)},t.isValidErrorCode=function(e){return e in t.Code},t.iotizeBLEMissing=function(){return new t("iotizeBLE global variable does not exist. Are you sure app is running inside a Cordova application ?",t.Code.InternalError)},t}(o.CodeError);!function(e){!function(e){e.InternalError="CordovaBLEErrorInternalError",e.IllegalArgument="CordovaBLEErrorIllegalArgument",e.BLENotAvailable="CordovaBLEErrorBLENotAvailable",e.InvalidMacAddress="InvalidMacAddressInvalidMacAddress",e.ConnectionError="CordovaBLEErrorConnectionError",e.RequestError="CordovaBLEErrorRequestError",e.LocationServiceDisabled="CordovaBLEErrorLocationServiceDisabled",e.DisconnectError="CordovaBLEErrorDisconnectError",e.IllegalAction="CordovaBLEErrorIllegalAction",e.NotConnectedError="CordovaBLEErrorNotConnectedError",e.StatusCodeError="CordovaBLEErrorStatusCodeError"}(e.Code||(e.Code={}))}(p||(p={}));var v=c.createDebugger("@iotize/device-com-ble.cordova");function b(){if("object"!=typeof iotizeBLE)throw p.iotizeBLEMissing();return iotizeBLE}var g=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function c(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}s((r=r.apply(e,t||[])).next())}))},y=function(e){function n(t,n,r){var i=e.call(this)||this;return i.deviceId=t,i.cordovaInterfaceOverwrite=r,n?i.options=n:i.options.connect.timeout=6e4,i}return f(n,e),Object.defineProperty(n.prototype,"pluginInterface",{get:function(){return this.cordovaInterfaceOverwrite||b()},enumerable:!1,configurable:!0}),n.prototype._connect=function(e){var n=this;return v("_connect",e),this.pluginInterface.connectAndDiscoverTapServices(this.deviceId).pipe(i.tap((function(e){n.setConnectionState(e)})),i.filter((function(e){return e===t.ConnectionState.CONNECTED})),i.first())},n.prototype._disconnect=function(e){var t=this;return v("_disconnect",e),r.defer((function(){return t.pluginInterface.disConnect(t.deviceId)}))},n.prototype.write=function(e){return g(this,void 0,void 0,(function(){return d(this,(function(e){throw new Error("Method not implemented.")}))}))},n.prototype.read=function(){return g(this,void 0,void 0,(function(){return d(this,(function(e){throw new Error("Method not implemented.")}))}))},n.prototype.send=function(e,n){var o=this;return r.defer((function(){return o.pluginInterface.send(o.deviceId,e)})).pipe(i.catchError((function(e){var n;return(null===(n=e)||void 0===n?void 0:n.code)===p.Code.NotConnectedError&&o.setConnectionState(t.ConnectionState.DISCONNECTED),r.throwError(e)})))},n}(n.QueueComProtocol),m=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function c(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}s((r=r.apply(e,t||[])).next())}))},S=function(){function e(e,n){void 0===n&&(n=b()),this.deviceId=e,this.cordovaPlugin=n,this._stateChange=new r.BehaviorSubject(t.ConnectionState.DISCONNECTED)}return Object.defineProperty(e.prototype,"stateChange",{get:function(){return this._stateChange.asObservable().pipe(i.distinctUntilChanged())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this.deviceId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return t.ConnectionState[this._stateChange.value]},enumerable:!1,configurable:!0}),e.prototype.discoverServices=function(e){return m(this,void 0,void 0,(function(){var t,n,r,i,o,c,u,s,a,l,f,p,v,b;return d(this,(function(d){switch(d.label){case 0:return t=this,[4,this.cordovaPlugin.discoverServices(this.deviceId)];case 1:if(t.serviceListCache=d.sent(),n={},e){r=function(e){var t=i.serviceListCache.find((function(t){return t.uuid===e}));t&&(n[e]=new C(t,i))},i=this;try{for(o=h(e),c=o.next();!c.done;c=o.next())u=c.value,r(u)}catch(e){f={error:e}}finally{try{c&&!c.done&&(p=o.return)&&p.call(o)}finally{if(f)throw f.error}}}else try{for(s=h(this.serviceListCache),a=s.next();!a.done;a=s.next())l=a.value,n[l.uuid]=new C(l,this)}catch(e){v={error:e}}finally{try{a&&!a.done&&(b=s.return)&&b.call(s)}finally{if(v)throw v.error}}return[2,n]}}))}))},e.prototype.connect=function(){var e;return m(this,void 0,void 0,(function(){var n,r=this;return d(this,(function(o){switch(o.label){case 0:return null===(e=this.connectionStateSubscription)||void 0===e||e.unsubscribe(),n=this.cordovaPlugin.connect(this.deviceId).pipe(i.shareReplay()),this.connectionStateSubscription=n.subscribe((function(e){r._stateChange.next(e)})),[4,n.pipe(i.filter((function(e){return e===t.ConnectionState.CONNECTED})),i.first()).toPromise()];case 1:return o.sent(),[2]}}))}))},e.prototype.disconnect=function(){var e;return m(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return[4,this.cordovaPlugin.disConnect(this.deviceId)];case 1:return n.sent(),this._stateChange.next(t.ConnectionState.DISCONNECTED),null===(e=this.connectionStateSubscription)||void 0===e||e.unsubscribe(),[2]}}))}))},e.prototype.close=function(){var e;return m(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return[4,this.cordovaPlugin.close(this.deviceId)];case 1:return n.sent(),this._stateChange.next(t.ConnectionState.DISCONNECTED),null===(e=this.connectionStateSubscription)||void 0===e||e.unsubscribe(),[2]}}))}))},e.prototype.getService=function(e){return m(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return this.serviceListCache?[3,2]:[4,this.discoverServices([e])];case 1:n.sent(),n.label=2;case 2:if(!(t=this.serviceListCache.find((function(t){return t.uuid===e}))))throw u.BleComError.serviceNotFound(e);return[2,new C(t,this)]}}))}))},e}(),C=function(){function e(e,t){this.config=e,this.peripheral=t}return Object.defineProperty(e.prototype,"uuid",{get:function(){return this.config.uuid},enumerable:!1,configurable:!0}),e.prototype.getCharacteristic=function(e){var t;return m(this,void 0,void 0,(function(){var n;return d(this,(function(r){if(!(n=null===(t=this.config.characteristics)||void 0===t?void 0:t.find((function(t){return t.uuid===e}))))throw u.BleComError.charcacteristicNotFound(e);return[2,new E(this,n)]}))}))},e.prototype.getCharacteristics=function(){return m(this,void 0,void 0,(function(){var e=this;return d(this,(function(t){return this.config.characteristics?[2,this.config.characteristics.map((function(t){return new E(e,t)}))]:[2,[]]}))}))},e}(),E=function(){function e(e,t){this.service=e,this.config=t}return Object.defineProperty(e.prototype,"uuid",{get:function(){return this.config.uuid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"properties",{get:function(){return this.config.properties},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.setupDataStreamIfRequired().pipe(i.map((function(e){return{data:e,isNotification:!0}})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deviceId",{get:function(){return this.service.peripheral.deviceId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pluginInterface",{get:function(){return this.service.peripheral.cordovaPlugin},enumerable:!1,configurable:!0}),e.prototype.read=function(){return m(this,void 0,void 0,(function(){return d(this,(function(e){return[2,this.pluginInterface.characteristicReadValue(this.deviceId,this.service.uuid,this.uuid)]}))}))},e.prototype.getDescriptor=function(){return m(this,void 0,void 0,(function(){return d(this,(function(e){throw new Error("Not implemented yet")}))}))},e.prototype.getDescriptors=function(){return m(this,void 0,void 0,(function(){var e=this;return d(this,(function(t){return this.config.descriptors?[2,this.config.descriptors.map((function(t){return new w(t,e)}))]:[2,[]]}))}))},e.prototype.write=function(e,t){return m(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return t?[4,this.pluginInterface.characteristicWriteWithoutResponse(this.deviceId,this.service.uuid,this.uuid,e)]:[3,2];case 1:return n.sent(),[3,4];case 2:return[4,this.pluginInterface.characteristicWrite(this.deviceId,this.service.uuid,this.uuid,e)];case 3:n.sent(),n.label=4;case 4:return[2,e]}}))}))},e.prototype.enableNotifications=function(e){return m(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return e?(this.setupDataStreamIfRequired(),[4,this.pluginInterface.characteristicStartNotification(this.deviceId,this.service.uuid,this.uuid)]):[3,2];case 1:return t.sent(),[3,4];case 2:return[4,this.pluginInterface.characteristicStopNotification(this.deviceId,this.service.uuid,this.uuid)];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))},e.prototype.setupDataStreamIfRequired=function(){return this._dataStream||(this._dataStream=this.pluginInterface.characteristicChanged(this.deviceId,this.service.uuid,this.uuid)),this._dataStream},e}(),w=function(){function e(e,t){this.config=e,this.characteristic=t}return Object.defineProperty(e.prototype,"uuid",{get:function(){return this.config.uuid},enumerable:!1,configurable:!0}),e.prototype.readValue=function(){return m(this,void 0,void 0,(function(){return d(this,(function(e){throw new Error("Reading descriptor value is not implemented yet")}))}))},e.prototype.writeValue=function(e){return m(this,void 0,void 0,(function(){return d(this,(function(e){throw new Error("Writing descriptor value is not implemented yet")}))}))},e}(),x=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function c(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}s((r=r.apply(e,t||[])).next())}))},I=function(){function e(e,t){this.cordovaInterfaceOverwrite=e,this.requestDeviceOptions=t,this._results=new r.BehaviorSubject([]),this._scanning$=new r.BehaviorSubject(!1)}return Object.defineProperty(e.prototype,"cordovaInterface",{get:function(){return this.cordovaInterfaceOverwrite||b()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scanning",{get:function(){return this._scanning$.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isScanning",{get:function(){return this._scanning$.value},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"results",{get:function(){return this._results.asObservable()},enumerable:!1,configurable:!0}),e.prototype.start=function(e){var t;return x(this,void 0,void 0,(function(){var e=this;return d(this,(function(n){switch(n.label){case 0:return null===(t=this.scanSubscription)||void 0===t||t.unsubscribe(),this.scanSubscription=void 0,this.clearResults(),[4,this.checkAvailable()];case 1:if(!n.sent())throw u.BleComError.bleNotAvailable("BLE is not available. Make sure that BLE is enabled on your device");return v("Start Scanning ..."),this._scanning$.next(!0),[2,new Promise((function(t,n){e.scanSubscription=e.cordovaInterface.startScan(e.requestDeviceOptions).subscribe((function(n){"Ok"!=n?e.addOrRefreshDevice(n):t()}),(function(t){v("Start scan failed with error: ",t),e.cordovaInterface.getLastError().then((function(e){v("Last BLE error "+e)})).catch((function(e){v("Cannot get last BLE error: ",e)})),n(t),e._scanning$.next(!1)}))}))]}}))}))},e.prototype.stop=function(){var e;return x(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:v("Stop Scanning ..."),n.label=1;case 1:return n.trys.push([1,3,,4]),null===(e=this.scanSubscription)||void 0===e||e.unsubscribe(),this.scanSubscription=void 0,[4,this.cordovaInterface.stopScan()];case 2:return n.sent(),this._scanning$.next(!1),[2];case 3:throw t=n.sent(),this._scanning$.next(!1),t;case 4:return[2]}}))}))},e.prototype.checkAvailable=function(){return this.cordovaInterface.checkAvailable()},Object.defineProperty(e.prototype,"devices",{get:function(){return this._results.value},enumerable:!1,configurable:!0}),e.prototype.clearResults=function(){this._results.next([])},e.prototype.addOrRefreshDevice=function(e){var t=this.devices.findIndex((function(t){return t.address==e.address}));if(t>=0){var n=this.devices[t];n.name==e.name&&n.rssi==e.rssi||(v("Updating device at index "+t+", name="+n.name+" with rssi="+n.rssi),this.devices[t]=e,this._results.next(this.devices))}else v("Adding new device name="+e.name+" with rssi="+e.rssi),this.devices.push(e),this._results.next(this.devices)},e}(),_=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function c(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,u)}s((r=r.apply(e,t||[])).next())}))};function O(e){try{return s.hexStringToBuffer(e)}catch(t){throw p.invalidNativeCallResult(e,t)}}var R=function(){function e(){}return e.prototype.checkAvailable=function(){return this.execSingleResult("checkAvailable",[])},e.prototype.requestEnableBle=function(){return this.execSingleResult("enable",[])},e.prototype.startScan=function(e){return this.execMultipleResult("startScan",[JSON.stringify(e)])},e.prototype.stopScan=function(){return this.execSingleResult("stopScan",[])},e.prototype.connect=function(e,n){var r=this;return void 0===n&&(n=!0),this.askBleEnable(n).pipe(i.switchMap((function(){return r.execMultipleResult("connect",[e]).pipe(i.map((function(e){return e in t.ConnectionState||console.warn('Plugin native code returned an invalid connection state: "'+e+'".'),a.safeEnumValue(t.ConnectionState,e)})))})))},e.prototype.askBleEnable=function(e){var t=this;return r.defer((function(){return _(t,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return e?[4,this.checkAvailable()]:[3,3];case 1:return t.sent()?[3,3]:[4,this.requestEnableBle()];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))}))},e.prototype.requestMTU=function(e,t){return this.execSingleResult("requestMTU",[e,t])},e.prototype.connectAndDiscoverTapServices=function(e,n){var r=this;return void 0===n&&(n=!0),this.askBleEnable(n).pipe(i.switchMap((function(){return r.execMultipleResult("connectAndDiscoverTapServices",[e]).pipe(i.map((function(e){return e in t.ConnectionState||console.warn('Plugin native code returned an invalid connection state: "'+e+'".'),a.safeEnumValue(t.ConnectionState,e)})))})))},e.prototype.disConnect=function(e){return this.execSingleResult("disConnect",[e])},e.prototype.close=function(e){return this.execSingleResult("close",[e])},e.prototype.isConnected=function(e){return this.execSingleResult("isConnected",[e])},e.prototype.send=function(e,t){return _(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return[4,this.execSingleResult("sendRequest",[e,s.bufferToHexString(t)])];case 1:return[2,O(n.sent())]}}))}))},e.prototype.getLastError=function(){return this.execSingleResult("getLastError",[])},e.prototype.characteristicStartNotification=function(e,t,n){return this.execSingleResult("characteristicStartNotification",[e,t,n])},e.prototype.characteristicChanged=function(e,t,n){return this.execMultipleResult("characteristicChanged",[e,t,n]).pipe(i.map((function(e){return O(e)})))},e.prototype.characteristicStopNotification=function(e,t,n){return this.execSingleResult("characteristicStopNotification",[e,t,n])},e.prototype.characteristicReadValue=function(e,t,n){return _(this,void 0,void 0,(function(){return d(this,(function(r){switch(r.label){case 0:return[4,this.execSingleResult("characteristicRead",[e,t,n])];case 1:return[2,O(r.sent())]}}))}))},e.prototype.characteristicWrite=function(e,t,n,r){return this.execSingleResult("characteristicWrite",[e,t,n,s.bufferToHexString(r)])},e.prototype.characteristicWriteWithoutResponse=function(e,t,n,r){return this.execSingleResult("characteristicWriteWithoutResponse",[e,t,n,s.bufferToHexString(r)])},e.prototype.discoverServices=function(e){return _(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this.execSingleResult("discoverServices",[e])];case 1:return[2,t.sent()]}}))}))},e.prototype.execSingleResult=function(e,t){return new Promise((function(n,r){cordova.exec(n,(function(e){r(P(e))}),"BLECom",e,t)}))},e.prototype.execMultipleResult=function(e,t){var n=new r.Subject;return cordova.exec((function(e){n.next(e)}),(function(e){n.error(P(e))}),"BLECom",e,t),n.asObservable()},e}();function P(e){return"object"==typeof e&&e.code&&e.message?p.isValidErrorCode(e.code)?new p(e.message,p.Code[e.code]):p.invalidErrorCode(e):p.invalidErrorResult(e)}e.BLEComProtocol=y,e.BLEScanner=I,e.CordovaCharacteristicAdapter=E,e.CordovaPeripheralAdapter=S,e.CordovaServiceAdapter=C,e.getIoTizeBleCordovaPlugin=b,e["ɵc"]=R,Object.defineProperty(e,"__esModule",{value:!0})}));
16
16
  //# sourceMappingURL=iotize-device-com-ble.cordova.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../node_modules/tslib/tslib.es6.js","../../../../src/lib/cordova-ble-error.ts","../../../../src/lib/logger.ts","../../../../src/lib/utility.ts","../../../../src/lib/ble-com-protocol.ts","../../../../src/lib/cordova-service-adapter.ts","../../../../src/lib/scanner.ts","../../../../src/lib/iotize-ble-cordova-plugin.ts"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","this","constructor","prototype","create","__generator","thisArg","body","f","y","t","g","_","label","sent","trys","ops","next","verb","throw","return","Symbol","iterator","n","v","op","TypeError","call","done","value","pop","length","push","e","step","__values","o","s","m","i","CordovaBLEError","_super","invalidErrorResult","errObject","Code","InternalError","invalidErrorCode","code","message","invalidNativeCallResult","result","cause","isValidErrorCode","iotizeBLEMissing","CodeError","debug","createDebugger","getIoTizeBleCordovaPlugin","iotizeBLE","BLEComProtocol","deviceId","comProtocolOptions","cordovaInterfaceOverwrite","_this","options","connect","timeout","defineProperty","_connect","pluginInterface","connectAndDiscoverTapServices","pipe","tap","state","setConnectionState","filter","ConnectionState","CONNECTED","first","_disconnect","defer","disConnect","write","data","Error","read","send","catchError","err","_a","NotConnectedError","DISCONNECTED","throwError","QueueComProtocol","CordovaPeripheralAdapter","cordovaPlugin","_stateChange","BehaviorSubject","asObservable","distinctUntilChanged","id","discoverServices","serviceUUIDs","_b","serviceListCache","_g","uuid","servicDefinition","this_1","find","def","CordovaServiceAdapter","serviceUUIDs_1","serviceUUIDs_1_1","_c","_d","serviceDefinition","connectionStateSubscription","unsubscribe","connectObservable","shareReplay","subscribe","toPromise","disconnect","close","getService","BleComError","serviceNotFound","config","peripheral","getCharacteristic","charcUUID","characteristicDescription","characteristics","c","charcacteristicNotFound","CordovaCharacteristicAdapter","getCharacteristics","map","service","properties","setupDataStreamIfRequired","isNotification","characteristicReadValue","getDescriptor","getDescriptors","descriptors","descriptor","CordovaDescriptorAdapter","writeWithoutResponse","characteristicWriteWithoutResponse","characteristicWrite","enableNotifications","enabled","characteristicStartNotification","characteristicStopNotification","_dataStream","characteristicChanged","characteristic","readValue","writeValue","BLEScanner","requestDeviceOptions","_results","_scanning$","start","scanSubscription","undefined","clearResults","checkAvailable","bleNotAvailable","Promise","resolve","reject","cordovaInterface","startScan","addOrRefreshDevice","error","getLastError","then","lasterror","catch","stop","stopScan","err_1","newDevice","storedDeviceIndex","devices","findIndex","entry","address","storedDevice","name","rssi","hexStringToBuffer","str","hexStringToBufferCore","IoTizeBleCordovaPlugin","execSingleResult","requestEnableBle","execMultipleResult","JSON","stringify","enableBleIfNot","askBleEnable","switchMap","console","warn","safeEnumValue","askEnable","__awaiter","requestMTU","mtu","isConnected","bufferToHexString","serviceId","characId","hexString","methodName","args","cordova","exec","objectErrorToError","subject","Subject"],"mappings":";;;;;;;;;;;;;;oFAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,MACpDN,EAAGC,aAGZO,EAAUR,EAAGC,GAEzB,SAASQ,IAAOC,KAAKC,YAAcX,EADnCD,EAAcC,EAAGC,GAEjBD,EAAEY,UAAkB,OAANX,EAAaC,OAAOW,OAAOZ,IAAMQ,EAAGG,UAAYX,EAAEW,UAAW,IAAIH,YAmDnEK,EAAYC,EAASC,GACjC,IAAsGC,EAAG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KEtB,EAAAlM,UAAAqM,mBAAA,SACNkB,EACAC,GAEA,IAAMI,EAAU,IAAIC,EAAAA,QAYpB,OAXAJ,QAAQC,MACN,SAAC1I,GACC4I,EAAQ9M,KAAKkE,MAEf,SAACK,GACCuI,EAAQ9C,MAAM6C,EAAmBtI,MAEnC,SACAkI,EACAC,GAEKI,EAAQ7H,qBAInB,SAAS4H,EAAmBnL,GAC1B,MAAyB,iBAAdA,GAA2BA,EAAUI,MAASJ,EAAUK,QAG9DR,EAAgBY,iBAAiBT,EAAUI,MAGzC,IAAIP,EACTG,EAAUK,QACVR,EAAgBI,KAAKD,EAAUI,OAJxBP,EAAgBM,iBAAiBH,GAHjCH,EAAgBE,mBAAmBC","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { CodeError } from '@iotize/common/error';\n\nexport class CordovaBLEError extends CodeError {\n static invalidErrorResult(errObject: {\n code?: string | undefined;\n message?: string | undefined;\n }): CordovaBLEError {\n return new CordovaBLEError(\n `Internal error: ble cordova plugin returned an unexpected error object`,\n CordovaBLEError.Code.InternalError\n );\n }\n\n static invalidErrorCode(errObject: {\n code?: string | undefined;\n message?: string | undefined;\n }): CordovaBLEError {\n return new CordovaBLEError(\n `Internal error: ble cordova plugin returned an invalid error code ${errObject.code} with message ${errObject.message}`,\n CordovaBLEError.Code.InternalError\n );\n }\n\n static invalidNativeCallResult(result: any, cause: Error): CordovaBLEError {\n return new CordovaBLEError(\n `Internal error: native call returned an invalid data type. ${cause.message}`,\n CordovaBLEError.Code.InternalError\n );\n }\n\n static isValidErrorCode(\n code: string\n ): code is keyof typeof CordovaBLEError.Code {\n return code in CordovaBLEError.Code;\n }\n\n static iotizeBLEMissing() {\n return new CordovaBLEError(\n `iotizeBLE global variable does not exist. Are you sure app is running inside a Cordova application ?`,\n CordovaBLEError.Code.InternalError\n );\n }\n}\n\n/* istanbul ignore next */\nexport namespace CordovaBLEError {\n export enum Code {\n InternalError = 'CordovaBLEErrorInternalError',\n IllegalArgument = 'CordovaBLEErrorIllegalArgument',\n BLENotAvailable = 'CordovaBLEErrorBLENotAvailable',\n InvalidMacAddress = 'InvalidMacAddressInvalidMacAddress',\n ConnectionError = 'CordovaBLEErrorConnectionError',\n RequestError = 'CordovaBLEErrorRequestError',\n LocationServiceDisabled = 'CordovaBLEErrorLocationServiceDisabled',\n DisconnectError = 'CordovaBLEErrorDisconnectError',\n IllegalAction = 'CordovaBLEErrorIllegalAction',\n NotConnectedError = 'CordovaBLEErrorNotConnectedError',\n StatusCodeError = 'CordovaBLEErrorStatusCodeError',\n }\n}\n","import { createDebugger } from \"@iotize/common/debug\";\n\nexport const debug = createDebugger(`@iotize/device-com-ble.cordova`);\n","import { CordovaBLEError } from \"./cordova-ble-error\";\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\n\ndeclare var iotizeBLE: IoTizeBleCordovaPlugin;\n\nexport function getIoTizeBleCordovaPlugin(): IoTizeBleCordovaPlugin {\n if (typeof iotizeBLE !== \"object\") {\n throw CordovaBLEError.iotizeBLEMissing();\n }\n return iotizeBLE;\n}\n","//\n// Copyright 2018 IoTize SAS Inc. Licensed under the MIT license.\n//\n// ble-com-protocol.ts\n// device-com-ble.cordova BLE Cordova Plugin\n//\nimport {\n ComProtocolConnectOptions,\n ComProtocolDisconnectOptions,\n ComProtocolOptions,\n ComProtocolSendOptions,\n ConnectionState,\n} from '@iotize/tap/protocol/api';\nimport { QueueComProtocol } from '@iotize/tap/protocol/core';\nimport { defer, Observable, of, throwError } from 'rxjs';\nimport { catchError, filter, first, tap } from 'rxjs/operators';\nimport { CordovaBLEError } from './cordova-ble-error';\nimport { IoTizeBleCordovaPlugin } from './iotize-ble-cordova-plugin';\nimport { debug } from './logger';\nimport { getIoTizeBleCordovaPlugin } from './utility';\n\nexport class BLEComProtocol extends QueueComProtocol {\n /**\n * Lazy reference to iotizeBLE.\n * We don't want to reference iotizeBLE in constructor as it may be referenced\n * before cordova plugin is loaded\n */\n private get pluginInterface(): IoTizeBleCordovaPlugin {\n return this.cordovaInterfaceOverwrite || getIoTizeBleCordovaPlugin();\n }\n\n constructor(\n private deviceId: string,\n comProtocolOptions?: ComProtocolOptions,\n public readonly cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin\n ) {\n super();\n if (comProtocolOptions) {\n this.options = comProtocolOptions;\n } else {\n this.options.connect.timeout = 60000;\n }\n }\n\n _connect(options?: ComProtocolConnectOptions): Observable<any> {\n debug('_connect', options);\n return this.pluginInterface\n .connectAndDiscoverTapServices(this.deviceId)\n .pipe(\n tap((state) => {\n this.setConnectionState(state);\n }),\n filter((state) => state === ConnectionState.CONNECTED),\n first()\n );\n }\n\n _disconnect(options?: ComProtocolDisconnectOptions): Observable<any> {\n debug('_disconnect', options);\n return defer(() => this.pluginInterface.disConnect(this.deviceId));\n }\n\n async write(data: Uint8Array): Promise<any> {\n throw new Error('Method not implemented.');\n }\n\n async read(): Promise<Uint8Array> {\n throw new Error('Method not implemented.');\n }\n\n send(\n data: Uint8Array,\n options?: ComProtocolSendOptions\n ): Observable<Uint8Array> {\n return defer(() => this.pluginInterface.send(this.deviceId, data)).pipe(\n catchError((err) => {\n if (\n (err as CordovaBLEError)?.code ===\n CordovaBLEError.Code.NotConnectedError\n ) {\n this.setConnectionState(ConnectionState.DISCONNECTED);\n }\n return throwError(err);\n })\n );\n }\n}\n","import { ConnectionState } from \"@iotize/tap/protocol/api\";\nimport {\n CharacteristicAdapterInterface,\n PeripheralAdapterInterface,\n ServiceAdapterInterface,\n DescriptorAdapterInterface,\n BleComError,\n CharacteristicProperties,\n} from \"@iotize/tap/protocol/ble/common\";\nimport { BehaviorSubject, Observable, Subscription } from \"rxjs\";\nimport {\n distinctUntilChanged,\n filter,\n first,\n map,\n shareReplay,\n} from \"rxjs/operators\";\nimport {\n CharacteristicDescription,\n DescriptorDescription,\n ServiceDescription,\n ServiceList,\n} from \"./definitions\";\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\nimport { getIoTizeBleCordovaPlugin } from \"./utility\";\n\nexport class CordovaPeripheralAdapter\n implements PeripheralAdapterInterface<CordovaServiceAdapter>\n{\n private _stateChange = new BehaviorSubject<ConnectionState>(\n ConnectionState.DISCONNECTED\n );\n private connectionStateSubscription?: Subscription;\n private serviceListCache?: ServiceList;\n\n get stateChange() {\n return this._stateChange.asObservable().pipe(distinctUntilChanged());\n }\n\n get name() {\n // TODO device name ?\n return this.id;\n }\n\n get id() {\n return this.deviceId;\n }\n\n constructor(\n public readonly deviceId: string,\n public readonly cordovaPlugin: IoTizeBleCordovaPlugin = getIoTizeBleCordovaPlugin()\n ) {}\n\n get state(): string {\n return ConnectionState[this._stateChange.value];\n }\n\n async discoverServices<Key extends string = string>(\n serviceUUIDs?: Key[]\n ): Promise<Partial<Record<Key, CordovaServiceAdapter>>> {\n this.serviceListCache = await this.cordovaPlugin.discoverServices(\n this.deviceId\n );\n const result: Partial<Record<Key, CordovaServiceAdapter>> = {};\n if (serviceUUIDs) {\n for (const uuid of serviceUUIDs) {\n const servicDefinition = this.serviceListCache.find(\n (def) => def.uuid === uuid\n );\n if (servicDefinition) {\n result[uuid] = new CordovaServiceAdapter(servicDefinition, this);\n }\n }\n } else {\n for (const serviceDefinition of this.serviceListCache) {\n result[serviceDefinition.uuid as Key] = new CordovaServiceAdapter(\n serviceDefinition,\n this\n );\n }\n }\n return result;\n }\n\n async connect(): Promise<void> {\n this.connectionStateSubscription?.unsubscribe();\n const connectObservable = this.cordovaPlugin\n .connect(this.deviceId)\n .pipe(shareReplay());\n this.connectionStateSubscription = connectObservable.subscribe((state) => {\n this._stateChange.next(state);\n });\n await connectObservable\n .pipe(\n filter((state) => state === ConnectionState.CONNECTED),\n first()\n )\n .toPromise();\n }\n\n async disconnect(): Promise<void> {\n await this.cordovaPlugin.disConnect(this.deviceId);\n this._stateChange.next(ConnectionState.DISCONNECTED);\n this.connectionStateSubscription?.unsubscribe();\n }\n\n async close(): Promise<void> {\n await this.cordovaPlugin.close(this.deviceId);\n this._stateChange.next(ConnectionState.DISCONNECTED);\n this.connectionStateSubscription?.unsubscribe();\n }\n\n async getService(uuid: string): Promise<CordovaServiceAdapter> {\n if (!this.serviceListCache) {\n await this.discoverServices([uuid]);\n }\n const serviceDefinition = this.serviceListCache!.find(\n (s) => s.uuid === uuid\n );\n if (!serviceDefinition) {\n throw BleComError.serviceNotFound(uuid);\n }\n return new CordovaServiceAdapter(serviceDefinition, this);\n }\n}\n\nexport class CordovaServiceAdapter implements ServiceAdapterInterface {\n get uuid() {\n return this.config.uuid;\n }\n\n constructor(\n private readonly config: ServiceDescription,\n public readonly peripheral: CordovaPeripheralAdapter\n ) {}\n\n async getCharacteristic(\n charcUUID: string\n ): Promise<CordovaCharacteristicAdapter> {\n const characteristicDescription = this.config.characteristics?.find(\n (c) => c.uuid === charcUUID\n );\n if (!characteristicDescription) {\n throw BleComError.charcacteristicNotFound(charcUUID);\n }\n return new CordovaCharacteristicAdapter(this, characteristicDescription);\n }\n\n async getCharacteristics(): Promise<CordovaCharacteristicAdapter[]> {\n if (!this.config.characteristics) {\n return [];\n }\n return this.config.characteristics.map(\n (c) => new CordovaCharacteristicAdapter(this, c)\n );\n }\n}\n\nexport class CordovaCharacteristicAdapter\n implements CharacteristicAdapterInterface\n{\n private _dataStream?: Observable<Uint8Array>;\n\n get uuid() {\n return this.config.uuid;\n }\n\n constructor(\n public readonly service: CordovaServiceAdapter,\n public readonly config: CharacteristicDescription\n ) {}\n\n get properties(): CharacteristicProperties {\n return this.config.properties;\n }\n\n get data(): Observable<{ data: Uint8Array; isNotification: boolean }> {\n return this.setupDataStreamIfRequired().pipe(\n map((data) => ({\n data,\n isNotification: true,\n }))\n );\n }\n\n protected get deviceId() {\n return this.service.peripheral.deviceId;\n }\n\n protected get pluginInterface() {\n return this.service.peripheral.cordovaPlugin;\n }\n\n async read(): Promise<Uint8Array> {\n return this.pluginInterface.characteristicReadValue(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n }\n\n async getDescriptor(): Promise<CordovaDescriptorAdapter> {\n throw new Error(`Not implemented yet`);\n }\n\n async getDescriptors(): Promise<DescriptorAdapterInterface[]> {\n if (!this.config.descriptors) {\n return [];\n }\n return this.config.descriptors.map(\n (descriptor) => new CordovaDescriptorAdapter(descriptor, this)\n );\n }\n\n async write(\n data: Uint8Array,\n writeWithoutResponse: boolean\n ): Promise<Uint8Array> {\n if (writeWithoutResponse) {\n await this.pluginInterface.characteristicWriteWithoutResponse(\n this.deviceId,\n this.service.uuid,\n this.uuid,\n data\n );\n } else {\n await this.pluginInterface.characteristicWrite(\n this.deviceId,\n this.service.uuid,\n this.uuid,\n data\n );\n }\n return data;\n }\n\n async enableNotifications(enabled?: boolean): Promise<void> {\n if (enabled) {\n this.setupDataStreamIfRequired();\n await this.pluginInterface.characteristicStartNotification(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n } else {\n await this.pluginInterface.characteristicStopNotification(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n }\n }\n\n setupDataStreamIfRequired() {\n if (!this._dataStream) {\n this._dataStream = this.pluginInterface.characteristicChanged(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n }\n return this._dataStream;\n }\n}\n\nexport class CordovaDescriptorAdapter implements DescriptorAdapterInterface {\n get uuid() {\n return this.config.uuid;\n }\n\n constructor(\n public readonly config: DescriptorDescription,\n public readonly characteristic: CordovaCharacteristicAdapter\n ) {}\n\n async readValue(): Promise<Uint8Array> {\n throw new Error(`Reading descriptor value is not implemented yet`);\n }\n\n async writeValue(data: Uint8Array): Promise<void> {\n throw new Error(`Writing descriptor value is not implemented yet`);\n }\n}\n","//\n// Copyright 2018 IoTize SAS Inc. Licensed under the MIT license.\n//\n// scanner.ts\n// device-com-ble.cordova BLE Cordova Plugin\n//\n\nimport { BleComError } from \"@iotize/tap/protocol/ble/common\";\nimport { DeviceScanner, DeviceScannerOptions } from \"@iotize/tap/scanner/api\";\nimport { BehaviorSubject, Observable, Subscription } from \"rxjs\";\nimport { CordovaBLEScanResult, RequestDeviceOptions } from \"./definitions\";\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\nimport { debug } from \"./logger\";\nimport { getIoTizeBleCordovaPlugin } from \"./utility\";\n\n/**\n * BLE Tap scanner for cordova apps\n */\nexport class BLEScanner implements DeviceScanner<CordovaBLEScanResult> {\n private _results = new BehaviorSubject<CordovaBLEScanResult[]>([]);\n private _scanning$ = new BehaviorSubject<boolean>(false);\n private scanSubscription?: Subscription;\n\n /**\n * Lazy reference to iotizeBLE.\n * We don't want to reference iotizeBLE in constructor as it may be referenced\n * before cordova plugin is loaded\n */\n private get cordovaInterface(): IoTizeBleCordovaPlugin {\n return this.cordovaInterfaceOverwrite || getIoTizeBleCordovaPlugin();\n }\n\n /**\n *\n * @param cordovaInterfaceOverwrite overwrite cordova interface. Used for testing\n */\n constructor(\n private cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin,\n /**\n * Request device options used to filter scan results\n */\n readonly requestDeviceOptions?: RequestDeviceOptions\n ) {}\n\n get scanning(): Observable<boolean> {\n return this._scanning$.asObservable();\n }\n\n get isScanning(): boolean {\n return this._scanning$.value;\n }\n\n /**\n * Gets the observable on the devices$ Subject\n * @return\n */\n get results(): Observable<CordovaBLEScanResult[]> {\n return this._results.asObservable();\n }\n\n /**\n * Launches the scan for BLE devices\n * Throws if BLE is not available\n */\n async start(options?: DeviceScannerOptions): Promise<void> {\n this.scanSubscription?.unsubscribe();\n this.scanSubscription = undefined;\n this.clearResults();\n const isAvailable = await this.checkAvailable();\n if (!isAvailable) {\n throw BleComError.bleNotAvailable(\n `BLE is not available. Make sure that BLE is enabled on your device`\n );\n }\n debug(\"Start Scanning ...\");\n this._scanning$.next(true);\n return new Promise<void>((resolve, reject) => {\n this.scanSubscription = this.cordovaInterface\n .startScan(this.requestDeviceOptions)\n .subscribe(\n (result) => {\n if (result == \"Ok\") {\n resolve();\n return;\n }\n this.addOrRefreshDevice(result);\n },\n (error) => {\n debug(\"Start scan failed with error: \", error);\n this.cordovaInterface\n .getLastError()\n .then((lasterror) => {\n debug(\"Last BLE error \" + lasterror);\n })\n .catch((err) => {\n debug(\"Cannot get last BLE error: \", err);\n });\n reject(error);\n this._scanning$.next(false);\n }\n );\n });\n }\n\n /**\n *\n */\n async stop(): Promise<void> {\n debug(\"Stop Scanning ...\");\n try {\n this.scanSubscription?.unsubscribe();\n this.scanSubscription = undefined;\n await this.cordovaInterface.stopScan();\n this._scanning$.next(false);\n return;\n } catch (err) {\n this._scanning$.next(false);\n throw err;\n }\n }\n\n /**\n * Returns true if this scanner is available\n */\n checkAvailable(): Promise<boolean> {\n return this.cordovaInterface.checkAvailable();\n }\n\n private get devices() {\n return this._results.value;\n }\n\n private clearResults() {\n this._results.next([]);\n }\n\n private addOrRefreshDevice(newDevice: CordovaBLEScanResult) {\n let storedDeviceIndex = this.devices.findIndex(\n (entry) => entry.address == newDevice.address\n );\n if (storedDeviceIndex >= 0) {\n let storedDevice = this.devices[storedDeviceIndex];\n if (\n storedDevice.name != newDevice.name ||\n storedDevice.rssi != newDevice.rssi\n ) {\n debug(\n `Updating device at index ${storedDeviceIndex}, name=${storedDevice.name} with rssi=${storedDevice.rssi}`\n );\n this.devices[storedDeviceIndex] = newDevice;\n // this.devices = [...this.devices];\n this._results.next(this.devices);\n }\n } else {\n debug(\n `Adding new device name=${newDevice.name} with rssi=${newDevice.rssi}`\n );\n this.devices.push(newDevice);\n this._results.next(this.devices);\n }\n }\n}\n","import {\n bufferToHexString,\n hexStringToBuffer as hexStringToBufferCore,\n} from \"@iotize/common/byte-converter\";\nimport { safeEnumValue } from \"@iotize/common/utility\";\nimport { ConnectionState } from \"@iotize/tap/protocol/api\";\nimport { Observable, Subject, defer } from \"rxjs\";\nimport { switchMap } from \"rxjs/operators\";\nimport { map } from \"rxjs/operators\";\nimport { CordovaInterface } from \"./cordova-interface\";\nimport {\n CordovaBLEScanResult,\n RequestDeviceOptions,\n ServiceList,\n} from \"./definitions\";\nimport { CordovaBLEError } from \"./cordova-ble-error\";\n\nfunction hexStringToBuffer(str: string): Uint8Array {\n try {\n return hexStringToBufferCore(str);\n } catch (err) {\n throw CordovaBLEError.invalidNativeCallResult(str, err as Error);\n }\n}\n\ndeclare var cordova: CordovaInterface;\n\nexport class IoTizeBleCordovaPlugin {\n checkAvailable(): Promise<boolean> {\n return this.execSingleResult<boolean>(\"checkAvailable\", []);\n }\n\n requestEnableBle(): Promise<\"OK\"> {\n return this.execSingleResult<\"OK\">(\"enable\", []);\n }\n\n startScan(\n requestDeviceOptions: RequestDeviceOptions | undefined\n ): Observable<CordovaBLEScanResult | \"Ok\"> {\n return this.execMultipleResult<CordovaBLEScanResult | \"Ok\">(\"startScan\", [\n JSON.stringify(requestDeviceOptions),\n ]);\n }\n\n stopScan() {\n return this.execSingleResult<\"OK\">(\"stopScan\", []);\n }\n\n connect(\n deviceId: string,\n enableBleIfNot: boolean = true\n ): Observable<ConnectionState> {\n return this.askBleEnable(enableBleIfNot).pipe(\n switchMap(() => {\n return this.execMultipleResult<string>(\"connect\", [deviceId]).pipe(\n map((state) => {\n if (!(state in ConnectionState)) {\n console.warn(\n `Plugin native code returned an invalid connection state: \"${state}\".`\n );\n }\n return safeEnumValue(ConnectionState, state);\n })\n );\n })\n );\n }\n\n askBleEnable(askEnable: boolean): Observable<void> {\n return defer(async () => {\n if (askEnable) {\n if (!(await this.checkAvailable())) {\n await this.requestEnableBle();\n }\n }\n });\n }\n\n requestMTU(deviceId: string, mtu: number) {\n return this.execSingleResult<\"OK\">(\"requestMTU\", [deviceId, mtu]);\n }\n\n connectAndDiscoverTapServices(\n deviceId: string,\n enableBleIfNot: boolean = true\n ): Observable<ConnectionState> {\n return this.askBleEnable(enableBleIfNot).pipe(\n switchMap(() => {\n return this.execMultipleResult<string>(\n \"connectAndDiscoverTapServices\",\n [deviceId]\n ).pipe(\n map((state) => {\n if (!(state in ConnectionState)) {\n console.warn(\n `Plugin native code returned an invalid connection state: \"${state}\".`\n );\n }\n return safeEnumValue(ConnectionState, state);\n })\n );\n })\n );\n }\n\n disConnect(deviceId: string) {\n return this.execSingleResult<\"OK\">(\"disConnect\", [deviceId]);\n }\n\n close(deviceId: string) {\n return this.execSingleResult<\"OK\">(\"close\", [deviceId]);\n }\n\n isConnected(deviceId: string) {\n return this.execSingleResult<boolean>(\"isConnected\", [deviceId]);\n }\n\n async send(deviceId: string, data: Uint8Array) {\n const hexString = await this.execSingleResult<string>(\"sendRequest\", [\n deviceId,\n bufferToHexString(data),\n ]);\n return hexStringToBuffer(hexString);\n }\n\n getLastError() {\n return this.execSingleResult<string>(\"getLastError\", []);\n }\n\n characteristicStartNotification(\n deviceId: string,\n serviceId: string,\n characId: string\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicStartNotification\", [\n deviceId,\n serviceId,\n characId,\n ]);\n }\n\n characteristicChanged(\n deviceId: string,\n serviceId: string,\n characId: string\n ): Observable<Uint8Array> {\n return this.execMultipleResult<string>(\"characteristicChanged\", [\n deviceId,\n serviceId,\n characId,\n ]).pipe(\n map((hexString) => {\n return hexStringToBuffer(hexString);\n })\n );\n }\n\n characteristicStopNotification(\n deviceId: string,\n serviceId: string,\n characId: string\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicStopNotification\", [\n deviceId,\n serviceId,\n characId,\n ]);\n }\n\n async characteristicReadValue(\n deviceId: string,\n serviceId: string,\n characId: string\n ): Promise<Uint8Array> {\n const hexString = await this.execSingleResult<string>(\n \"characteristicRead\",\n [deviceId, serviceId, characId]\n );\n return hexStringToBuffer(hexString);\n }\n\n characteristicWrite(\n deviceId: string,\n serviceId: string,\n characId: string,\n data: Uint8Array\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicWrite\", [\n deviceId,\n serviceId,\n characId,\n bufferToHexString(data),\n ]);\n }\n\n characteristicWriteWithoutResponse(\n deviceId: string,\n serviceId: string,\n characId: string,\n data: Uint8Array\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicWriteWithoutResponse\", [\n deviceId,\n serviceId,\n characId,\n bufferToHexString(data),\n ]);\n }\n\n async discoverServices(deviceId: string): Promise<ServiceList> {\n const services = await this.execSingleResult<ServiceList>(\n \"discoverServices\",\n [deviceId]\n );\n return services;\n }\n\n private execSingleResult<T extends string | void | boolean | Object>(\n methodName: string,\n args: any[]\n ): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n cordova.exec(\n resolve,\n (errObject: { code?: string; message?: string }) => {\n reject(objectErrorToError(errObject));\n },\n \"BLECom\",\n methodName,\n args\n );\n });\n }\n\n private execMultipleResult<T>(\n methodName: string,\n args: any[]\n ): Observable<T> {\n const subject = new Subject<T>();\n cordova.exec<T>(\n (data) => {\n subject.next(data);\n },\n (err) => {\n subject.error(objectErrorToError(err));\n },\n \"BLECom\",\n methodName,\n args\n );\n return subject.asObservable();\n }\n}\n\nfunction objectErrorToError(errObject: { code?: string; message?: string }) {\n if (typeof errObject !== \"object\" || !errObject.code || !errObject.message) {\n return CordovaBLEError.invalidErrorResult(errObject);\n }\n if (!CordovaBLEError.isValidErrorCode(errObject.code)) {\n return CordovaBLEError.invalidErrorCode(errObject);\n }\n return new CordovaBLEError(\n errObject.message,\n CordovaBLEError.Code[errObject.code]\n );\n}\n"]}
1
+ {"version":3,"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","this","constructor","prototype","create","__generator","thisArg","body","f","y","t","g","_","label","sent","trys","ops","next","verb","throw","return","Symbol","iterator","n","v","op","TypeError","call","done","value","pop","length","push","e","step","__values","o","s","m","i","CordovaBLEError","_super","invalidErrorResult","errObject","Code","InternalError","invalidErrorCode","code","message","invalidNativeCallResult","result","cause","isValidErrorCode","iotizeBLEMissing","CodeError","debug","createDebugger","getIoTizeBleCordovaPlugin","iotizeBLE","BLEComProtocol","deviceId","comProtocolOptions","cordovaInterfaceOverwrite","_this","options","connect","timeout","defineProperty","_connect","pluginInterface","connectAndDiscoverTapServices","pipe","tap","state","setConnectionState","filter","ConnectionState","CONNECTED","first","_disconnect","defer","disConnect","write","data","Error","read","send","catchError","err","_a","NotConnectedError","DISCONNECTED","throwError","QueueComProtocol","CordovaPeripheralAdapter","cordovaPlugin","_stateChange","BehaviorSubject","asObservable","distinctUntilChanged","id","discoverServices","serviceUUIDs","_b","serviceListCache","_g","uuid","servicDefinition","this_1","find","def","CordovaServiceAdapter","serviceUUIDs_1","serviceUUIDs_1_1","_c","_d","serviceDefinition","connectionStateSubscription","unsubscribe","connectObservable","shareReplay","subscribe","toPromise","disconnect","close","getService","BleComError","serviceNotFound","config","peripheral","getCharacteristic","charcUUID","characteristicDescription","characteristics","c","charcacteristicNotFound","CordovaCharacteristicAdapter","getCharacteristics","map","service","properties","setupDataStreamIfRequired","isNotification","characteristicReadValue","getDescriptor","getDescriptors","descriptors","descriptor","CordovaDescriptorAdapter","writeWithoutResponse","characteristicWriteWithoutResponse","characteristicWrite","enableNotifications","enabled","characteristicStartNotification","characteristicStopNotification","_dataStream","characteristicChanged","characteristic","readValue","writeValue","BLEScanner","requestDeviceOptions","_results","_scanning$","start","scanSubscription","undefined","clearResults","checkAvailable","bleNotAvailable","Promise","resolve","reject","cordovaInterface","startScan","addOrRefreshDevice","error","getLastError","then","lasterror","catch","stop","stopScan","err_1","newDevice","storedDeviceIndex","devices","findIndex","entry","address","storedDevice","name","rssi","hexStringToBuffer","str","hexStringToBufferCore","IoTizeBleCordovaPlugin","execSingleResult","requestEnableBle","execMultipleResult","JSON","stringify","enableBleIfNot","askBleEnable","switchMap","console","warn","safeEnumValue","askEnable","__awaiter","requestMTU","mtu","isConnected","bufferToHexString","serviceId","characId","hexString","methodName","args","cordova","exec","objectErrorToError","subject","Subject"],"sources":["../../../../node_modules/tslib/tslib.es6.js","../../../../src/lib/cordova-ble-error.ts","../../../../src/lib/logger.ts","../../../../src/lib/utility.ts","../../../../src/lib/ble-com-protocol.ts","../../../../src/lib/cordova-service-adapter.ts","../../../../src/lib/scanner.ts","../../../../src/lib/iotize-ble-cordova-plugin.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { CodeError } from '@iotize/common/error';\n\nexport class CordovaBLEError extends CodeError {\n static invalidErrorResult(errObject: {\n code?: string | undefined;\n message?: string | undefined;\n }): CordovaBLEError {\n return new CordovaBLEError(\n `Internal error: ble cordova plugin returned an unexpected error object`,\n CordovaBLEError.Code.InternalError\n );\n }\n\n static invalidErrorCode(errObject: {\n code?: string | undefined;\n message?: string | undefined;\n }): CordovaBLEError {\n return new CordovaBLEError(\n `Internal error: ble cordova plugin returned an invalid error code ${errObject.code} with message ${errObject.message}`,\n CordovaBLEError.Code.InternalError\n );\n }\n\n static invalidNativeCallResult(result: any, cause: Error): CordovaBLEError {\n return new CordovaBLEError(\n `Internal error: native call returned an invalid data type. ${cause.message}`,\n CordovaBLEError.Code.InternalError\n );\n }\n\n static isValidErrorCode(\n code: string\n ): code is keyof typeof CordovaBLEError.Code {\n return code in CordovaBLEError.Code;\n }\n\n static iotizeBLEMissing() {\n return new CordovaBLEError(\n `iotizeBLE global variable does not exist. Are you sure app is running inside a Cordova application ?`,\n CordovaBLEError.Code.InternalError\n );\n }\n}\n\n/* istanbul ignore next */\nexport namespace CordovaBLEError {\n export enum Code {\n InternalError = 'CordovaBLEErrorInternalError',\n IllegalArgument = 'CordovaBLEErrorIllegalArgument',\n BLENotAvailable = 'CordovaBLEErrorBLENotAvailable',\n InvalidMacAddress = 'InvalidMacAddressInvalidMacAddress',\n ConnectionError = 'CordovaBLEErrorConnectionError',\n RequestError = 'CordovaBLEErrorRequestError',\n LocationServiceDisabled = 'CordovaBLEErrorLocationServiceDisabled',\n DisconnectError = 'CordovaBLEErrorDisconnectError',\n IllegalAction = 'CordovaBLEErrorIllegalAction',\n NotConnectedError = 'CordovaBLEErrorNotConnectedError',\n StatusCodeError = 'CordovaBLEErrorStatusCodeError',\n }\n}\n","import { createDebugger } from \"@iotize/common/debug\";\n\nexport const debug = createDebugger(`@iotize/device-com-ble.cordova`);\n","import { CordovaBLEError } from \"./cordova-ble-error\";\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\n\ndeclare var iotizeBLE: IoTizeBleCordovaPlugin;\n\nexport function getIoTizeBleCordovaPlugin(): IoTizeBleCordovaPlugin {\n if (typeof iotizeBLE !== \"object\") {\n throw CordovaBLEError.iotizeBLEMissing();\n }\n return iotizeBLE;\n}\n","//\n// Copyright 2018 IoTize SAS Inc. Licensed under the MIT license.\n//\n// ble-com-protocol.ts\n// device-com-ble.cordova BLE Cordova Plugin\n//\nimport {\n ComProtocolConnectOptions,\n ComProtocolDisconnectOptions,\n ComProtocolOptions,\n ComProtocolSendOptions,\n ConnectionState,\n} from '@iotize/tap/protocol/api';\nimport { QueueComProtocol } from '@iotize/tap/protocol/core';\nimport { defer, Observable, of, throwError } from 'rxjs';\nimport { catchError, filter, first, tap } from 'rxjs/operators';\nimport { CordovaBLEError } from './cordova-ble-error';\nimport { IoTizeBleCordovaPlugin } from './iotize-ble-cordova-plugin';\nimport { debug } from './logger';\nimport { getIoTizeBleCordovaPlugin } from './utility';\n\nexport class BLEComProtocol extends QueueComProtocol {\n /**\n * Lazy reference to iotizeBLE.\n * We don't want to reference iotizeBLE in constructor as it may be referenced\n * before cordova plugin is loaded\n */\n private get pluginInterface(): IoTizeBleCordovaPlugin {\n return this.cordovaInterfaceOverwrite || getIoTizeBleCordovaPlugin();\n }\n\n constructor(\n private deviceId: string,\n comProtocolOptions?: ComProtocolOptions,\n public readonly cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin\n ) {\n super();\n if (comProtocolOptions) {\n this.options = comProtocolOptions;\n } else {\n this.options.connect.timeout = 60000;\n }\n }\n\n _connect(options?: ComProtocolConnectOptions): Observable<any> {\n debug('_connect', options);\n return this.pluginInterface\n .connectAndDiscoverTapServices(this.deviceId)\n .pipe(\n tap((state) => {\n this.setConnectionState(state);\n }),\n filter((state) => state === ConnectionState.CONNECTED),\n first()\n );\n }\n\n _disconnect(options?: ComProtocolDisconnectOptions): Observable<any> {\n debug('_disconnect', options);\n return defer(() => this.pluginInterface.disConnect(this.deviceId));\n }\n\n async write(data: Uint8Array): Promise<any> {\n throw new Error('Method not implemented.');\n }\n\n async read(): Promise<Uint8Array> {\n throw new Error('Method not implemented.');\n }\n\n send(\n data: Uint8Array,\n options?: ComProtocolSendOptions\n ): Observable<Uint8Array> {\n return defer(() => this.pluginInterface.send(this.deviceId, data)).pipe(\n catchError((err) => {\n if (\n (err as CordovaBLEError)?.code ===\n CordovaBLEError.Code.NotConnectedError\n ) {\n this.setConnectionState(ConnectionState.DISCONNECTED);\n }\n return throwError(err);\n })\n );\n }\n}\n","import { ConnectionState } from \"@iotize/tap/protocol/api\";\nimport {\n CharacteristicAdapterInterface,\n PeripheralAdapterInterface,\n ServiceAdapterInterface,\n DescriptorAdapterInterface,\n BleComError,\n CharacteristicProperties,\n} from \"@iotize/tap/protocol/ble/common\";\nimport { BehaviorSubject, Observable, Subscription } from \"rxjs\";\nimport {\n distinctUntilChanged,\n filter,\n first,\n map,\n shareReplay,\n} from \"rxjs/operators\";\nimport {\n CharacteristicDescription,\n DescriptorDescription,\n ServiceDescription,\n ServiceList,\n} from \"./definitions\";\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\nimport { getIoTizeBleCordovaPlugin } from \"./utility\";\n\nexport class CordovaPeripheralAdapter\n implements PeripheralAdapterInterface<CordovaServiceAdapter>\n{\n private _stateChange = new BehaviorSubject<ConnectionState>(\n ConnectionState.DISCONNECTED\n );\n private connectionStateSubscription?: Subscription;\n private serviceListCache?: ServiceList;\n\n get stateChange() {\n return this._stateChange.asObservable().pipe(distinctUntilChanged());\n }\n\n get name() {\n // TODO device name ?\n return this.id;\n }\n\n get id() {\n return this.deviceId;\n }\n\n constructor(\n public readonly deviceId: string,\n public readonly cordovaPlugin: IoTizeBleCordovaPlugin = getIoTizeBleCordovaPlugin()\n ) {}\n\n get state(): string {\n return ConnectionState[this._stateChange.value];\n }\n\n async discoverServices<Key extends string = string>(\n serviceUUIDs?: Key[]\n ): Promise<Partial<Record<Key, CordovaServiceAdapter>>> {\n this.serviceListCache = await this.cordovaPlugin.discoverServices(\n this.deviceId\n );\n const result: Partial<Record<Key, CordovaServiceAdapter>> = {};\n if (serviceUUIDs) {\n for (const uuid of serviceUUIDs) {\n const servicDefinition = this.serviceListCache.find(\n (def) => def.uuid === uuid\n );\n if (servicDefinition) {\n result[uuid] = new CordovaServiceAdapter(servicDefinition, this);\n }\n }\n } else {\n for (const serviceDefinition of this.serviceListCache) {\n result[serviceDefinition.uuid as Key] = new CordovaServiceAdapter(\n serviceDefinition,\n this\n );\n }\n }\n return result;\n }\n\n async connect(): Promise<void> {\n this.connectionStateSubscription?.unsubscribe();\n const connectObservable = this.cordovaPlugin\n .connect(this.deviceId)\n .pipe(shareReplay());\n this.connectionStateSubscription = connectObservable.subscribe((state) => {\n this._stateChange.next(state);\n });\n await connectObservable\n .pipe(\n filter((state) => state === ConnectionState.CONNECTED),\n first()\n )\n .toPromise();\n }\n\n async disconnect(): Promise<void> {\n await this.cordovaPlugin.disConnect(this.deviceId);\n this._stateChange.next(ConnectionState.DISCONNECTED);\n this.connectionStateSubscription?.unsubscribe();\n }\n\n async close(): Promise<void> {\n await this.cordovaPlugin.close(this.deviceId);\n this._stateChange.next(ConnectionState.DISCONNECTED);\n this.connectionStateSubscription?.unsubscribe();\n }\n\n async getService(uuid: string): Promise<CordovaServiceAdapter> {\n if (!this.serviceListCache) {\n await this.discoverServices([uuid]);\n }\n const serviceDefinition = this.serviceListCache!.find(\n (s) => s.uuid === uuid\n );\n if (!serviceDefinition) {\n throw BleComError.serviceNotFound(uuid);\n }\n return new CordovaServiceAdapter(serviceDefinition, this);\n }\n}\n\nexport class CordovaServiceAdapter implements ServiceAdapterInterface {\n get uuid() {\n return this.config.uuid;\n }\n\n constructor(\n private readonly config: ServiceDescription,\n public readonly peripheral: CordovaPeripheralAdapter\n ) {}\n\n async getCharacteristic(\n charcUUID: string\n ): Promise<CordovaCharacteristicAdapter> {\n const characteristicDescription = this.config.characteristics?.find(\n (c) => c.uuid === charcUUID\n );\n if (!characteristicDescription) {\n throw BleComError.charcacteristicNotFound(charcUUID);\n }\n return new CordovaCharacteristicAdapter(this, characteristicDescription);\n }\n\n async getCharacteristics(): Promise<CordovaCharacteristicAdapter[]> {\n if (!this.config.characteristics) {\n return [];\n }\n return this.config.characteristics.map(\n (c) => new CordovaCharacteristicAdapter(this, c)\n );\n }\n}\n\nexport class CordovaCharacteristicAdapter\n implements CharacteristicAdapterInterface\n{\n private _dataStream?: Observable<Uint8Array>;\n\n get uuid() {\n return this.config.uuid;\n }\n\n constructor(\n public readonly service: CordovaServiceAdapter,\n public readonly config: CharacteristicDescription\n ) {}\n\n get properties(): CharacteristicProperties {\n return this.config.properties;\n }\n\n get data(): Observable<{ data: Uint8Array; isNotification: boolean }> {\n return this.setupDataStreamIfRequired().pipe(\n map((data) => ({\n data,\n isNotification: true,\n }))\n );\n }\n\n protected get deviceId() {\n return this.service.peripheral.deviceId;\n }\n\n protected get pluginInterface() {\n return this.service.peripheral.cordovaPlugin;\n }\n\n async read(): Promise<Uint8Array> {\n return this.pluginInterface.characteristicReadValue(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n }\n\n async getDescriptor(): Promise<CordovaDescriptorAdapter> {\n throw new Error(`Not implemented yet`);\n }\n\n async getDescriptors(): Promise<DescriptorAdapterInterface[]> {\n if (!this.config.descriptors) {\n return [];\n }\n return this.config.descriptors.map(\n (descriptor) => new CordovaDescriptorAdapter(descriptor, this)\n );\n }\n\n async write(\n data: Uint8Array,\n writeWithoutResponse: boolean\n ): Promise<Uint8Array> {\n if (writeWithoutResponse) {\n await this.pluginInterface.characteristicWriteWithoutResponse(\n this.deviceId,\n this.service.uuid,\n this.uuid,\n data\n );\n } else {\n await this.pluginInterface.characteristicWrite(\n this.deviceId,\n this.service.uuid,\n this.uuid,\n data\n );\n }\n return data;\n }\n\n async enableNotifications(enabled?: boolean): Promise<void> {\n if (enabled) {\n this.setupDataStreamIfRequired();\n await this.pluginInterface.characteristicStartNotification(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n } else {\n await this.pluginInterface.characteristicStopNotification(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n }\n }\n\n setupDataStreamIfRequired() {\n if (!this._dataStream) {\n this._dataStream = this.pluginInterface.characteristicChanged(\n this.deviceId,\n this.service.uuid,\n this.uuid\n );\n }\n return this._dataStream;\n }\n}\n\nexport class CordovaDescriptorAdapter implements DescriptorAdapterInterface {\n get uuid() {\n return this.config.uuid;\n }\n\n constructor(\n public readonly config: DescriptorDescription,\n public readonly characteristic: CordovaCharacteristicAdapter\n ) {}\n\n async readValue(): Promise<Uint8Array> {\n throw new Error(`Reading descriptor value is not implemented yet`);\n }\n\n async writeValue(data: Uint8Array): Promise<void> {\n throw new Error(`Writing descriptor value is not implemented yet`);\n }\n}\n","//\n// Copyright 2018 IoTize SAS Inc. Licensed under the MIT license.\n//\n// scanner.ts\n// device-com-ble.cordova BLE Cordova Plugin\n//\n\nimport { BleComError } from \"@iotize/tap/protocol/ble/common\";\nimport { DeviceScanner, DeviceScannerOptions } from \"@iotize/tap/scanner/api\";\nimport { BehaviorSubject, Observable, Subscription } from \"rxjs\";\nimport { CordovaBLEScanResult, RequestDeviceOptions } from \"./definitions\";\nimport { IoTizeBleCordovaPlugin } from \"./iotize-ble-cordova-plugin\";\nimport { debug } from \"./logger\";\nimport { getIoTizeBleCordovaPlugin } from \"./utility\";\n\n/**\n * BLE Tap scanner for cordova apps\n */\nexport class BLEScanner implements DeviceScanner<CordovaBLEScanResult> {\n private _results = new BehaviorSubject<CordovaBLEScanResult[]>([]);\n private _scanning$ = new BehaviorSubject<boolean>(false);\n private scanSubscription?: Subscription;\n\n /**\n * Lazy reference to iotizeBLE.\n * We don't want to reference iotizeBLE in constructor as it may be referenced\n * before cordova plugin is loaded\n */\n private get cordovaInterface(): IoTizeBleCordovaPlugin {\n return this.cordovaInterfaceOverwrite || getIoTizeBleCordovaPlugin();\n }\n\n /**\n *\n * @param cordovaInterfaceOverwrite overwrite cordova interface. Used for testing\n */\n constructor(\n private cordovaInterfaceOverwrite?: IoTizeBleCordovaPlugin,\n /**\n * Request device options used to filter scan results\n */\n readonly requestDeviceOptions?: RequestDeviceOptions\n ) {}\n\n get scanning(): Observable<boolean> {\n return this._scanning$.asObservable();\n }\n\n get isScanning(): boolean {\n return this._scanning$.value;\n }\n\n /**\n * Gets the observable on the devices$ Subject\n * @return\n */\n get results(): Observable<CordovaBLEScanResult[]> {\n return this._results.asObservable();\n }\n\n /**\n * Launches the scan for BLE devices\n * Throws if BLE is not available\n */\n async start(options?: DeviceScannerOptions): Promise<void> {\n this.scanSubscription?.unsubscribe();\n this.scanSubscription = undefined;\n this.clearResults();\n const isAvailable = await this.checkAvailable();\n if (!isAvailable) {\n throw BleComError.bleNotAvailable(\n `BLE is not available. Make sure that BLE is enabled on your device`\n );\n }\n debug(\"Start Scanning ...\");\n this._scanning$.next(true);\n return new Promise<void>((resolve, reject) => {\n this.scanSubscription = this.cordovaInterface\n .startScan(this.requestDeviceOptions)\n .subscribe(\n (result) => {\n if (result == \"Ok\") {\n resolve();\n return;\n }\n this.addOrRefreshDevice(result);\n },\n (error) => {\n debug(\"Start scan failed with error: \", error);\n this.cordovaInterface\n .getLastError()\n .then((lasterror) => {\n debug(\"Last BLE error \" + lasterror);\n })\n .catch((err) => {\n debug(\"Cannot get last BLE error: \", err);\n });\n reject(error);\n this._scanning$.next(false);\n }\n );\n });\n }\n\n /**\n *\n */\n async stop(): Promise<void> {\n debug(\"Stop Scanning ...\");\n try {\n this.scanSubscription?.unsubscribe();\n this.scanSubscription = undefined;\n await this.cordovaInterface.stopScan();\n this._scanning$.next(false);\n return;\n } catch (err) {\n this._scanning$.next(false);\n throw err;\n }\n }\n\n /**\n * Returns true if this scanner is available\n */\n checkAvailable(): Promise<boolean> {\n return this.cordovaInterface.checkAvailable();\n }\n\n private get devices() {\n return this._results.value;\n }\n\n private clearResults() {\n this._results.next([]);\n }\n\n private addOrRefreshDevice(newDevice: CordovaBLEScanResult) {\n let storedDeviceIndex = this.devices.findIndex(\n (entry) => entry.address == newDevice.address\n );\n if (storedDeviceIndex >= 0) {\n let storedDevice = this.devices[storedDeviceIndex];\n if (\n storedDevice.name != newDevice.name ||\n storedDevice.rssi != newDevice.rssi\n ) {\n debug(\n `Updating device at index ${storedDeviceIndex}, name=${storedDevice.name} with rssi=${storedDevice.rssi}`\n );\n this.devices[storedDeviceIndex] = newDevice;\n // this.devices = [...this.devices];\n this._results.next(this.devices);\n }\n } else {\n debug(\n `Adding new device name=${newDevice.name} with rssi=${newDevice.rssi}`\n );\n this.devices.push(newDevice);\n this._results.next(this.devices);\n }\n }\n}\n","import {\n bufferToHexString,\n hexStringToBuffer as hexStringToBufferCore,\n} from \"@iotize/common/byte-converter\";\nimport { safeEnumValue } from \"@iotize/common/utility\";\nimport { ConnectionState } from \"@iotize/tap/protocol/api\";\nimport { Observable, Subject, defer } from \"rxjs\";\nimport { switchMap } from \"rxjs/operators\";\nimport { map } from \"rxjs/operators\";\nimport { CordovaInterface } from \"./cordova-interface\";\nimport {\n CordovaBLEScanResult,\n RequestDeviceOptions,\n ServiceList,\n} from \"./definitions\";\nimport { CordovaBLEError } from \"./cordova-ble-error\";\n\nfunction hexStringToBuffer(str: string): Uint8Array {\n try {\n return hexStringToBufferCore(str);\n } catch (err) {\n throw CordovaBLEError.invalidNativeCallResult(str, err as Error);\n }\n}\n\ndeclare var cordova: CordovaInterface;\n\nexport class IoTizeBleCordovaPlugin {\n checkAvailable(): Promise<boolean> {\n return this.execSingleResult<boolean>(\"checkAvailable\", []);\n }\n\n requestEnableBle(): Promise<\"OK\"> {\n return this.execSingleResult<\"OK\">(\"enable\", []);\n }\n\n startScan(\n requestDeviceOptions: RequestDeviceOptions | undefined\n ): Observable<CordovaBLEScanResult | \"Ok\"> {\n return this.execMultipleResult<CordovaBLEScanResult | \"Ok\">(\"startScan\", [\n JSON.stringify(requestDeviceOptions),\n ]);\n }\n\n stopScan() {\n return this.execSingleResult<\"OK\">(\"stopScan\", []);\n }\n\n connect(\n deviceId: string,\n enableBleIfNot: boolean = true\n ): Observable<ConnectionState> {\n return this.askBleEnable(enableBleIfNot).pipe(\n switchMap(() => {\n return this.execMultipleResult<string>(\"connect\", [deviceId]).pipe(\n map((state) => {\n if (!(state in ConnectionState)) {\n console.warn(\n `Plugin native code returned an invalid connection state: \"${state}\".`\n );\n }\n return safeEnumValue(ConnectionState, state);\n })\n );\n })\n );\n }\n\n askBleEnable(askEnable: boolean): Observable<void> {\n return defer(async () => {\n if (askEnable) {\n if (!(await this.checkAvailable())) {\n await this.requestEnableBle();\n }\n }\n });\n }\n\n requestMTU(deviceId: string, mtu: number) {\n return this.execSingleResult<\"OK\">(\"requestMTU\", [deviceId, mtu]);\n }\n\n connectAndDiscoverTapServices(\n deviceId: string,\n enableBleIfNot: boolean = true\n ): Observable<ConnectionState> {\n return this.askBleEnable(enableBleIfNot).pipe(\n switchMap(() => {\n return this.execMultipleResult<string>(\n \"connectAndDiscoverTapServices\",\n [deviceId]\n ).pipe(\n map((state) => {\n if (!(state in ConnectionState)) {\n console.warn(\n `Plugin native code returned an invalid connection state: \"${state}\".`\n );\n }\n return safeEnumValue(ConnectionState, state);\n })\n );\n })\n );\n }\n\n disConnect(deviceId: string) {\n return this.execSingleResult<\"OK\">(\"disConnect\", [deviceId]);\n }\n\n close(deviceId: string) {\n return this.execSingleResult<\"OK\">(\"close\", [deviceId]);\n }\n\n isConnected(deviceId: string) {\n return this.execSingleResult<boolean>(\"isConnected\", [deviceId]);\n }\n\n async send(deviceId: string, data: Uint8Array) {\n const hexString = await this.execSingleResult<string>(\"sendRequest\", [\n deviceId,\n bufferToHexString(data),\n ]);\n return hexStringToBuffer(hexString);\n }\n\n getLastError() {\n return this.execSingleResult<string>(\"getLastError\", []);\n }\n\n characteristicStartNotification(\n deviceId: string,\n serviceId: string,\n characId: string\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicStartNotification\", [\n deviceId,\n serviceId,\n characId,\n ]);\n }\n\n characteristicChanged(\n deviceId: string,\n serviceId: string,\n characId: string\n ): Observable<Uint8Array> {\n return this.execMultipleResult<string>(\"characteristicChanged\", [\n deviceId,\n serviceId,\n characId,\n ]).pipe(\n map((hexString) => {\n return hexStringToBuffer(hexString);\n })\n );\n }\n\n characteristicStopNotification(\n deviceId: string,\n serviceId: string,\n characId: string\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicStopNotification\", [\n deviceId,\n serviceId,\n characId,\n ]);\n }\n\n async characteristicReadValue(\n deviceId: string,\n serviceId: string,\n characId: string\n ): Promise<Uint8Array> {\n const hexString = await this.execSingleResult<string>(\n \"characteristicRead\",\n [deviceId, serviceId, characId]\n );\n return hexStringToBuffer(hexString);\n }\n\n characteristicWrite(\n deviceId: string,\n serviceId: string,\n characId: string,\n data: Uint8Array\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicWrite\", [\n deviceId,\n serviceId,\n characId,\n bufferToHexString(data),\n ]);\n }\n\n characteristicWriteWithoutResponse(\n deviceId: string,\n serviceId: string,\n characId: string,\n data: Uint8Array\n ) {\n return this.execSingleResult<\"OK\">(\"characteristicWriteWithoutResponse\", [\n deviceId,\n serviceId,\n characId,\n bufferToHexString(data),\n ]);\n }\n\n async discoverServices(deviceId: string): Promise<ServiceList> {\n const services = await this.execSingleResult<ServiceList>(\n \"discoverServices\",\n [deviceId]\n );\n return services;\n }\n\n private execSingleResult<T extends string | void | boolean | Object>(\n methodName: string,\n args: any[]\n ): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n cordova.exec(\n resolve,\n (errObject: { code?: string; message?: string }) => {\n reject(objectErrorToError(errObject));\n },\n \"BLECom\",\n methodName,\n args\n );\n });\n }\n\n private execMultipleResult<T>(\n methodName: string,\n args: any[]\n ): Observable<T> {\n const subject = new Subject<T>();\n cordova.exec<T>(\n (data) => {\n subject.next(data);\n },\n (err) => {\n subject.error(objectErrorToError(err));\n },\n \"BLECom\",\n methodName,\n args\n );\n return subject.asObservable();\n }\n}\n\nfunction objectErrorToError(errObject: { code?: string; message?: string }) {\n if (typeof errObject !== \"object\" || !errObject.code || !errObject.message) {\n return CordovaBLEError.invalidErrorResult(errObject);\n }\n if (!CordovaBLEError.isValidErrorCode(errObject.code)) {\n return CordovaBLEError.invalidErrorCode(errObject);\n }\n return new CordovaBLEError(\n errObject.message,\n CordovaBLEError.Code[errObject.code]\n );\n}\n"],"mappings":";;;;;;;;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EACAC,GAEA,OAAO,IAAIhD,SAAW,SAACC,EAASC,GAC9B+C,QAAQC,KACNjD,GACA,SAACjI,GACCkI,EAAOiD,EAAmBnL,G,GAE5B,SACA+K,EACAC,E,KAKEtB,EAAAlM,UAAAqM,mBAAA,SACNkB,EACAC,GAEA,IAAMI,EAAU,IAAIC,UAYpB,OAXAJ,QAAQC,MACN,SAAC1I,GACC4I,EAAQ9M,KAAKkE,E,IAEf,SAACK,GACCuI,EAAQ9C,MAAM6C,EAAmBtI,G,GAEnC,SACAkI,EACAC,GAEKI,EAAQ7H,c,OAInB,SAAS4H,EAAmBnL,GAC1B,MAAyB,iBAAdA,GAA2BA,EAAUI,MAASJ,EAAUK,QAG9DR,EAAgBY,iBAAiBT,EAAUI,MAGzC,IAAIP,EACTG,EAAUK,QACVR,EAAgBI,KAAKD,EAAUI,OAJxBP,EAAgBM,iBAAiBH,GAHjCH,EAAgBE,mBAAmBC,EAS9C,C"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "IoTize <contact@iotize.com>",
3
3
  "license": "MIT",
4
4
  "name": "@iotize/device-com-ble.cordova",
5
- "version": "3.4.1",
5
+ "version": "3.4.2",
6
6
  "cordova": {
7
7
  "id": "@iotize/device-com-ble.cordova",
8
8
  "platforms": [
@@ -397,9 +397,7 @@ public class BLECom extends CordovaPlugin {
397
397
  private void _removePeripheral(@NonNull String macAddress) {
398
398
  BLEProtocol peripheral = peripherals.getIfExists(macAddress);
399
399
  if (peripheral != null) {
400
- if (PermissionHelper.hasPermission(this, BLUETOOTH_CONNECT)) {
401
- peripheral.getGatt().close();
402
- }
400
+ peripheral.getGatt().close();
403
401
  peripherals.remove(macAddress);
404
402
  }
405
403
  }
package/www/plugin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see plugin.js.LICENSE.txt */
2
- (()=>{"use strict";var t={9012:(t,e,n)=>{function r(t){const e=new Uint8Array(t.length);for(let n=0,r=t.length;n<r;n++)e[n]=t.charCodeAt(n);return e}function i(t){return t.buffer.slice(t.byteOffset,t.byteLength+t.byteOffset)}function o(t){return t?Array.prototype.map.call(t,(t=>("00"+t.toString(16)).slice(-2))).join("").toUpperCase():""}function s(t){return Array.prototype.map.call(t,(t=>{let e="";for(let n=7;n>=0;n--)e+=(1<<n&t)>0?"1":"0";return e})).join("")}function u(t){let e,n=(t=t.trim()).startsWith("0x")?2:0;const r=[];for(;n<t.length;n++)switch(t[n]){case" ":case"\t":continue;default:if(void 0!==e){const i=parseInt(e+t[n],16);if(isNaN(i))throw new Error(`Invalid hexadecimal string format for input string "${t}"`);r.push(i),e=void 0}else e=t[n]}return void 0!==e&&r.push(parseInt(e,16)),Uint8Array.from(r)}function c(t){return String.fromCharCode.apply(null,t)}n.r(e),n.d(e,{asciiStringToByteBuffer:()=>r,bufferToAsciiString:()=>c,bufferToBinaryString:()=>s,bufferToHexString:()=>o,hexStringToBuffer:()=>u,typedArrayToBuffer:()=>i})},3653:(t,e,n)=>{n.r(e),n.d(e,{BaseError:()=>r,CodeError:()=>i,isCodeError:()=>o});class r extends Error{constructor(t){super(t),this.message=t,Object.defineProperty(this,"name",{get:()=>this.constructor.name,set:()=>{}}),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class i extends r{constructor(t,e){super(t),this.code=e}}function o(t,e){return e.code===t}},8588:(t,e,n)=>{function r(t,e){if(t===e)return!0;if("object"==typeof t&&null!=t&&"object"==typeof e&&null!=e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t){if(!e.hasOwnProperty(n))return!1;if(!r(t[n],e[n]))return!1}return!0}return!1}function i(t){return new Promise(((e,n)=>{setTimeout((()=>{e()}),t)}))}function o(t,e){if(!(e in t))throw new Error(`Enum key "${e}" does not exist`);return t[e]}function s(t){let e=Object.keys(t);return e=e.filter((e=>"number"==typeof t[e]||isNaN(parseInt(e,10))&&isNaN(parseInt(t[e],10)))),0===e.length&&(e=Object.keys(t)),e}function u(t){return s(t).map((e=>t[e]))}function c(t){throw new Error(`Internal error: ${t}`)}n.r(e),n.d(e,{assertError:()=>c,deepCopy:()=>a,deepEqual:()=>r,listEnumKeys:()=>s,listEnumValues:()=>u,safeEnumValue:()=>o,sleep:()=>i});const a=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>a(t)))}if(t instanceof Uint8Array)return new Uint8Array(t);if("object"==typeof t&&t!=={}){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{e[t]=a(e[t])})),e}return t}},1691:(t,e,n)=>{var r;n.r(e),n.d(e,{ComProtocol:()=>o,ConnectionState:()=>r}),function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.DISCONNECTING=3]="DISCONNECTING"}(r||(r={}));var i,o,s=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});!function(t){var e,n=function(t){function n(e,n){var r=t.call(this,n)||this;return r.code=e,r}return s(n,t),n.operationCanceled=function(){return new n(e.OperationCancelled,"Communication protocol operation cancelled")},n.notConnected=function(t){return new n(e.ProtocolNotConnected,"Communication protocol is not connected")},n.timeoutError=function(t){return new n(e.TimeoutError,t.msg||"Communication protocol timeout")},n.unknownError=function(){return new n(e.UnknownError,"Unnown communication protocol error")},n}(Error);t.Errors=n,function(t){t.ProtocolNotConnected="ProtocolNotConnected",t.TimeoutError="TimeoutError",t.UnknownError="UnknownError",t.OperationCancelled="OperationCancelled"}(e=t.ErrorCode||(t.ErrorCode={}))}(o||(o={}))},4143:(t,e,n)=>{n.r(e),n.d(e,{ArgumentOutOfRangeError:()=>O.W,AsyncSubject:()=>h.c,BehaviorSubject:()=>c.X,ConnectableObservable:()=>i.c,EMPTY:()=>H.E,EmptyError:()=>j.K,GroupedObservable:()=>o.T,NEVER:()=>lt,Notification:()=>E.P,NotificationKind:()=>E.W,ObjectUnsubscribedError:()=>k.N,Observable:()=>r.y,ReplaySubject:()=>a.t,Scheduler:()=>g.b,Subject:()=>u.xQ,Subscriber:()=>T.L,Subscription:()=>S.w,TimeoutError:()=>L.W,UnsubscriptionError:()=>Z.B,VirtualAction:()=>_,VirtualTimeScheduler:()=>x,animationFrame:()=>m,animationFrameScheduler:()=>w,asap:()=>l.e,asapScheduler:()=>l.E,async:()=>f.P,asyncScheduler:()=>f.z,bindCallback:()=>R,bindNodeCallback:()=>Y,combineLatest:()=>K.aj,concat:()=>q.z,config:()=>Vt.v,defer:()=>Q.P,empty:()=>H.c,forkJoin:()=>J,from:()=>G.D,fromEvent:()=>et,fromEventPattern:()=>rt,generate:()=>it,identity:()=>I.y,iif:()=>st,interval:()=>ct,isObservable:()=>V,merge:()=>ht.T,never:()=>ft,noop:()=>N.Z,observable:()=>s.L,of:()=>pt.of,onErrorResumeNext:()=>dt,pairs:()=>bt,partition:()=>xt,pipe:()=>C.z,queue:()=>p.c,queueScheduler:()=>p.N,race:()=>_t.S3,range:()=>gt,scheduled:()=>It.x,throwError:()=>Tt._,timer:()=>Et.H,using:()=>Ct,zip:()=>Nt.$R});var r=n(2772),i=n(3140),o=n(1120),s=n(5050),u=n(211),c=n(9233),a=n(2630),h=n(364),l=n(6650),f=n(964),p=n(2546),d=n(655),b=n(6114),v=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return d.ZT(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e.scheduled||(e.scheduled=requestAnimationFrame((function(){return e.flush(null)}))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);0===e.actions.length&&(cancelAnimationFrame(n),e.scheduled=void 0)},e}(b.o),y=n(8399),w=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return d.ZT(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,n=this.actions,r=-1,i=n.length;t=t||n.shift();do{if(e=t.execute(t.state,t.delay))break}while(++r<i&&(t=n.shift()));if(this.active=!1,e){for(;++r<i&&(t=n.shift());)t.unsubscribe();throw e}},e}(y.v))(v),m=w,x=function(t){function e(e,n){void 0===e&&(e=_),void 0===n&&(n=Number.POSITIVE_INFINITY);var r=t.call(this,e,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}return d.ZT(e,t),e.prototype.flush=function(){for(var t,e,n=this.actions,r=this.maxFrames;(e=n[0])&&e.delay<=r&&(n.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=n.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10,e}(y.v),_=function(t){function e(e,n,r){void 0===r&&(r=e.index+=1);var i=t.call(this,e,n)||this;return i.scheduler=e,i.work=n,i.index=r,i.active=!0,i.index=e.index=r,i}return d.ZT(e,t),e.prototype.schedule=function(n,r){if(void 0===r&&(r=0),!this.id)return t.prototype.schedule.call(this,n,r);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(n,r)},e.prototype.requestAsyncId=function(t,n,r){void 0===r&&(r=0),this.delay=t.frame+r;var i=t.actions;return i.push(this),i.sort(e.sortActions),!0},e.prototype.recycleAsyncId=function(t,e,n){void 0===n&&(n=0)},e.prototype._execute=function(e,n){if(!0===this.active)return t.prototype._execute.call(this,e,n)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(b.o),g=n(8725),S=n(8760),T=n(979),E=n(2632),C=n(2561),N=n(3306),I=n(3608);function V(t){return!!t&&(t instanceof r.y||"function"==typeof t.lift&&"function"==typeof t.subscribe)}var O=n(6565),j=n(6929),k=n(1016),Z=n(8782),L=n(1462),P=n(5709),A=n(3642),D=n(9026),B=n(7507);function R(t,e,n){if(e){if(!(0,B.K)(e))return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return R(t,n).apply(void 0,r).pipe((0,P.U)((function(t){return(0,D.k)(t)?e.apply(void 0,t):e(t)})))};n=e}return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o,s=this,u={context:s,subject:o,callbackFunc:t,scheduler:n};return new r.y((function(r){if(n){var i={args:e,subscriber:r,params:u};return n.schedule(z,0,i)}if(!o){o=new h.c;try{t.apply(s,e.concat([function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o.next(t.length<=1?t[0]:t),o.complete()}]))}catch(t){(0,A._)(o)?o.error(t):console.warn(t)}}return o.subscribe(r)}))}}function z(t){var e=this,n=t.args,r=t.subscriber,i=t.params,o=i.callbackFunc,s=i.context,u=i.scheduler,c=i.subject;if(!c){c=i.subject=new h.c;try{o.apply(s,n.concat([function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.length<=1?t[0]:t;e.add(u.schedule(W,0,{value:r,subject:c}))}]))}catch(t){c.error(t)}}this.add(c.subscribe(r))}function W(t){var e=t.value,n=t.subject;n.next(e),n.complete()}function Y(t,e,n){if(e){if(!(0,B.K)(e))return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return Y(t,n).apply(void 0,r).pipe((0,P.U)((function(t){return(0,D.k)(t)?e.apply(void 0,t):e(t)})))};n=e}return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o={subject:void 0,args:e,callbackFunc:t,scheduler:n,context:this};return new r.y((function(r){var i=o.context,s=o.subject;if(n)return n.schedule(F,0,{params:o,subscriber:r,context:i});if(!s){s=o.subject=new h.c;try{t.apply(i,e.concat([function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.shift();n?s.error(n):(s.next(t.length<=1?t[0]:t),s.complete())}]))}catch(t){(0,A._)(s)?s.error(t):console.warn(t)}}return s.subscribe(r)}))}}function F(t){var e=this,n=t.params,r=t.subscriber,i=t.context,o=n.callbackFunc,s=n.args,u=n.scheduler,c=n.subject;if(!c){c=n.subject=new h.c;try{o.apply(i,s.concat([function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.shift();if(r)e.add(u.schedule(U,0,{err:r,subject:c}));else{var i=t.length<=1?t[0]:t;e.add(u.schedule(M,0,{value:i,subject:c}))}}]))}catch(t){this.add(u.schedule(U,0,{err:t,subject:c}))}}this.add(c.subscribe(r))}function M(t){var e=t.value,n=t.subject;n.next(e),n.complete()}function U(t){var e=t.err;t.subject.error(e)}var K=n(5142),q=n(9795),Q=n(1410),H=n(5631),$=n(2009),G=n(5760);function J(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){var n=t[0];if((0,D.k)(n))return X(n,null);if((0,$.K)(n)&&Object.getPrototypeOf(n)===Object.prototype){var r=Object.keys(n);return X(r.map((function(t){return n[t]})),r)}}if("function"==typeof t[t.length-1]){var i=t.pop();return X(t=1===t.length&&(0,D.k)(t[0])?t[0]:t,null).pipe((0,P.U)((function(t){return i.apply(void 0,t)})))}return X(t,null)}function X(t,e){return new r.y((function(n){var r=t.length;if(0!==r)for(var i=new Array(r),o=0,s=0,u=function(u){var c=(0,G.D)(t[u]),a=!1;n.add(c.subscribe({next:function(t){a||(a=!0,s++),i[u]=t},error:function(t){return n.error(t)},complete:function(){++o!==r&&a||(s===r&&n.next(e?e.reduce((function(t,e,n){return t[e]=i[n],t}),{}):i),n.complete())}}))},c=0;c<r;c++)u(c);else n.complete()}))}var tt=n(4156);function et(t,e,n,i){return(0,tt.m)(n)&&(i=n,n=void 0),i?et(t,e,n).pipe((0,P.U)((function(t){return(0,D.k)(t)?i.apply(void 0,t):i(t)}))):new r.y((function(r){nt(t,e,(function(t){arguments.length>1?r.next(Array.prototype.slice.call(arguments)):r.next(t)}),r,n)}))}function nt(t,e,n,r,i){var o;if(function(t){return t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener}(t)){var s=t;t.addEventListener(e,n,i),o=function(){return s.removeEventListener(e,n,i)}}else if(function(t){return t&&"function"==typeof t.on&&"function"==typeof t.off}(t)){var u=t;t.on(e,n),o=function(){return u.off(e,n)}}else if(function(t){return t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener}(t)){var c=t;t.addListener(e,n),o=function(){return c.removeListener(e,n)}}else{if(!t||!t.length)throw new TypeError("Invalid event target");for(var a=0,h=t.length;a<h;a++)nt(t[a],e,n,r,i)}r.add(o)}function rt(t,e,n){return n?rt(t,e).pipe((0,P.U)((function(t){return(0,D.k)(t)?n.apply(void 0,t):n(t)}))):new r.y((function(n){var r,i=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.next(1===t.length?t[0]:t)};try{r=t(i)}catch(t){return void n.error(t)}if((0,tt.m)(e))return function(){return e(i,r)}}))}function it(t,e,n,i,o){var s,u;if(1==arguments.length){var c=t;u=c.initialState,e=c.condition,n=c.iterate,s=c.resultSelector||I.y,o=c.scheduler}else void 0===i||(0,B.K)(i)?(u=t,s=I.y,o=i):(u=t,s=i);return new r.y((function(t){var r=u;if(o)return o.schedule(ot,0,{subscriber:t,iterate:n,condition:e,resultSelector:s,state:r});for(;;){if(e){var i=void 0;try{i=e(r)}catch(e){return void t.error(e)}if(!i){t.complete();break}}var c=void 0;try{c=s(r)}catch(e){return void t.error(e)}if(t.next(c),t.closed)break;try{r=n(r)}catch(e){return void t.error(e)}}}))}function ot(t){var e=t.subscriber,n=t.condition;if(!e.closed){if(t.needIterate)try{t.state=t.iterate(t.state)}catch(t){return void e.error(t)}else t.needIterate=!0;if(n){var r=void 0;try{r=n(t.state)}catch(t){return void e.error(t)}if(!r)return void e.complete();if(e.closed)return}var i;try{i=t.resultSelector(t.state)}catch(t){return void e.error(t)}if(!e.closed&&(e.next(i),!e.closed))return this.schedule(t)}}function st(t,e,n){return void 0===e&&(e=H.E),void 0===n&&(n=H.E),(0,Q.P)((function(){return t()?e:n}))}var ut=n(5812);function ct(t,e){return void 0===t&&(t=0),void 0===e&&(e=f.P),(!(0,ut.k)(t)||t<0)&&(t=0),e&&"function"==typeof e.schedule||(e=f.P),new r.y((function(n){return n.add(e.schedule(at,t,{subscriber:n,counter:0,period:t})),n}))}function at(t){var e=t.subscriber,n=t.counter,r=t.period;e.next(n),this.schedule({subscriber:e,counter:n+1,period:r},r)}var ht=n(4370),lt=new r.y(N.Z);function ft(){return lt}var pt=n(8170);function dt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return H.E;var n=t[0],i=t.slice(1);return 1===t.length&&(0,D.k)(n)?dt.apply(void 0,n):new r.y((function(t){var e=function(){return t.add(dt.apply(void 0,i).subscribe(t))};return(0,G.D)(n).subscribe({next:function(e){t.next(e)},error:e,complete:e})}))}function bt(t,e){return e?new r.y((function(n){var r=Object.keys(t),i=new S.w;return i.add(e.schedule(vt,0,{keys:r,index:0,subscriber:n,subscription:i,obj:t})),i})):new r.y((function(e){for(var n=Object.keys(t),r=0;r<n.length&&!e.closed;r++){var i=n[r];t.hasOwnProperty(i)&&e.next([i,t[i]])}e.complete()}))}function vt(t){var e=t.keys,n=t.index,r=t.subscriber,i=t.subscription,o=t.obj;if(!r.closed)if(n<e.length){var s=e[n];r.next([s,o[s]]),i.add(this.schedule({keys:e,index:n+1,subscriber:r,subscription:i,obj:o}))}else r.complete()}var yt=n(8463),wt=n(7843),mt=n(6008);function xt(t,e,n){return[(0,mt.h)(e,n)(new r.y((0,wt.s)(t))),(0,mt.h)((0,yt.f)(e,n))(new r.y((0,wt.s)(t)))]}var _t=n(8821);function gt(t,e,n){return void 0===t&&(t=0),new r.y((function(r){void 0===e&&(e=t,t=0);var i=0,o=t;if(n)return n.schedule(St,0,{index:i,count:e,start:t,subscriber:r});for(;;){if(i++>=e){r.complete();break}if(r.next(o++),r.closed)break}}))}function St(t){var e=t.start,n=t.index,r=t.count,i=t.subscriber;n>=r?i.complete():(i.next(e),i.closed||(t.index=n+1,t.start=e+1,this.schedule(t)))}var Tt=n(4944),Et=n(9604);function Ct(t,e){return new r.y((function(n){var r,i;try{r=t()}catch(t){return void n.error(t)}try{i=e(r)}catch(t){return void n.error(t)}var o=(i?(0,G.D)(i):H.E).subscribe(n);return function(){o.unsubscribe(),r&&r.unsubscribe()}}))}var Nt=n(5080),It=n(8107),Vt=n(150)},364:(t,e,n)=>{n.d(e,{c:()=>s});var r=n(655),i=n(211),o=n(8760),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.value=null,e.hasNext=!1,e.hasCompleted=!1,e}return r.ZT(e,t),e.prototype._subscribe=function(e){return this.hasError?(e.error(this.thrownError),o.w.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),o.w.EMPTY):t.prototype._subscribe.call(this,e)},e.prototype.next=function(t){this.hasCompleted||(this.value=t,this.hasNext=!0)},e.prototype.error=function(e){this.hasCompleted||t.prototype.error.call(this,e)},e.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&t.prototype.next.call(this,this.value),t.prototype.complete.call(this)},e}(i.xQ)},9233:(t,e,n)=>{n.d(e,{X:()=>s});var r=n(655),i=n(211),o=n(1016),s=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return r.ZT(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return n&&!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.N;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(i.xQ)},2632:(t,e,n)=>{n.d(e,{W:()=>r,P:()=>u});var r,i=n(5631),o=n(8170),s=n(4944);r||(r={});var u=function(){function t(t,e,n){this.kind=t,this.value=e,this.error=n,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,n){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return n&&n()}},t.prototype.accept=function(t,e,n){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,n)},t.prototype.toObservable=function(){switch(this.kind){case"N":return(0,o.of)(this.value);case"E":return(0,s._)(this.error);case"C":return(0,i.c)()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}()},2772:(t,e,n)=>{n.d(e,{y:()=>h});var r=n(3642),i=n(979),o=n(3142),s=n(2174),u=n(5050),c=n(2561),a=n(150),h=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r=this.operator,u=function(t,e,n){if(t){if(t instanceof i.L)return t;if(t[o.b])return t[o.b]()}return t||e||n?new i.L(t,e,n):new i.L(s.c)}(t,e,n);if(r?u.add(r.call(u,this.source)):u.add(this.source||a.v.useDeprecatedSynchronousErrorHandling&&!u.syncErrorThrowable?this._subscribe(u):this._trySubscribe(u)),a.v.useDeprecatedSynchronousErrorHandling&&u.syncErrorThrowable&&(u.syncErrorThrowable=!1,u.syncErrorThrown))throw u.syncErrorValue;return u},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.v.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),(0,r._)(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=l(e))((function(e,r){var i;i=n.subscribe((function(e){try{t(e)}catch(t){r(t),i&&i.unsubscribe()}}),r,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[u.L]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:(0,c.U)(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=l(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function l(t){if(t||(t=a.v.Promise||Promise),!t)throw new Error("no Promise impl found");return t}},2174:(t,e,n)=>{n.d(e,{c:()=>o});var r=n(150),i=n(1644),o={closed:!0,next:function(t){},error:function(t){if(r.v.useDeprecatedSynchronousErrorHandling)throw t;(0,i.z)(t)},complete:function(){}}},2039:(t,e,n)=>{n.d(e,{L:()=>i});var r=n(655),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.ZT(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(n(979).L)},2630:(t,e,n)=>{n.d(e,{t:()=>h});var r=n(655),i=n(211),o=n(2546),s=n(8760),u=n(9276),c=n(1016),a=n(8253),h=function(t){function e(e,n,r){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===n&&(n=Number.POSITIVE_INFINITY);var i=t.call(this)||this;return i.scheduler=r,i._events=[],i._infiniteTimeWindow=!1,i._bufferSize=e<1?1:e,i._windowTime=n<1?1:n,n===Number.POSITIVE_INFINITY?(i._infiniteTimeWindow=!0,i.next=i.nextInfiniteTimeWindow):i.next=i.nextTimeWindow,i}return r.ZT(e,t),e.prototype.nextInfiniteTimeWindow=function(e){if(!this.isStopped){var n=this._events;n.push(e),n.length>this._bufferSize&&n.shift()}t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this.isStopped||(this._events.push(new l(this._getNow(),e)),this._trimBufferThenGetEvents()),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,n=this._infiniteTimeWindow,r=n?this._events:this._trimBufferThenGetEvents(),i=this.scheduler,o=r.length;if(this.closed)throw new c.N;if(this.isStopped||this.hasError?e=s.w.EMPTY:(this.observers.push(t),e=new a.W(this,t)),i&&t.add(t=new u.ht(t,i)),n)for(var h=0;h<o&&!t.closed;h++)t.next(r[h]);else for(h=0;h<o&&!t.closed;h++)t.next(r[h].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||o.c).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,n=this._windowTime,r=this._events,i=r.length,o=0;o<i&&!(t-r[o].time<n);)o++;return i>e&&(o=Math.max(o,i-e)),o>0&&r.splice(0,o),r},e}(i.xQ),l=function(){return function(t,e){this.time=t,this.value=e}}()},8725:(t,e,n)=>{n.d(e,{b:()=>r});var r=function(){function t(e,n){void 0===n&&(n=t.now),this.SchedulerAction=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(n,e)},t.now=function(){return Date.now()},t}()},211:(t,e,n)=>{n.d(e,{Yc:()=>h,xQ:()=>l});var r=n(655),i=n(2772),o=n(979),s=n(8760),u=n(1016),c=n(8253),a=n(3142),h=function(t){function e(e){var n=t.call(this,e)||this;return n.destination=e,n}return r.ZT(e,t),e}(o.L),l=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return r.ZT(e,t),e.prototype[a.b]=function(){return new h(this)},e.prototype.lift=function(t){var e=new f(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new u.N;if(!this.isStopped)for(var e=this.observers,n=e.length,r=e.slice(),i=0;i<n;i++)r[i].next(t)},e.prototype.error=function(t){if(this.closed)throw new u.N;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,r=e.slice(),i=0;i<n;i++)r[i].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new u.N;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),r=0;r<e;r++)n[r].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 u.N;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new u.N;return this.hasError?(t.error(this.thrownError),s.w.EMPTY):this.isStopped?(t.complete(),s.w.EMPTY):(this.observers.push(t),new c.W(this,t))},e.prototype.asObservable=function(){var t=new i.y;return t.source=this,t},e.create=function(t,e){return new f(t,e)},e}(i.y),f=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return r.ZT(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){return this.source?this.source.subscribe(t):s.w.EMPTY},e}(l)},8253:(t,e,n)=>{n.d(e,{W:()=>i});var r=n(655),i=function(t){function e(e,n){var r=t.call(this)||this;return r.subject=e,r.subscriber=n,r.closed=!1,r}return r.ZT(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 n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}},e}(n(8760).w)},979:(t,e,n)=>{n.d(e,{L:()=>h});var r=n(655),i=n(4156),o=n(2174),s=n(8760),u=n(3142),c=n(150),a=n(1644),h=function(t){function e(n,r,i){var s=t.call(this)||this;switch(s.syncErrorValue=null,s.syncErrorThrown=!1,s.syncErrorThrowable=!1,s.isStopped=!1,arguments.length){case 0:s.destination=o.c;break;case 1:if(!n){s.destination=o.c;break}if("object"==typeof n){n instanceof e?(s.syncErrorThrowable=n.syncErrorThrowable,s.destination=n,n.add(s)):(s.syncErrorThrowable=!0,s.destination=new l(s,n));break}default:s.syncErrorThrowable=!0,s.destination=new l(s,n,r,i)}return s}return r.ZT(e,t),e.prototype[u.b]=function(){return this},e.create=function(t,n,r){var i=new e(t,n,r);return i.syncErrorThrowable=!1,i},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.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(s.w),l=function(t){function e(e,n,r,s){var u,c=t.call(this)||this;c._parentSubscriber=e;var a=c;return(0,i.m)(n)?u=n:n&&(u=n.next,r=n.error,s=n.complete,n!==o.c&&(a=Object.create(n),(0,i.m)(a.unsubscribe)&&c.add(a.unsubscribe.bind(a)),a.unsubscribe=c.unsubscribe.bind(c))),c._context=a,c._next=u,c._error=r,c._complete=s,c}return r.ZT(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;c.v.useDeprecatedSynchronousErrorHandling&&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._parentSubscriber,n=c.v.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):(0,a.z)(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;(0,a.z)(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};c.v.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),c.v.useDeprecatedSynchronousErrorHandling)throw t;(0,a.z)(t)}},e.prototype.__tryOrSetError=function(t,e,n){if(!c.v.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return c.v.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):((0,a.z)(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(h)},8760:(t,e,n)=>{n.d(e,{w:()=>u});var r=n(9026),i=n(2009),o=n(4156),s=n(8782),u=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this,u=n._parentOrParents,a=n._ctorUnsubscribe,h=n._unsubscribe,l=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,u instanceof t)u.remove(this);else if(null!==u)for(var f=0;f<u.length;++f)u[f].remove(this);if((0,o.m)(h)){a&&(this._unsubscribe=void 0);try{h.call(this)}catch(t){e=t instanceof s.B?c(t.errors):[t]}}if((0,r.k)(l)){f=-1;for(var p=l.length;++f<p;){var d=l[f];if((0,i.K)(d))try{d.unsubscribe()}catch(t){e=e||[],t instanceof s.B?e=e.concat(c(t.errors)):e.push(t)}}}if(e)throw new s.B(e)}},t.prototype.add=function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var r=n;(n=new t)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var i=n._parentOrParents;if(null===i)n._parentOrParents=this;else if(i instanceof t){if(i===this)return n;n._parentOrParents=[i,this]}else{if(-1!==i.indexOf(this))return n;i.push(this)}var o=this._subscriptions;return null===o?this._subscriptions=[n]:o.push(n),n},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function c(t){return t.reduce((function(t,e){return t.concat(e instanceof s.B?e.errors:e)}),[])}},150:(t,e,n)=>{n.d(e,{v:()=>i});var r=!1,i={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack,r=t},get useDeprecatedSynchronousErrorHandling(){return r}}},7604:(t,e,n)=>{n.d(e,{IY:()=>u,Ds:()=>c,ft:()=>a});var r=n(655),i=n(979),o=n(2772),s=n(7843),u=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,n}return r.ZT(e,t),e.prototype._next=function(t){this.parent.notifyNext(t)},e.prototype._error=function(t){this.parent.notifyError(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},e}(i.L),c=(i.L,function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.ZT(e,t),e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.destination.complete()},e}(i.L));function a(t,e){if(!e.closed){if(t instanceof o.y)return t.subscribe(e);var n;try{n=(0,s.s)(t)(e)}catch(t){e.error(t)}return n}}i.L},3140:(t,e,n)=>{n.d(e,{c:()=>a,N:()=>h});var r=n(655),i=n(211),o=n(2772),s=n(979),u=n(8760),c=n(3018),a=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._refCount=0,r._isComplete=!1,r}return r.ZT(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var t=this._connection;return t||(this._isComplete=!1,(t=this._connection=new u.w).add(this.source.subscribe(new l(this.getSubject(),this))),t.closed&&(this._connection=null,t=u.w.EMPTY)),t},e.prototype.refCount=function(){return(0,c.x)()(this)},e}(o.y),h=function(){var t=a.prototype;return{operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:t._subscribe},_isComplete:{value:t._isComplete,writable:!0},getSubject:{value:t.getSubject},connect:{value:t.connect},refCount:{value:t.refCount}}}(),l=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return r.ZT(e,t),e.prototype._error=function(e){this._unsubscribe(),t.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}},e}(i.Yc);s.L},5142:(t,e,n)=>{n.d(e,{aj:()=>h,Ms:()=>l});var r=n(655),i=n(7507),o=n(9026),s=n(2039),u=n(2080),c=n(3375),a={};function h(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=void 0,r=void 0;return(0,i.K)(t[t.length-1])&&(r=t.pop()),"function"==typeof t[t.length-1]&&(n=t.pop()),1===t.length&&(0,o.k)(t[0])&&(t=t[0]),(0,c.n)(t,r).lift(new l(n))}var l=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new f(t,this.resultSelector))},t}(),f=function(t){function e(e,n){var r=t.call(this,e)||this;return r.resultSelector=n,r.active=0,r.values=[],r.observables=[],r}return r.ZT(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 n=0;n<e;n++){var r=t[n];this.add((0,u.D)(this,r,void 0,n))}}},e.prototype.notifyComplete=function(t){0==(this.active-=1)&&this.destination.complete()},e.prototype.notifyNext=function(t,e,n){var r=this.values,i=r[n],o=this.toRespond?i===a?--this.toRespond:this.toRespond:0;r[n]=e,0===o&&(this.resultSelector?this._tryResultSelector(r):this.destination.next(r.slice()))},e.prototype._tryResultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.L)},9795:(t,e,n)=>{n.d(e,{z:()=>o});var r=n(8170),i=n(2257);function o(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(0,i.u)()(r.of.apply(void 0,t))}},1410:(t,e,n)=>{n.d(e,{P:()=>s});var r=n(2772),i=n(5760),o=n(5631);function s(t){return new r.y((function(e){var n;try{n=t()}catch(t){return void e.error(t)}return(n?(0,i.D)(n):(0,o.c)()).subscribe(e)}))}},5631:(t,e,n)=>{n.d(e,{E:()=>i,c:()=>o});var r=n(2772),i=new r.y((function(t){return t.complete()}));function o(t){return t?function(t){return new r.y((function(e){return t.schedule((function(){return e.complete()}))}))}(t):i}},5760:(t,e,n)=>{n.d(e,{D:()=>s});var r=n(2772),i=n(7843),o=n(8107);function s(t,e){return e?(0,o.x)(t,e):t instanceof r.y?t:new r.y((0,i.s)(t))}},3375:(t,e,n)=>{n.d(e,{n:()=>s});var r=n(2772),i=n(6900),o=n(3109);function s(t,e){return e?(0,o.r)(t,e):new r.y((0,i.V)(t))}},4370:(t,e,n)=>{n.d(e,{T:()=>u});var r=n(2772),i=n(7507),o=n(2556),s=n(3375);function u(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Number.POSITIVE_INFINITY,u=null,c=t[t.length-1];return(0,i.K)(c)?(u=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(n=t.pop())):"number"==typeof c&&(n=t.pop()),null===u&&1===t.length&&t[0]instanceof r.y?t[0]:(0,o.J)(n)((0,s.n)(t,u))}},8170:(t,e,n)=>{n.d(e,{of:()=>s});var r=n(7507),i=n(3375),o=n(3109);function s(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return(0,r.K)(n)?(t.pop(),(0,o.r)(t,n)):(0,i.n)(t)}},8821:(t,e,n)=>{n.d(e,{S3:()=>c});var r=n(655),i=n(9026),o=n(3375),s=n(2039),u=n(2080);function c(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){if(!(0,i.k)(t[0]))return t[0];t=t[0]}return(0,o.n)(t,void 0).lift(new a)}var a=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new h(t))},t}(),h=function(t){function e(e){var n=t.call(this,e)||this;return n.hasFirst=!1,n.observables=[],n.subscriptions=[],n}return r.ZT(e,t),e.prototype._next=function(t){this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{for(var n=0;n<e&&!this.hasFirst;n++){var r=t[n],i=(0,u.D)(this,r,void 0,n);this.subscriptions&&this.subscriptions.push(i),this.add(i)}this.observables=null}},e.prototype.notifyNext=function(t,e,n){if(!this.hasFirst){this.hasFirst=!0;for(var r=0;r<this.subscriptions.length;r++)if(r!==n){var i=this.subscriptions[r];i.unsubscribe(),this.remove(i)}this.subscriptions=null}this.destination.next(e)},e}(s.L)},4944:(t,e,n)=>{n.d(e,{_:()=>i});var r=n(2772);function i(t,e){return e?new r.y((function(n){return e.schedule(o,0,{error:t,subscriber:n})})):new r.y((function(e){return e.error(t)}))}function o(t){var e=t.error;t.subscriber.error(e)}},9604:(t,e,n)=>{n.d(e,{H:()=>u});var r=n(2772),i=n(964),o=n(5812),s=n(7507);function u(t,e,n){void 0===t&&(t=0);var u=-1;return(0,o.k)(e)?u=Number(e)<1?1:Number(e):(0,s.K)(e)&&(n=e),(0,s.K)(n)||(n=i.P),new r.y((function(e){var r=(0,o.k)(t)?t:+t-n.now();return n.schedule(c,r,{index:0,period:u,subscriber:e})}))}function c(t){var e=t.index,n=t.period,r=t.subscriber;if(r.next(e),!r.closed){if(-1===n)return r.complete();t.index=e+1,this.schedule(t,n)}}},5080:(t,e,n)=>{n.d(e,{$R:()=>a,mx:()=>h});var r=n(655),i=n(3375),o=n(9026),s=n(979),u=n(999),c=n(7604);function a(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return"function"==typeof n&&t.pop(),(0,i.n)(t,void 0).lift(new h(n))}var h=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new l(t,this.resultSelector))},t}(),l=function(t){function e(e,n,r){void 0===r&&(r=Object.create(null));var i=t.call(this,e)||this;return i.resultSelector=n,i.iterators=[],i.active=0,i.resultSelector="function"==typeof n?n:void 0,i}return r.ZT(e,t),e.prototype._next=function(t){var e=this.iterators;(0,o.k)(t)?e.push(new p(t)):"function"==typeof t[u.hZ]?e.push(new f(t[u.hZ]())):e.push(new d(this.destination,this,t))},e.prototype._complete=function(){var t=this.iterators,e=t.length;if(this.unsubscribe(),0!==e){this.active=e;for(var n=0;n<e;n++){var r=t[n];r.stillUnsubscribed?this.destination.add(r.subscribe()):this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var t=this.iterators,e=t.length,n=this.destination,r=0;r<e;r++)if("function"==typeof(s=t[r]).hasValue&&!s.hasValue())return;var i=!1,o=[];for(r=0;r<e;r++){var s,u=(s=t[r]).next();if(s.hasCompleted()&&(i=!0),u.done)return void n.complete();o.push(u.value)}this.resultSelector?this._tryresultSelector(o):n.next(o),i&&n.complete()},e.prototype._tryresultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.L),f=function(){function t(t){this.iterator=t,this.nextResult=t.next()}return t.prototype.hasValue=function(){return!0},t.prototype.next=function(){var t=this.nextResult;return this.nextResult=this.iterator.next(),t},t.prototype.hasCompleted=function(){var t=this.nextResult;return Boolean(t&&t.done)},t}(),p=function(){function t(t){this.array=t,this.index=0,this.length=0,this.length=t.length}return t.prototype[u.hZ]=function(){return this},t.prototype.next=function(t){var e=this.index++,n=this.array;return e<this.length?{value:n[e],done:!1}:{value:null,done:!0}},t.prototype.hasValue=function(){return this.array.length>this.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),d=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.parent=n,i.observable=r,i.stillUnsubscribed=!0,i.buffer=[],i.isComplete=!1,i}return r.ZT(e,t),e.prototype[u.hZ]=function(){return this},e.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},e.prototype.hasValue=function(){return this.buffer.length>0},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(t){this.buffer.push(t),this.parent.checkIterators()},e.prototype.subscribe=function(){return(0,c.ft)(this.observable,new c.IY(this))},e}(c.Ds)},2257:(t,e,n)=>{n.d(e,{u:()=>i});var r=n(2556);function i(){return(0,r.J)(1)}},6008:(t,e,n)=>{n.d(e,{h:()=>o});var r=n(655),i=n(979);function o(t,e){return function(n){return n.lift(new s(t,e))}}var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.predicate,this.thisArg))},t}(),u=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.thisArg=r,i.count=0,i}return r.ZT(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.L)},1120:(t,e,n)=>{n.d(e,{v:()=>c,T:()=>f});var r=n(655),i=n(979),o=n(8760),s=n(2772),u=n(211);function c(t,e,n,r){return function(i){return i.lift(new a(t,e,n,r))}}var a=function(){function t(t,e,n,r){this.keySelector=t,this.elementSelector=e,this.durationSelector=n,this.subjectSelector=r}return t.prototype.call=function(t,e){return e.subscribe(new h(t,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},t}(),h=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.keySelector=n,s.elementSelector=r,s.durationSelector=i,s.subjectSelector=o,s.groups=null,s.attemptedToUnsubscribe=!1,s.count=0,s}return r.ZT(e,t),e.prototype._next=function(t){var e;try{e=this.keySelector(t)}catch(t){return void this.error(t)}this._group(t,e)},e.prototype._group=function(t,e){var n=this.groups;n||(n=this.groups=new Map);var r,i=n.get(e);if(this.elementSelector)try{r=this.elementSelector(t)}catch(t){this.error(t)}else r=t;if(!i){i=this.subjectSelector?this.subjectSelector():new u.xQ,n.set(e,i);var o=new f(e,i,this);if(this.destination.next(o),this.durationSelector){var s=void 0;try{s=this.durationSelector(new f(e,i))}catch(t){return void this.error(t)}this.add(s.subscribe(new l(e,i,this)))}}i.closed||i.next(r)},e.prototype._error=function(t){var e=this.groups;e&&(e.forEach((function(e,n){e.error(t)})),e.clear()),this.destination.error(t)},e.prototype._complete=function(){var t=this.groups;t&&(t.forEach((function(t,e){t.complete()})),t.clear()),this.destination.complete()},e.prototype.removeGroup=function(t){this.groups.delete(t)},e.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&t.prototype.unsubscribe.call(this))},e}(i.L),l=function(t){function e(e,n,r){var i=t.call(this,n)||this;return i.key=e,i.group=n,i.parent=r,i}return r.ZT(e,t),e.prototype._next=function(t){this.complete()},e.prototype._unsubscribe=function(){var t=this.parent,e=this.key;this.key=this.parent=null,t&&t.removeGroup(e)},e}(i.L),f=function(t){function e(e,n,r){var i=t.call(this)||this;return i.key=e,i.groupSubject=n,i.refCountSubscription=r,i}return r.ZT(e,t),e.prototype._subscribe=function(t){var e=new o.w,n=this.refCountSubscription,r=this.groupSubject;return n&&!n.closed&&e.add(new p(n)),e.add(r.subscribe(t)),e},e}(s.y),p=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,e.count++,n}return r.ZT(e,t),e.prototype.unsubscribe=function(){var e=this.parent;e.closed||this.closed||(t.prototype.unsubscribe.call(this),e.count-=1,0===e.count&&e.attemptedToUnsubscribe&&e.unsubscribe())},e}(o.w)},5709:(t,e,n)=>{n.d(e,{U:()=>o});var r=n(655),i=n(979);function o(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new s(t,e))}}var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.thisArg))},t}(),u=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.project=n,i.count=0,i.thisArg=r||i,i}return r.ZT(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.L)},2556:(t,e,n)=>{n.d(e,{J:()=>o});var r=n(7746),i=n(3608);function o(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),(0,r.zg)(i.y,t)}},7746:(t,e,n)=>{n.d(e,{zg:()=>u,VS:()=>h});var r=n(655),i=n(5709),o=n(5760),s=n(7604);function u(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?function(r){return r.pipe(u((function(n,r){return(0,o.D)(t(n,r)).pipe((0,i.U)((function(t,i){return e(n,t,r,i)})))}),n))}:("number"==typeof e&&(n=e),function(e){return e.lift(new c(t,n))})}var c=function(){function t(t,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.project=t,this.concurrent=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.concurrent))},t}(),a=function(t){function e(e,n,r){void 0===r&&(r=Number.POSITIVE_INFINITY);var i=t.call(this,e)||this;return i.project=n,i.concurrent=r,i.hasCompleted=!1,i.buffer=[],i.active=0,i.index=0,i}return r.ZT(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,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new s.IY(this),n=this.destination;n.add(e);var r=(0,s.ft)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(s.Ds),h=u},9276:(t,e,n)=>{n.d(e,{QV:()=>s,ht:()=>c});var r=n(655),i=n(979),o=n(2632);function s(t,e){return void 0===e&&(e=0),function(n){return n.lift(new u(t,e))}}var u=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 c(t,this.scheduler,this.delay))},t}(),c=function(t){function e(e,n,r){void 0===r&&(r=0);var i=t.call(this,e)||this;return i.scheduler=n,i.delay=r,i}return r.ZT(e,t),e.dispatch=function(t){var e=t.notification,n=t.destination;e.observe(n),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.destination.add(this.scheduler.schedule(e.dispatch,this.delay,new a(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(o.P.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(o.P.createError(t)),this.unsubscribe()},e.prototype._complete=function(){this.scheduleMessage(o.P.createComplete()),this.unsubscribe()},e}(i.L),a=function(){return function(t,e){this.notification=t,this.destination=e}}()},3018:(t,e,n)=>{n.d(e,{x:()=>o});var r=n(655),i=n(979);function o(){return function(t){return t.lift(new s(t))}}var s=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var n=this.connectable;n._refCount++;var r=new u(t,n),i=e.subscribe(r);return r.closed||(r.connection=n.connect()),i},t}(),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return r.ZT(e,t),e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._refCount;if(e<=0)this.connection=null;else if(t._refCount=e-1,e>1)this.connection=null;else{var n=this.connection,r=t._connection;this.connection=null,!r||n&&r!==n||r.unsubscribe()}}else this.connection=null},e}(i.L)},3109:(t,e,n)=>{n.d(e,{r:()=>o});var r=n(2772),i=n(8760);function o(t,e){return new r.y((function(n){var r=new i.w,o=0;return r.add(e.schedule((function(){o!==t.length?(n.next(t[o++]),n.closed||r.add(this.schedule())):n.complete()}))),r}))}},8107:(t,e,n)=>{n.d(e,{x:()=>h});var r=n(2772),i=n(8760),o=n(5050),s=n(3109),u=n(999),c=n(336),a=n(9217);function h(t,e){if(null!=t){if(function(t){return t&&"function"==typeof t[o.L]}(t))return function(t,e){return new r.y((function(n){var r=new i.w;return r.add(e.schedule((function(){var i=t[o.L]();r.add(i.subscribe({next:function(t){r.add(e.schedule((function(){return n.next(t)})))},error:function(t){r.add(e.schedule((function(){return n.error(t)})))},complete:function(){r.add(e.schedule((function(){return n.complete()})))}}))}))),r}))}(t,e);if((0,c.t)(t))return function(t,e){return new r.y((function(n){var r=new i.w;return r.add(e.schedule((function(){return t.then((function(t){r.add(e.schedule((function(){n.next(t),r.add(e.schedule((function(){return n.complete()})))})))}),(function(t){r.add(e.schedule((function(){return n.error(t)})))}))}))),r}))}(t,e);if((0,a.z)(t))return(0,s.r)(t,e);if(function(t){return t&&"function"==typeof t[u.hZ]}(t)||"string"==typeof t)return function(t,e){if(!t)throw new Error("Iterable cannot be null");return new r.y((function(n){var r,o=new i.w;return o.add((function(){r&&"function"==typeof r.return&&r.return()})),o.add(e.schedule((function(){r=t[u.hZ](),o.add(e.schedule((function(){if(!n.closed){var t,e;try{var i=r.next();t=i.value,e=i.done}catch(t){return void n.error(t)}e?n.complete():(n.next(t),this.schedule())}})))}))),o}))}(t,e)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}},6114:(t,e,n)=>{n.d(e,{o:()=>i});var r=n(655),i=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return r.ZT(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!==n&&this.delay===n&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n=!1,r=void 0;try{this.work(t)}catch(t){n=!0,r=!!t&&t||new Error(t)}if(n)return this.unsubscribe(),r},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,n=e.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,n){return t.call(this)||this}return r.ZT(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(n(8760).w))},8399:(t,e,n)=>{n.d(e,{v:()=>o});var r=n(655),i=n(8725),o=function(t){function e(n,r){void 0===r&&(r=i.b.now);var o=t.call(this,n,(function(){return e.delegate&&e.delegate!==o?e.delegate.now():r()}))||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return r.ZT(e,t),e.prototype.schedule=function(n,r,i){return void 0===r&&(r=0),e.delegate&&e.delegate!==this?e.delegate.schedule(n,r,i):t.prototype.schedule.call(this,n,r,i)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var n;this.active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(i.b)},6650:(t,e,n)=>{n.d(e,{e:()=>h,E:()=>a});var r=n(655),i=1,o=function(){return Promise.resolve()}(),s={};function u(t){return t in s&&(delete s[t],!0)}var c=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.ZT(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e.scheduled||(e.scheduled=(c=e.flush.bind(e,null),a=i++,s[a]=!0,o.then((function(){return u(a)&&c()})),a)));var c,a},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);0===e.actions.length&&(u(n),e.scheduled=void 0)},e}(n(6114).o),a=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.ZT(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,n=this.actions,r=-1,i=n.length;t=t||n.shift();do{if(e=t.execute(t.state,t.delay))break}while(++r<i&&(t=n.shift()));if(this.active=!1,e){for(;++r<i&&(t=n.shift());)t.unsubscribe();throw e}},e}(n(8399).v))(c),h=a},964:(t,e,n)=>{n.d(e,{z:()=>i,P:()=>o});var r=n(6114),i=new(n(8399).v)(r.o),o=i},2546:(t,e,n)=>{n.d(e,{c:()=>s,N:()=>o});var r=n(655),i=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.ZT(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):e.flush(this)},e}(n(6114).o),o=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.ZT(e,t),e}(n(8399).v))(i),s=o},999:(t,e,n)=>{function r(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}n.d(e,{hZ:()=>i});var i=r()},5050:(t,e,n)=>{n.d(e,{L:()=>r});var r=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},3142:(t,e,n)=>{n.d(e,{b:()=>r});var r=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},6565:(t,e,n)=>{n.d(e,{W:()=>r});var r=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}()},6929:(t,e,n)=>{n.d(e,{K:()=>r});var r=function(){function t(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}return t.prototype=Object.create(Error.prototype),t}()},1016:(t,e,n)=>{n.d(e,{N:()=>r});var r=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}()},1462:(t,e,n)=>{n.d(e,{W:()=>r});var r=function(){function t(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}return t.prototype=Object.create(Error.prototype),t}()},8782:(t,e,n)=>{n.d(e,{B:()=>r});var r=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}()},3642:(t,e,n)=>{n.d(e,{_:()=>i});var r=n(979);function i(t){for(;t;){var e=t,n=e.closed,i=e.destination,o=e.isStopped;if(n||o)return!1;t=i&&i instanceof r.L?i:null}return!0}},1644:(t,e,n)=>{function r(t){setTimeout((function(){throw t}),0)}n.d(e,{z:()=>r})},3608:(t,e,n)=>{function r(t){return t}n.d(e,{y:()=>r})},9026:(t,e,n)=>{n.d(e,{k:()=>r});var r=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}()},9217:(t,e,n)=>{n.d(e,{z:()=>r});var r=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t}},4156:(t,e,n)=>{function r(t){return"function"==typeof t}n.d(e,{m:()=>r})},5812:(t,e,n)=>{n.d(e,{k:()=>i});var r=n(9026);function i(t){return!(0,r.k)(t)&&t-parseFloat(t)+1>=0}},2009:(t,e,n)=>{function r(t){return null!==t&&"object"==typeof t}n.d(e,{K:()=>r})},336:(t,e,n)=>{function r(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}n.d(e,{t:()=>r})},7507:(t,e,n)=>{function r(t){return t&&"function"==typeof t.schedule}n.d(e,{K:()=>r})},3306:(t,e,n)=>{function r(){}n.d(e,{Z:()=>r})},8463:(t,e,n)=>{function r(t,e){function n(){return!n.pred.apply(n.thisArg,arguments)}return n.pred=t,n.thisArg=e,n}n.d(e,{f:()=>r})},2561:(t,e,n)=>{n.d(e,{z:()=>i,U:()=>o});var r=n(3608);function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(t)}function o(t){return 0===t.length?r.y:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}},7843:(t,e,n)=>{n.d(e,{s:()=>h});var r=n(6900),i=n(1644),o=n(999),s=n(5050),u=n(9217),c=n(336),a=n(2009),h=function(t){if(t&&"function"==typeof t[s.L])return h=t,function(t){var e=h[s.L]();if("function"!=typeof e.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return e.subscribe(t)};if((0,u.z)(t))return(0,r.V)(t);if((0,c.t)(t))return n=t,function(t){return n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,i.z),t};if(t&&"function"==typeof t[o.hZ])return e=t,function(t){for(var n=e[o.hZ]();;){var r=void 0;try{r=n.next()}catch(e){return t.error(e),t}if(r.done){t.complete();break}if(t.next(r.value),t.closed)break}return"function"==typeof n.return&&t.add((function(){n.return&&n.return()})),t};var e,n,h,l=(0,a.K)(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+l+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},6900:(t,e,n)=>{n.d(e,{V:()=>r});var r=function(t){return function(e){for(var n=0,r=t.length;n<r&&!e.closed;n++)e.next(t[n]);e.complete()}}},2080:(t,e,n)=>{n.d(e,{D:()=>u});var r=n(655),i=function(t){function e(e,n,r){var i=t.call(this)||this;return i.parent=e,i.outerValue=n,i.outerIndex=r,i.index=0,i}return r.ZT(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}(n(979).L),o=n(7843),s=n(2772);function u(t,e,n,r,u){if(void 0===u&&(u=new i(t,n,r)),!u.closed)return e instanceof s.y?e.subscribe(u):(0,o.s)(e)(u)}},1717:(t,e,n)=>{n.r(e),n.d(e,{audit:()=>o,auditTime:()=>h,buffer:()=>l,bufferCount:()=>b,bufferTime:()=>x,bufferToggle:()=>O,bufferWhen:()=>Z,catchError:()=>A,combineAll:()=>z,combineLatest:()=>F,concat:()=>U,concatAll:()=>K.u,concatMap:()=>Q,concatMapTo:()=>H,count:()=>$,debounce:()=>X,debounceTime:()=>nt,defaultIfEmpty:()=>st,delay:()=>lt,delayWhen:()=>vt,dematerialize:()=>_t,distinct:()=>Tt,distinctUntilChanged:()=>Nt,distinctUntilKeyChanged:()=>Ot,elementAt:()=>Yt,endWith:()=>Mt,every:()=>Ut,exhaust:()=>Qt,exhaustMap:()=>Jt,expand:()=>ee,filter:()=>kt.h,finalize:()=>ie,find:()=>ue,findIndex:()=>he,first:()=>fe,flatMap:()=>q.VS,groupBy:()=>pe.v,ignoreElements:()=>de,isEmpty:()=>ye,last:()=>Se,map:()=>Gt.U,mapTo:()=>Te,materialize:()=>Ne,max:()=>Pe,merge:()=>De,mergeAll:()=>Be.J,mergeMap:()=>q.zg,mergeMapTo:()=>Re,mergeScan:()=>ze,min:()=>Fe,multicast:()=>Ue,observeOn:()=>qe.QV,onErrorResumeNext:()=>Qe,pairwise:()=>Ge,partition:()=>en,pluck:()=>nn,publish:()=>sn,publishBehavior:()=>cn,publishLast:()=>hn,publishReplay:()=>fn,race:()=>dn,reduce:()=>Le,refCount:()=>Nn.x,repeat:()=>bn,repeatWhen:()=>wn,retry:()=>_n,retryWhen:()=>Tn,sample:()=>In,sampleTime:()=>jn,scan:()=>Oe,sequenceEqual:()=>Pn,share:()=>zn,shareReplay:()=>Wn,single:()=>Yn,skip:()=>Un,skipLast:()=>Qn,skipUntil:()=>Gn,skipWhile:()=>tr,startWith:()=>rr,subscribeOn:()=>ur,switchAll:()=>fr,switchMap:()=>ar,switchMapTo:()=>pr,take:()=>Rt,takeLast:()=>xe,takeUntil:()=>dr,takeWhile:()=>yr,tap:()=>gr,throttle:()=>Cr,throttleTime:()=>Vr,throwIfEmpty:()=>Lt,timeInterval:()=>Lr,timeout:()=>Wr,timeoutWith:()=>Dr,timestamp:()=>Yr,toArray:()=>Ur,window:()=>Kr,windowCount:()=>Hr,windowTime:()=>Jr,windowToggle:()=>oi,windowWhen:()=>ci,withLatestFrom:()=>li,zip:()=>bi,zipAll:()=>vi});var r=n(655),i=n(7604);function o(t){return function(e){return e.lift(new s(t))}}var s=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.durationSelector))},t}(),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.durationSelector=n,r.hasValue=!1,r}return r.ZT(e,t),e.prototype._next=function(t){if(this.value=t,this.hasValue=!0,!this.throttled){var e=void 0;try{e=(0,this.durationSelector)(t)}catch(t){return this.destination.error(t)}var n=(0,i.ft)(e,new i.IY(this));!n||n.closed?this.clearThrottle():this.add(this.throttled=n)}},e.prototype.clearThrottle=function(){var t=this,e=t.value,n=t.hasValue,r=t.throttled;r&&(this.remove(r),this.throttled=void 0,r.unsubscribe()),n&&(this.value=void 0,this.hasValue=!1,this.destination.next(e))},e.prototype.notifyNext=function(){this.clearThrottle()},e.prototype.notifyComplete=function(){this.clearThrottle()},e}(i.Ds),c=n(964),a=n(9604);function h(t,e){return void 0===e&&(e=c.P),o((function(){return(0,a.H)(t,e)}))}function l(t){return function(e){return e.lift(new f(t))}}var f=function(){function t(t){this.closingNotifier=t}return t.prototype.call=function(t,e){return e.subscribe(new p(t,this.closingNotifier))},t}(),p=function(t){function e(e,n){var r=t.call(this,e)||this;return r.buffer=[],r.add((0,i.ft)(n,new i.IY(r))),r}return r.ZT(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype.notifyNext=function(){var t=this.buffer;this.buffer=[],this.destination.next(t)},e}(i.Ds),d=n(979);function b(t,e){return void 0===e&&(e=null),function(n){return n.lift(new v(t,e))}}var v=function(){function t(t,e){this.bufferSize=t,this.startBufferEvery=e,this.subscriberClass=e&&t!==e?w:y}return t.prototype.call=function(t,e){return e.subscribe(new this.subscriberClass(t,this.bufferSize,this.startBufferEvery))},t}(),y=function(t){function e(e,n){var r=t.call(this,e)||this;return r.bufferSize=n,r.buffer=[],r}return r.ZT(e,t),e.prototype._next=function(t){var e=this.buffer;e.push(t),e.length==this.bufferSize&&(this.destination.next(e),this.buffer=[])},e.prototype._complete=function(){var e=this.buffer;e.length>0&&this.destination.next(e),t.prototype._complete.call(this)},e}(d.L),w=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.bufferSize=n,i.startBufferEvery=r,i.buffers=[],i.count=0,i}return r.ZT(e,t),e.prototype._next=function(t){var e=this,n=e.bufferSize,r=e.startBufferEvery,i=e.buffers,o=e.count;this.count++,o%r==0&&i.push([]);for(var s=i.length;s--;){var u=i[s];u.push(t),u.length===n&&(i.splice(s,1),this.destination.next(u))}},e.prototype._complete=function(){for(var e=this.buffers,n=this.destination;e.length>0;){var r=e.shift();r.length>0&&n.next(r)}t.prototype._complete.call(this)},e}(d.L),m=n(7507);function x(t){var e=arguments.length,n=c.P;(0,m.K)(arguments[arguments.length-1])&&(n=arguments[arguments.length-1],e--);var r=null;e>=2&&(r=arguments[1]);var i=Number.POSITIVE_INFINITY;return e>=3&&(i=arguments[2]),function(e){return e.lift(new _(t,r,i,n))}}var _=function(){function t(t,e,n,r){this.bufferTimeSpan=t,this.bufferCreationInterval=e,this.maxBufferSize=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new S(t,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},t}(),g=function(){return function(){this.buffer=[]}}(),S=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;s.bufferTimeSpan=n,s.bufferCreationInterval=r,s.maxBufferSize=i,s.scheduler=o,s.contexts=[];var u=s.openContext();if(s.timespanOnly=null==r||r<0,s.timespanOnly){var c={subscriber:s,context:u,bufferTimeSpan:n};s.add(u.closeAction=o.schedule(T,n,c))}else{var a={subscriber:s,context:u},h={bufferTimeSpan:n,bufferCreationInterval:r,subscriber:s,scheduler:o};s.add(u.closeAction=o.schedule(C,n,a)),s.add(o.schedule(E,r,h))}return s}return r.ZT(e,t),e.prototype._next=function(t){for(var e,n=this.contexts,r=n.length,i=0;i<r;i++){var o=n[i],s=o.buffer;s.push(t),s.length==this.maxBufferSize&&(e=o)}e&&this.onBufferFull(e)},e.prototype._error=function(e){this.contexts.length=0,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts,n=this.destination;e.length>0;){var r=e.shift();n.next(r.buffer)}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.contexts=null},e.prototype.onBufferFull=function(t){this.closeContext(t);var e=t.closeAction;if(e.unsubscribe(),this.remove(e),!this.closed&&this.timespanOnly){t=this.openContext();var n=this.bufferTimeSpan,r={subscriber:this,context:t,bufferTimeSpan:n};this.add(t.closeAction=this.scheduler.schedule(T,n,r))}},e.prototype.openContext=function(){var t=new g;return this.contexts.push(t),t},e.prototype.closeContext=function(t){this.destination.next(t.buffer);var e=this.contexts;(e?e.indexOf(t):-1)>=0&&e.splice(e.indexOf(t),1)},e}(d.L);function T(t){var e=t.subscriber,n=t.context;n&&e.closeContext(n),e.closed||(t.context=e.openContext(),t.context.closeAction=this.schedule(t,t.bufferTimeSpan))}function E(t){var e=t.bufferCreationInterval,n=t.bufferTimeSpan,r=t.subscriber,i=t.scheduler,o=r.openContext();r.closed||(r.add(o.closeAction=i.schedule(C,n,{subscriber:r,context:o})),this.schedule(t,e))}function C(t){var e=t.subscriber,n=t.context;e.closeContext(n)}var N=n(8760),I=n(2080),V=n(2039);function O(t,e){return function(n){return n.lift(new j(t,e))}}var j=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new k(t,this.openings,this.closingSelector))},t}(),k=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.closingSelector=r,i.contexts=[],i.add((0,I.D)(i,n)),i}return r.ZT(e,t),e.prototype._next=function(t){for(var e=this.contexts,n=e.length,r=0;r<n;r++)e[r].buffer.push(t)},e.prototype._error=function(e){for(var n=this.contexts;n.length>0;){var r=n.shift();r.subscription.unsubscribe(),r.buffer=null,r.subscription=null}this.contexts=null,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts;e.length>0;){var n=e.shift();this.destination.next(n.buffer),n.subscription.unsubscribe(),n.buffer=null,n.subscription=null}this.contexts=null,t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e){t?this.closeBuffer(t):this.openBuffer(e)},e.prototype.notifyComplete=function(t){this.closeBuffer(t.context)},e.prototype.openBuffer=function(t){try{var e=this.closingSelector.call(this,t);e&&this.trySubscribe(e)}catch(t){this._error(t)}},e.prototype.closeBuffer=function(t){var e=this.contexts;if(e&&t){var n=t.buffer,r=t.subscription;this.destination.next(n),e.splice(e.indexOf(t),1),this.remove(r),r.unsubscribe()}},e.prototype.trySubscribe=function(t){var e=this.contexts,n=new N.w,r={buffer:[],subscription:n};e.push(r);var i=(0,I.D)(this,t,r);!i||i.closed?this.closeBuffer(r):(i.context=r,this.add(i),n.add(i))},e}(V.L);function Z(t){return function(e){return e.lift(new L(t))}}var L=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new P(t,this.closingSelector))},t}(),P=function(t){function e(e,n){var r=t.call(this,e)||this;return r.closingSelector=n,r.subscribing=!1,r.openBuffer(),r}return r.ZT(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=void 0,this.subscribing=!1},e.prototype.notifyNext=function(){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e,n=this.buffer;this.buffer&&this.destination.next(n),this.buffer=[];try{e=(0,this.closingSelector)()}catch(t){return this.error(t)}t=new N.w,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add((0,i.ft)(e,new i.IY(this))),this.subscribing=!1},e}(i.Ds);function A(t){return function(e){var n=new D(t),r=e.lift(n);return n.caught=r}}var D=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new B(t,this.selector,this.caught))},t}(),B=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.selector=n,i.caught=r,i}return r.ZT(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=void 0;try{n=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle();var r=new i.IY(this);this.add(r);var o=(0,i.ft)(n,r);o!==r&&this.add(o)}},e}(i.Ds),R=n(5142);function z(t){return function(e){return e.lift(new R.Ms(t))}}var W=n(9026),Y=n(5760);function F(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=null;return"function"==typeof t[t.length-1]&&(n=t.pop()),1===t.length&&(0,W.k)(t[0])&&(t=t[0].slice()),function(e){return e.lift.call((0,Y.D)([e].concat(t)),new R.Ms(n))}}var M=n(9795);function U(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(M.z.apply(void 0,[e].concat(t)))}}var K=n(2257),q=n(7746);function Q(t,e){return(0,q.zg)(t,e,1)}function H(t,e){return Q((function(){return t}),e)}function $(t){return function(e){return e.lift(new G(t,e))}}var G=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new J(t,this.predicate,this.source))},t}(),J=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.source=r,i.count=0,i.index=0,i}return r.ZT(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}(d.L);function X(t){return function(e){return e.lift(new tt(t))}}var tt=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new et(t,this.durationSelector))},t}(),et=function(t){function e(e,n){var r=t.call(this,e)||this;return r.durationSelector=n,r.hasValue=!1,r}return r.ZT(e,t),e.prototype._next=function(t){try{var e=this.durationSelector.call(this,t);e&&this._tryNext(t,e)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.emitValue(),this.destination.complete()},e.prototype._tryNext=function(t,e){var n=this.durationSubscription;this.value=t,this.hasValue=!0,n&&(n.unsubscribe(),this.remove(n)),(n=(0,i.ft)(e,new i.IY(this)))&&!n.closed&&this.add(this.durationSubscription=n)},e.prototype.notifyNext=function(){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){if(this.hasValue){var e=this.value,n=this.durationSubscription;n&&(this.durationSubscription=void 0,n.unsubscribe(),this.remove(n)),this.value=void 0,this.hasValue=!1,t.prototype._next.call(this,e)}},e}(i.Ds);function nt(t,e){return void 0===e&&(e=c.P),function(n){return n.lift(new rt(t,e))}}var rt=function(){function t(t,e){this.dueTime=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new it(t,this.dueTime,this.scheduler))},t}(),it=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.dueTime=n,i.scheduler=r,i.debouncedSubscription=null,i.lastValue=null,i.hasValue=!1,i}return r.ZT(e,t),e.prototype._next=function(t){this.clearDebounce(),this.lastValue=t,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(ot,this.dueTime,this))},e.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},e.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var t=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(t)}},e.prototype.clearDebounce=function(){var t=this.debouncedSubscription;null!==t&&(this.remove(t),t.unsubscribe(),this.debouncedSubscription=null)},e}(d.L);function ot(t){t.debouncedNext()}function st(t){return void 0===t&&(t=null),function(e){return e.lift(new ut(t))}}var ut=function(){function t(t){this.defaultValue=t}return t.prototype.call=function(t,e){return e.subscribe(new ct(t,this.defaultValue))},t}(),ct=function(t){function e(e,n){var r=t.call(this,e)||this;return r.defaultValue=n,r.isEmpty=!0,r}return r.ZT(e,t),e.prototype._next=function(t){this.isEmpty=!1,this.destination.next(t)},e.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},e}(d.L);function at(t){return t instanceof Date&&!isNaN(+t)}var ht=n(2632);function lt(t,e){void 0===e&&(e=c.P);var n=at(t)?+t-e.now():Math.abs(t);return function(t){return t.lift(new ft(n,e))}}var ft=function(){function t(t,e){this.delay=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new pt(t,this.delay,this.scheduler))},t}(),pt=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.delay=n,i.scheduler=r,i.queue=[],i.active=!1,i.errored=!1,i}return r.ZT(e,t),e.dispatch=function(t){for(var e=t.source,n=e.queue,r=t.scheduler,i=t.destination;n.length>0&&n[0].time-r.now()<=0;)n.shift().notification.observe(i);if(n.length>0){var o=Math.max(0,n[0].time-r.now());this.schedule(t,o)}else this.unsubscribe(),e.active=!1},e.prototype._schedule=function(t){this.active=!0,this.destination.add(t.schedule(e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},e.prototype.scheduleNotification=function(t){if(!0!==this.errored){var e=this.scheduler,n=new dt(e.now()+this.delay,t);this.queue.push(n),!1===this.active&&this._schedule(e)}},e.prototype._next=function(t){this.scheduleNotification(ht.P.createNext(t))},e.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.scheduleNotification(ht.P.createComplete()),this.unsubscribe()},e}(d.L),dt=function(){return function(t,e){this.time=t,this.notification=e}}(),bt=n(2772);function vt(t,e){return e?function(n){return new mt(n,e).lift(new yt(t))}:function(e){return e.lift(new yt(t))}}var yt=function(){function t(t){this.delayDurationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new wt(t,this.delayDurationSelector))},t}(),wt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.delayDurationSelector=n,r.completed=!1,r.delayNotifierSubscriptions=[],r.index=0,r}return r.ZT(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.destination.next(t),this.removeSubscription(i),this.tryComplete()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype.notifyComplete=function(t){var e=this.removeSubscription(t);e&&this.destination.next(e),this.tryComplete()},e.prototype._next=function(t){var e=this.index++;try{var n=this.delayDurationSelector(t,e);n&&this.tryDelay(n,t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.completed=!0,this.tryComplete(),this.unsubscribe()},e.prototype.removeSubscription=function(t){t.unsubscribe();var e=this.delayNotifierSubscriptions.indexOf(t);return-1!==e&&this.delayNotifierSubscriptions.splice(e,1),t.outerValue},e.prototype.tryDelay=function(t,e){var n=(0,I.D)(this,t,e);n&&!n.closed&&(this.destination.add(n),this.delayNotifierSubscriptions.push(n))},e.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},e}(V.L),mt=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subscriptionDelay=n,r}return r.ZT(e,t),e.prototype._subscribe=function(t){this.subscriptionDelay.subscribe(new xt(t,this.source))},e}(bt.y),xt=function(t){function e(e,n){var r=t.call(this)||this;return r.parent=e,r.source=n,r.sourceSubscribed=!1,r}return r.ZT(e,t),e.prototype._next=function(t){this.subscribeToSource()},e.prototype._error=function(t){this.unsubscribe(),this.parent.error(t)},e.prototype._complete=function(){this.unsubscribe(),this.subscribeToSource()},e.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},e}(d.L);function _t(){return function(t){return t.lift(new gt)}}var gt=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new St(t))},t}(),St=function(t){function e(e){return t.call(this,e)||this}return r.ZT(e,t),e.prototype._next=function(t){t.observe(this.destination)},e}(d.L);function Tt(t,e){return function(n){return n.lift(new Et(t,e))}}var Et=function(){function t(t,e){this.keySelector=t,this.flushes=e}return t.prototype.call=function(t,e){return e.subscribe(new Ct(t,this.keySelector,this.flushes))},t}(),Ct=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.keySelector=n,o.values=new Set,r&&o.add((0,i.ft)(r,new i.IY(o))),o}return r.ZT(e,t),e.prototype.notifyNext=function(){this.values.clear()},e.prototype.notifyError=function(t){this._error(t)},e.prototype._next=function(t){this.keySelector?this._useKeySelector(t):this._finalizeNext(t,t)},e.prototype._useKeySelector=function(t){var e,n=this.destination;try{e=this.keySelector(t)}catch(t){return void n.error(t)}this._finalizeNext(e,t)},e.prototype._finalizeNext=function(t,e){var n=this.values;n.has(t)||(n.add(t),this.destination.next(e))},e}(i.Ds);function Nt(t,e){return function(n){return n.lift(new It(t,e))}}var It=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new Vt(t,this.compare,this.keySelector))},t}(),Vt=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.keySelector=r,i.hasKey=!1,"function"==typeof n&&(i.compare=n),i}return r.ZT(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e;try{var n=this.keySelector;e=n?n(t):t}catch(t){return this.destination.error(t)}var r=!1;if(this.hasKey)try{r=(0,this.compare)(this.key,e)}catch(t){return this.destination.error(t)}else this.hasKey=!0;r||(this.key=e,this.destination.next(t))},e}(d.L);function Ot(t,e){return Nt((function(n,r){return e?e(n[t],r[t]):n[t]===r[t]}))}var jt=n(6565),kt=n(6008),Zt=n(6929);function Lt(t){return void 0===t&&(t=Dt),function(e){return e.lift(new Pt(t))}}var Pt=function(){function t(t){this.errorFactory=t}return t.prototype.call=function(t,e){return e.subscribe(new At(t,this.errorFactory))},t}(),At=function(t){function e(e,n){var r=t.call(this,e)||this;return r.errorFactory=n,r.hasValue=!1,r}return r.ZT(e,t),e.prototype._next=function(t){this.hasValue=!0,this.destination.next(t)},e.prototype._complete=function(){if(this.hasValue)return this.destination.complete();var t=void 0;try{t=this.errorFactory()}catch(e){t=e}this.destination.error(t)},e}(d.L);function Dt(){return new Zt.K}var Bt=n(5631);function Rt(t){return function(e){return 0===t?(0,Bt.c)():e.lift(new zt(t))}}var zt=function(){function t(t){if(this.total=t,this.total<0)throw new jt.W}return t.prototype.call=function(t,e){return e.subscribe(new Wt(t,this.total))},t}(),Wt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return r.ZT(e,t),e.prototype._next=function(t){var e=this.total,n=++this.count;n<=e&&(this.destination.next(t),n===e&&(this.destination.complete(),this.unsubscribe()))},e}(d.L);function Yt(t,e){if(t<0)throw new jt.W;var n=arguments.length>=2;return function(r){return r.pipe((0,kt.h)((function(e,n){return n===t})),Rt(1),n?st(e):Lt((function(){return new jt.W})))}}var Ft=n(8170);function Mt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return(0,M.z)(e,Ft.of.apply(void 0,t))}}function Ut(t,e){return function(n){return n.lift(new Kt(t,e,n))}}var Kt=function(){function t(t,e,n){this.predicate=t,this.thisArg=e,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new qt(t,this.predicate,this.thisArg,this.source))},t}(),qt=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.predicate=n,o.thisArg=r,o.source=i,o.index=0,o.thisArg=r||o,o}return r.ZT(e,t),e.prototype.notifyComplete=function(t){this.destination.next(t),this.destination.complete()},e.prototype._next=function(t){var e=!1;try{e=this.predicate.call(this.thisArg,t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e||this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(d.L);function Qt(){return function(t){return t.lift(new Ht)}}var Ht=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new $t(t))},t}(),$t=function(t){function e(e){var n=t.call(this,e)||this;return n.hasCompleted=!1,n.hasSubscription=!1,n}return r.ZT(e,t),e.prototype._next=function(t){this.hasSubscription||(this.hasSubscription=!0,this.add((0,i.ft)(t,new i.IY(this))))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},e.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(i.Ds),Gt=n(5709);function Jt(t,e){return e?function(n){return n.pipe(Jt((function(n,r){return(0,Y.D)(t(n,r)).pipe((0,Gt.U)((function(t,i){return e(n,t,r,i)})))})))}:function(e){return e.lift(new Xt(t))}}var Xt=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new te(t,this.project))},t}(),te=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.hasSubscription=!1,r.hasCompleted=!1,r.index=0,r}return r.ZT(e,t),e.prototype._next=function(t){this.hasSubscription||this.tryNext(t)},e.prototype.tryNext=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.hasSubscription=!0,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new i.IY(this),n=this.destination;n.add(e);var r=(0,i.ft)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(i.Ds);function ee(t,e,n){return void 0===e&&(e=Number.POSITIVE_INFINITY),e=(e||0)<1?Number.POSITIVE_INFINITY:e,function(r){return r.lift(new ne(t,e,n))}}var ne=function(){function t(t,e,n){this.project=t,this.concurrent=e,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new re(t,this.project,this.concurrent,this.scheduler))},t}(),re=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.project=n,o.concurrent=r,o.scheduler=i,o.index=0,o.active=0,o.hasCompleted=!1,r<Number.POSITIVE_INFINITY&&(o.buffer=[]),o}return r.ZT(e,t),e.dispatch=function(t){var e=t.subscriber,n=t.result,r=t.value,i=t.index;e.subscribeToProjection(n,r,i)},e.prototype._next=function(t){var n=this.destination;if(n.closed)this._complete();else{var r=this.index++;if(this.active<this.concurrent){n.next(t);try{var i=(0,this.project)(t,r);if(this.scheduler){var o={subscriber:this,result:i,value:t,index:r};this.destination.add(this.scheduler.schedule(e.dispatch,0,o))}else this.subscribeToProjection(i,t,r)}catch(t){n.error(t)}}else this.buffer.push(t)}},e.prototype.subscribeToProjection=function(t,e,n){this.active++,this.destination.add((0,i.ft)(t,new i.IY(this)))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this._next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t&&t.length>0&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},e}(i.Ds);function ie(t){return function(e){return e.lift(new oe(t))}}var oe=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e.subscribe(new se(t,this.callback))},t}(),se=function(t){function e(e,n){var r=t.call(this,e)||this;return r.add(new N.w(n)),r}return r.ZT(e,t),e}(d.L);function ue(t,e){if("function"!=typeof t)throw new TypeError("predicate is not a function");return function(n){return n.lift(new ce(t,n,!1,e))}}var ce=function(){function t(t,e,n,r){this.predicate=t,this.source=e,this.yieldIndex=n,this.thisArg=r}return t.prototype.call=function(t,e){return e.subscribe(new ae(t,this.predicate,this.source,this.yieldIndex,this.thisArg))},t}(),ae=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.predicate=n,s.source=r,s.yieldIndex=i,s.thisArg=o,s.index=0,s}return r.ZT(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete(),this.unsubscribe()},e.prototype._next=function(t){var e=this.predicate,n=this.thisArg,r=this.index++;try{e.call(n||this,t,r,this.source)&&this.notifyComplete(this.yieldIndex?r:t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},e}(d.L);function he(t,e){return function(n){return n.lift(new ce(t,n,!0,e))}}var le=n(3608);function fe(t,e){var n=arguments.length>=2;return function(r){return r.pipe(t?(0,kt.h)((function(e,n){return t(e,n,r)})):le.y,Rt(1),n?st(e):Lt((function(){return new Zt.K})))}}var pe=n(1120);function de(){return function(t){return t.lift(new be)}}var be=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new ve(t))},t}(),ve=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.ZT(e,t),e.prototype._next=function(t){},e}(d.L);function ye(){return function(t){return t.lift(new we)}}var we=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new me(t))},t}(),me=function(t){function e(e){return t.call(this,e)||this}return r.ZT(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype._next=function(t){this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(d.L);function xe(t){return function(e){return 0===t?(0,Bt.c)():e.lift(new _e(t))}}var _e=function(){function t(t){if(this.total=t,this.total<0)throw new jt.W}return t.prototype.call=function(t,e){return e.subscribe(new ge(t,this.total))},t}(),ge=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.ring=new Array,r.count=0,r}return r.ZT(e,t),e.prototype._next=function(t){var e=this.ring,n=this.total,r=this.count++;e.length<n?e.push(t):e[r%n]=t},e.prototype._complete=function(){var t=this.destination,e=this.count;if(e>0)for(var n=this.count>=this.total?this.total:this.count,r=this.ring,i=0;i<n;i++){var o=e++%n;t.next(r[o])}t.complete()},e}(d.L);function Se(t,e){var n=arguments.length>=2;return function(r){return r.pipe(t?(0,kt.h)((function(e,n){return t(e,n,r)})):le.y,xe(1),n?st(e):Lt((function(){return new Zt.K})))}}function Te(t){return function(e){return e.lift(new Ee(t))}}var Ee=function(){function t(t){this.value=t}return t.prototype.call=function(t,e){return e.subscribe(new Ce(t,this.value))},t}(),Ce=function(t){function e(e,n){var r=t.call(this,e)||this;return r.value=n,r}return r.ZT(e,t),e.prototype._next=function(t){this.destination.next(this.value)},e}(d.L);function Ne(){return function(t){return t.lift(new Ie)}}var Ie=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Ve(t))},t}(),Ve=function(t){function e(e){return t.call(this,e)||this}return r.ZT(e,t),e.prototype._next=function(t){this.destination.next(ht.P.createNext(t))},e.prototype._error=function(t){var e=this.destination;e.next(ht.P.createError(t)),e.complete()},e.prototype._complete=function(){var t=this.destination;t.next(ht.P.createComplete()),t.complete()},e}(d.L);function Oe(t,e){var n=!1;return arguments.length>=2&&(n=!0),function(r){return r.lift(new je(t,e,n))}}var je=function(){function t(t,e,n){void 0===n&&(n=!1),this.accumulator=t,this.seed=e,this.hasSeed=n}return t.prototype.call=function(t,e){return e.subscribe(new ke(t,this.accumulator,this.seed,this.hasSeed))},t}(),ke=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.accumulator=n,o._seed=r,o.hasSeed=i,o.index=0,o}return r.ZT(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,n=this.index++;try{e=this.accumulator(this.seed,t,n)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(d.L),Ze=n(2561);function Le(t,e){return arguments.length>=2?function(n){return(0,Ze.z)(Oe(t,e),xe(1),st(e))(n)}:function(e){return(0,Ze.z)(Oe((function(e,n,r){return t(e,n,r+1)})),xe(1))(e)}}function Pe(t){return Le("function"==typeof t?function(e,n){return t(e,n)>0?e:n}:function(t,e){return t>e?t:e})}var Ae=n(4370);function De(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(Ae.T.apply(void 0,[e].concat(t)))}}var Be=n(2556);function Re(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?(0,q.zg)((function(){return t}),e,n):("number"==typeof e&&(n=e),(0,q.zg)((function(){return t}),n))}function ze(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),function(r){return r.lift(new We(t,e,n))}}var We=function(){function t(t,e,n){this.accumulator=t,this.seed=e,this.concurrent=n}return t.prototype.call=function(t,e){return e.subscribe(new Ye(t,this.accumulator,this.seed,this.concurrent))},t}(),Ye=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.accumulator=n,o.acc=r,o.concurrent=i,o.hasValue=!1,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return r.ZT(e,t),e.prototype._next=function(t){if(this.active<this.concurrent){var e=this.index++,n=this.destination,r=void 0;try{r=(0,this.accumulator)(this.acc,t,e)}catch(t){return n.error(t)}this.active++,this._innerSub(r)}else this.buffer.push(t)},e.prototype._innerSub=function(t){var e=new i.IY(this),n=this.destination;n.add(e);var r=(0,i.ft)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete()),this.unsubscribe()},e.prototype.notifyNext=function(t){var e=this.destination;this.acc=t,this.hasValue=!0,e.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},e}(i.Ds);function Fe(t){return Le("function"==typeof t?function(e,n){return t(e,n)<0?e:n}:function(t,e){return t<e?t:e})}var Me=n(3140);function Ue(t,e){return function(n){var r;if(r="function"==typeof t?t:function(){return t},"function"==typeof e)return n.lift(new Ke(r,e));var i=Object.create(n,Me.N);return i.source=n,i.subjectFactory=r,i}}var Ke=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var n=this.selector,r=this.subjectFactory(),i=n(r).subscribe(t);return i.add(e.subscribe(r)),i},t}(),qe=n(9276);function Qe(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&(0,W.k)(t[0])&&(t=t[0]),function(e){return e.lift(new He(t))}}var He=function(){function t(t){this.nextSources=t}return t.prototype.call=function(t,e){return e.subscribe(new $e(t,this.nextSources))},t}(),$e=function(t){function e(e,n){var r=t.call(this,e)||this;return r.destination=e,r.nextSources=n,r}return r.ZT(e,t),e.prototype.notifyError=function(){this.subscribeToNextSource()},e.prototype.notifyComplete=function(){this.subscribeToNextSource()},e.prototype._error=function(t){this.subscribeToNextSource(),this.unsubscribe()},e.prototype._complete=function(){this.subscribeToNextSource(),this.unsubscribe()},e.prototype.subscribeToNextSource=function(){var t=this.nextSources.shift();if(t){var e=new i.IY(this),n=this.destination;n.add(e);var r=(0,i.ft)(t,e);r!==e&&n.add(r)}else this.destination.complete()},e}(i.Ds);function Ge(){return function(t){return t.lift(new Je)}}var Je=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Xe(t))},t}(),Xe=function(t){function e(e){var n=t.call(this,e)||this;return n.hasPrev=!1,n}return r.ZT(e,t),e.prototype._next=function(t){var e;this.hasPrev?e=[this.prev,t]:this.hasPrev=!0,this.prev=t,e&&this.destination.next(e)},e}(d.L),tn=n(8463);function en(t,e){return function(n){return[(0,kt.h)(t,e)(n),(0,kt.h)((0,tn.f)(t,e))(n)]}}function nn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.length;if(0===n)throw new Error("list of properties cannot be empty.");return function(e){return(0,Gt.U)(rn(t,n))(e)}}function rn(t,e){return function(n){for(var r=n,i=0;i<e;i++){var o=null!=r?r[t[i]]:void 0;if(void 0===o)return;r=o}return r}}var on=n(211);function sn(t){return t?Ue((function(){return new on.xQ}),t):Ue(new on.xQ)}var un=n(9233);function cn(t){return function(e){return Ue(new un.X(t))(e)}}var an=n(364);function hn(){return function(t){return Ue(new an.c)(t)}}var ln=n(2630);function fn(t,e,n,r){n&&"function"!=typeof n&&(r=n);var i="function"==typeof n?n:void 0,o=new ln.t(t,e,r);return function(t){return Ue((function(){return o}),i)(t)}}var pn=n(8821);function dn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return 1===t.length&&(0,W.k)(t[0])&&(t=t[0]),e.lift.call(pn.S3.apply(void 0,[e].concat(t)))}}function bn(t){return void 0===t&&(t=-1),function(e){return 0===t?(0,Bt.c)():t<0?e.lift(new vn(-1,e)):e.lift(new vn(t-1,e))}}var vn=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new yn(t,this.count,this.source))},t}(),yn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.count=n,i.source=r,i}return r.ZT(e,t),e.prototype.complete=function(){if(!this.isStopped){var e=this.source,n=this.count;if(0===n)return t.prototype.complete.call(this);n>-1&&(this.count=n-1),e.subscribe(this._unsubscribeAndRecycle())}},e}(d.L);function wn(t){return function(e){return e.lift(new mn(t))}}var mn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new xn(t,this.notifier,e))},t}(),xn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.notifier=n,i.source=r,i.sourceIsBeingSubscribedTo=!0,i}return r.ZT(e,t),e.prototype.notifyNext=function(){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},e.prototype.notifyComplete=function(){if(!1===this.sourceIsBeingSubscribedTo)return t.prototype.complete.call(this)},e.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries||this.subscribeToRetries(),!this.retriesSubscription||this.retriesSubscription.closed)return t.prototype.complete.call(this);this._unsubscribeAndRecycle(),this.notifications.next(void 0)}},e.prototype._unsubscribe=function(){var t=this.notifications,e=this.retriesSubscription;t&&(t.unsubscribe(),this.notifications=void 0),e&&(e.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},e.prototype._unsubscribeAndRecycle=function(){var e=this._unsubscribe;return this._unsubscribe=null,t.prototype._unsubscribeAndRecycle.call(this),this._unsubscribe=e,this},e.prototype.subscribeToRetries=function(){var e;this.notifications=new on.xQ;try{e=(0,this.notifier)(this.notifications)}catch(e){return t.prototype.complete.call(this)}this.retries=e,this.retriesSubscription=(0,i.ft)(e,new i.IY(this))},e}(i.Ds);function _n(t){return void 0===t&&(t=-1),function(e){return e.lift(new gn(t,e))}}var gn=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Sn(t,this.count,this.source))},t}(),Sn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.count=n,i.source=r,i}return r.ZT(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=this.source,r=this.count;if(0===r)return t.prototype.error.call(this,e);r>-1&&(this.count=r-1),n.subscribe(this._unsubscribeAndRecycle())}},e}(d.L);function Tn(t){return function(e){return e.lift(new En(t,e))}}var En=function(){function t(t,e){this.notifier=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Cn(t,this.notifier,this.source))},t}(),Cn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.notifier=n,i.source=r,i}return r.ZT(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=this.errors,r=this.retries,o=this.retriesSubscription;if(r)this.errors=void 0,this.retriesSubscription=void 0;else{n=new on.xQ;try{r=(0,this.notifier)(n)}catch(e){return t.prototype.error.call(this,e)}o=(0,i.ft)(r,new i.IY(this))}this._unsubscribeAndRecycle(),this.errors=n,this.retries=r,this.retriesSubscription=o,n.next(e)}},e.prototype._unsubscribe=function(){var t=this.errors,e=this.retriesSubscription;t&&(t.unsubscribe(),this.errors=void 0),e&&(e.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},e.prototype.notifyNext=function(){var t=this._unsubscribe;this._unsubscribe=null,this._unsubscribeAndRecycle(),this._unsubscribe=t,this.source.subscribe(this)},e}(i.Ds),Nn=n(3018);function In(t){return function(e){return e.lift(new Vn(t))}}var Vn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new On(t),r=e.subscribe(n);return r.add((0,i.ft)(this.notifier,new i.IY(n))),r},t}(),On=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasValue=!1,e}return r.ZT(e,t),e.prototype._next=function(t){this.value=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},e}(i.Ds);function jn(t,e){return void 0===e&&(e=c.P),function(n){return n.lift(new kn(t,e))}}var kn=function(){function t(t,e){this.period=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new Zn(t,this.period,this.scheduler))},t}(),Zn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.period=n,i.scheduler=r,i.hasValue=!1,i.add(r.schedule(Ln,n,{subscriber:i,period:n})),i}return r.ZT(e,t),e.prototype._next=function(t){this.lastValue=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},e}(d.L);function Ln(t){var e=t.subscriber,n=t.period;e.notifyNext(),this.schedule(t,n)}function Pn(t,e){return function(n){return n.lift(new An(t,e))}}var An=function(){function t(t,e){this.compareTo=t,this.comparator=e}return t.prototype.call=function(t,e){return e.subscribe(new Dn(t,this.compareTo,this.comparator))},t}(),Dn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.compareTo=n,i.comparator=r,i._a=[],i._b=[],i._oneComplete=!1,i.destination.add(n.subscribe(new Bn(e,i))),i}return r.ZT(e,t),e.prototype._next=function(t){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(t),this.checkValues())},e.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0,this.unsubscribe()},e.prototype.checkValues=function(){for(var t=this,e=t._a,n=t._b,r=t.comparator;e.length>0&&n.length>0;){var i=e.shift(),o=n.shift(),s=!1;try{s=r?r(i,o):i===o}catch(t){this.destination.error(t)}s||this.emit(!1)}},e.prototype.emit=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype.nextB=function(t){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(t),this.checkValues())},e.prototype.completeB=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},e}(d.L),Bn=function(t){function e(e,n){var r=t.call(this,e)||this;return r.parent=n,r}return r.ZT(e,t),e.prototype._next=function(t){this.parent.nextB(t)},e.prototype._error=function(t){this.parent.error(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.completeB(),this.unsubscribe()},e}(d.L);function Rn(){return new on.xQ}function zn(){return function(t){return(0,Nn.x)()(Ue(Rn)(t))}}function Wn(t,e,n){var r;return r=t&&"object"==typeof t?t:{bufferSize:t,windowTime:e,refCount:!1,scheduler:n},function(t){return t.lift(function(t){var e,n,r=t.bufferSize,i=void 0===r?Number.POSITIVE_INFINITY:r,o=t.windowTime,s=void 0===o?Number.POSITIVE_INFINITY:o,u=t.refCount,c=t.scheduler,a=0,h=!1,l=!1;return function(t){var r;a++,!e||h?(h=!1,e=new ln.t(i,s,c),r=e.subscribe(this),n=t.subscribe({next:function(t){e.next(t)},error:function(t){h=!0,e.error(t)},complete:function(){l=!0,n=void 0,e.complete()}}),l&&(n=void 0)):r=e.subscribe(this),this.add((function(){a--,r.unsubscribe(),r=void 0,n&&!l&&u&&0===a&&(n.unsubscribe(),n=void 0,e=void 0)}))}}(r))}}function Yn(t){return function(e){return e.lift(new Fn(t,e))}}var Fn=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Mn(t,this.predicate,this.source))},t}(),Mn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.source=r,i.seenValue=!1,i.index=0,i}return r.ZT(e,t),e.prototype.applySingleValue=function(t){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=t)},e.prototype._next=function(t){var e=this.index++;this.predicate?this.tryNext(t,e):this.applySingleValue(t)},e.prototype.tryNext=function(t,e){try{this.predicate(t,e,this.source)&&this.applySingleValue(t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){var t=this.destination;this.index>0?(t.next(this.seenValue?this.singleValue:void 0),t.complete()):t.error(new Zt.K)},e}(d.L);function Un(t){return function(e){return e.lift(new Kn(t))}}var Kn=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new qn(t,this.total))},t}(),qn=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return r.ZT(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(d.L);function Qn(t){return function(e){return e.lift(new Hn(t))}}var Hn=function(){function t(t){if(this._skipCount=t,this._skipCount<0)throw new jt.W}return t.prototype.call=function(t,e){return 0===this._skipCount?e.subscribe(new d.L(t)):e.subscribe(new $n(t,this._skipCount))},t}(),$n=function(t){function e(e,n){var r=t.call(this,e)||this;return r._skipCount=n,r._count=0,r._ring=new Array(n),r}return r.ZT(e,t),e.prototype._next=function(t){var e=this._skipCount,n=this._count++;if(n<e)this._ring[n]=t;else{var r=n%e,i=this._ring,o=i[r];i[r]=t,this.destination.next(o)}},e}(d.L);function Gn(t){return function(e){return e.lift(new Jn(t))}}var Jn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new Xn(t,this.notifier))},t}(),Xn=function(t){function e(e,n){var r=t.call(this,e)||this;r.hasValue=!1;var o=new i.IY(r);r.add(o),r.innerSubscription=o;var s=(0,i.ft)(n,o);return s!==o&&(r.add(s),r.innerSubscription=s),r}return r.ZT(e,t),e.prototype._next=function(e){this.hasValue&&t.prototype._next.call(this,e)},e.prototype.notifyNext=function(){this.hasValue=!0,this.innerSubscription&&this.innerSubscription.unsubscribe()},e.prototype.notifyComplete=function(){},e}(i.Ds);function tr(t){return function(e){return e.lift(new er(t))}}var er=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new nr(t,this.predicate))},t}(),nr=function(t){function e(e,n){var r=t.call(this,e)||this;return r.predicate=n,r.skipping=!0,r.index=0,r}return r.ZT(e,t),e.prototype._next=function(t){var e=this.destination;this.skipping&&this.tryCallPredicate(t),this.skipping||e.next(t)},e.prototype.tryCallPredicate=function(t){try{var e=this.predicate(t,this.index++);this.skipping=Boolean(e)}catch(t){this.destination.error(t)}},e}(d.L);function rr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return(0,m.K)(n)?(t.pop(),function(e){return(0,M.z)(t,e,n)}):function(e){return(0,M.z)(t,e)}}var ir=n(6650),or=n(5812),sr=function(t){function e(e,n,r){void 0===n&&(n=0),void 0===r&&(r=ir.e);var i=t.call(this)||this;return i.source=e,i.delayTime=n,i.scheduler=r,(!(0,or.k)(n)||n<0)&&(i.delayTime=0),r&&"function"==typeof r.schedule||(i.scheduler=ir.e),i}return r.ZT(e,t),e.create=function(t,n,r){return void 0===n&&(n=0),void 0===r&&(r=ir.e),new e(t,n,r)},e.dispatch=function(t){var e=t.source,n=t.subscriber;return this.add(e.subscribe(n))},e.prototype._subscribe=function(t){var n=this.delayTime,r=this.source;return this.scheduler.schedule(e.dispatch,n,{source:r,subscriber:t})},e}(bt.y);function ur(t,e){return void 0===e&&(e=0),function(n){return n.lift(new cr(t,e))}}var cr=function(){function t(t,e){this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return new sr(e,this.delay,this.scheduler).subscribe(t)},t}();function ar(t,e){return"function"==typeof e?function(n){return n.pipe(ar((function(n,r){return(0,Y.D)(t(n,r)).pipe((0,Gt.U)((function(t,i){return e(n,t,r,i)})))})))}:function(e){return e.lift(new hr(t))}}var hr=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new lr(t,this.project))},t}(),lr=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.index=0,r}return r.ZT(e,t),e.prototype._next=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this._innerSub(e)},e.prototype._innerSub=function(t){var e=this.innerSubscription;e&&e.unsubscribe();var n=new i.IY(this),r=this.destination;r.add(n),this.innerSubscription=(0,i.ft)(t,n),this.innerSubscription!==n&&r.add(this.innerSubscription)},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this),this.unsubscribe()},e.prototype._unsubscribe=function(){this.innerSubscription=void 0},e.prototype.notifyComplete=function(){this.innerSubscription=void 0,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t){this.destination.next(t)},e}(i.Ds);function fr(){return ar(le.y)}function pr(t,e){return e?ar((function(){return t}),e):ar((function(){return t}))}function dr(t){return function(e){return e.lift(new br(t))}}var br=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new vr(t),r=(0,i.ft)(this.notifier,new i.IY(n));return r&&!n.seenValue?(n.add(r),e.subscribe(n)):n},t}(),vr=function(t){function e(e){var n=t.call(this,e)||this;return n.seenValue=!1,n}return r.ZT(e,t),e.prototype.notifyNext=function(){this.seenValue=!0,this.complete()},e.prototype.notifyComplete=function(){},e}(i.Ds);function yr(t,e){return void 0===e&&(e=!1),function(n){return n.lift(new wr(t,e))}}var wr=function(){function t(t,e){this.predicate=t,this.inclusive=e}return t.prototype.call=function(t,e){return e.subscribe(new mr(t,this.predicate,this.inclusive))},t}(),mr=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.inclusive=r,i.index=0,i}return r.ZT(e,t),e.prototype._next=function(t){var e,n=this.destination;try{e=this.predicate(t,this.index++)}catch(t){return void n.error(t)}this.nextOrComplete(t,e)},e.prototype.nextOrComplete=function(t,e){var n=this.destination;Boolean(e)?n.next(t):(this.inclusive&&n.next(t),n.complete())},e}(d.L),xr=n(3306),_r=n(4156);function gr(t,e,n){return function(r){return r.lift(new Sr(t,e,n))}}var Sr=function(){function t(t,e,n){this.nextOrObserver=t,this.error=e,this.complete=n}return t.prototype.call=function(t,e){return e.subscribe(new Tr(t,this.nextOrObserver,this.error,this.complete))},t}(),Tr=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o._tapNext=xr.Z,o._tapError=xr.Z,o._tapComplete=xr.Z,o._tapError=r||xr.Z,o._tapComplete=i||xr.Z,(0,_r.m)(n)?(o._context=o,o._tapNext=n):n&&(o._context=n,o._tapNext=n.next||xr.Z,o._tapError=n.error||xr.Z,o._tapComplete=n.complete||xr.Z),o}return r.ZT(e,t),e.prototype._next=function(t){try{this._tapNext.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.next(t)},e.prototype._error=function(t){try{this._tapError.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.error(t)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(t){return void this.destination.error(t)}return this.destination.complete()},e}(d.L),Er={leading:!0,trailing:!1};function Cr(t,e){return void 0===e&&(e=Er),function(n){return n.lift(new Nr(t,!!e.leading,!!e.trailing))}}var Nr=function(){function t(t,e,n){this.durationSelector=t,this.leading=e,this.trailing=n}return t.prototype.call=function(t,e){return e.subscribe(new Ir(t,this.durationSelector,this.leading,this.trailing))},t}(),Ir=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.destination=e,o.durationSelector=n,o._leading=r,o._trailing=i,o._hasValue=!1,o}return r.ZT(e,t),e.prototype._next=function(t){this._hasValue=!0,this._sendValue=t,this._throttled||(this._leading?this.send():this.throttle(t))},e.prototype.send=function(){var t=this._hasValue,e=this._sendValue;t&&(this.destination.next(e),this.throttle(e)),this._hasValue=!1,this._sendValue=void 0},e.prototype.throttle=function(t){var e=this.tryDurationSelector(t);e&&this.add(this._throttled=(0,i.ft)(e,new i.IY(this)))},e.prototype.tryDurationSelector=function(t){try{return this.durationSelector(t)}catch(t){return this.destination.error(t),null}},e.prototype.throttlingDone=function(){var t=this._throttled,e=this._trailing;t&&t.unsubscribe(),this._throttled=void 0,e&&this.send()},e.prototype.notifyNext=function(){this.throttlingDone()},e.prototype.notifyComplete=function(){this.throttlingDone()},e}(i.Ds);function Vr(t,e,n){return void 0===e&&(e=c.P),void 0===n&&(n=Er),function(r){return r.lift(new Or(t,e,n.leading,n.trailing))}}var Or=function(){function t(t,e,n,r){this.duration=t,this.scheduler=e,this.leading=n,this.trailing=r}return t.prototype.call=function(t,e){return e.subscribe(new jr(t,this.duration,this.scheduler,this.leading,this.trailing))},t}(),jr=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.duration=n,s.scheduler=r,s.leading=i,s.trailing=o,s._hasTrailingValue=!1,s._trailingValue=null,s}return r.ZT(e,t),e.prototype._next=function(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(kr,this.duration,{subscriber:this})),this.leading?this.destination.next(t):this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0))},e.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},e.prototype.clearThrottle=function(){var t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)},e}(d.L);function kr(t){t.subscriber.clearThrottle()}var Zr=n(1410);function Lr(t){return void 0===t&&(t=c.P),function(e){return(0,Zr.P)((function(){return e.pipe(Oe((function(e,n){var r=e.current;return{value:n,current:t.now(),last:r}}),{current:t.now(),value:void 0,last:void 0}),(0,Gt.U)((function(t){var e=t.current,n=t.last,r=t.value;return new Pr(r,e-n)})))}))}}var Pr=function(){return function(t,e){this.value=t,this.interval=e}}(),Ar=n(1462);function Dr(t,e,n){return void 0===n&&(n=c.P),function(r){var i=at(t),o=i?+t-n.now():Math.abs(t);return r.lift(new Br(o,i,e,n))}}var Br=function(){function t(t,e,n,r){this.waitFor=t,this.absoluteTimeout=e,this.withObservable=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new Rr(t,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},t}(),Rr=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.absoluteTimeout=n,s.waitFor=r,s.withObservable=i,s.scheduler=o,s.scheduleTimeout(),s}return r.ZT(e,t),e.dispatchTimeout=function(t){var e=t.withObservable;t._unsubscribeAndRecycle(),t.add((0,i.ft)(e,new i.IY(t)))},e.prototype.scheduleTimeout=function(){var t=this.action;t?this.action=t.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(e.dispatchTimeout,this.waitFor,this))},e.prototype._next=function(e){this.absoluteTimeout||this.scheduleTimeout(),t.prototype._next.call(this,e)},e.prototype._unsubscribe=function(){this.action=void 0,this.scheduler=null,this.withObservable=null},e}(i.Ds),zr=n(4944);function Wr(t,e){return void 0===e&&(e=c.P),Dr(t,(0,zr._)(new Ar.W),e)}function Yr(t){return void 0===t&&(t=c.P),(0,Gt.U)((function(e){return new Fr(e,t.now())}))}var Fr=function(){return function(t,e){this.value=t,this.timestamp=e}}();function Mr(t,e,n){return 0===n?[e]:(t.push(e),t)}function Ur(){return Le(Mr,[])}function Kr(t){return function(e){return e.lift(new qr(t))}}var qr=function(){function t(t){this.windowBoundaries=t}return t.prototype.call=function(t,e){var n=new Qr(t),r=e.subscribe(n);return r.closed||n.add((0,i.ft)(this.windowBoundaries,new i.IY(n))),r},t}(),Qr=function(t){function e(e){var n=t.call(this,e)||this;return n.window=new on.xQ,e.next(n.window),n}return r.ZT(e,t),e.prototype.notifyNext=function(){this.openWindow()},e.prototype.notifyError=function(t){this._error(t)},e.prototype.notifyComplete=function(){this._complete()},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t)},e.prototype._complete=function(){this.window.complete(),this.destination.complete()},e.prototype._unsubscribe=function(){this.window=null},e.prototype.openWindow=function(){var t=this.window;t&&t.complete();var e=this.destination,n=this.window=new on.xQ;e.next(n)},e}(i.Ds);function Hr(t,e){return void 0===e&&(e=0),function(n){return n.lift(new $r(t,e))}}var $r=function(){function t(t,e){this.windowSize=t,this.startWindowEvery=e}return t.prototype.call=function(t,e){return e.subscribe(new Gr(t,this.windowSize,this.startWindowEvery))},t}(),Gr=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.destination=e,i.windowSize=n,i.startWindowEvery=r,i.windows=[new on.xQ],i.count=0,e.next(i.windows[0]),i}return r.ZT(e,t),e.prototype._next=function(t){for(var e=this.startWindowEvery>0?this.startWindowEvery:this.windowSize,n=this.destination,r=this.windowSize,i=this.windows,o=i.length,s=0;s<o&&!this.closed;s++)i[s].next(t);var u=this.count-r+1;if(u>=0&&u%e==0&&!this.closed&&i.shift().complete(),++this.count%e==0&&!this.closed){var c=new on.xQ;i.push(c),n.next(c)}},e.prototype._error=function(t){var e=this.windows;if(e)for(;e.length>0&&!this.closed;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){var t=this.windows;if(t)for(;t.length>0&&!this.closed;)t.shift().complete();this.destination.complete()},e.prototype._unsubscribe=function(){this.count=0,this.windows=null},e}(d.L);function Jr(t){var e=c.P,n=null,r=Number.POSITIVE_INFINITY;return(0,m.K)(arguments[3])&&(e=arguments[3]),(0,m.K)(arguments[2])?e=arguments[2]:(0,or.k)(arguments[2])&&(r=Number(arguments[2])),(0,m.K)(arguments[1])?e=arguments[1]:(0,or.k)(arguments[1])&&(n=Number(arguments[1])),function(i){return i.lift(new Xr(t,n,r,e))}}var Xr=function(){function t(t,e,n,r){this.windowTimeSpan=t,this.windowCreationInterval=e,this.maxWindowSize=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new ei(t,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},t}(),ti=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._numberOfNextedValues=0,e}return r.ZT(e,t),e.prototype.next=function(e){this._numberOfNextedValues++,t.prototype.next.call(this,e)},Object.defineProperty(e.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),e}(on.xQ),ei=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;s.destination=e,s.windowTimeSpan=n,s.windowCreationInterval=r,s.maxWindowSize=i,s.scheduler=o,s.windows=[];var u=s.openWindow();if(null!==r&&r>=0){var c={subscriber:s,window:u,context:null},a={windowTimeSpan:n,windowCreationInterval:r,subscriber:s,scheduler:o};s.add(o.schedule(ii,n,c)),s.add(o.schedule(ri,r,a))}else{var h={subscriber:s,window:u,windowTimeSpan:n};s.add(o.schedule(ni,n,h))}return s}return r.ZT(e,t),e.prototype._next=function(t){for(var e=this.windows,n=e.length,r=0;r<n;r++){var i=e[r];i.closed||(i.next(t),i.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(i))}},e.prototype._error=function(t){for(var e=this.windows;e.length>0;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){for(var t=this.windows;t.length>0;){var e=t.shift();e.closed||e.complete()}this.destination.complete()},e.prototype.openWindow=function(){var t=new ti;return this.windows.push(t),this.destination.next(t),t},e.prototype.closeWindow=function(t){t.complete();var e=this.windows;e.splice(e.indexOf(t),1)},e}(d.L);function ni(t){var e=t.subscriber,n=t.windowTimeSpan,r=t.window;r&&e.closeWindow(r),t.window=e.openWindow(),this.schedule(t,n)}function ri(t){var e=t.windowTimeSpan,n=t.subscriber,r=t.scheduler,i=t.windowCreationInterval,o=n.openWindow(),s=this,u={action:s,subscription:null},c={subscriber:n,window:o,context:u};u.subscription=r.schedule(ii,e,c),s.add(u.subscription),s.schedule(t,i)}function ii(t){var e=t.subscriber,n=t.window,r=t.context;r&&r.action&&r.subscription&&r.action.remove(r.subscription),e.closeWindow(n)}function oi(t,e){return function(n){return n.lift(new si(t,e))}}var si=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new ui(t,this.openings,this.closingSelector))},t}(),ui=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.openings=n,i.closingSelector=r,i.contexts=[],i.add(i.openSubscription=(0,I.D)(i,n,n)),i}return r.ZT(e,t),e.prototype._next=function(t){var e=this.contexts;if(e)for(var n=e.length,r=0;r<n;r++)e[r].window.next(t)},e.prototype._error=function(e){var n=this.contexts;if(this.contexts=null,n)for(var r=n.length,i=-1;++i<r;){var o=n[i];o.window.error(e),o.subscription.unsubscribe()}t.prototype._error.call(this,e)},e.prototype._complete=function(){var e=this.contexts;if(this.contexts=null,e)for(var n=e.length,r=-1;++r<n;){var i=e[r];i.window.complete(),i.subscription.unsubscribe()}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.contexts;if(this.contexts=null,t)for(var e=t.length,n=-1;++n<e;){var r=t[n];r.window.unsubscribe(),r.subscription.unsubscribe()}},e.prototype.notifyNext=function(t,e,n,r,i){if(t===this.openings){var o=void 0;try{o=(0,this.closingSelector)(e)}catch(t){return this.error(t)}var s=new on.xQ,u=new N.w,c={window:s,subscription:u};this.contexts.push(c);var a=(0,I.D)(this,o,c);a.closed?this.closeWindow(this.contexts.length-1):(a.context=c,u.add(a)),this.destination.next(s)}else this.closeWindow(this.contexts.indexOf(t))},e.prototype.notifyError=function(t){this.error(t)},e.prototype.notifyComplete=function(t){t!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(t.context))},e.prototype.closeWindow=function(t){if(-1!==t){var e=this.contexts,n=e[t],r=n.window,i=n.subscription;e.splice(t,1),r.complete(),i.unsubscribe()}},e}(V.L);function ci(t){return function(e){return e.lift(new ai(t))}}var ai=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new hi(t,this.closingSelector))},t}(),hi=function(t){function e(e,n){var r=t.call(this,e)||this;return r.destination=e,r.closingSelector=n,r.openWindow(),r}return r.ZT(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.openWindow(i)},e.prototype.notifyError=function(t){this._error(t)},e.prototype.notifyComplete=function(t){this.openWindow(t)},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t),this.unsubscribeClosingNotification()},e.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},e.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},e.prototype.openWindow=function(t){void 0===t&&(t=null),t&&(this.remove(t),t.unsubscribe());var e=this.window;e&&e.complete();var n,r=this.window=new on.xQ;this.destination.next(r);try{n=(0,this.closingSelector)()}catch(t){return this.destination.error(t),void this.window.error(t)}this.add(this.closingNotification=(0,I.D)(this,n))},e}(V.L);function li(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){var n;"function"==typeof t[t.length-1]&&(n=t.pop());var r=t;return e.lift(new fi(r,n))}}var fi=function(){function t(t,e){this.observables=t,this.project=e}return t.prototype.call=function(t,e){return e.subscribe(new pi(t,this.observables,this.project))},t}(),pi=function(t){function e(e,n,r){var i=t.call(this,e)||this;i.observables=n,i.project=r,i.toRespond=[];var o=n.length;i.values=new Array(o);for(var s=0;s<o;s++)i.toRespond.push(s);for(s=0;s<o;s++){var u=n[s];i.add((0,I.D)(i,u,void 0,s))}return i}return r.ZT(e,t),e.prototype.notifyNext=function(t,e,n){this.values[n]=e;var r=this.toRespond;if(r.length>0){var i=r.indexOf(n);-1!==i&&r.splice(i,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},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}(V.L),di=n(5080);function bi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(di.$R.apply(void 0,[e].concat(t)))}}function vi(t){return function(e){return e.lift(new di.mx(t))}}},359:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaBLEError=void 0;const r=n(3653);class i extends r.CodeError{static invalidErrorResult(t){return new i("Internal error: ble cordova plugin returned an unexpected error object",i.Code.InternalError)}static invalidErrorCode(t){return new i(`Internal error: ble cordova plugin returned an invalid error code ${t.code} with message ${t.message}`,i.Code.InternalError)}static invalidNativeCallResult(t,e){return new i(`Internal error: native call returned an invalid data type. ${e.message}`,i.Code.InternalError)}static isValidErrorCode(t){return t in i.Code}static iotizeBLEMissing(){return new i("iotizeBLE global variable does not exist. Are you sure app is running inside a Cordova application ?",i.Code.InternalError)}}e.CordovaBLEError=i,function(t){let e;!function(t){t.InternalError="CordovaBLEErrorInternalError",t.IllegalArgument="CordovaBLEErrorIllegalArgument",t.BLENotAvailable="CordovaBLEErrorBLENotAvailable",t.InvalidMacAddress="InvalidMacAddressInvalidMacAddress",t.ConnectionError="CordovaBLEErrorConnectionError",t.RequestError="CordovaBLEErrorRequestError",t.LocationServiceDisabled="CordovaBLEErrorLocationServiceDisabled",t.DisconnectError="CordovaBLEErrorDisconnectError",t.IllegalAction="CordovaBLEErrorIllegalAction",t.NotConnectedError="CordovaBLEErrorNotConnectedError",t.StatusCodeError="CordovaBLEErrorStatusCodeError"}(e=t.Code||(t.Code={}))}(i=e.CordovaBLEError||(e.CordovaBLEError={}))},1890:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function u(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}c((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.IoTizeBleCordovaPlugin=void 0;const i=n(9012),o=n(8588),s=n(1691),u=n(4143),c=n(1717),a=n(1717),h=n(359);function l(t){try{return(0,i.hexStringToBuffer)(t)}catch(e){throw h.CordovaBLEError.invalidNativeCallResult(t,e)}}function f(t){return"object"==typeof t&&t.code&&t.message?h.CordovaBLEError.isValidErrorCode(t.code)?new h.CordovaBLEError(t.message,h.CordovaBLEError.Code[t.code]):h.CordovaBLEError.invalidErrorCode(t):h.CordovaBLEError.invalidErrorResult(t)}e.IoTizeBleCordovaPlugin=class{checkAvailable(){return this.execSingleResult("checkAvailable",[])}requestEnableBle(){return this.execSingleResult("enable",[])}startScan(t){return this.execMultipleResult("startScan",[JSON.stringify(t)])}stopScan(){return this.execSingleResult("stopScan",[])}connect(t,e=!0){return this.askBleEnable(e).pipe((0,c.switchMap)((()=>this.execMultipleResult("connect",[t]).pipe((0,a.map)((t=>(t in s.ConnectionState||console.warn(`Plugin native code returned an invalid connection state: "${t}".`),(0,o.safeEnumValue)(s.ConnectionState,t))))))))}askBleEnable(t){return(0,u.defer)((()=>r(this,void 0,void 0,(function*(){t&&((yield this.checkAvailable())||(yield this.requestEnableBle()))}))))}requestMTU(t,e){return this.execSingleResult("requestMTU",[t,e])}connectAndDiscoverTapServices(t,e=!0){return this.askBleEnable(e).pipe((0,c.switchMap)((()=>this.execMultipleResult("connectAndDiscoverTapServices",[t]).pipe((0,a.map)((t=>(t in s.ConnectionState||console.warn(`Plugin native code returned an invalid connection state: "${t}".`),(0,o.safeEnumValue)(s.ConnectionState,t))))))))}disConnect(t){return this.execSingleResult("disConnect",[t])}close(t){return this.execSingleResult("close",[t])}isConnected(t){return this.execSingleResult("isConnected",[t])}send(t,e){return r(this,void 0,void 0,(function*(){return l(yield this.execSingleResult("sendRequest",[t,(0,i.bufferToHexString)(e)]))}))}getLastError(){return this.execSingleResult("getLastError",[])}characteristicStartNotification(t,e,n){return this.execSingleResult("characteristicStartNotification",[t,e,n])}characteristicChanged(t,e,n){return this.execMultipleResult("characteristicChanged",[t,e,n]).pipe((0,a.map)((t=>l(t))))}characteristicStopNotification(t,e,n){return this.execSingleResult("characteristicStopNotification",[t,e,n])}characteristicReadValue(t,e,n){return r(this,void 0,void 0,(function*(){return l(yield this.execSingleResult("characteristicRead",[t,e,n]))}))}characteristicWrite(t,e,n,r){return this.execSingleResult("characteristicWrite",[t,e,n,(0,i.bufferToHexString)(r)])}characteristicWriteWithoutResponse(t,e,n,r){return this.execSingleResult("characteristicWriteWithoutResponse",[t,e,n,(0,i.bufferToHexString)(r)])}discoverServices(t){return r(this,void 0,void 0,(function*(){return yield this.execSingleResult("discoverServices",[t])}))}execSingleResult(t,e){return new Promise(((n,r)=>{cordova.exec(n,(t=>{r(f(t))}),"BLECom",t,e)}))}execMultipleResult(t,e){const n=new u.Subject;return cordova.exec((t=>{n.next(t)}),(t=>{n.error(f(t))}),"BLECom",t,e),n.asObservable()}}},1326:(t,e,n)=>{const r=new(n(1890).IoTizeBleCordovaPlugin);t.exports=r},655:(t,e,n)=>{n.d(e,{ZT:()=>i});var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r=n(1326);module.exports=r})();
2
+ (()=>{"use strict";var t={9012:(t,e,n)=>{function r(t){const e=new Uint8Array(t.length);for(let n=0,r=t.length;n<r;n++)e[n]=t.charCodeAt(n);return e}function i(t){return t.buffer.slice(t.byteOffset,t.byteLength+t.byteOffset)}function o(t){return t?Array.prototype.map.call(t,(t=>("00"+t.toString(16)).slice(-2))).join("").toUpperCase():""}function s(t){return Array.prototype.map.call(t,(t=>{let e="";for(let n=7;n>=0;n--)e+=(1<<n&t)>0?"1":"0";return e})).join("")}function u(t){let e,n=(t=t.trim()).startsWith("0x")?2:0;const r=[];for(;n<t.length;n++)switch(t[n]){case" ":case"\t":continue;default:if(void 0!==e){const i=parseInt(e+t[n],16);if(isNaN(i))throw new Error(`Invalid hexadecimal string format for input string "${t}"`);r.push(i),e=void 0}else e=t[n]}return void 0!==e&&r.push(parseInt(e,16)),Uint8Array.from(r)}function c(t){return String.fromCharCode.apply(null,t)}n.r(e),n.d(e,{asciiStringToByteBuffer:()=>r,bufferToAsciiString:()=>c,bufferToBinaryString:()=>s,bufferToHexString:()=>o,hexStringToBuffer:()=>u,typedArrayToBuffer:()=>i})},3653:(t,e,n)=>{n.r(e),n.d(e,{BaseError:()=>r,CodeError:()=>i,isCodeError:()=>o});class r extends Error{constructor(t){super(t),this.message=t,Object.defineProperty(this,"name",{get:()=>this.constructor.name,set:()=>{}}),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class i extends r{constructor(t,e){super(t),this.code=e}}function o(t,e){return e.code===t}},8588:(t,e,n)=>{function r(t,e){if(t===e)return!0;if("object"==typeof t&&null!=t&&"object"==typeof e&&null!=e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t){if(!e.hasOwnProperty(n))return!1;if(!r(t[n],e[n]))return!1}return!0}return!1}function i(t){return new Promise(((e,n)=>{setTimeout((()=>{e()}),t)}))}function o(t,e){if(!(e in t))throw new Error(`Enum key "${e}" does not exist`);return t[e]}function s(t){let e=Object.keys(t);return e=e.filter((e=>"number"==typeof t[e]||isNaN(parseInt(e,10))&&isNaN(parseInt(t[e],10)))),0===e.length&&(e=Object.keys(t)),e}function u(t){return s(t).map((e=>t[e]))}function c(t){throw new Error(`Internal error: ${t}`)}n.r(e),n.d(e,{assertError:()=>c,deepCopy:()=>a,deepEqual:()=>r,listEnumKeys:()=>s,listEnumValues:()=>u,safeEnumValue:()=>o,sleep:()=>i});const a=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>a(t)))}if(t instanceof Uint8Array)return new Uint8Array(t);if("object"==typeof t&&t!=={}){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{e[t]=a(e[t])})),e}return t}},1691:(t,e,n)=>{var r;n.r(e),n.d(e,{ComProtocol:()=>o,ConnectionState:()=>r}),function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.DISCONNECTING=3]="DISCONNECTING"}(r||(r={}));var i,o,s=(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},i(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});!function(t){var e,n=function(t){function n(e,n){var r=t.call(this,n)||this;return r.code=e,r}return s(n,t),n.operationCanceled=function(){return new n(e.OperationCancelled,"Communication protocol operation cancelled")},n.notConnected=function(t){return new n(e.ProtocolNotConnected,"Communication protocol is not connected")},n.timeoutError=function(t){return new n(e.TimeoutError,t.msg||"Communication protocol timeout")},n.unknownError=function(){return new n(e.UnknownError,"Unnown communication protocol error")},n}(Error);t.Errors=n,function(t){t.ProtocolNotConnected="ProtocolNotConnected",t.TimeoutError="TimeoutError",t.UnknownError="UnknownError",t.OperationCancelled="OperationCancelled"}(e=t.ErrorCode||(t.ErrorCode={}))}(o||(o={}))},4143:(t,e,n)=>{n.r(e),n.d(e,{ArgumentOutOfRangeError:()=>O.W,AsyncSubject:()=>h.c,BehaviorSubject:()=>c.X,ConnectableObservable:()=>i.c,EMPTY:()=>H.E,EmptyError:()=>j.K,GroupedObservable:()=>o.T,NEVER:()=>lt,Notification:()=>E.P,NotificationKind:()=>E.W,ObjectUnsubscribedError:()=>k.N,Observable:()=>r.y,ReplaySubject:()=>a.t,Scheduler:()=>g.b,Subject:()=>u.xQ,Subscriber:()=>T.L,Subscription:()=>S.w,TimeoutError:()=>L.W,UnsubscriptionError:()=>Z.B,VirtualAction:()=>_,VirtualTimeScheduler:()=>x,animationFrame:()=>m,animationFrameScheduler:()=>w,asap:()=>l.e,asapScheduler:()=>l.E,async:()=>f.P,asyncScheduler:()=>f.z,bindCallback:()=>R,bindNodeCallback:()=>Y,combineLatest:()=>K.aj,concat:()=>q.z,config:()=>Vt.v,defer:()=>Q.P,empty:()=>H.c,forkJoin:()=>J,from:()=>G.D,fromEvent:()=>et,fromEventPattern:()=>rt,generate:()=>it,identity:()=>I.y,iif:()=>st,interval:()=>ct,isObservable:()=>V,merge:()=>ht.T,never:()=>ft,noop:()=>N.Z,observable:()=>s.L,of:()=>pt.of,onErrorResumeNext:()=>dt,pairs:()=>bt,partition:()=>xt,pipe:()=>C.z,queue:()=>p.c,queueScheduler:()=>p.N,race:()=>_t.S3,range:()=>gt,scheduled:()=>It.x,throwError:()=>Tt._,timer:()=>Et.H,using:()=>Ct,zip:()=>Nt.$R});var r=n(2772),i=n(3140),o=n(1120),s=n(5050),u=n(211),c=n(9233),a=n(2630),h=n(364),l=n(6650),f=n(964),p=n(2546),d=n(655),b=n(6114),v=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return d.ZT(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e.scheduled||(e.scheduled=requestAnimationFrame((function(){return e.flush(null)}))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);0===e.actions.length&&(cancelAnimationFrame(n),e.scheduled=void 0)},e}(b.o),y=n(8399),w=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return d.ZT(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,n=this.actions,r=-1,i=n.length;t=t||n.shift();do{if(e=t.execute(t.state,t.delay))break}while(++r<i&&(t=n.shift()));if(this.active=!1,e){for(;++r<i&&(t=n.shift());)t.unsubscribe();throw e}},e}(y.v))(v),m=w,x=function(t){function e(e,n){void 0===e&&(e=_),void 0===n&&(n=Number.POSITIVE_INFINITY);var r=t.call(this,e,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}return d.ZT(e,t),e.prototype.flush=function(){for(var t,e,n=this.actions,r=this.maxFrames;(e=n[0])&&e.delay<=r&&(n.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=n.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10,e}(y.v),_=function(t){function e(e,n,r){void 0===r&&(r=e.index+=1);var i=t.call(this,e,n)||this;return i.scheduler=e,i.work=n,i.index=r,i.active=!0,i.index=e.index=r,i}return d.ZT(e,t),e.prototype.schedule=function(n,r){if(void 0===r&&(r=0),!this.id)return t.prototype.schedule.call(this,n,r);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(n,r)},e.prototype.requestAsyncId=function(t,n,r){void 0===r&&(r=0),this.delay=t.frame+r;var i=t.actions;return i.push(this),i.sort(e.sortActions),!0},e.prototype.recycleAsyncId=function(t,e,n){void 0===n&&(n=0)},e.prototype._execute=function(e,n){if(!0===this.active)return t.prototype._execute.call(this,e,n)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(b.o),g=n(8725),S=n(8760),T=n(979),E=n(2632),C=n(2561),N=n(3306),I=n(3608);function V(t){return!!t&&(t instanceof r.y||"function"==typeof t.lift&&"function"==typeof t.subscribe)}var O=n(6565),j=n(6929),k=n(1016),Z=n(8782),L=n(1462),P=n(5709),A=n(3642),D=n(9026),B=n(7507);function R(t,e,n){if(e){if(!(0,B.K)(e))return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return R(t,n).apply(void 0,r).pipe((0,P.U)((function(t){return(0,D.k)(t)?e.apply(void 0,t):e(t)})))};n=e}return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o,s=this,u={context:s,subject:o,callbackFunc:t,scheduler:n};return new r.y((function(r){if(n){var i={args:e,subscriber:r,params:u};return n.schedule(z,0,i)}if(!o){o=new h.c;try{t.apply(s,e.concat([function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o.next(t.length<=1?t[0]:t),o.complete()}]))}catch(t){(0,A._)(o)?o.error(t):console.warn(t)}}return o.subscribe(r)}))}}function z(t){var e=this,n=t.args,r=t.subscriber,i=t.params,o=i.callbackFunc,s=i.context,u=i.scheduler,c=i.subject;if(!c){c=i.subject=new h.c;try{o.apply(s,n.concat([function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.length<=1?t[0]:t;e.add(u.schedule(W,0,{value:r,subject:c}))}]))}catch(t){c.error(t)}}this.add(c.subscribe(r))}function W(t){var e=t.value,n=t.subject;n.next(e),n.complete()}function Y(t,e,n){if(e){if(!(0,B.K)(e))return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return Y(t,n).apply(void 0,r).pipe((0,P.U)((function(t){return(0,D.k)(t)?e.apply(void 0,t):e(t)})))};n=e}return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o={subject:void 0,args:e,callbackFunc:t,scheduler:n,context:this};return new r.y((function(r){var i=o.context,s=o.subject;if(n)return n.schedule(F,0,{params:o,subscriber:r,context:i});if(!s){s=o.subject=new h.c;try{t.apply(i,e.concat([function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.shift();n?s.error(n):(s.next(t.length<=1?t[0]:t),s.complete())}]))}catch(t){(0,A._)(s)?s.error(t):console.warn(t)}}return s.subscribe(r)}))}}function F(t){var e=this,n=t.params,r=t.subscriber,i=t.context,o=n.callbackFunc,s=n.args,u=n.scheduler,c=n.subject;if(!c){c=n.subject=new h.c;try{o.apply(i,s.concat([function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.shift();if(r)e.add(u.schedule(U,0,{err:r,subject:c}));else{var i=t.length<=1?t[0]:t;e.add(u.schedule(M,0,{value:i,subject:c}))}}]))}catch(t){this.add(u.schedule(U,0,{err:t,subject:c}))}}this.add(c.subscribe(r))}function M(t){var e=t.value,n=t.subject;n.next(e),n.complete()}function U(t){var e=t.err;t.subject.error(e)}var K=n(5142),q=n(9795),Q=n(1410),H=n(5631),$=n(2009),G=n(5760);function J(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){var n=t[0];if((0,D.k)(n))return X(n,null);if((0,$.K)(n)&&Object.getPrototypeOf(n)===Object.prototype){var r=Object.keys(n);return X(r.map((function(t){return n[t]})),r)}}if("function"==typeof t[t.length-1]){var i=t.pop();return X(t=1===t.length&&(0,D.k)(t[0])?t[0]:t,null).pipe((0,P.U)((function(t){return i.apply(void 0,t)})))}return X(t,null)}function X(t,e){return new r.y((function(n){var r=t.length;if(0!==r)for(var i=new Array(r),o=0,s=0,u=function(u){var c=(0,G.D)(t[u]),a=!1;n.add(c.subscribe({next:function(t){a||(a=!0,s++),i[u]=t},error:function(t){return n.error(t)},complete:function(){++o!==r&&a||(s===r&&n.next(e?e.reduce((function(t,e,n){return t[e]=i[n],t}),{}):i),n.complete())}}))},c=0;c<r;c++)u(c);else n.complete()}))}var tt=n(4156);function et(t,e,n,i){return(0,tt.m)(n)&&(i=n,n=void 0),i?et(t,e,n).pipe((0,P.U)((function(t){return(0,D.k)(t)?i.apply(void 0,t):i(t)}))):new r.y((function(r){nt(t,e,(function(t){arguments.length>1?r.next(Array.prototype.slice.call(arguments)):r.next(t)}),r,n)}))}function nt(t,e,n,r,i){var o;if(function(t){return t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener}(t)){var s=t;t.addEventListener(e,n,i),o=function(){return s.removeEventListener(e,n,i)}}else if(function(t){return t&&"function"==typeof t.on&&"function"==typeof t.off}(t)){var u=t;t.on(e,n),o=function(){return u.off(e,n)}}else if(function(t){return t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener}(t)){var c=t;t.addListener(e,n),o=function(){return c.removeListener(e,n)}}else{if(!t||!t.length)throw new TypeError("Invalid event target");for(var a=0,h=t.length;a<h;a++)nt(t[a],e,n,r,i)}r.add(o)}function rt(t,e,n){return n?rt(t,e).pipe((0,P.U)((function(t){return(0,D.k)(t)?n.apply(void 0,t):n(t)}))):new r.y((function(n){var r,i=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.next(1===t.length?t[0]:t)};try{r=t(i)}catch(t){return void n.error(t)}if((0,tt.m)(e))return function(){return e(i,r)}}))}function it(t,e,n,i,o){var s,u;if(1==arguments.length){var c=t;u=c.initialState,e=c.condition,n=c.iterate,s=c.resultSelector||I.y,o=c.scheduler}else void 0===i||(0,B.K)(i)?(u=t,s=I.y,o=i):(u=t,s=i);return new r.y((function(t){var r=u;if(o)return o.schedule(ot,0,{subscriber:t,iterate:n,condition:e,resultSelector:s,state:r});for(;;){if(e){var i=void 0;try{i=e(r)}catch(e){return void t.error(e)}if(!i){t.complete();break}}var c=void 0;try{c=s(r)}catch(e){return void t.error(e)}if(t.next(c),t.closed)break;try{r=n(r)}catch(e){return void t.error(e)}}}))}function ot(t){var e=t.subscriber,n=t.condition;if(!e.closed){if(t.needIterate)try{t.state=t.iterate(t.state)}catch(t){return void e.error(t)}else t.needIterate=!0;if(n){var r=void 0;try{r=n(t.state)}catch(t){return void e.error(t)}if(!r)return void e.complete();if(e.closed)return}var i;try{i=t.resultSelector(t.state)}catch(t){return void e.error(t)}if(!e.closed&&(e.next(i),!e.closed))return this.schedule(t)}}function st(t,e,n){return void 0===e&&(e=H.E),void 0===n&&(n=H.E),(0,Q.P)((function(){return t()?e:n}))}var ut=n(5812);function ct(t,e){return void 0===t&&(t=0),void 0===e&&(e=f.P),(!(0,ut.k)(t)||t<0)&&(t=0),e&&"function"==typeof e.schedule||(e=f.P),new r.y((function(n){return n.add(e.schedule(at,t,{subscriber:n,counter:0,period:t})),n}))}function at(t){var e=t.subscriber,n=t.counter,r=t.period;e.next(n),this.schedule({subscriber:e,counter:n+1,period:r},r)}var ht=n(4370),lt=new r.y(N.Z);function ft(){return lt}var pt=n(8170);function dt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return H.E;var n=t[0],i=t.slice(1);return 1===t.length&&(0,D.k)(n)?dt.apply(void 0,n):new r.y((function(t){var e=function(){return t.add(dt.apply(void 0,i).subscribe(t))};return(0,G.D)(n).subscribe({next:function(e){t.next(e)},error:e,complete:e})}))}function bt(t,e){return e?new r.y((function(n){var r=Object.keys(t),i=new S.w;return i.add(e.schedule(vt,0,{keys:r,index:0,subscriber:n,subscription:i,obj:t})),i})):new r.y((function(e){for(var n=Object.keys(t),r=0;r<n.length&&!e.closed;r++){var i=n[r];t.hasOwnProperty(i)&&e.next([i,t[i]])}e.complete()}))}function vt(t){var e=t.keys,n=t.index,r=t.subscriber,i=t.subscription,o=t.obj;if(!r.closed)if(n<e.length){var s=e[n];r.next([s,o[s]]),i.add(this.schedule({keys:e,index:n+1,subscriber:r,subscription:i,obj:o}))}else r.complete()}var yt=n(8463),wt=n(7843),mt=n(6008);function xt(t,e,n){return[(0,mt.h)(e,n)(new r.y((0,wt.s)(t))),(0,mt.h)((0,yt.f)(e,n))(new r.y((0,wt.s)(t)))]}var _t=n(8821);function gt(t,e,n){return void 0===t&&(t=0),new r.y((function(r){void 0===e&&(e=t,t=0);var i=0,o=t;if(n)return n.schedule(St,0,{index:i,count:e,start:t,subscriber:r});for(;;){if(i++>=e){r.complete();break}if(r.next(o++),r.closed)break}}))}function St(t){var e=t.start,n=t.index,r=t.count,i=t.subscriber;n>=r?i.complete():(i.next(e),i.closed||(t.index=n+1,t.start=e+1,this.schedule(t)))}var Tt=n(4944),Et=n(9604);function Ct(t,e){return new r.y((function(n){var r,i;try{r=t()}catch(t){return void n.error(t)}try{i=e(r)}catch(t){return void n.error(t)}var o=(i?(0,G.D)(i):H.E).subscribe(n);return function(){o.unsubscribe(),r&&r.unsubscribe()}}))}var Nt=n(5080),It=n(8107),Vt=n(150)},364:(t,e,n)=>{n.d(e,{c:()=>s});var r=n(655),i=n(211),o=n(8760),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.value=null,e.hasNext=!1,e.hasCompleted=!1,e}return r.ZT(e,t),e.prototype._subscribe=function(e){return this.hasError?(e.error(this.thrownError),o.w.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),o.w.EMPTY):t.prototype._subscribe.call(this,e)},e.prototype.next=function(t){this.hasCompleted||(this.value=t,this.hasNext=!0)},e.prototype.error=function(e){this.hasCompleted||t.prototype.error.call(this,e)},e.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&t.prototype.next.call(this,this.value),t.prototype.complete.call(this)},e}(i.xQ)},9233:(t,e,n)=>{n.d(e,{X:()=>s});var r=n(655),i=n(211),o=n(1016),s=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return r.ZT(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return n&&!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.N;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(i.xQ)},2632:(t,e,n)=>{n.d(e,{W:()=>r,P:()=>u});var r,i=n(5631),o=n(8170),s=n(4944);r||(r={});var u=function(){function t(t,e,n){this.kind=t,this.value=e,this.error=n,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,n){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return n&&n()}},t.prototype.accept=function(t,e,n){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,n)},t.prototype.toObservable=function(){switch(this.kind){case"N":return(0,o.of)(this.value);case"E":return(0,s._)(this.error);case"C":return(0,i.c)()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}()},2772:(t,e,n)=>{n.d(e,{y:()=>h});var r=n(3642),i=n(979),o=n(3142),s=n(2174),u=n(5050),c=n(2561),a=n(150),h=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r=this.operator,u=function(t,e,n){if(t){if(t instanceof i.L)return t;if(t[o.b])return t[o.b]()}return t||e||n?new i.L(t,e,n):new i.L(s.c)}(t,e,n);if(r?u.add(r.call(u,this.source)):u.add(this.source||a.v.useDeprecatedSynchronousErrorHandling&&!u.syncErrorThrowable?this._subscribe(u):this._trySubscribe(u)),a.v.useDeprecatedSynchronousErrorHandling&&u.syncErrorThrowable&&(u.syncErrorThrowable=!1,u.syncErrorThrown))throw u.syncErrorValue;return u},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.v.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),(0,r._)(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=l(e))((function(e,r){var i;i=n.subscribe((function(e){try{t(e)}catch(t){r(t),i&&i.unsubscribe()}}),r,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[u.L]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:(0,c.U)(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=l(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function l(t){if(t||(t=a.v.Promise||Promise),!t)throw new Error("no Promise impl found");return t}},2174:(t,e,n)=>{n.d(e,{c:()=>o});var r=n(150),i=n(1644),o={closed:!0,next:function(t){},error:function(t){if(r.v.useDeprecatedSynchronousErrorHandling)throw t;(0,i.z)(t)},complete:function(){}}},2039:(t,e,n)=>{n.d(e,{L:()=>i});var r=n(655),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.ZT(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(n(979).L)},2630:(t,e,n)=>{n.d(e,{t:()=>h});var r=n(655),i=n(211),o=n(2546),s=n(8760),u=n(9276),c=n(1016),a=n(8253),h=function(t){function e(e,n,r){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===n&&(n=Number.POSITIVE_INFINITY);var i=t.call(this)||this;return i.scheduler=r,i._events=[],i._infiniteTimeWindow=!1,i._bufferSize=e<1?1:e,i._windowTime=n<1?1:n,n===Number.POSITIVE_INFINITY?(i._infiniteTimeWindow=!0,i.next=i.nextInfiniteTimeWindow):i.next=i.nextTimeWindow,i}return r.ZT(e,t),e.prototype.nextInfiniteTimeWindow=function(e){if(!this.isStopped){var n=this._events;n.push(e),n.length>this._bufferSize&&n.shift()}t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this.isStopped||(this._events.push(new l(this._getNow(),e)),this._trimBufferThenGetEvents()),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,n=this._infiniteTimeWindow,r=n?this._events:this._trimBufferThenGetEvents(),i=this.scheduler,o=r.length;if(this.closed)throw new c.N;if(this.isStopped||this.hasError?e=s.w.EMPTY:(this.observers.push(t),e=new a.W(this,t)),i&&t.add(t=new u.ht(t,i)),n)for(var h=0;h<o&&!t.closed;h++)t.next(r[h]);else for(h=0;h<o&&!t.closed;h++)t.next(r[h].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||o.c).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,n=this._windowTime,r=this._events,i=r.length,o=0;o<i&&!(t-r[o].time<n);)o++;return i>e&&(o=Math.max(o,i-e)),o>0&&r.splice(0,o),r},e}(i.xQ),l=function(){return function(t,e){this.time=t,this.value=e}}()},8725:(t,e,n)=>{n.d(e,{b:()=>r});var r=function(){function t(e,n){void 0===n&&(n=t.now),this.SchedulerAction=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(n,e)},t.now=function(){return Date.now()},t}()},211:(t,e,n)=>{n.d(e,{Yc:()=>h,xQ:()=>l});var r=n(655),i=n(2772),o=n(979),s=n(8760),u=n(1016),c=n(8253),a=n(3142),h=function(t){function e(e){var n=t.call(this,e)||this;return n.destination=e,n}return r.ZT(e,t),e}(o.L),l=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return r.ZT(e,t),e.prototype[a.b]=function(){return new h(this)},e.prototype.lift=function(t){var e=new f(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new u.N;if(!this.isStopped)for(var e=this.observers,n=e.length,r=e.slice(),i=0;i<n;i++)r[i].next(t)},e.prototype.error=function(t){if(this.closed)throw new u.N;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,r=e.slice(),i=0;i<n;i++)r[i].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new u.N;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),r=0;r<e;r++)n[r].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 u.N;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new u.N;return this.hasError?(t.error(this.thrownError),s.w.EMPTY):this.isStopped?(t.complete(),s.w.EMPTY):(this.observers.push(t),new c.W(this,t))},e.prototype.asObservable=function(){var t=new i.y;return t.source=this,t},e.create=function(t,e){return new f(t,e)},e}(i.y),f=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return r.ZT(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){return this.source?this.source.subscribe(t):s.w.EMPTY},e}(l)},8253:(t,e,n)=>{n.d(e,{W:()=>i});var r=n(655),i=function(t){function e(e,n){var r=t.call(this)||this;return r.subject=e,r.subscriber=n,r.closed=!1,r}return r.ZT(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 n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}},e}(n(8760).w)},979:(t,e,n)=>{n.d(e,{L:()=>h});var r=n(655),i=n(4156),o=n(2174),s=n(8760),u=n(3142),c=n(150),a=n(1644),h=function(t){function e(n,r,i){var s=t.call(this)||this;switch(s.syncErrorValue=null,s.syncErrorThrown=!1,s.syncErrorThrowable=!1,s.isStopped=!1,arguments.length){case 0:s.destination=o.c;break;case 1:if(!n){s.destination=o.c;break}if("object"==typeof n){n instanceof e?(s.syncErrorThrowable=n.syncErrorThrowable,s.destination=n,n.add(s)):(s.syncErrorThrowable=!0,s.destination=new l(s,n));break}default:s.syncErrorThrowable=!0,s.destination=new l(s,n,r,i)}return s}return r.ZT(e,t),e.prototype[u.b]=function(){return this},e.create=function(t,n,r){var i=new e(t,n,r);return i.syncErrorThrowable=!1,i},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.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(s.w),l=function(t){function e(e,n,r,s){var u,c=t.call(this)||this;c._parentSubscriber=e;var a=c;return(0,i.m)(n)?u=n:n&&(u=n.next,r=n.error,s=n.complete,n!==o.c&&(a=Object.create(n),(0,i.m)(a.unsubscribe)&&c.add(a.unsubscribe.bind(a)),a.unsubscribe=c.unsubscribe.bind(c))),c._context=a,c._next=u,c._error=r,c._complete=s,c}return r.ZT(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;c.v.useDeprecatedSynchronousErrorHandling&&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._parentSubscriber,n=c.v.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):(0,a.z)(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;(0,a.z)(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};c.v.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),c.v.useDeprecatedSynchronousErrorHandling)throw t;(0,a.z)(t)}},e.prototype.__tryOrSetError=function(t,e,n){if(!c.v.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return c.v.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):((0,a.z)(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(h)},8760:(t,e,n)=>{n.d(e,{w:()=>u});var r=n(9026),i=n(2009),o=n(4156),s=n(8782),u=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this,u=n._parentOrParents,a=n._ctorUnsubscribe,h=n._unsubscribe,l=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,u instanceof t)u.remove(this);else if(null!==u)for(var f=0;f<u.length;++f)u[f].remove(this);if((0,o.m)(h)){a&&(this._unsubscribe=void 0);try{h.call(this)}catch(t){e=t instanceof s.B?c(t.errors):[t]}}if((0,r.k)(l)){f=-1;for(var p=l.length;++f<p;){var d=l[f];if((0,i.K)(d))try{d.unsubscribe()}catch(t){e=e||[],t instanceof s.B?e=e.concat(c(t.errors)):e.push(t)}}}if(e)throw new s.B(e)}},t.prototype.add=function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var r=n;(n=new t)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var i=n._parentOrParents;if(null===i)n._parentOrParents=this;else if(i instanceof t){if(i===this)return n;n._parentOrParents=[i,this]}else{if(-1!==i.indexOf(this))return n;i.push(this)}var o=this._subscriptions;return null===o?this._subscriptions=[n]:o.push(n),n},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function c(t){return t.reduce((function(t,e){return t.concat(e instanceof s.B?e.errors:e)}),[])}},150:(t,e,n)=>{n.d(e,{v:()=>i});var r=!1,i={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack,r=t},get useDeprecatedSynchronousErrorHandling(){return r}}},7604:(t,e,n)=>{n.d(e,{IY:()=>u,Ds:()=>c,ft:()=>a});var r=n(655),i=n(979),o=n(2772),s=n(7843),u=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,n}return r.ZT(e,t),e.prototype._next=function(t){this.parent.notifyNext(t)},e.prototype._error=function(t){this.parent.notifyError(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},e}(i.L),c=(i.L,function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.ZT(e,t),e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.destination.complete()},e}(i.L));function a(t,e){if(!e.closed){if(t instanceof o.y)return t.subscribe(e);var n;try{n=(0,s.s)(t)(e)}catch(t){e.error(t)}return n}}i.L},3140:(t,e,n)=>{n.d(e,{c:()=>a,N:()=>h});var r=n(655),i=n(211),o=n(2772),s=n(979),u=n(8760),c=n(3018),a=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._refCount=0,r._isComplete=!1,r}return r.ZT(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var t=this._connection;return t||(this._isComplete=!1,(t=this._connection=new u.w).add(this.source.subscribe(new l(this.getSubject(),this))),t.closed&&(this._connection=null,t=u.w.EMPTY)),t},e.prototype.refCount=function(){return(0,c.x)()(this)},e}(o.y),h=function(){var t=a.prototype;return{operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:t._subscribe},_isComplete:{value:t._isComplete,writable:!0},getSubject:{value:t.getSubject},connect:{value:t.connect},refCount:{value:t.refCount}}}(),l=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return r.ZT(e,t),e.prototype._error=function(e){this._unsubscribe(),t.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}},e}(i.Yc);s.L},5142:(t,e,n)=>{n.d(e,{aj:()=>h,Ms:()=>l});var r=n(655),i=n(7507),o=n(9026),s=n(2039),u=n(2080),c=n(3375),a={};function h(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=void 0,r=void 0;return(0,i.K)(t[t.length-1])&&(r=t.pop()),"function"==typeof t[t.length-1]&&(n=t.pop()),1===t.length&&(0,o.k)(t[0])&&(t=t[0]),(0,c.n)(t,r).lift(new l(n))}var l=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new f(t,this.resultSelector))},t}(),f=function(t){function e(e,n){var r=t.call(this,e)||this;return r.resultSelector=n,r.active=0,r.values=[],r.observables=[],r}return r.ZT(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 n=0;n<e;n++){var r=t[n];this.add((0,u.D)(this,r,void 0,n))}}},e.prototype.notifyComplete=function(t){0==(this.active-=1)&&this.destination.complete()},e.prototype.notifyNext=function(t,e,n){var r=this.values,i=r[n],o=this.toRespond?i===a?--this.toRespond:this.toRespond:0;r[n]=e,0===o&&(this.resultSelector?this._tryResultSelector(r):this.destination.next(r.slice()))},e.prototype._tryResultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.L)},9795:(t,e,n)=>{n.d(e,{z:()=>o});var r=n(8170),i=n(2257);function o(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(0,i.u)()(r.of.apply(void 0,t))}},1410:(t,e,n)=>{n.d(e,{P:()=>s});var r=n(2772),i=n(5760),o=n(5631);function s(t){return new r.y((function(e){var n;try{n=t()}catch(t){return void e.error(t)}return(n?(0,i.D)(n):(0,o.c)()).subscribe(e)}))}},5631:(t,e,n)=>{n.d(e,{E:()=>i,c:()=>o});var r=n(2772),i=new r.y((function(t){return t.complete()}));function o(t){return t?function(t){return new r.y((function(e){return t.schedule((function(){return e.complete()}))}))}(t):i}},5760:(t,e,n)=>{n.d(e,{D:()=>s});var r=n(2772),i=n(7843),o=n(8107);function s(t,e){return e?(0,o.x)(t,e):t instanceof r.y?t:new r.y((0,i.s)(t))}},3375:(t,e,n)=>{n.d(e,{n:()=>s});var r=n(2772),i=n(6900),o=n(3109);function s(t,e){return e?(0,o.r)(t,e):new r.y((0,i.V)(t))}},4370:(t,e,n)=>{n.d(e,{T:()=>u});var r=n(2772),i=n(7507),o=n(2556),s=n(3375);function u(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Number.POSITIVE_INFINITY,u=null,c=t[t.length-1];return(0,i.K)(c)?(u=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(n=t.pop())):"number"==typeof c&&(n=t.pop()),null===u&&1===t.length&&t[0]instanceof r.y?t[0]:(0,o.J)(n)((0,s.n)(t,u))}},8170:(t,e,n)=>{n.d(e,{of:()=>s});var r=n(7507),i=n(3375),o=n(3109);function s(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return(0,r.K)(n)?(t.pop(),(0,o.r)(t,n)):(0,i.n)(t)}},8821:(t,e,n)=>{n.d(e,{S3:()=>c});var r=n(655),i=n(9026),o=n(3375),s=n(2039),u=n(2080);function c(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){if(!(0,i.k)(t[0]))return t[0];t=t[0]}return(0,o.n)(t,void 0).lift(new a)}var a=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new h(t))},t}(),h=function(t){function e(e){var n=t.call(this,e)||this;return n.hasFirst=!1,n.observables=[],n.subscriptions=[],n}return r.ZT(e,t),e.prototype._next=function(t){this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{for(var n=0;n<e&&!this.hasFirst;n++){var r=t[n],i=(0,u.D)(this,r,void 0,n);this.subscriptions&&this.subscriptions.push(i),this.add(i)}this.observables=null}},e.prototype.notifyNext=function(t,e,n){if(!this.hasFirst){this.hasFirst=!0;for(var r=0;r<this.subscriptions.length;r++)if(r!==n){var i=this.subscriptions[r];i.unsubscribe(),this.remove(i)}this.subscriptions=null}this.destination.next(e)},e}(s.L)},4944:(t,e,n)=>{n.d(e,{_:()=>i});var r=n(2772);function i(t,e){return e?new r.y((function(n){return e.schedule(o,0,{error:t,subscriber:n})})):new r.y((function(e){return e.error(t)}))}function o(t){var e=t.error;t.subscriber.error(e)}},9604:(t,e,n)=>{n.d(e,{H:()=>u});var r=n(2772),i=n(964),o=n(5812),s=n(7507);function u(t,e,n){void 0===t&&(t=0);var u=-1;return(0,o.k)(e)?u=Number(e)<1?1:Number(e):(0,s.K)(e)&&(n=e),(0,s.K)(n)||(n=i.P),new r.y((function(e){var r=(0,o.k)(t)?t:+t-n.now();return n.schedule(c,r,{index:0,period:u,subscriber:e})}))}function c(t){var e=t.index,n=t.period,r=t.subscriber;if(r.next(e),!r.closed){if(-1===n)return r.complete();t.index=e+1,this.schedule(t,n)}}},5080:(t,e,n)=>{n.d(e,{$R:()=>a,mx:()=>h});var r=n(655),i=n(3375),o=n(9026),s=n(979),u=n(999),c=n(7604);function a(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return"function"==typeof n&&t.pop(),(0,i.n)(t,void 0).lift(new h(n))}var h=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new l(t,this.resultSelector))},t}(),l=function(t){function e(e,n,r){void 0===r&&(r=Object.create(null));var i=t.call(this,e)||this;return i.resultSelector=n,i.iterators=[],i.active=0,i.resultSelector="function"==typeof n?n:void 0,i}return r.ZT(e,t),e.prototype._next=function(t){var e=this.iterators;(0,o.k)(t)?e.push(new p(t)):"function"==typeof t[u.hZ]?e.push(new f(t[u.hZ]())):e.push(new d(this.destination,this,t))},e.prototype._complete=function(){var t=this.iterators,e=t.length;if(this.unsubscribe(),0!==e){this.active=e;for(var n=0;n<e;n++){var r=t[n];r.stillUnsubscribed?this.destination.add(r.subscribe()):this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var t=this.iterators,e=t.length,n=this.destination,r=0;r<e;r++)if("function"==typeof(s=t[r]).hasValue&&!s.hasValue())return;var i=!1,o=[];for(r=0;r<e;r++){var s,u=(s=t[r]).next();if(s.hasCompleted()&&(i=!0),u.done)return void n.complete();o.push(u.value)}this.resultSelector?this._tryresultSelector(o):n.next(o),i&&n.complete()},e.prototype._tryresultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(s.L),f=function(){function t(t){this.iterator=t,this.nextResult=t.next()}return t.prototype.hasValue=function(){return!0},t.prototype.next=function(){var t=this.nextResult;return this.nextResult=this.iterator.next(),t},t.prototype.hasCompleted=function(){var t=this.nextResult;return Boolean(t&&t.done)},t}(),p=function(){function t(t){this.array=t,this.index=0,this.length=0,this.length=t.length}return t.prototype[u.hZ]=function(){return this},t.prototype.next=function(t){var e=this.index++,n=this.array;return e<this.length?{value:n[e],done:!1}:{value:null,done:!0}},t.prototype.hasValue=function(){return this.array.length>this.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),d=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.parent=n,i.observable=r,i.stillUnsubscribed=!0,i.buffer=[],i.isComplete=!1,i}return r.ZT(e,t),e.prototype[u.hZ]=function(){return this},e.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},e.prototype.hasValue=function(){return this.buffer.length>0},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(t){this.buffer.push(t),this.parent.checkIterators()},e.prototype.subscribe=function(){return(0,c.ft)(this.observable,new c.IY(this))},e}(c.Ds)},2257:(t,e,n)=>{n.d(e,{u:()=>i});var r=n(2556);function i(){return(0,r.J)(1)}},6008:(t,e,n)=>{n.d(e,{h:()=>o});var r=n(655),i=n(979);function o(t,e){return function(n){return n.lift(new s(t,e))}}var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.predicate,this.thisArg))},t}(),u=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.thisArg=r,i.count=0,i}return r.ZT(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.L)},1120:(t,e,n)=>{n.d(e,{v:()=>c,T:()=>f});var r=n(655),i=n(979),o=n(8760),s=n(2772),u=n(211);function c(t,e,n,r){return function(i){return i.lift(new a(t,e,n,r))}}var a=function(){function t(t,e,n,r){this.keySelector=t,this.elementSelector=e,this.durationSelector=n,this.subjectSelector=r}return t.prototype.call=function(t,e){return e.subscribe(new h(t,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},t}(),h=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.keySelector=n,s.elementSelector=r,s.durationSelector=i,s.subjectSelector=o,s.groups=null,s.attemptedToUnsubscribe=!1,s.count=0,s}return r.ZT(e,t),e.prototype._next=function(t){var e;try{e=this.keySelector(t)}catch(t){return void this.error(t)}this._group(t,e)},e.prototype._group=function(t,e){var n=this.groups;n||(n=this.groups=new Map);var r,i=n.get(e);if(this.elementSelector)try{r=this.elementSelector(t)}catch(t){this.error(t)}else r=t;if(!i){i=this.subjectSelector?this.subjectSelector():new u.xQ,n.set(e,i);var o=new f(e,i,this);if(this.destination.next(o),this.durationSelector){var s=void 0;try{s=this.durationSelector(new f(e,i))}catch(t){return void this.error(t)}this.add(s.subscribe(new l(e,i,this)))}}i.closed||i.next(r)},e.prototype._error=function(t){var e=this.groups;e&&(e.forEach((function(e,n){e.error(t)})),e.clear()),this.destination.error(t)},e.prototype._complete=function(){var t=this.groups;t&&(t.forEach((function(t,e){t.complete()})),t.clear()),this.destination.complete()},e.prototype.removeGroup=function(t){this.groups.delete(t)},e.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&t.prototype.unsubscribe.call(this))},e}(i.L),l=function(t){function e(e,n,r){var i=t.call(this,n)||this;return i.key=e,i.group=n,i.parent=r,i}return r.ZT(e,t),e.prototype._next=function(t){this.complete()},e.prototype._unsubscribe=function(){var t=this.parent,e=this.key;this.key=this.parent=null,t&&t.removeGroup(e)},e}(i.L),f=function(t){function e(e,n,r){var i=t.call(this)||this;return i.key=e,i.groupSubject=n,i.refCountSubscription=r,i}return r.ZT(e,t),e.prototype._subscribe=function(t){var e=new o.w,n=this.refCountSubscription,r=this.groupSubject;return n&&!n.closed&&e.add(new p(n)),e.add(r.subscribe(t)),e},e}(s.y),p=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,e.count++,n}return r.ZT(e,t),e.prototype.unsubscribe=function(){var e=this.parent;e.closed||this.closed||(t.prototype.unsubscribe.call(this),e.count-=1,0===e.count&&e.attemptedToUnsubscribe&&e.unsubscribe())},e}(o.w)},5709:(t,e,n)=>{n.d(e,{U:()=>o});var r=n(655),i=n(979);function o(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new s(t,e))}}var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.thisArg))},t}(),u=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.project=n,i.count=0,i.thisArg=r||i,i}return r.ZT(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.L)},2556:(t,e,n)=>{n.d(e,{J:()=>o});var r=n(7746),i=n(3608);function o(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),(0,r.zg)(i.y,t)}},7746:(t,e,n)=>{n.d(e,{zg:()=>u,VS:()=>h});var r=n(655),i=n(5709),o=n(5760),s=n(7604);function u(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?function(r){return r.pipe(u((function(n,r){return(0,o.D)(t(n,r)).pipe((0,i.U)((function(t,i){return e(n,t,r,i)})))}),n))}:("number"==typeof e&&(n=e),function(e){return e.lift(new c(t,n))})}var c=function(){function t(t,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.project=t,this.concurrent=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.concurrent))},t}(),a=function(t){function e(e,n,r){void 0===r&&(r=Number.POSITIVE_INFINITY);var i=t.call(this,e)||this;return i.project=n,i.concurrent=r,i.hasCompleted=!1,i.buffer=[],i.active=0,i.index=0,i}return r.ZT(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,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new s.IY(this),n=this.destination;n.add(e);var r=(0,s.ft)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(s.Ds),h=u},9276:(t,e,n)=>{n.d(e,{QV:()=>s,ht:()=>c});var r=n(655),i=n(979),o=n(2632);function s(t,e){return void 0===e&&(e=0),function(n){return n.lift(new u(t,e))}}var u=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 c(t,this.scheduler,this.delay))},t}(),c=function(t){function e(e,n,r){void 0===r&&(r=0);var i=t.call(this,e)||this;return i.scheduler=n,i.delay=r,i}return r.ZT(e,t),e.dispatch=function(t){var e=t.notification,n=t.destination;e.observe(n),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.destination.add(this.scheduler.schedule(e.dispatch,this.delay,new a(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(o.P.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(o.P.createError(t)),this.unsubscribe()},e.prototype._complete=function(){this.scheduleMessage(o.P.createComplete()),this.unsubscribe()},e}(i.L),a=function(){return function(t,e){this.notification=t,this.destination=e}}()},3018:(t,e,n)=>{n.d(e,{x:()=>o});var r=n(655),i=n(979);function o(){return function(t){return t.lift(new s(t))}}var s=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var n=this.connectable;n._refCount++;var r=new u(t,n),i=e.subscribe(r);return r.closed||(r.connection=n.connect()),i},t}(),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return r.ZT(e,t),e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._refCount;if(e<=0)this.connection=null;else if(t._refCount=e-1,e>1)this.connection=null;else{var n=this.connection,r=t._connection;this.connection=null,!r||n&&r!==n||r.unsubscribe()}}else this.connection=null},e}(i.L)},3109:(t,e,n)=>{n.d(e,{r:()=>o});var r=n(2772),i=n(8760);function o(t,e){return new r.y((function(n){var r=new i.w,o=0;return r.add(e.schedule((function(){o!==t.length?(n.next(t[o++]),n.closed||r.add(this.schedule())):n.complete()}))),r}))}},8107:(t,e,n)=>{n.d(e,{x:()=>h});var r=n(2772),i=n(8760),o=n(5050),s=n(3109),u=n(999),c=n(336),a=n(9217);function h(t,e){if(null!=t){if(function(t){return t&&"function"==typeof t[o.L]}(t))return function(t,e){return new r.y((function(n){var r=new i.w;return r.add(e.schedule((function(){var i=t[o.L]();r.add(i.subscribe({next:function(t){r.add(e.schedule((function(){return n.next(t)})))},error:function(t){r.add(e.schedule((function(){return n.error(t)})))},complete:function(){r.add(e.schedule((function(){return n.complete()})))}}))}))),r}))}(t,e);if((0,c.t)(t))return function(t,e){return new r.y((function(n){var r=new i.w;return r.add(e.schedule((function(){return t.then((function(t){r.add(e.schedule((function(){n.next(t),r.add(e.schedule((function(){return n.complete()})))})))}),(function(t){r.add(e.schedule((function(){return n.error(t)})))}))}))),r}))}(t,e);if((0,a.z)(t))return(0,s.r)(t,e);if(function(t){return t&&"function"==typeof t[u.hZ]}(t)||"string"==typeof t)return function(t,e){if(!t)throw new Error("Iterable cannot be null");return new r.y((function(n){var r,o=new i.w;return o.add((function(){r&&"function"==typeof r.return&&r.return()})),o.add(e.schedule((function(){r=t[u.hZ](),o.add(e.schedule((function(){if(!n.closed){var t,e;try{var i=r.next();t=i.value,e=i.done}catch(t){return void n.error(t)}e?n.complete():(n.next(t),this.schedule())}})))}))),o}))}(t,e)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}},6114:(t,e,n)=>{n.d(e,{o:()=>i});var r=n(655),i=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return r.ZT(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!==n&&this.delay===n&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n=!1,r=void 0;try{this.work(t)}catch(t){n=!0,r=!!t&&t||new Error(t)}if(n)return this.unsubscribe(),r},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,n=e.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,n){return t.call(this)||this}return r.ZT(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(n(8760).w))},8399:(t,e,n)=>{n.d(e,{v:()=>o});var r=n(655),i=n(8725),o=function(t){function e(n,r){void 0===r&&(r=i.b.now);var o=t.call(this,n,(function(){return e.delegate&&e.delegate!==o?e.delegate.now():r()}))||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return r.ZT(e,t),e.prototype.schedule=function(n,r,i){return void 0===r&&(r=0),e.delegate&&e.delegate!==this?e.delegate.schedule(n,r,i):t.prototype.schedule.call(this,n,r,i)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var n;this.active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(i.b)},6650:(t,e,n)=>{n.d(e,{e:()=>h,E:()=>a});var r=n(655),i=1,o=function(){return Promise.resolve()}(),s={};function u(t){return t in s&&(delete s[t],!0)}var c=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.ZT(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e.scheduled||(e.scheduled=(c=e.flush.bind(e,null),a=i++,s[a]=!0,o.then((function(){return u(a)&&c()})),a)));var c,a},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);0===e.actions.length&&(u(n),e.scheduled=void 0)},e}(n(6114).o),a=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.ZT(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,n=this.actions,r=-1,i=n.length;t=t||n.shift();do{if(e=t.execute(t.state,t.delay))break}while(++r<i&&(t=n.shift()));if(this.active=!1,e){for(;++r<i&&(t=n.shift());)t.unsubscribe();throw e}},e}(n(8399).v))(c),h=a},964:(t,e,n)=>{n.d(e,{z:()=>i,P:()=>o});var r=n(6114),i=new(n(8399).v)(r.o),o=i},2546:(t,e,n)=>{n.d(e,{c:()=>s,N:()=>o});var r=n(655),i=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.ZT(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):e.flush(this)},e}(n(6114).o),o=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.ZT(e,t),e}(n(8399).v))(i),s=o},999:(t,e,n)=>{function r(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}n.d(e,{hZ:()=>i});var i=r()},5050:(t,e,n)=>{n.d(e,{L:()=>r});var r=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},3142:(t,e,n)=>{n.d(e,{b:()=>r});var r=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},6565:(t,e,n)=>{n.d(e,{W:()=>r});var r=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}()},6929:(t,e,n)=>{n.d(e,{K:()=>r});var r=function(){function t(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}return t.prototype=Object.create(Error.prototype),t}()},1016:(t,e,n)=>{n.d(e,{N:()=>r});var r=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}()},1462:(t,e,n)=>{n.d(e,{W:()=>r});var r=function(){function t(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}return t.prototype=Object.create(Error.prototype),t}()},8782:(t,e,n)=>{n.d(e,{B:()=>r});var r=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}()},3642:(t,e,n)=>{n.d(e,{_:()=>i});var r=n(979);function i(t){for(;t;){var e=t,n=e.closed,i=e.destination,o=e.isStopped;if(n||o)return!1;t=i&&i instanceof r.L?i:null}return!0}},1644:(t,e,n)=>{function r(t){setTimeout((function(){throw t}),0)}n.d(e,{z:()=>r})},3608:(t,e,n)=>{function r(t){return t}n.d(e,{y:()=>r})},9026:(t,e,n)=>{n.d(e,{k:()=>r});var r=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}()},9217:(t,e,n)=>{n.d(e,{z:()=>r});var r=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t}},4156:(t,e,n)=>{function r(t){return"function"==typeof t}n.d(e,{m:()=>r})},5812:(t,e,n)=>{n.d(e,{k:()=>i});var r=n(9026);function i(t){return!(0,r.k)(t)&&t-parseFloat(t)+1>=0}},2009:(t,e,n)=>{function r(t){return null!==t&&"object"==typeof t}n.d(e,{K:()=>r})},336:(t,e,n)=>{function r(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}n.d(e,{t:()=>r})},7507:(t,e,n)=>{function r(t){return t&&"function"==typeof t.schedule}n.d(e,{K:()=>r})},3306:(t,e,n)=>{function r(){}n.d(e,{Z:()=>r})},8463:(t,e,n)=>{function r(t,e){function n(){return!n.pred.apply(n.thisArg,arguments)}return n.pred=t,n.thisArg=e,n}n.d(e,{f:()=>r})},2561:(t,e,n)=>{n.d(e,{z:()=>i,U:()=>o});var r=n(3608);function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(t)}function o(t){return 0===t.length?r.y:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}},7843:(t,e,n)=>{n.d(e,{s:()=>h});var r=n(6900),i=n(1644),o=n(999),s=n(5050),u=n(9217),c=n(336),a=n(2009),h=function(t){if(t&&"function"==typeof t[s.L])return h=t,function(t){var e=h[s.L]();if("function"!=typeof e.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return e.subscribe(t)};if((0,u.z)(t))return(0,r.V)(t);if((0,c.t)(t))return n=t,function(t){return n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,i.z),t};if(t&&"function"==typeof t[o.hZ])return e=t,function(t){for(var n=e[o.hZ]();;){var r=void 0;try{r=n.next()}catch(e){return t.error(e),t}if(r.done){t.complete();break}if(t.next(r.value),t.closed)break}return"function"==typeof n.return&&t.add((function(){n.return&&n.return()})),t};var e,n,h,l=(0,a.K)(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+l+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},6900:(t,e,n)=>{n.d(e,{V:()=>r});var r=function(t){return function(e){for(var n=0,r=t.length;n<r&&!e.closed;n++)e.next(t[n]);e.complete()}}},2080:(t,e,n)=>{n.d(e,{D:()=>u});var r=n(655),i=function(t){function e(e,n,r){var i=t.call(this)||this;return i.parent=e,i.outerValue=n,i.outerIndex=r,i.index=0,i}return r.ZT(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}(n(979).L),o=n(7843),s=n(2772);function u(t,e,n,r,u){if(void 0===u&&(u=new i(t,n,r)),!u.closed)return e instanceof s.y?e.subscribe(u):(0,o.s)(e)(u)}},1717:(t,e,n)=>{n.r(e),n.d(e,{audit:()=>o,auditTime:()=>h,buffer:()=>l,bufferCount:()=>b,bufferTime:()=>x,bufferToggle:()=>O,bufferWhen:()=>Z,catchError:()=>A,combineAll:()=>z,combineLatest:()=>F,concat:()=>U,concatAll:()=>K.u,concatMap:()=>Q,concatMapTo:()=>H,count:()=>$,debounce:()=>X,debounceTime:()=>nt,defaultIfEmpty:()=>st,delay:()=>lt,delayWhen:()=>vt,dematerialize:()=>_t,distinct:()=>Tt,distinctUntilChanged:()=>Nt,distinctUntilKeyChanged:()=>Ot,elementAt:()=>Yt,endWith:()=>Mt,every:()=>Ut,exhaust:()=>Qt,exhaustMap:()=>Jt,expand:()=>ee,filter:()=>kt.h,finalize:()=>ie,find:()=>ue,findIndex:()=>he,first:()=>fe,flatMap:()=>q.VS,groupBy:()=>pe.v,ignoreElements:()=>de,isEmpty:()=>ye,last:()=>Se,map:()=>Gt.U,mapTo:()=>Te,materialize:()=>Ne,max:()=>Pe,merge:()=>De,mergeAll:()=>Be.J,mergeMap:()=>q.zg,mergeMapTo:()=>Re,mergeScan:()=>ze,min:()=>Fe,multicast:()=>Ue,observeOn:()=>qe.QV,onErrorResumeNext:()=>Qe,pairwise:()=>Ge,partition:()=>en,pluck:()=>nn,publish:()=>sn,publishBehavior:()=>cn,publishLast:()=>hn,publishReplay:()=>fn,race:()=>dn,reduce:()=>Le,refCount:()=>Nn.x,repeat:()=>bn,repeatWhen:()=>wn,retry:()=>_n,retryWhen:()=>Tn,sample:()=>In,sampleTime:()=>jn,scan:()=>Oe,sequenceEqual:()=>Pn,share:()=>zn,shareReplay:()=>Wn,single:()=>Yn,skip:()=>Un,skipLast:()=>Qn,skipUntil:()=>Gn,skipWhile:()=>tr,startWith:()=>rr,subscribeOn:()=>ur,switchAll:()=>fr,switchMap:()=>ar,switchMapTo:()=>pr,take:()=>Rt,takeLast:()=>xe,takeUntil:()=>dr,takeWhile:()=>yr,tap:()=>gr,throttle:()=>Cr,throttleTime:()=>Vr,throwIfEmpty:()=>Lt,timeInterval:()=>Lr,timeout:()=>Wr,timeoutWith:()=>Dr,timestamp:()=>Yr,toArray:()=>Ur,window:()=>Kr,windowCount:()=>Hr,windowTime:()=>Jr,windowToggle:()=>oi,windowWhen:()=>ci,withLatestFrom:()=>li,zip:()=>bi,zipAll:()=>vi});var r=n(655),i=n(7604);function o(t){return function(e){return e.lift(new s(t))}}var s=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.durationSelector))},t}(),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.durationSelector=n,r.hasValue=!1,r}return r.ZT(e,t),e.prototype._next=function(t){if(this.value=t,this.hasValue=!0,!this.throttled){var e=void 0;try{e=(0,this.durationSelector)(t)}catch(t){return this.destination.error(t)}var n=(0,i.ft)(e,new i.IY(this));!n||n.closed?this.clearThrottle():this.add(this.throttled=n)}},e.prototype.clearThrottle=function(){var t=this,e=t.value,n=t.hasValue,r=t.throttled;r&&(this.remove(r),this.throttled=void 0,r.unsubscribe()),n&&(this.value=void 0,this.hasValue=!1,this.destination.next(e))},e.prototype.notifyNext=function(){this.clearThrottle()},e.prototype.notifyComplete=function(){this.clearThrottle()},e}(i.Ds),c=n(964),a=n(9604);function h(t,e){return void 0===e&&(e=c.P),o((function(){return(0,a.H)(t,e)}))}function l(t){return function(e){return e.lift(new f(t))}}var f=function(){function t(t){this.closingNotifier=t}return t.prototype.call=function(t,e){return e.subscribe(new p(t,this.closingNotifier))},t}(),p=function(t){function e(e,n){var r=t.call(this,e)||this;return r.buffer=[],r.add((0,i.ft)(n,new i.IY(r))),r}return r.ZT(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype.notifyNext=function(){var t=this.buffer;this.buffer=[],this.destination.next(t)},e}(i.Ds),d=n(979);function b(t,e){return void 0===e&&(e=null),function(n){return n.lift(new v(t,e))}}var v=function(){function t(t,e){this.bufferSize=t,this.startBufferEvery=e,this.subscriberClass=e&&t!==e?w:y}return t.prototype.call=function(t,e){return e.subscribe(new this.subscriberClass(t,this.bufferSize,this.startBufferEvery))},t}(),y=function(t){function e(e,n){var r=t.call(this,e)||this;return r.bufferSize=n,r.buffer=[],r}return r.ZT(e,t),e.prototype._next=function(t){var e=this.buffer;e.push(t),e.length==this.bufferSize&&(this.destination.next(e),this.buffer=[])},e.prototype._complete=function(){var e=this.buffer;e.length>0&&this.destination.next(e),t.prototype._complete.call(this)},e}(d.L),w=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.bufferSize=n,i.startBufferEvery=r,i.buffers=[],i.count=0,i}return r.ZT(e,t),e.prototype._next=function(t){var e=this,n=e.bufferSize,r=e.startBufferEvery,i=e.buffers,o=e.count;this.count++,o%r==0&&i.push([]);for(var s=i.length;s--;){var u=i[s];u.push(t),u.length===n&&(i.splice(s,1),this.destination.next(u))}},e.prototype._complete=function(){for(var e=this.buffers,n=this.destination;e.length>0;){var r=e.shift();r.length>0&&n.next(r)}t.prototype._complete.call(this)},e}(d.L),m=n(7507);function x(t){var e=arguments.length,n=c.P;(0,m.K)(arguments[arguments.length-1])&&(n=arguments[arguments.length-1],e--);var r=null;e>=2&&(r=arguments[1]);var i=Number.POSITIVE_INFINITY;return e>=3&&(i=arguments[2]),function(e){return e.lift(new _(t,r,i,n))}}var _=function(){function t(t,e,n,r){this.bufferTimeSpan=t,this.bufferCreationInterval=e,this.maxBufferSize=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new S(t,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},t}(),g=function(){return function(){this.buffer=[]}}(),S=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;s.bufferTimeSpan=n,s.bufferCreationInterval=r,s.maxBufferSize=i,s.scheduler=o,s.contexts=[];var u=s.openContext();if(s.timespanOnly=null==r||r<0,s.timespanOnly){var c={subscriber:s,context:u,bufferTimeSpan:n};s.add(u.closeAction=o.schedule(T,n,c))}else{var a={subscriber:s,context:u},h={bufferTimeSpan:n,bufferCreationInterval:r,subscriber:s,scheduler:o};s.add(u.closeAction=o.schedule(C,n,a)),s.add(o.schedule(E,r,h))}return s}return r.ZT(e,t),e.prototype._next=function(t){for(var e,n=this.contexts,r=n.length,i=0;i<r;i++){var o=n[i],s=o.buffer;s.push(t),s.length==this.maxBufferSize&&(e=o)}e&&this.onBufferFull(e)},e.prototype._error=function(e){this.contexts.length=0,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts,n=this.destination;e.length>0;){var r=e.shift();n.next(r.buffer)}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.contexts=null},e.prototype.onBufferFull=function(t){this.closeContext(t);var e=t.closeAction;if(e.unsubscribe(),this.remove(e),!this.closed&&this.timespanOnly){t=this.openContext();var n=this.bufferTimeSpan,r={subscriber:this,context:t,bufferTimeSpan:n};this.add(t.closeAction=this.scheduler.schedule(T,n,r))}},e.prototype.openContext=function(){var t=new g;return this.contexts.push(t),t},e.prototype.closeContext=function(t){this.destination.next(t.buffer);var e=this.contexts;(e?e.indexOf(t):-1)>=0&&e.splice(e.indexOf(t),1)},e}(d.L);function T(t){var e=t.subscriber,n=t.context;n&&e.closeContext(n),e.closed||(t.context=e.openContext(),t.context.closeAction=this.schedule(t,t.bufferTimeSpan))}function E(t){var e=t.bufferCreationInterval,n=t.bufferTimeSpan,r=t.subscriber,i=t.scheduler,o=r.openContext();r.closed||(r.add(o.closeAction=i.schedule(C,n,{subscriber:r,context:o})),this.schedule(t,e))}function C(t){var e=t.subscriber,n=t.context;e.closeContext(n)}var N=n(8760),I=n(2080),V=n(2039);function O(t,e){return function(n){return n.lift(new j(t,e))}}var j=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new k(t,this.openings,this.closingSelector))},t}(),k=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.closingSelector=r,i.contexts=[],i.add((0,I.D)(i,n)),i}return r.ZT(e,t),e.prototype._next=function(t){for(var e=this.contexts,n=e.length,r=0;r<n;r++)e[r].buffer.push(t)},e.prototype._error=function(e){for(var n=this.contexts;n.length>0;){var r=n.shift();r.subscription.unsubscribe(),r.buffer=null,r.subscription=null}this.contexts=null,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts;e.length>0;){var n=e.shift();this.destination.next(n.buffer),n.subscription.unsubscribe(),n.buffer=null,n.subscription=null}this.contexts=null,t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e){t?this.closeBuffer(t):this.openBuffer(e)},e.prototype.notifyComplete=function(t){this.closeBuffer(t.context)},e.prototype.openBuffer=function(t){try{var e=this.closingSelector.call(this,t);e&&this.trySubscribe(e)}catch(t){this._error(t)}},e.prototype.closeBuffer=function(t){var e=this.contexts;if(e&&t){var n=t.buffer,r=t.subscription;this.destination.next(n),e.splice(e.indexOf(t),1),this.remove(r),r.unsubscribe()}},e.prototype.trySubscribe=function(t){var e=this.contexts,n=new N.w,r={buffer:[],subscription:n};e.push(r);var i=(0,I.D)(this,t,r);!i||i.closed?this.closeBuffer(r):(i.context=r,this.add(i),n.add(i))},e}(V.L);function Z(t){return function(e){return e.lift(new L(t))}}var L=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new P(t,this.closingSelector))},t}(),P=function(t){function e(e,n){var r=t.call(this,e)||this;return r.closingSelector=n,r.subscribing=!1,r.openBuffer(),r}return r.ZT(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=void 0,this.subscribing=!1},e.prototype.notifyNext=function(){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e,n=this.buffer;this.buffer&&this.destination.next(n),this.buffer=[];try{e=(0,this.closingSelector)()}catch(t){return this.error(t)}t=new N.w,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add((0,i.ft)(e,new i.IY(this))),this.subscribing=!1},e}(i.Ds);function A(t){return function(e){var n=new D(t),r=e.lift(n);return n.caught=r}}var D=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new B(t,this.selector,this.caught))},t}(),B=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.selector=n,i.caught=r,i}return r.ZT(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=void 0;try{n=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle();var r=new i.IY(this);this.add(r);var o=(0,i.ft)(n,r);o!==r&&this.add(o)}},e}(i.Ds),R=n(5142);function z(t){return function(e){return e.lift(new R.Ms(t))}}var W=n(9026),Y=n(5760);function F(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=null;return"function"==typeof t[t.length-1]&&(n=t.pop()),1===t.length&&(0,W.k)(t[0])&&(t=t[0].slice()),function(e){return e.lift.call((0,Y.D)([e].concat(t)),new R.Ms(n))}}var M=n(9795);function U(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(M.z.apply(void 0,[e].concat(t)))}}var K=n(2257),q=n(7746);function Q(t,e){return(0,q.zg)(t,e,1)}function H(t,e){return Q((function(){return t}),e)}function $(t){return function(e){return e.lift(new G(t,e))}}var G=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new J(t,this.predicate,this.source))},t}(),J=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.source=r,i.count=0,i.index=0,i}return r.ZT(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}(d.L);function X(t){return function(e){return e.lift(new tt(t))}}var tt=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new et(t,this.durationSelector))},t}(),et=function(t){function e(e,n){var r=t.call(this,e)||this;return r.durationSelector=n,r.hasValue=!1,r}return r.ZT(e,t),e.prototype._next=function(t){try{var e=this.durationSelector.call(this,t);e&&this._tryNext(t,e)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.emitValue(),this.destination.complete()},e.prototype._tryNext=function(t,e){var n=this.durationSubscription;this.value=t,this.hasValue=!0,n&&(n.unsubscribe(),this.remove(n)),(n=(0,i.ft)(e,new i.IY(this)))&&!n.closed&&this.add(this.durationSubscription=n)},e.prototype.notifyNext=function(){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){if(this.hasValue){var e=this.value,n=this.durationSubscription;n&&(this.durationSubscription=void 0,n.unsubscribe(),this.remove(n)),this.value=void 0,this.hasValue=!1,t.prototype._next.call(this,e)}},e}(i.Ds);function nt(t,e){return void 0===e&&(e=c.P),function(n){return n.lift(new rt(t,e))}}var rt=function(){function t(t,e){this.dueTime=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new it(t,this.dueTime,this.scheduler))},t}(),it=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.dueTime=n,i.scheduler=r,i.debouncedSubscription=null,i.lastValue=null,i.hasValue=!1,i}return r.ZT(e,t),e.prototype._next=function(t){this.clearDebounce(),this.lastValue=t,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(ot,this.dueTime,this))},e.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},e.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var t=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(t)}},e.prototype.clearDebounce=function(){var t=this.debouncedSubscription;null!==t&&(this.remove(t),t.unsubscribe(),this.debouncedSubscription=null)},e}(d.L);function ot(t){t.debouncedNext()}function st(t){return void 0===t&&(t=null),function(e){return e.lift(new ut(t))}}var ut=function(){function t(t){this.defaultValue=t}return t.prototype.call=function(t,e){return e.subscribe(new ct(t,this.defaultValue))},t}(),ct=function(t){function e(e,n){var r=t.call(this,e)||this;return r.defaultValue=n,r.isEmpty=!0,r}return r.ZT(e,t),e.prototype._next=function(t){this.isEmpty=!1,this.destination.next(t)},e.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},e}(d.L);function at(t){return t instanceof Date&&!isNaN(+t)}var ht=n(2632);function lt(t,e){void 0===e&&(e=c.P);var n=at(t)?+t-e.now():Math.abs(t);return function(t){return t.lift(new ft(n,e))}}var ft=function(){function t(t,e){this.delay=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new pt(t,this.delay,this.scheduler))},t}(),pt=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.delay=n,i.scheduler=r,i.queue=[],i.active=!1,i.errored=!1,i}return r.ZT(e,t),e.dispatch=function(t){for(var e=t.source,n=e.queue,r=t.scheduler,i=t.destination;n.length>0&&n[0].time-r.now()<=0;)n.shift().notification.observe(i);if(n.length>0){var o=Math.max(0,n[0].time-r.now());this.schedule(t,o)}else this.unsubscribe(),e.active=!1},e.prototype._schedule=function(t){this.active=!0,this.destination.add(t.schedule(e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},e.prototype.scheduleNotification=function(t){if(!0!==this.errored){var e=this.scheduler,n=new dt(e.now()+this.delay,t);this.queue.push(n),!1===this.active&&this._schedule(e)}},e.prototype._next=function(t){this.scheduleNotification(ht.P.createNext(t))},e.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.scheduleNotification(ht.P.createComplete()),this.unsubscribe()},e}(d.L),dt=function(){return function(t,e){this.time=t,this.notification=e}}(),bt=n(2772);function vt(t,e){return e?function(n){return new mt(n,e).lift(new yt(t))}:function(e){return e.lift(new yt(t))}}var yt=function(){function t(t){this.delayDurationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new wt(t,this.delayDurationSelector))},t}(),wt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.delayDurationSelector=n,r.completed=!1,r.delayNotifierSubscriptions=[],r.index=0,r}return r.ZT(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.destination.next(t),this.removeSubscription(i),this.tryComplete()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype.notifyComplete=function(t){var e=this.removeSubscription(t);e&&this.destination.next(e),this.tryComplete()},e.prototype._next=function(t){var e=this.index++;try{var n=this.delayDurationSelector(t,e);n&&this.tryDelay(n,t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.completed=!0,this.tryComplete(),this.unsubscribe()},e.prototype.removeSubscription=function(t){t.unsubscribe();var e=this.delayNotifierSubscriptions.indexOf(t);return-1!==e&&this.delayNotifierSubscriptions.splice(e,1),t.outerValue},e.prototype.tryDelay=function(t,e){var n=(0,I.D)(this,t,e);n&&!n.closed&&(this.destination.add(n),this.delayNotifierSubscriptions.push(n))},e.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},e}(V.L),mt=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subscriptionDelay=n,r}return r.ZT(e,t),e.prototype._subscribe=function(t){this.subscriptionDelay.subscribe(new xt(t,this.source))},e}(bt.y),xt=function(t){function e(e,n){var r=t.call(this)||this;return r.parent=e,r.source=n,r.sourceSubscribed=!1,r}return r.ZT(e,t),e.prototype._next=function(t){this.subscribeToSource()},e.prototype._error=function(t){this.unsubscribe(),this.parent.error(t)},e.prototype._complete=function(){this.unsubscribe(),this.subscribeToSource()},e.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},e}(d.L);function _t(){return function(t){return t.lift(new gt)}}var gt=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new St(t))},t}(),St=function(t){function e(e){return t.call(this,e)||this}return r.ZT(e,t),e.prototype._next=function(t){t.observe(this.destination)},e}(d.L);function Tt(t,e){return function(n){return n.lift(new Et(t,e))}}var Et=function(){function t(t,e){this.keySelector=t,this.flushes=e}return t.prototype.call=function(t,e){return e.subscribe(new Ct(t,this.keySelector,this.flushes))},t}(),Ct=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.keySelector=n,o.values=new Set,r&&o.add((0,i.ft)(r,new i.IY(o))),o}return r.ZT(e,t),e.prototype.notifyNext=function(){this.values.clear()},e.prototype.notifyError=function(t){this._error(t)},e.prototype._next=function(t){this.keySelector?this._useKeySelector(t):this._finalizeNext(t,t)},e.prototype._useKeySelector=function(t){var e,n=this.destination;try{e=this.keySelector(t)}catch(t){return void n.error(t)}this._finalizeNext(e,t)},e.prototype._finalizeNext=function(t,e){var n=this.values;n.has(t)||(n.add(t),this.destination.next(e))},e}(i.Ds);function Nt(t,e){return function(n){return n.lift(new It(t,e))}}var It=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new Vt(t,this.compare,this.keySelector))},t}(),Vt=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.keySelector=r,i.hasKey=!1,"function"==typeof n&&(i.compare=n),i}return r.ZT(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e;try{var n=this.keySelector;e=n?n(t):t}catch(t){return this.destination.error(t)}var r=!1;if(this.hasKey)try{r=(0,this.compare)(this.key,e)}catch(t){return this.destination.error(t)}else this.hasKey=!0;r||(this.key=e,this.destination.next(t))},e}(d.L);function Ot(t,e){return Nt((function(n,r){return e?e(n[t],r[t]):n[t]===r[t]}))}var jt=n(6565),kt=n(6008),Zt=n(6929);function Lt(t){return void 0===t&&(t=Dt),function(e){return e.lift(new Pt(t))}}var Pt=function(){function t(t){this.errorFactory=t}return t.prototype.call=function(t,e){return e.subscribe(new At(t,this.errorFactory))},t}(),At=function(t){function e(e,n){var r=t.call(this,e)||this;return r.errorFactory=n,r.hasValue=!1,r}return r.ZT(e,t),e.prototype._next=function(t){this.hasValue=!0,this.destination.next(t)},e.prototype._complete=function(){if(this.hasValue)return this.destination.complete();var t=void 0;try{t=this.errorFactory()}catch(e){t=e}this.destination.error(t)},e}(d.L);function Dt(){return new Zt.K}var Bt=n(5631);function Rt(t){return function(e){return 0===t?(0,Bt.c)():e.lift(new zt(t))}}var zt=function(){function t(t){if(this.total=t,this.total<0)throw new jt.W}return t.prototype.call=function(t,e){return e.subscribe(new Wt(t,this.total))},t}(),Wt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return r.ZT(e,t),e.prototype._next=function(t){var e=this.total,n=++this.count;n<=e&&(this.destination.next(t),n===e&&(this.destination.complete(),this.unsubscribe()))},e}(d.L);function Yt(t,e){if(t<0)throw new jt.W;var n=arguments.length>=2;return function(r){return r.pipe((0,kt.h)((function(e,n){return n===t})),Rt(1),n?st(e):Lt((function(){return new jt.W})))}}var Ft=n(8170);function Mt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return(0,M.z)(e,Ft.of.apply(void 0,t))}}function Ut(t,e){return function(n){return n.lift(new Kt(t,e,n))}}var Kt=function(){function t(t,e,n){this.predicate=t,this.thisArg=e,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new qt(t,this.predicate,this.thisArg,this.source))},t}(),qt=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.predicate=n,o.thisArg=r,o.source=i,o.index=0,o.thisArg=r||o,o}return r.ZT(e,t),e.prototype.notifyComplete=function(t){this.destination.next(t),this.destination.complete()},e.prototype._next=function(t){var e=!1;try{e=this.predicate.call(this.thisArg,t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e||this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(d.L);function Qt(){return function(t){return t.lift(new Ht)}}var Ht=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new $t(t))},t}(),$t=function(t){function e(e){var n=t.call(this,e)||this;return n.hasCompleted=!1,n.hasSubscription=!1,n}return r.ZT(e,t),e.prototype._next=function(t){this.hasSubscription||(this.hasSubscription=!0,this.add((0,i.ft)(t,new i.IY(this))))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},e.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(i.Ds),Gt=n(5709);function Jt(t,e){return e?function(n){return n.pipe(Jt((function(n,r){return(0,Y.D)(t(n,r)).pipe((0,Gt.U)((function(t,i){return e(n,t,r,i)})))})))}:function(e){return e.lift(new Xt(t))}}var Xt=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new te(t,this.project))},t}(),te=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.hasSubscription=!1,r.hasCompleted=!1,r.index=0,r}return r.ZT(e,t),e.prototype._next=function(t){this.hasSubscription||this.tryNext(t)},e.prototype.tryNext=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.hasSubscription=!0,this._innerSub(e)},e.prototype._innerSub=function(t){var e=new i.IY(this),n=this.destination;n.add(e);var r=(0,i.ft)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this.destination.next(t)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(i.Ds);function ee(t,e,n){return void 0===e&&(e=Number.POSITIVE_INFINITY),e=(e||0)<1?Number.POSITIVE_INFINITY:e,function(r){return r.lift(new ne(t,e,n))}}var ne=function(){function t(t,e,n){this.project=t,this.concurrent=e,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new re(t,this.project,this.concurrent,this.scheduler))},t}(),re=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.project=n,o.concurrent=r,o.scheduler=i,o.index=0,o.active=0,o.hasCompleted=!1,r<Number.POSITIVE_INFINITY&&(o.buffer=[]),o}return r.ZT(e,t),e.dispatch=function(t){var e=t.subscriber,n=t.result,r=t.value,i=t.index;e.subscribeToProjection(n,r,i)},e.prototype._next=function(t){var n=this.destination;if(n.closed)this._complete();else{var r=this.index++;if(this.active<this.concurrent){n.next(t);try{var i=(0,this.project)(t,r);if(this.scheduler){var o={subscriber:this,result:i,value:t,index:r};this.destination.add(this.scheduler.schedule(e.dispatch,0,o))}else this.subscribeToProjection(i,t,r)}catch(t){n.error(t)}}else this.buffer.push(t)}},e.prototype.subscribeToProjection=function(t,e,n){this.active++,this.destination.add((0,i.ft)(t,new i.IY(this)))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t){this._next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t&&t.length>0&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},e}(i.Ds);function ie(t){return function(e){return e.lift(new oe(t))}}var oe=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e.subscribe(new se(t,this.callback))},t}(),se=function(t){function e(e,n){var r=t.call(this,e)||this;return r.add(new N.w(n)),r}return r.ZT(e,t),e}(d.L);function ue(t,e){if("function"!=typeof t)throw new TypeError("predicate is not a function");return function(n){return n.lift(new ce(t,n,!1,e))}}var ce=function(){function t(t,e,n,r){this.predicate=t,this.source=e,this.yieldIndex=n,this.thisArg=r}return t.prototype.call=function(t,e){return e.subscribe(new ae(t,this.predicate,this.source,this.yieldIndex,this.thisArg))},t}(),ae=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.predicate=n,s.source=r,s.yieldIndex=i,s.thisArg=o,s.index=0,s}return r.ZT(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete(),this.unsubscribe()},e.prototype._next=function(t){var e=this.predicate,n=this.thisArg,r=this.index++;try{e.call(n||this,t,r,this.source)&&this.notifyComplete(this.yieldIndex?r:t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},e}(d.L);function he(t,e){return function(n){return n.lift(new ce(t,n,!0,e))}}var le=n(3608);function fe(t,e){var n=arguments.length>=2;return function(r){return r.pipe(t?(0,kt.h)((function(e,n){return t(e,n,r)})):le.y,Rt(1),n?st(e):Lt((function(){return new Zt.K})))}}var pe=n(1120);function de(){return function(t){return t.lift(new be)}}var be=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new ve(t))},t}(),ve=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.ZT(e,t),e.prototype._next=function(t){},e}(d.L);function ye(){return function(t){return t.lift(new we)}}var we=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new me(t))},t}(),me=function(t){function e(e){return t.call(this,e)||this}return r.ZT(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype._next=function(t){this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(d.L);function xe(t){return function(e){return 0===t?(0,Bt.c)():e.lift(new _e(t))}}var _e=function(){function t(t){if(this.total=t,this.total<0)throw new jt.W}return t.prototype.call=function(t,e){return e.subscribe(new ge(t,this.total))},t}(),ge=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.ring=new Array,r.count=0,r}return r.ZT(e,t),e.prototype._next=function(t){var e=this.ring,n=this.total,r=this.count++;e.length<n?e.push(t):e[r%n]=t},e.prototype._complete=function(){var t=this.destination,e=this.count;if(e>0)for(var n=this.count>=this.total?this.total:this.count,r=this.ring,i=0;i<n;i++){var o=e++%n;t.next(r[o])}t.complete()},e}(d.L);function Se(t,e){var n=arguments.length>=2;return function(r){return r.pipe(t?(0,kt.h)((function(e,n){return t(e,n,r)})):le.y,xe(1),n?st(e):Lt((function(){return new Zt.K})))}}function Te(t){return function(e){return e.lift(new Ee(t))}}var Ee=function(){function t(t){this.value=t}return t.prototype.call=function(t,e){return e.subscribe(new Ce(t,this.value))},t}(),Ce=function(t){function e(e,n){var r=t.call(this,e)||this;return r.value=n,r}return r.ZT(e,t),e.prototype._next=function(t){this.destination.next(this.value)},e}(d.L);function Ne(){return function(t){return t.lift(new Ie)}}var Ie=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Ve(t))},t}(),Ve=function(t){function e(e){return t.call(this,e)||this}return r.ZT(e,t),e.prototype._next=function(t){this.destination.next(ht.P.createNext(t))},e.prototype._error=function(t){var e=this.destination;e.next(ht.P.createError(t)),e.complete()},e.prototype._complete=function(){var t=this.destination;t.next(ht.P.createComplete()),t.complete()},e}(d.L);function Oe(t,e){var n=!1;return arguments.length>=2&&(n=!0),function(r){return r.lift(new je(t,e,n))}}var je=function(){function t(t,e,n){void 0===n&&(n=!1),this.accumulator=t,this.seed=e,this.hasSeed=n}return t.prototype.call=function(t,e){return e.subscribe(new ke(t,this.accumulator,this.seed,this.hasSeed))},t}(),ke=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.accumulator=n,o._seed=r,o.hasSeed=i,o.index=0,o}return r.ZT(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,n=this.index++;try{e=this.accumulator(this.seed,t,n)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(d.L),Ze=n(2561);function Le(t,e){return arguments.length>=2?function(n){return(0,Ze.z)(Oe(t,e),xe(1),st(e))(n)}:function(e){return(0,Ze.z)(Oe((function(e,n,r){return t(e,n,r+1)})),xe(1))(e)}}function Pe(t){return Le("function"==typeof t?function(e,n){return t(e,n)>0?e:n}:function(t,e){return t>e?t:e})}var Ae=n(4370);function De(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(Ae.T.apply(void 0,[e].concat(t)))}}var Be=n(2556);function Re(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?(0,q.zg)((function(){return t}),e,n):("number"==typeof e&&(n=e),(0,q.zg)((function(){return t}),n))}function ze(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),function(r){return r.lift(new We(t,e,n))}}var We=function(){function t(t,e,n){this.accumulator=t,this.seed=e,this.concurrent=n}return t.prototype.call=function(t,e){return e.subscribe(new Ye(t,this.accumulator,this.seed,this.concurrent))},t}(),Ye=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.accumulator=n,o.acc=r,o.concurrent=i,o.hasValue=!1,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return r.ZT(e,t),e.prototype._next=function(t){if(this.active<this.concurrent){var e=this.index++,n=this.destination,r=void 0;try{r=(0,this.accumulator)(this.acc,t,e)}catch(t){return n.error(t)}this.active++,this._innerSub(r)}else this.buffer.push(t)},e.prototype._innerSub=function(t){var e=new i.IY(this),n=this.destination;n.add(e);var r=(0,i.ft)(t,e);r!==e&&n.add(r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete()),this.unsubscribe()},e.prototype.notifyNext=function(t){var e=this.destination;this.acc=t,this.hasValue=!0,e.next(t)},e.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},e}(i.Ds);function Fe(t){return Le("function"==typeof t?function(e,n){return t(e,n)<0?e:n}:function(t,e){return t<e?t:e})}var Me=n(3140);function Ue(t,e){return function(n){var r;if(r="function"==typeof t?t:function(){return t},"function"==typeof e)return n.lift(new Ke(r,e));var i=Object.create(n,Me.N);return i.source=n,i.subjectFactory=r,i}}var Ke=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var n=this.selector,r=this.subjectFactory(),i=n(r).subscribe(t);return i.add(e.subscribe(r)),i},t}(),qe=n(9276);function Qe(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&(0,W.k)(t[0])&&(t=t[0]),function(e){return e.lift(new He(t))}}var He=function(){function t(t){this.nextSources=t}return t.prototype.call=function(t,e){return e.subscribe(new $e(t,this.nextSources))},t}(),$e=function(t){function e(e,n){var r=t.call(this,e)||this;return r.destination=e,r.nextSources=n,r}return r.ZT(e,t),e.prototype.notifyError=function(){this.subscribeToNextSource()},e.prototype.notifyComplete=function(){this.subscribeToNextSource()},e.prototype._error=function(t){this.subscribeToNextSource(),this.unsubscribe()},e.prototype._complete=function(){this.subscribeToNextSource(),this.unsubscribe()},e.prototype.subscribeToNextSource=function(){var t=this.nextSources.shift();if(t){var e=new i.IY(this),n=this.destination;n.add(e);var r=(0,i.ft)(t,e);r!==e&&n.add(r)}else this.destination.complete()},e}(i.Ds);function Ge(){return function(t){return t.lift(new Je)}}var Je=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Xe(t))},t}(),Xe=function(t){function e(e){var n=t.call(this,e)||this;return n.hasPrev=!1,n}return r.ZT(e,t),e.prototype._next=function(t){var e;this.hasPrev?e=[this.prev,t]:this.hasPrev=!0,this.prev=t,e&&this.destination.next(e)},e}(d.L),tn=n(8463);function en(t,e){return function(n){return[(0,kt.h)(t,e)(n),(0,kt.h)((0,tn.f)(t,e))(n)]}}function nn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.length;if(0===n)throw new Error("list of properties cannot be empty.");return function(e){return(0,Gt.U)(rn(t,n))(e)}}function rn(t,e){return function(n){for(var r=n,i=0;i<e;i++){var o=null!=r?r[t[i]]:void 0;if(void 0===o)return;r=o}return r}}var on=n(211);function sn(t){return t?Ue((function(){return new on.xQ}),t):Ue(new on.xQ)}var un=n(9233);function cn(t){return function(e){return Ue(new un.X(t))(e)}}var an=n(364);function hn(){return function(t){return Ue(new an.c)(t)}}var ln=n(2630);function fn(t,e,n,r){n&&"function"!=typeof n&&(r=n);var i="function"==typeof n?n:void 0,o=new ln.t(t,e,r);return function(t){return Ue((function(){return o}),i)(t)}}var pn=n(8821);function dn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return 1===t.length&&(0,W.k)(t[0])&&(t=t[0]),e.lift.call(pn.S3.apply(void 0,[e].concat(t)))}}function bn(t){return void 0===t&&(t=-1),function(e){return 0===t?(0,Bt.c)():t<0?e.lift(new vn(-1,e)):e.lift(new vn(t-1,e))}}var vn=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new yn(t,this.count,this.source))},t}(),yn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.count=n,i.source=r,i}return r.ZT(e,t),e.prototype.complete=function(){if(!this.isStopped){var e=this.source,n=this.count;if(0===n)return t.prototype.complete.call(this);n>-1&&(this.count=n-1),e.subscribe(this._unsubscribeAndRecycle())}},e}(d.L);function wn(t){return function(e){return e.lift(new mn(t))}}var mn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new xn(t,this.notifier,e))},t}(),xn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.notifier=n,i.source=r,i.sourceIsBeingSubscribedTo=!0,i}return r.ZT(e,t),e.prototype.notifyNext=function(){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},e.prototype.notifyComplete=function(){if(!1===this.sourceIsBeingSubscribedTo)return t.prototype.complete.call(this)},e.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries||this.subscribeToRetries(),!this.retriesSubscription||this.retriesSubscription.closed)return t.prototype.complete.call(this);this._unsubscribeAndRecycle(),this.notifications.next(void 0)}},e.prototype._unsubscribe=function(){var t=this.notifications,e=this.retriesSubscription;t&&(t.unsubscribe(),this.notifications=void 0),e&&(e.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},e.prototype._unsubscribeAndRecycle=function(){var e=this._unsubscribe;return this._unsubscribe=null,t.prototype._unsubscribeAndRecycle.call(this),this._unsubscribe=e,this},e.prototype.subscribeToRetries=function(){var e;this.notifications=new on.xQ;try{e=(0,this.notifier)(this.notifications)}catch(e){return t.prototype.complete.call(this)}this.retries=e,this.retriesSubscription=(0,i.ft)(e,new i.IY(this))},e}(i.Ds);function _n(t){return void 0===t&&(t=-1),function(e){return e.lift(new gn(t,e))}}var gn=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Sn(t,this.count,this.source))},t}(),Sn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.count=n,i.source=r,i}return r.ZT(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=this.source,r=this.count;if(0===r)return t.prototype.error.call(this,e);r>-1&&(this.count=r-1),n.subscribe(this._unsubscribeAndRecycle())}},e}(d.L);function Tn(t){return function(e){return e.lift(new En(t,e))}}var En=function(){function t(t,e){this.notifier=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Cn(t,this.notifier,this.source))},t}(),Cn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.notifier=n,i.source=r,i}return r.ZT(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=this.errors,r=this.retries,o=this.retriesSubscription;if(r)this.errors=void 0,this.retriesSubscription=void 0;else{n=new on.xQ;try{r=(0,this.notifier)(n)}catch(e){return t.prototype.error.call(this,e)}o=(0,i.ft)(r,new i.IY(this))}this._unsubscribeAndRecycle(),this.errors=n,this.retries=r,this.retriesSubscription=o,n.next(e)}},e.prototype._unsubscribe=function(){var t=this.errors,e=this.retriesSubscription;t&&(t.unsubscribe(),this.errors=void 0),e&&(e.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},e.prototype.notifyNext=function(){var t=this._unsubscribe;this._unsubscribe=null,this._unsubscribeAndRecycle(),this._unsubscribe=t,this.source.subscribe(this)},e}(i.Ds),Nn=n(3018);function In(t){return function(e){return e.lift(new Vn(t))}}var Vn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new On(t),r=e.subscribe(n);return r.add((0,i.ft)(this.notifier,new i.IY(n))),r},t}(),On=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasValue=!1,e}return r.ZT(e,t),e.prototype._next=function(t){this.value=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},e}(i.Ds);function jn(t,e){return void 0===e&&(e=c.P),function(n){return n.lift(new kn(t,e))}}var kn=function(){function t(t,e){this.period=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new Zn(t,this.period,this.scheduler))},t}(),Zn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.period=n,i.scheduler=r,i.hasValue=!1,i.add(r.schedule(Ln,n,{subscriber:i,period:n})),i}return r.ZT(e,t),e.prototype._next=function(t){this.lastValue=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},e}(d.L);function Ln(t){var e=t.subscriber,n=t.period;e.notifyNext(),this.schedule(t,n)}function Pn(t,e){return function(n){return n.lift(new An(t,e))}}var An=function(){function t(t,e){this.compareTo=t,this.comparator=e}return t.prototype.call=function(t,e){return e.subscribe(new Dn(t,this.compareTo,this.comparator))},t}(),Dn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.compareTo=n,i.comparator=r,i._a=[],i._b=[],i._oneComplete=!1,i.destination.add(n.subscribe(new Bn(e,i))),i}return r.ZT(e,t),e.prototype._next=function(t){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(t),this.checkValues())},e.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0,this.unsubscribe()},e.prototype.checkValues=function(){for(var t=this,e=t._a,n=t._b,r=t.comparator;e.length>0&&n.length>0;){var i=e.shift(),o=n.shift(),s=!1;try{s=r?r(i,o):i===o}catch(t){this.destination.error(t)}s||this.emit(!1)}},e.prototype.emit=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype.nextB=function(t){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(t),this.checkValues())},e.prototype.completeB=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},e}(d.L),Bn=function(t){function e(e,n){var r=t.call(this,e)||this;return r.parent=n,r}return r.ZT(e,t),e.prototype._next=function(t){this.parent.nextB(t)},e.prototype._error=function(t){this.parent.error(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.completeB(),this.unsubscribe()},e}(d.L);function Rn(){return new on.xQ}function zn(){return function(t){return(0,Nn.x)()(Ue(Rn)(t))}}function Wn(t,e,n){var r;return r=t&&"object"==typeof t?t:{bufferSize:t,windowTime:e,refCount:!1,scheduler:n},function(t){return t.lift(function(t){var e,n,r=t.bufferSize,i=void 0===r?Number.POSITIVE_INFINITY:r,o=t.windowTime,s=void 0===o?Number.POSITIVE_INFINITY:o,u=t.refCount,c=t.scheduler,a=0,h=!1,l=!1;return function(t){var r;a++,!e||h?(h=!1,e=new ln.t(i,s,c),r=e.subscribe(this),n=t.subscribe({next:function(t){e.next(t)},error:function(t){h=!0,e.error(t)},complete:function(){l=!0,n=void 0,e.complete()}}),l&&(n=void 0)):r=e.subscribe(this),this.add((function(){a--,r.unsubscribe(),r=void 0,n&&!l&&u&&0===a&&(n.unsubscribe(),n=void 0,e=void 0)}))}}(r))}}function Yn(t){return function(e){return e.lift(new Fn(t,e))}}var Fn=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Mn(t,this.predicate,this.source))},t}(),Mn=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.source=r,i.seenValue=!1,i.index=0,i}return r.ZT(e,t),e.prototype.applySingleValue=function(t){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=t)},e.prototype._next=function(t){var e=this.index++;this.predicate?this.tryNext(t,e):this.applySingleValue(t)},e.prototype.tryNext=function(t,e){try{this.predicate(t,e,this.source)&&this.applySingleValue(t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){var t=this.destination;this.index>0?(t.next(this.seenValue?this.singleValue:void 0),t.complete()):t.error(new Zt.K)},e}(d.L);function Un(t){return function(e){return e.lift(new Kn(t))}}var Kn=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new qn(t,this.total))},t}(),qn=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return r.ZT(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(d.L);function Qn(t){return function(e){return e.lift(new Hn(t))}}var Hn=function(){function t(t){if(this._skipCount=t,this._skipCount<0)throw new jt.W}return t.prototype.call=function(t,e){return 0===this._skipCount?e.subscribe(new d.L(t)):e.subscribe(new $n(t,this._skipCount))},t}(),$n=function(t){function e(e,n){var r=t.call(this,e)||this;return r._skipCount=n,r._count=0,r._ring=new Array(n),r}return r.ZT(e,t),e.prototype._next=function(t){var e=this._skipCount,n=this._count++;if(n<e)this._ring[n]=t;else{var r=n%e,i=this._ring,o=i[r];i[r]=t,this.destination.next(o)}},e}(d.L);function Gn(t){return function(e){return e.lift(new Jn(t))}}var Jn=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new Xn(t,this.notifier))},t}(),Xn=function(t){function e(e,n){var r=t.call(this,e)||this;r.hasValue=!1;var o=new i.IY(r);r.add(o),r.innerSubscription=o;var s=(0,i.ft)(n,o);return s!==o&&(r.add(s),r.innerSubscription=s),r}return r.ZT(e,t),e.prototype._next=function(e){this.hasValue&&t.prototype._next.call(this,e)},e.prototype.notifyNext=function(){this.hasValue=!0,this.innerSubscription&&this.innerSubscription.unsubscribe()},e.prototype.notifyComplete=function(){},e}(i.Ds);function tr(t){return function(e){return e.lift(new er(t))}}var er=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new nr(t,this.predicate))},t}(),nr=function(t){function e(e,n){var r=t.call(this,e)||this;return r.predicate=n,r.skipping=!0,r.index=0,r}return r.ZT(e,t),e.prototype._next=function(t){var e=this.destination;this.skipping&&this.tryCallPredicate(t),this.skipping||e.next(t)},e.prototype.tryCallPredicate=function(t){try{var e=this.predicate(t,this.index++);this.skipping=Boolean(e)}catch(t){this.destination.error(t)}},e}(d.L);function rr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return(0,m.K)(n)?(t.pop(),function(e){return(0,M.z)(t,e,n)}):function(e){return(0,M.z)(t,e)}}var ir=n(6650),or=n(5812),sr=function(t){function e(e,n,r){void 0===n&&(n=0),void 0===r&&(r=ir.e);var i=t.call(this)||this;return i.source=e,i.delayTime=n,i.scheduler=r,(!(0,or.k)(n)||n<0)&&(i.delayTime=0),r&&"function"==typeof r.schedule||(i.scheduler=ir.e),i}return r.ZT(e,t),e.create=function(t,n,r){return void 0===n&&(n=0),void 0===r&&(r=ir.e),new e(t,n,r)},e.dispatch=function(t){var e=t.source,n=t.subscriber;return this.add(e.subscribe(n))},e.prototype._subscribe=function(t){var n=this.delayTime,r=this.source;return this.scheduler.schedule(e.dispatch,n,{source:r,subscriber:t})},e}(bt.y);function ur(t,e){return void 0===e&&(e=0),function(n){return n.lift(new cr(t,e))}}var cr=function(){function t(t,e){this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return new sr(e,this.delay,this.scheduler).subscribe(t)},t}();function ar(t,e){return"function"==typeof e?function(n){return n.pipe(ar((function(n,r){return(0,Y.D)(t(n,r)).pipe((0,Gt.U)((function(t,i){return e(n,t,r,i)})))})))}:function(e){return e.lift(new hr(t))}}var hr=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new lr(t,this.project))},t}(),lr=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.index=0,r}return r.ZT(e,t),e.prototype._next=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this._innerSub(e)},e.prototype._innerSub=function(t){var e=this.innerSubscription;e&&e.unsubscribe();var n=new i.IY(this),r=this.destination;r.add(n),this.innerSubscription=(0,i.ft)(t,n),this.innerSubscription!==n&&r.add(this.innerSubscription)},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this),this.unsubscribe()},e.prototype._unsubscribe=function(){this.innerSubscription=void 0},e.prototype.notifyComplete=function(){this.innerSubscription=void 0,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t){this.destination.next(t)},e}(i.Ds);function fr(){return ar(le.y)}function pr(t,e){return e?ar((function(){return t}),e):ar((function(){return t}))}function dr(t){return function(e){return e.lift(new br(t))}}var br=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new vr(t),r=(0,i.ft)(this.notifier,new i.IY(n));return r&&!n.seenValue?(n.add(r),e.subscribe(n)):n},t}(),vr=function(t){function e(e){var n=t.call(this,e)||this;return n.seenValue=!1,n}return r.ZT(e,t),e.prototype.notifyNext=function(){this.seenValue=!0,this.complete()},e.prototype.notifyComplete=function(){},e}(i.Ds);function yr(t,e){return void 0===e&&(e=!1),function(n){return n.lift(new wr(t,e))}}var wr=function(){function t(t,e){this.predicate=t,this.inclusive=e}return t.prototype.call=function(t,e){return e.subscribe(new mr(t,this.predicate,this.inclusive))},t}(),mr=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.predicate=n,i.inclusive=r,i.index=0,i}return r.ZT(e,t),e.prototype._next=function(t){var e,n=this.destination;try{e=this.predicate(t,this.index++)}catch(t){return void n.error(t)}this.nextOrComplete(t,e)},e.prototype.nextOrComplete=function(t,e){var n=this.destination;Boolean(e)?n.next(t):(this.inclusive&&n.next(t),n.complete())},e}(d.L),xr=n(3306),_r=n(4156);function gr(t,e,n){return function(r){return r.lift(new Sr(t,e,n))}}var Sr=function(){function t(t,e,n){this.nextOrObserver=t,this.error=e,this.complete=n}return t.prototype.call=function(t,e){return e.subscribe(new Tr(t,this.nextOrObserver,this.error,this.complete))},t}(),Tr=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o._tapNext=xr.Z,o._tapError=xr.Z,o._tapComplete=xr.Z,o._tapError=r||xr.Z,o._tapComplete=i||xr.Z,(0,_r.m)(n)?(o._context=o,o._tapNext=n):n&&(o._context=n,o._tapNext=n.next||xr.Z,o._tapError=n.error||xr.Z,o._tapComplete=n.complete||xr.Z),o}return r.ZT(e,t),e.prototype._next=function(t){try{this._tapNext.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.next(t)},e.prototype._error=function(t){try{this._tapError.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.error(t)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(t){return void this.destination.error(t)}return this.destination.complete()},e}(d.L),Er={leading:!0,trailing:!1};function Cr(t,e){return void 0===e&&(e=Er),function(n){return n.lift(new Nr(t,!!e.leading,!!e.trailing))}}var Nr=function(){function t(t,e,n){this.durationSelector=t,this.leading=e,this.trailing=n}return t.prototype.call=function(t,e){return e.subscribe(new Ir(t,this.durationSelector,this.leading,this.trailing))},t}(),Ir=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.destination=e,o.durationSelector=n,o._leading=r,o._trailing=i,o._hasValue=!1,o}return r.ZT(e,t),e.prototype._next=function(t){this._hasValue=!0,this._sendValue=t,this._throttled||(this._leading?this.send():this.throttle(t))},e.prototype.send=function(){var t=this._hasValue,e=this._sendValue;t&&(this.destination.next(e),this.throttle(e)),this._hasValue=!1,this._sendValue=void 0},e.prototype.throttle=function(t){var e=this.tryDurationSelector(t);e&&this.add(this._throttled=(0,i.ft)(e,new i.IY(this)))},e.prototype.tryDurationSelector=function(t){try{return this.durationSelector(t)}catch(t){return this.destination.error(t),null}},e.prototype.throttlingDone=function(){var t=this._throttled,e=this._trailing;t&&t.unsubscribe(),this._throttled=void 0,e&&this.send()},e.prototype.notifyNext=function(){this.throttlingDone()},e.prototype.notifyComplete=function(){this.throttlingDone()},e}(i.Ds);function Vr(t,e,n){return void 0===e&&(e=c.P),void 0===n&&(n=Er),function(r){return r.lift(new Or(t,e,n.leading,n.trailing))}}var Or=function(){function t(t,e,n,r){this.duration=t,this.scheduler=e,this.leading=n,this.trailing=r}return t.prototype.call=function(t,e){return e.subscribe(new jr(t,this.duration,this.scheduler,this.leading,this.trailing))},t}(),jr=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.duration=n,s.scheduler=r,s.leading=i,s.trailing=o,s._hasTrailingValue=!1,s._trailingValue=null,s}return r.ZT(e,t),e.prototype._next=function(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(kr,this.duration,{subscriber:this})),this.leading?this.destination.next(t):this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0))},e.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},e.prototype.clearThrottle=function(){var t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)},e}(d.L);function kr(t){t.subscriber.clearThrottle()}var Zr=n(1410);function Lr(t){return void 0===t&&(t=c.P),function(e){return(0,Zr.P)((function(){return e.pipe(Oe((function(e,n){var r=e.current;return{value:n,current:t.now(),last:r}}),{current:t.now(),value:void 0,last:void 0}),(0,Gt.U)((function(t){var e=t.current,n=t.last,r=t.value;return new Pr(r,e-n)})))}))}}var Pr=function(){return function(t,e){this.value=t,this.interval=e}}(),Ar=n(1462);function Dr(t,e,n){return void 0===n&&(n=c.P),function(r){var i=at(t),o=i?+t-n.now():Math.abs(t);return r.lift(new Br(o,i,e,n))}}var Br=function(){function t(t,e,n,r){this.waitFor=t,this.absoluteTimeout=e,this.withObservable=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new Rr(t,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},t}(),Rr=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;return s.absoluteTimeout=n,s.waitFor=r,s.withObservable=i,s.scheduler=o,s.scheduleTimeout(),s}return r.ZT(e,t),e.dispatchTimeout=function(t){var e=t.withObservable;t._unsubscribeAndRecycle(),t.add((0,i.ft)(e,new i.IY(t)))},e.prototype.scheduleTimeout=function(){var t=this.action;t?this.action=t.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(e.dispatchTimeout,this.waitFor,this))},e.prototype._next=function(e){this.absoluteTimeout||this.scheduleTimeout(),t.prototype._next.call(this,e)},e.prototype._unsubscribe=function(){this.action=void 0,this.scheduler=null,this.withObservable=null},e}(i.Ds),zr=n(4944);function Wr(t,e){return void 0===e&&(e=c.P),Dr(t,(0,zr._)(new Ar.W),e)}function Yr(t){return void 0===t&&(t=c.P),(0,Gt.U)((function(e){return new Fr(e,t.now())}))}var Fr=function(){return function(t,e){this.value=t,this.timestamp=e}}();function Mr(t,e,n){return 0===n?[e]:(t.push(e),t)}function Ur(){return Le(Mr,[])}function Kr(t){return function(e){return e.lift(new qr(t))}}var qr=function(){function t(t){this.windowBoundaries=t}return t.prototype.call=function(t,e){var n=new Qr(t),r=e.subscribe(n);return r.closed||n.add((0,i.ft)(this.windowBoundaries,new i.IY(n))),r},t}(),Qr=function(t){function e(e){var n=t.call(this,e)||this;return n.window=new on.xQ,e.next(n.window),n}return r.ZT(e,t),e.prototype.notifyNext=function(){this.openWindow()},e.prototype.notifyError=function(t){this._error(t)},e.prototype.notifyComplete=function(){this._complete()},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t)},e.prototype._complete=function(){this.window.complete(),this.destination.complete()},e.prototype._unsubscribe=function(){this.window=null},e.prototype.openWindow=function(){var t=this.window;t&&t.complete();var e=this.destination,n=this.window=new on.xQ;e.next(n)},e}(i.Ds);function Hr(t,e){return void 0===e&&(e=0),function(n){return n.lift(new $r(t,e))}}var $r=function(){function t(t,e){this.windowSize=t,this.startWindowEvery=e}return t.prototype.call=function(t,e){return e.subscribe(new Gr(t,this.windowSize,this.startWindowEvery))},t}(),Gr=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.destination=e,i.windowSize=n,i.startWindowEvery=r,i.windows=[new on.xQ],i.count=0,e.next(i.windows[0]),i}return r.ZT(e,t),e.prototype._next=function(t){for(var e=this.startWindowEvery>0?this.startWindowEvery:this.windowSize,n=this.destination,r=this.windowSize,i=this.windows,o=i.length,s=0;s<o&&!this.closed;s++)i[s].next(t);var u=this.count-r+1;if(u>=0&&u%e==0&&!this.closed&&i.shift().complete(),++this.count%e==0&&!this.closed){var c=new on.xQ;i.push(c),n.next(c)}},e.prototype._error=function(t){var e=this.windows;if(e)for(;e.length>0&&!this.closed;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){var t=this.windows;if(t)for(;t.length>0&&!this.closed;)t.shift().complete();this.destination.complete()},e.prototype._unsubscribe=function(){this.count=0,this.windows=null},e}(d.L);function Jr(t){var e=c.P,n=null,r=Number.POSITIVE_INFINITY;return(0,m.K)(arguments[3])&&(e=arguments[3]),(0,m.K)(arguments[2])?e=arguments[2]:(0,or.k)(arguments[2])&&(r=Number(arguments[2])),(0,m.K)(arguments[1])?e=arguments[1]:(0,or.k)(arguments[1])&&(n=Number(arguments[1])),function(i){return i.lift(new Xr(t,n,r,e))}}var Xr=function(){function t(t,e,n,r){this.windowTimeSpan=t,this.windowCreationInterval=e,this.maxWindowSize=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new ei(t,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},t}(),ti=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._numberOfNextedValues=0,e}return r.ZT(e,t),e.prototype.next=function(e){this._numberOfNextedValues++,t.prototype.next.call(this,e)},Object.defineProperty(e.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),e}(on.xQ),ei=function(t){function e(e,n,r,i,o){var s=t.call(this,e)||this;s.destination=e,s.windowTimeSpan=n,s.windowCreationInterval=r,s.maxWindowSize=i,s.scheduler=o,s.windows=[];var u=s.openWindow();if(null!==r&&r>=0){var c={subscriber:s,window:u,context:null},a={windowTimeSpan:n,windowCreationInterval:r,subscriber:s,scheduler:o};s.add(o.schedule(ii,n,c)),s.add(o.schedule(ri,r,a))}else{var h={subscriber:s,window:u,windowTimeSpan:n};s.add(o.schedule(ni,n,h))}return s}return r.ZT(e,t),e.prototype._next=function(t){for(var e=this.windows,n=e.length,r=0;r<n;r++){var i=e[r];i.closed||(i.next(t),i.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(i))}},e.prototype._error=function(t){for(var e=this.windows;e.length>0;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){for(var t=this.windows;t.length>0;){var e=t.shift();e.closed||e.complete()}this.destination.complete()},e.prototype.openWindow=function(){var t=new ti;return this.windows.push(t),this.destination.next(t),t},e.prototype.closeWindow=function(t){t.complete();var e=this.windows;e.splice(e.indexOf(t),1)},e}(d.L);function ni(t){var e=t.subscriber,n=t.windowTimeSpan,r=t.window;r&&e.closeWindow(r),t.window=e.openWindow(),this.schedule(t,n)}function ri(t){var e=t.windowTimeSpan,n=t.subscriber,r=t.scheduler,i=t.windowCreationInterval,o=n.openWindow(),s=this,u={action:s,subscription:null},c={subscriber:n,window:o,context:u};u.subscription=r.schedule(ii,e,c),s.add(u.subscription),s.schedule(t,i)}function ii(t){var e=t.subscriber,n=t.window,r=t.context;r&&r.action&&r.subscription&&r.action.remove(r.subscription),e.closeWindow(n)}function oi(t,e){return function(n){return n.lift(new si(t,e))}}var si=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new ui(t,this.openings,this.closingSelector))},t}(),ui=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.openings=n,i.closingSelector=r,i.contexts=[],i.add(i.openSubscription=(0,I.D)(i,n,n)),i}return r.ZT(e,t),e.prototype._next=function(t){var e=this.contexts;if(e)for(var n=e.length,r=0;r<n;r++)e[r].window.next(t)},e.prototype._error=function(e){var n=this.contexts;if(this.contexts=null,n)for(var r=n.length,i=-1;++i<r;){var o=n[i];o.window.error(e),o.subscription.unsubscribe()}t.prototype._error.call(this,e)},e.prototype._complete=function(){var e=this.contexts;if(this.contexts=null,e)for(var n=e.length,r=-1;++r<n;){var i=e[r];i.window.complete(),i.subscription.unsubscribe()}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.contexts;if(this.contexts=null,t)for(var e=t.length,n=-1;++n<e;){var r=t[n];r.window.unsubscribe(),r.subscription.unsubscribe()}},e.prototype.notifyNext=function(t,e,n,r,i){if(t===this.openings){var o=void 0;try{o=(0,this.closingSelector)(e)}catch(t){return this.error(t)}var s=new on.xQ,u=new N.w,c={window:s,subscription:u};this.contexts.push(c);var a=(0,I.D)(this,o,c);a.closed?this.closeWindow(this.contexts.length-1):(a.context=c,u.add(a)),this.destination.next(s)}else this.closeWindow(this.contexts.indexOf(t))},e.prototype.notifyError=function(t){this.error(t)},e.prototype.notifyComplete=function(t){t!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(t.context))},e.prototype.closeWindow=function(t){if(-1!==t){var e=this.contexts,n=e[t],r=n.window,i=n.subscription;e.splice(t,1),r.complete(),i.unsubscribe()}},e}(V.L);function ci(t){return function(e){return e.lift(new ai(t))}}var ai=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new hi(t,this.closingSelector))},t}(),hi=function(t){function e(e,n){var r=t.call(this,e)||this;return r.destination=e,r.closingSelector=n,r.openWindow(),r}return r.ZT(e,t),e.prototype.notifyNext=function(t,e,n,r,i){this.openWindow(i)},e.prototype.notifyError=function(t){this._error(t)},e.prototype.notifyComplete=function(t){this.openWindow(t)},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t),this.unsubscribeClosingNotification()},e.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},e.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},e.prototype.openWindow=function(t){void 0===t&&(t=null),t&&(this.remove(t),t.unsubscribe());var e=this.window;e&&e.complete();var n,r=this.window=new on.xQ;this.destination.next(r);try{n=(0,this.closingSelector)()}catch(t){return this.destination.error(t),void this.window.error(t)}this.add(this.closingNotification=(0,I.D)(this,n))},e}(V.L);function li(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){var n;"function"==typeof t[t.length-1]&&(n=t.pop());var r=t;return e.lift(new fi(r,n))}}var fi=function(){function t(t,e){this.observables=t,this.project=e}return t.prototype.call=function(t,e){return e.subscribe(new pi(t,this.observables,this.project))},t}(),pi=function(t){function e(e,n,r){var i=t.call(this,e)||this;i.observables=n,i.project=r,i.toRespond=[];var o=n.length;i.values=new Array(o);for(var s=0;s<o;s++)i.toRespond.push(s);for(s=0;s<o;s++){var u=n[s];i.add((0,I.D)(i,u,void 0,s))}return i}return r.ZT(e,t),e.prototype.notifyNext=function(t,e,n){this.values[n]=e;var r=this.toRespond;if(r.length>0){var i=r.indexOf(n);-1!==i&&r.splice(i,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},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}(V.L),di=n(5080);function bi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(di.$R.apply(void 0,[e].concat(t)))}}function vi(t){return function(e){return e.lift(new di.mx(t))}}},359:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaBLEError=void 0;const r=n(3653);class i extends r.CodeError{static invalidErrorResult(t){return new i("Internal error: ble cordova plugin returned an unexpected error object",i.Code.InternalError)}static invalidErrorCode(t){return new i(`Internal error: ble cordova plugin returned an invalid error code ${t.code} with message ${t.message}`,i.Code.InternalError)}static invalidNativeCallResult(t,e){return new i(`Internal error: native call returned an invalid data type. ${e.message}`,i.Code.InternalError)}static isValidErrorCode(t){return t in i.Code}static iotizeBLEMissing(){return new i("iotizeBLE global variable does not exist. Are you sure app is running inside a Cordova application ?",i.Code.InternalError)}}e.CordovaBLEError=i,function(t){let e;!function(t){t.InternalError="CordovaBLEErrorInternalError",t.IllegalArgument="CordovaBLEErrorIllegalArgument",t.BLENotAvailable="CordovaBLEErrorBLENotAvailable",t.InvalidMacAddress="InvalidMacAddressInvalidMacAddress",t.ConnectionError="CordovaBLEErrorConnectionError",t.RequestError="CordovaBLEErrorRequestError",t.LocationServiceDisabled="CordovaBLEErrorLocationServiceDisabled",t.DisconnectError="CordovaBLEErrorDisconnectError",t.IllegalAction="CordovaBLEErrorIllegalAction",t.NotConnectedError="CordovaBLEErrorNotConnectedError",t.StatusCodeError="CordovaBLEErrorStatusCodeError"}(e=t.Code||(t.Code={}))}(i=e.CordovaBLEError||(e.CordovaBLEError={}))},1890:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function u(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}c((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.IoTizeBleCordovaPlugin=void 0;const i=n(9012),o=n(8588),s=n(1691),u=n(4143),c=n(1717),a=n(1717),h=n(359);function l(t){try{return(0,i.hexStringToBuffer)(t)}catch(e){throw h.CordovaBLEError.invalidNativeCallResult(t,e)}}function f(t){return"object"==typeof t&&t.code&&t.message?h.CordovaBLEError.isValidErrorCode(t.code)?new h.CordovaBLEError(t.message,h.CordovaBLEError.Code[t.code]):h.CordovaBLEError.invalidErrorCode(t):h.CordovaBLEError.invalidErrorResult(t)}e.IoTizeBleCordovaPlugin=class{checkAvailable(){return this.execSingleResult("checkAvailable",[])}requestEnableBle(){return this.execSingleResult("enable",[])}startScan(t){return this.execMultipleResult("startScan",[JSON.stringify(t)])}stopScan(){return this.execSingleResult("stopScan",[])}connect(t,e=!0){return this.askBleEnable(e).pipe((0,c.switchMap)((()=>this.execMultipleResult("connect",[t]).pipe((0,a.map)((t=>(t in s.ConnectionState||console.warn(`Plugin native code returned an invalid connection state: "${t}".`),(0,o.safeEnumValue)(s.ConnectionState,t))))))))}askBleEnable(t){return(0,u.defer)((()=>r(this,void 0,void 0,(function*(){t&&((yield this.checkAvailable())||(yield this.requestEnableBle()))}))))}requestMTU(t,e){return this.execSingleResult("requestMTU",[t,e])}connectAndDiscoverTapServices(t,e=!0){return this.askBleEnable(e).pipe((0,c.switchMap)((()=>this.execMultipleResult("connectAndDiscoverTapServices",[t]).pipe((0,a.map)((t=>(t in s.ConnectionState||console.warn(`Plugin native code returned an invalid connection state: "${t}".`),(0,o.safeEnumValue)(s.ConnectionState,t))))))))}disConnect(t){return this.execSingleResult("disConnect",[t])}close(t){return this.execSingleResult("close",[t])}isConnected(t){return this.execSingleResult("isConnected",[t])}send(t,e){return r(this,void 0,void 0,(function*(){return l(yield this.execSingleResult("sendRequest",[t,(0,i.bufferToHexString)(e)]))}))}getLastError(){return this.execSingleResult("getLastError",[])}characteristicStartNotification(t,e,n){return this.execSingleResult("characteristicStartNotification",[t,e,n])}characteristicChanged(t,e,n){return this.execMultipleResult("characteristicChanged",[t,e,n]).pipe((0,a.map)((t=>l(t))))}characteristicStopNotification(t,e,n){return this.execSingleResult("characteristicStopNotification",[t,e,n])}characteristicReadValue(t,e,n){return r(this,void 0,void 0,(function*(){return l(yield this.execSingleResult("characteristicRead",[t,e,n]))}))}characteristicWrite(t,e,n,r){return this.execSingleResult("characteristicWrite",[t,e,n,(0,i.bufferToHexString)(r)])}characteristicWriteWithoutResponse(t,e,n,r){return this.execSingleResult("characteristicWriteWithoutResponse",[t,e,n,(0,i.bufferToHexString)(r)])}discoverServices(t){return r(this,void 0,void 0,(function*(){return yield this.execSingleResult("discoverServices",[t])}))}execSingleResult(t,e){return new Promise(((n,r)=>{cordova.exec(n,(t=>{r(f(t))}),"BLECom",t,e)}))}execMultipleResult(t,e){const n=new u.Subject;return cordova.exec((t=>{n.next(t)}),(t=>{n.error(f(t))}),"BLECom",t,e),n.asObservable()}}},1326:(t,e,n)=>{const r=new(n(1890).IoTizeBleCordovaPlugin);t.exports=r},655:(t,e,n)=>{n.d(e,{ZT:()=>i});var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r=n(1326);module.exports=r})();