Date: Mon, 23 Oct 2023 13:13:52 +0000
Subject: [PATCH 47/82] chore(deps): update actions/setup-node action to v3.8.2
---
.github/workflows/main.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3570f6f2..0599dd52 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -93,7 +93,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
- uses: actions/setup-node@v3.8.1
+ uses: actions/setup-node@v3.8.2
with:
node-version: ${{ matrix.node }}
From eb698747548e79a8e56fdccde896e4f718b66732 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Mon, 23 Oct 2023 16:40:44 +0000
Subject: [PATCH 48/82] chore(deps): update dependency async-test-util to
v2.2.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 39007aa9..9efd0f63 100644
--- a/package.json
+++ b/package.json
@@ -108,7 +108,7 @@
"@babel/types": "7.23.0",
"@types/core-js": "2.5.7",
"assert": "2.1.0",
- "async-test-util": "2.1.1",
+ "async-test-util": "2.2.0",
"browserify": "17.0.0",
"child-process-promise": "2.2.1",
"clone": "2.1.2",
From a476cbf171060011e255558032dd27cd2e632a56 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 25 Oct 2023 16:51:31 +0000
Subject: [PATCH 49/82] chore(deps): update dependency async-test-util to
v2.2.1
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 9efd0f63..b6042302 100644
--- a/package.json
+++ b/package.json
@@ -108,7 +108,7 @@
"@babel/types": "7.23.0",
"@types/core-js": "2.5.7",
"assert": "2.1.0",
- "async-test-util": "2.2.0",
+ "async-test-util": "2.2.1",
"browserify": "17.0.0",
"child-process-promise": "2.2.1",
"clone": "2.1.2",
From c4e83b1387bb906410d8d7e98eef9c9939e9e2d4 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Thu, 26 Oct 2023 01:13:51 +0200
Subject: [PATCH 50/82] chore(deps): update actions/setup-node action to v4
(#1285)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
.github/workflows/main.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 0599dd52..20949a2f 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -93,7 +93,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
- uses: actions/setup-node@v3.8.2
+ uses: actions/setup-node@v4.0.0
with:
node-version: ${{ matrix.node }}
From d0acfd5bb255e02c70bc6931ae559d89858b97da Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Thu, 26 Oct 2023 15:46:23 +0000
Subject: [PATCH 51/82] fix(deps): update dependency oblivious-set to v1.4.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index b6042302..d6ecded2 100644
--- a/package.json
+++ b/package.json
@@ -92,7 +92,7 @@
],
"dependencies": {
"@babel/runtime": "7.23.2",
- "oblivious-set": "1.1.1",
+ "oblivious-set": "1.4.0",
"p-queue": "6.6.2",
"unload": "2.4.1"
},
From a90c818b4eaed7507e6ce48d050b6795499935e7 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat, 28 Oct 2023 10:57:02 +0000
Subject: [PATCH 52/82] chore(deps): update dependency rollup to v4.1.5
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index d6ecded2..c7631288 100644
--- a/package.json
+++ b/package.json
@@ -139,7 +139,7 @@
"random-int": "3.0.0",
"random-token": "0.0.8",
"rimraf": "5.0.5",
- "rollup": "4.1.4",
+ "rollup": "4.1.5",
"@rollup/plugin-terser": "0.4.4",
"testcafe": "3.3.0",
"ts-node": "10.9.1",
From eedab933e3131ec164a697bf85bf33a99299e62b Mon Sep 17 00:00:00 2001
From: Daniel Meyer <8926560+pubkey@users.noreply.github.com>
Date: Mon, 30 Oct 2023 03:22:02 +0100
Subject: [PATCH 53/82] Feature/deno (#1288)
* ADD deno support
* ADD deno support
* ADD docs
* FIX lint
* FIX test
* UPDATE node
* FIX check
* FIX tests
* CLEAR cache
* PIN node version
---
.github/README.md | 8 ++--
.github/workflows/main.yml | 75 +++++++++++++++++++++++++++++++++++---
CHANGELOG.md | 2 +
README.md | 2 +-
package.json | 12 +++++-
src/methods/native.js | 9 +++++
test/test-deno.js | 34 +++++++++++++++++
7 files changed, 129 insertions(+), 13 deletions(-)
create mode 100644 test/test-deno.js
diff --git a/.github/README.md b/.github/README.md
index f48a3b00..06f8a1b5 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -7,7 +7,7 @@
BroadcastChannel
- A BroadcastChannel to send data across multiple browser-tabs or nodejs-processes
+ A BroadcastChannel to send data across multiple browser-tabs or nodejs-processes or Deno-Deploy-Instances
+ LeaderElection over the channels
@@ -22,7 +22,7 @@
* * *
-A BroadcastChannel that allows you to send data between different browser-tabs or nodejs-processes.
+A BroadcastChannel that allows you to send data between different browser-tabs or nodejs-processes or Deno-Deploy-Instances.
- It works completely **client-side** and **offline**,
- Tested on **old browsers**, **new browsers**, **WebWorkers**, **Iframes** and **NodeJs**.
@@ -188,7 +188,7 @@ Depending in which environment this is used, a proper method is automatically se
| Method | Used in | Description |
| ---------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **Native** | [Modern Browsers](https://caniuse.com/broadcastchannel) | If the browser supports the BroadcastChannel-API, this method will be used because it is the fastest |
+| **Native** | [Modern Browsers](https://caniuse.com/broadcastchannel) | If the browser supports the BroadcastChannel-API, this method will be used because it is the fastest. This is also used in Deno runtimes. |
| **IndexedDB** | [Browsers with WebWorkers](https://caniuse.com/#feat=indexeddb) | If there is no native BroadcastChannel support, the IndexedDB method is used because it supports messaging between browser-tabs, iframes and WebWorkers |
| **LocalStorage** | [Older Browsers](https://caniuse.com/#feat=namevalue-storage) | In older browsers that do not support IndexedDb, a localstorage-method is used |
| **Sockets** | NodeJs | In NodeJs the communication is handled by sockets that send each other messages |
@@ -282,7 +282,7 @@ This module is optimised for:
- This is not a polyfill. Do not set this module to `window.BroadcastChannel`. This implementation behaves similiar to the [BroadcastChannel-Standard](https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API) with these limitations:
- You can only send data that can be `JSON.stringify`-ed,
- While the offical API emits [onmessage-events](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/onmessage), this module directly emitts the data which was posted.
-- This is not a replacement for a message queue. If you use this in NodeJs and want send more than 50 messages per second, you should use proper [IPC-Tooling](https://en.wikipedia.org/wiki/Message_queue).
+- This is not a replacement for a message queue. If you use this in NodeJs or Deno and want send more than 50 messages per second, you should use proper [IPC-Tooling](https://en.wikipedia.org/wiki/Message_queue).
## Browser Support
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 20949a2f..105b77a1 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -13,6 +13,11 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
+# https://stackoverflow.com/a/72408109/3443137
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
@@ -24,6 +29,10 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
+ - name: Setup Node.js environment
+ uses: actions/setup-node@v4.0.0
+ with:
+ node-version: '20.9.0'
# https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows
- name: Reuse npm cache folder
@@ -37,10 +46,10 @@ jobs:
./node_modules
./test-electron/node_modules
# invalidate cache when any package.json changes
- key: ${{ runner.os }}-npm-x1-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
+ key: ${{ runner.os }}-npm-x2-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
- ${{ runner.os }}-npm-x1-${{ env.cache-name }}-
- ${{ runner.os }}-npm-x1-
+ ${{ runner.os }}-npm-x2-${{ env.cache-name }}-
+ ${{ runner.os }}-npm-x2-
${{ runner.os }}-
# install
@@ -89,7 +98,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
- node: ['17.3.0', '18.12.1']
+ node: ['18.18.2', '20.9.0']
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
@@ -108,9 +117,9 @@ jobs:
./node_modules
./test-electron/node_modules
# invalidate cache when any package.json changes
- key: ${{ runner.os }}-npm-test-node-x1-${{ matrix.node }}-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
+ key: ${{ runner.os }}-npm-test-node-x2-${{ matrix.node }}-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
- ${{ runner.os }}-npm-test-node-x1-${{ matrix.node }}-${{ env.cache-name }}-
+ ${{ runner.os }}-npm-test-node-x2-${{ matrix.node }}-${{ env.cache-name }}-
${{ runner.os }}-npm-test-node
${{ runner.os }}-test-node
@@ -124,6 +133,60 @@ jobs:
run: npm run test:node
+ test-deno:
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Node.js environment
+ uses: actions/setup-node@v4.0.0
+ with:
+ node-version: '20.9.0'
+
+ # https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows
+ - name: Reuse npm cache folder
+ uses: actions/cache@v3
+ env:
+ cache-name: cache-node-modules
+ with:
+ path: |
+ ~/.npm
+ ./node_modules
+ ./test-electron/node_modules
+ # invalidate cache when any package.json changes
+ key: ${{ runner.os }}-npm-test-deno-x2-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
+ restore-keys: |
+ ${{ runner.os }}-npm-test-deno-x2-${{ env.cache-name }}-
+ ${{ runner.os }}-npm-test-deno
+ ${{ runner.os }}-test-deno
+
+ - name: install node modules
+ run: npm install --legacy-peer-deps
+
+ - name: build
+ run: npm run build
+
+ - name: Reuse deno cache folder
+ uses: actions/cache@v3
+ env:
+ cache-name: cache-deno-modules
+ with:
+ path: |
+ /home/runner/.cache/deno
+ # do not cache based on package.json because deno install randomly fails
+ # and it would then never succeed on the first run on dependency updateds
+ key: ${{ runner.os }}-deno-x2-
+
+ - uses: denoland/setup-deno@v1
+ with:
+ # https://github.com/denoland/deno/releases
+ deno-version: "1.37.2"
+ - name: run deno tests
+ run: |
+ sudo npm i -g cross-env
+ deno info
+ npm run test:deno
+
+
# TODO this does not work atm. fix this.
# - name: test electron
# uses: GabrielBB/xvfb-action@v1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e38c004d..438b758c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,8 @@
## X.X.X (comming soon)
+- ADD support for the Deno runtime
+
## 5.5.1 (23 October 2023)
- REPLACE `new Date().getTime()` with `Date.now()` which is faster
diff --git a/README.md b/README.md
index 6727879d..2dd9184d 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
BroadcastChannel
- A BroadcastChannel that works in old browsers, new browsers, WebWorkers and NodeJs
+ A BroadcastChannel that works in old browsers, new browsers, WebWorkers and NodeJs and Deno
+ LeaderElection over the channels
diff --git a/package.json b/package.json
index c7631288..17491ae6 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "broadcast-channel",
"version": "5.5.1",
- "description": "A BroadcastChannel that works in New Browsers, Old Browsers, WebWorkers and NodeJs and iframes",
+ "description": "A BroadcastChannel that works in New Browsers, Old Browsers, WebWorkers, NodeJs, Deno and iframes",
"exports": {
".": {
"node": {
@@ -9,6 +9,11 @@
"import": "./dist/esnode/index.js",
"default": "./dist/es5node/index.js"
},
+ "deno": {
+ "types": "./types/index.d.ts",
+ "import": "./dist/esbrowser/index.js",
+ "default": "./dist/lib/index.js"
+ },
"browser": {
"types": "./types/index.d.ts",
"import": "./dist/esbrowser/index.js",
@@ -34,7 +39,9 @@
"postMessage",
"crosstab",
"ipc",
- "leader-election"
+ "leader-election",
+ "queue",
+ "inter-process"
],
"repository": {
"type": "git",
@@ -58,6 +65,7 @@
"test:module:cjs": "npm run build:es5node && mocha ./test/module.cjs.test.js -b --timeout 6000 --exit",
"test:node": "npm run build:es5node && mocha ./test/index.test.js -b --timeout 6000 --exit",
"test:node:loop": "npm run test:node && npm run test:node:loop",
+ "test:deno": "deno run --allow-env --unstable ./test/test-deno.js",
"test:browser": "npm run build && karma start ./config/karma.conf.js --single-run",
"test:e2e": "concurrently \"npm run docs:serve\" \"sleep 20 && testcafe -b && testcafe chrome -e test/e2e.test.js --hostname localhost\" --kill-others --success first",
"test:typings": "npm run build && mocha ./test/typings.test.js -b --timeout 12000 --exit",
diff --git a/src/methods/native.js b/src/methods/native.js
index d06862b7..fa14d229 100644
--- a/src/methods/native.js
+++ b/src/methods/native.js
@@ -1,3 +1,4 @@
+
import {
microSeconds as micro,
PROMISE_RESOLVED_VOID
@@ -42,6 +43,14 @@ export function onMessage(channelState, fn) {
}
export function canBeUsed() {
+
+ // Deno runtime
+ // eslint-disable-next-line
+ if (typeof globalThis !== 'undefined' && globalThis.Deno && globalThis.Deno.args) {
+ return true;
+ }
+
+ // Browser runtime
if (
(typeof window !== 'undefined' || typeof self !== 'undefined') &&
typeof BroadcastChannel === 'function'
diff --git a/test/test-deno.js b/test/test-deno.js
new file mode 100644
index 00000000..9aa974fb
--- /dev/null
+++ b/test/test-deno.js
@@ -0,0 +1,34 @@
+import { BroadcastChannel } from '../dist/esbrowser/index.js';
+import { randomString } from 'async-test-util';
+import assert from 'assert';
+export async function run() {
+
+ console.log('--- 1');
+
+ console.dir({
+ // eslint-disable-next-line
+ 'globalThis.Deno': !!globalThis.Deno,
+ // eslint-disable-next-line
+ 'globalThis.Deno.args': !!globalThis.Deno.args
+ });
+ console.log('--- 2');
+ // eslint-disable-next-line
+ console.log(Object.keys(Deno).sort().join(', '));
+
+ console.log('--- 3');
+
+
+ const bc = new BroadcastChannel(randomString());
+ console.log('bc.type: ' + bc.type);
+
+
+ /**
+ * Deno should use its global native BroadcastChannel
+ * @link https://docs.deno.com/deploy/api/runtime-broadcast-channel
+ */
+ assert.strictEqual(bc.type, 'native');
+
+ await bc.postMessage({ foo: 'bar' });
+ await bc.close();
+}
+run();
From 190aeac0c6c20ad960131f66ba53c7a8af4535e9 Mon Sep 17 00:00:00 2001
From: pubkey <8926560+pubkey@users.noreply.github.com>
Date: Mon, 30 Oct 2023 03:25:01 +0100
Subject: [PATCH 54/82] 6.0.0
---
CHANGELOG.md | 2 +
dist/es5node/methods/native.js | 7 +
dist/esbrowser/methods/native.js | 7 +
dist/esnode/methods/native.js | 7 +
dist/lib/browser.js | 99 +++++++++----
dist/lib/browser.min.js | 2 +-
dist/lib/methods/native.js | 7 +
docs/e2e.js | 241 ++++++++++++++++++++-----------
docs/iframe.js | 107 +++++++++-----
docs/index.js | 105 +++++++++-----
docs/leader-iframe.js | 107 +++++++++-----
docs/worker.js | 239 ++++++++++++++++++++----------
package.json | 2 +-
13 files changed, 630 insertions(+), 302 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 438b758c..d6655f43 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,8 @@
## X.X.X (comming soon)
+## 6.0.0 (30 October 2023)
+
- ADD support for the Deno runtime
## 5.5.1 (23 October 2023)
diff --git a/dist/es5node/methods/native.js b/dist/es5node/methods/native.js
index 0f656ca2..0ae3d2c1 100644
--- a/dist/es5node/methods/native.js
+++ b/dist/es5node/methods/native.js
@@ -45,6 +45,13 @@ function onMessage(channelState, fn) {
channelState.messagesCallback = fn;
}
function canBeUsed() {
+ // Deno runtime
+ // eslint-disable-next-line
+ if (typeof globalThis !== 'undefined' && globalThis.Deno && globalThis.Deno.args) {
+ return true;
+ }
+
+ // Browser runtime
if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof BroadcastChannel === 'function') {
if (BroadcastChannel._pubkey) {
throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');
diff --git a/dist/esbrowser/methods/native.js b/dist/esbrowser/methods/native.js
index cd27da13..6c1bbf88 100644
--- a/dist/esbrowser/methods/native.js
+++ b/dist/esbrowser/methods/native.js
@@ -31,6 +31,13 @@ export function onMessage(channelState, fn) {
channelState.messagesCallback = fn;
}
export function canBeUsed() {
+ // Deno runtime
+ // eslint-disable-next-line
+ if (typeof globalThis !== 'undefined' && globalThis.Deno && globalThis.Deno.args) {
+ return true;
+ }
+
+ // Browser runtime
if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof BroadcastChannel === 'function') {
if (BroadcastChannel._pubkey) {
throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');
diff --git a/dist/esnode/methods/native.js b/dist/esnode/methods/native.js
index cd27da13..6c1bbf88 100644
--- a/dist/esnode/methods/native.js
+++ b/dist/esnode/methods/native.js
@@ -31,6 +31,13 @@ export function onMessage(channelState, fn) {
channelState.messagesCallback = fn;
}
export function canBeUsed() {
+ // Deno runtime
+ // eslint-disable-next-line
+ if (typeof globalThis !== 'undefined' && globalThis.Deno && globalThis.Deno.args) {
+ return true;
+ }
+
+ // Browser runtime
if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof BroadcastChannel === 'function') {
if (BroadcastChannel._pubkey) {
throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');
diff --git a/dist/lib/browser.js b/dist/lib/browser.js
index 9a5ae61f..13b5d399 100644
--- a/dist/lib/browser.js
+++ b/dist/lib/browser.js
@@ -397,7 +397,7 @@ function beLeader(leaderElector) {
leaderElector._lstns.push(isLeaderListener);
return sendLeaderMessage(leaderElector, 'tell');
}
-},{"unload":19}],6:[function(require,module,exports){
+},{"unload":20}],6:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1428,6 +1428,13 @@ function onMessage(channelState, fn) {
channelState.messagesCallback = fn;
}
function canBeUsed() {
+ // Deno runtime
+ // eslint-disable-next-line
+ if (typeof globalThis !== 'undefined' && globalThis.Deno && globalThis.Deno.args) {
+ return true;
+ }
+
+ // Browser runtime
if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof BroadcastChannel === 'function') {
if (BroadcastChannel._pubkey) {
throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');
@@ -1642,6 +1649,35 @@ function _typeof(o) {
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
},{}],16:[function(require,module,exports){
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const pkg = __importStar(require("./index.js"));
+module.exports = pkg;
+
+},{"./index.js":17}],17:[function(require,module,exports){
+"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
/**
@@ -1649,21 +1685,21 @@ exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
* a given entry when a new entry is set and the ttl
* of the old one is over
*/
-var ObliviousSet = /** @class */ (function () {
- function ObliviousSet(ttl) {
+class ObliviousSet {
+ ttl;
+ map = new Map();
+ /**
+ * Creating calls to setTimeout() is expensive,
+ * so we only do that if there is not timeout already open.
+ */
+ _to = false;
+ constructor(ttl) {
this.ttl = ttl;
- this.map = new Map();
- /**
- * Creating calls to setTimeout() is expensive,
- * so we only do that if there is not timeout already open.
- */
- this._to = false;
}
- ObliviousSet.prototype.has = function (value) {
+ has(value) {
return this.map.has(value);
- };
- ObliviousSet.prototype.add = function (value) {
- var _this = this;
+ }
+ add(value) {
this.map.set(value, now());
/**
* When a new value is added,
@@ -1673,36 +1709,35 @@ var ObliviousSet = /** @class */ (function () {
*/
if (!this._to) {
this._to = true;
- setTimeout(function () {
- _this._to = false;
- removeTooOldValues(_this);
+ setTimeout(() => {
+ this._to = false;
+ removeTooOldValues(this);
}, 0);
}
- };
- ObliviousSet.prototype.clear = function () {
+ }
+ clear() {
this.map.clear();
- };
- return ObliviousSet;
-}());
+ }
+}
exports.ObliviousSet = ObliviousSet;
/**
* Removes all entries from the set
* where the TTL has expired
*/
function removeTooOldValues(obliviousSet) {
- var olderThen = now() - obliviousSet.ttl;
- var iterator = obliviousSet.map[Symbol.iterator]();
+ const olderThen = now() - obliviousSet.ttl;
+ const iterator = obliviousSet.map[Symbol.iterator]();
/**
* Because we can assume the new values are added at the bottom,
* we start from the top and stop as soon as we reach a non-too-old value.
*/
while (true) {
- var next = iterator.next().value;
+ const next = iterator.next().value;
if (!next) {
return; // no more elements
}
- var value = next[0];
- var time = next[1];
+ const value = next[0];
+ const time = next[1];
if (time < olderThen) {
obliviousSet.map.delete(value);
}
@@ -1714,11 +1749,11 @@ function removeTooOldValues(obliviousSet) {
}
exports.removeTooOldValues = removeTooOldValues;
function now() {
- return new Date().getTime();
+ return Date.now();
}
exports.now = now;
-},{}],17:[function(require,module,exports){
+},{}],18:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
@@ -1904,7 +1939,7 @@ process.chdir = function (dir) {
};
process.umask = function() { return 0; };
-},{}],18:[function(require,module,exports){
+},{}],19:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1956,7 +1991,7 @@ function addBrowser(fn) {
* @link https://stackoverflow.com/a/26193516/3443137
*/
}
-},{}],19:[function(require,module,exports){
+},{}],20:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -2017,7 +2052,7 @@ function getSize() {
return LISTENERS.size;
}
}).call(this)}).call(this,require('_process'))
-},{"./browser.js":18,"./node.js":20,"_process":17}],20:[function(require,module,exports){
+},{"./browser.js":19,"./node.js":21,"_process":18}],21:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -2056,4 +2091,4 @@ function addNode(fn) {
});
}
}).call(this)}).call(this,require('_process'))
-},{"_process":17}]},{},[2]);
+},{"_process":18}]},{},[2]);
diff --git a/dist/lib/browser.min.js b/dist/lib/browser.min.js
index 6b287c76..7e09252a 100644
--- a/dist/lib/browser.min.js
+++ b/dist/lib/browser.min.js
@@ -1 +1 @@
-!function o(r,i,s){function a(t,e){if(!i[t]){if(!r[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(u)return u(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}n=i[t]={exports:{}},r[t][0].call(n.exports,function(e){return a(r[t][1][e]||e)},n,n.exports,o,r,i,s)}return i[t].exports}for(var u="function"==typeof require&&require,e=0;e=t&&e.fn(n.data)})},r=i.method.microSeconds(),i._prepP?i._prepP.then(function(){i._iL=!0,i.method.onMessage(i._state,o,r)}):(i._iL=!0,i.method.onMessage(i._state,o,r)))}function f(e,t,n){e._addEL[t]=e._addEL[t].filter(function(e){return e!==n});t=e;t._iL&&!l(t)&&(t._iL=!1,e=t.method.microSeconds(),t.method.onMessage(t._state,null,e))}e._pubkey=!0,e.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return c(this,"message",e)},postInternal:function(e){return c(this,"internal",e)},set onmessage(e){var t={time:this.method.microSeconds(),fn:e};f(this,"message",this._onML),e&&"function"==typeof e?(this._onML=t,d(this,"message",t)):this._onML=null},addEventListener:function(e,t){var n=this.method.microSeconds();d(this,e,{time:n,fn:t})},removeEventListener:function(e,t){var n=this._addEL[e].find(function(e){return e.fn===t});f(this,e,n)},close:function(){var e,t=this;if(!this.closed)return a.delete(this),this.closed=!0,e=this._prepP||r.PROMISE_RESOLVED_VOID,this._onML=null,this._addEL.message=[],e.then(function(){return Promise.all(Array.from(t._uMP))}).then(function(){return Promise.all(t._befC.map(function(e){return e()}))}).then(function(){return t.method.close(t._state)})},get type(){return this.method.type},get isClosed(){return this.closed}}},{"./method-chooser.js":8,"./options.js":13,"./util.js":14}],2:[function(e,t,n){"use strict";var e=e("./index.es5.js"),o=e.BroadcastChannel,e=e.createLeaderElection;window.BroadcastChannel2=o,window.createLeaderElection=e},{"./index.es5.js":3}],3:[function(e,t,n){"use strict";e=e("./index.js");t.exports={BroadcastChannel:e.BroadcastChannel,createLeaderElection:e.createLeaderElection,clearNodeFolder:e.clearNodeFolder,enforceOptions:e.enforceOptions,beLeader:e.beLeader}},{"./index.js":4}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"BroadcastChannel",{enumerable:!0,get:function(){return o.BroadcastChannel}}),Object.defineProperty(n,"OPEN_BROADCAST_CHANNELS",{enumerable:!0,get:function(){return o.OPEN_BROADCAST_CHANNELS}}),Object.defineProperty(n,"beLeader",{enumerable:!0,get:function(){return i.beLeader}}),Object.defineProperty(n,"clearNodeFolder",{enumerable:!0,get:function(){return o.clearNodeFolder}}),Object.defineProperty(n,"createLeaderElection",{enumerable:!0,get:function(){return r.createLeaderElection}}),Object.defineProperty(n,"enforceOptions",{enumerable:!0,get:function(){return o.enforceOptions}});var o=e("./broadcast-channel.js"),r=e("./leader-election.js"),i=e("./leader-election-util.js")},{"./broadcast-channel.js":1,"./leader-election-util.js":5,"./leader-election.js":7}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.beLeader=function(t){t.isLeader=!0,t._hasLeader=!0;function e(e){"leader"===e.context&&"apply"===e.action&&r(t,"tell"),"leader"!==e.context||"tell"!==e.action||t._dpLC||(t._dpLC=!0,t._dpL(),r(t,"tell"))}var n=(0,o.add)(function(){return t.die()});t._unl.push(n);return t.broadcastChannel.addEventListener("internal",e),t._lstns.push(e),r(t,"tell")},n.sendLeaderMessage=r;var o=e("unload");function r(e,t){t={context:"leader",action:t,token:e.token};return e.broadcastChannel.postInternal(t)}},{unload:19}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.LeaderElectionWebLock=void 0;var o=e("./util.js"),r=e("./leader-election-util.js");(n.LeaderElectionWebLock=function(e,t){var n=this;(this.broadcastChannel=e)._befC.push(function(){return n.die()}),this._options=t,this.isLeader=!1,this.isDead=!1,this.token=(0,o.randomToken)(),this._lstns=[],this._unl=[],this._dpL=function(){},this._dpLC=!1,this._wKMC={},this.lN="pubkey-bc||"+e.method.type+"||"+e.name}).prototype={hasLeader:function(){var t=this;return navigator.locks.query().then(function(e){e=e.held?e.held.filter(function(e){return e.name===t.lN}):[];return!!(e&&0s.token&&n(),"tell"===e.action)&&(n(),s._hasLeader=!0)}),r=i?4*s._options.responseTime:s._options.responseTime,(0,u.sendLeaderMessage)(s,"apply").then(function(){return Promise.race([(0,a.sleep)(r),e.then(function(){return Promise.reject(new Error)})])}).then(function(){return(0,u.sendLeaderMessage)(s,"apply")}).then(function(){return Promise.race([(0,a.sleep)(r),e.then(function(){return Promise.reject(new Error)})])}).catch(function(){}).then(function(){return s.broadcastChannel.removeEventListener("internal",o),!t&&(0,u.beLeader)(s).then(function(){return!0})}));var t,n,e,o,r}).then(function(){s._aplQC=s._aplQC-1}),this._aplQ.then(function(){return s.isLeader}))},awaitLeadership:function(){return this._aLP||(this._aLP=function(r){if(r.isLeader)return a.PROMISE_RESOLVED_VOID;return new Promise(function(e){var t=!1;function n(){t||(t=!0,r.broadcastChannel.removeEventListener("internal",o),e(!0))}r.applyOnce().then(function(){r.isLeader&&n()});(function e(){return(0,a.sleep)(r._options.fallbackInterval).then(function(){if(!r.isDead&&!t)return r.isLeader?void n():r.applyOnce(!0).then(function(){(r.isLeader?n:e)()})})})();var o=function(e){"leader"===e.context&&"death"===e.action&&(r._hasLeader=!1,r.applyOnce().then(function(){r.isLeader&&n()}))};r.broadcastChannel.addEventListener("internal",o),r._lstns.push(o)})}(this)),this._aLP},set onduplicate(e){this._dpL=e},die:function(){var t=this;return this._lstns.forEach(function(e){return t.broadcastChannel.removeEventListener("internal",e)}),this._lstns=[],this._unl.forEach(function(e){return e.remove()}),this._unl=[],this.isLeader&&(this._hasLeader=!1,this.isLeader=!1),this.isDead=!0,(0,u.sendLeaderMessage)(this,"death")}}},{"./leader-election-util.js":5,"./leader-election-web-lock.js":6,"./util.js":14}],8:[function(e,t,n){"use strict";e("@babel/runtime/helpers/typeof");Object.defineProperty(n,"__esModule",{value:!0}),n.chooseMethod=function(t){var e=[].concat(t.methods,s).filter(Boolean);if(t.type){if("simulate"===t.type)return i.SimulateMethod;var n=e.find(function(e){return e.type===t.type});if(n)return n;throw new Error("method-type "+t.type+" not found")}t.webWorkerSupport||(e=e.filter(function(e){return"idb"!==e.type}));n=e.find(function(e){return e.canBeUsed()});{if(n)return n;throw new Error("No usable method found in "+JSON.stringify(s.map(function(e){return e.type})))}};var n=e("./methods/native.js"),o=e("./methods/indexed-db.js"),r=e("./methods/localstorage.js"),i=e("./methods/simulate.js");var s=[n.NativeMethod,o.IndexedDBMethod,r.LocalstorageMethod]},{"./methods/indexed-db.js":9,"./methods/localstorage.js":10,"./methods/native.js":11,"./methods/simulate.js":12,"@babel/runtime/helpers/typeof":15}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.TRANSACTION_SETTINGS=n.IndexedDBMethod=void 0,n.averageResponseTime=E,n.canBeUsed=y,n.cleanOldMessages=v,n.close=g,n.commitIndexedDBTransaction=d,n.create=_,n.createDatabase=u,n.getAllMessages=function(e){var n=e.transaction(c,"readonly",l),o=n.objectStore(c),r=[];return new Promise(function(t){o.openCursor().onsuccess=function(e){e=e.target.result;e?(r.push(e.value),e.continue()):(d(n),t(r))}})},n.getIdb=a,n.getMessagesHigherThan=h,n.getOldMessages=m,n.microSeconds=void 0,n.onMessage=L,n.postMessage=w,n.removeMessagesById=p,n.type=void 0,n.writeMessage=f;var r=e("../util.js"),i=e("oblivious-set"),s=e("../options.js"),e=n.microSeconds=r.microSeconds,o="pubkey.broadcast-channel-0-",c="messages",l=n.TRANSACTION_SETTINGS={durability:"relaxed"};n.type="idb";function a(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof window){if(void 0!==window.mozIndexedDB)return window.mozIndexedDB;if(void 0!==window.webkitIndexedDB)return window.webkitIndexedDB;if(void 0!==window.msIndexedDB)return window.msIndexedDB}return!1}function d(e){e.commit&&e.commit()}function u(e){var n=a().open(o+e);return n.onupgradeneeded=function(e){e.target.result.createObjectStore(c,{keyPath:"id",autoIncrement:!0})},new Promise(function(e,t){n.onerror=function(e){return t(e)},n.onsuccess=function(){e(n.result)}})}function f(e,t,n){var o={uuid:t,time:Date.now(),data:n},r=e.transaction([c],"readwrite",l);return new Promise(function(e,t){r.oncomplete=function(){return e()},r.onerror=function(e){return t(e)},r.objectStore(c).add(o),d(r)})}function h(e,o){var r,i=e.transaction(c,"readonly",l),s=i.objectStore(c),a=[],u=IDBKeyRange.bound(o+1,1/0);return s.getAll?(r=s.getAll(u),new Promise(function(t,n){r.onerror=function(e){return n(e)},r.onsuccess=function(e){t(e.target.result)}})):new Promise(function(t,n){var e=function(){try{return u=IDBKeyRange.bound(o+1,1/0),s.openCursor(u)}catch(e){return s.openCursor()}}();e.onerror=function(e){return n(e)},e.onsuccess=function(e){e=e.target.result;e?e.value.idn.lastCursorId&&(n.lastCursorId=e.id),e}).filter(function(e){return t=n,(e=e).uuid!==t.uuid&&!(t.eMIs.has(e.id)||e.data.time=t&&e.fn(n.data)})},r=i.method.microSeconds(),i._prepP?i._prepP.then(function(){i._iL=!0,i.method.onMessage(i._state,o,r)}):(i._iL=!0,i.method.onMessage(i._state,o,r)))}function f(e,t,n){e._addEL[t]=e._addEL[t].filter(function(e){return e!==n});t=e;t._iL&&!l(t)&&(t._iL=!1,e=t.method.microSeconds(),t.method.onMessage(t._state,null,e))}e._pubkey=!0,e.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return c(this,"message",e)},postInternal:function(e){return c(this,"internal",e)},set onmessage(e){var t={time:this.method.microSeconds(),fn:e};f(this,"message",this._onML),e&&"function"==typeof e?(this._onML=t,d(this,"message",t)):this._onML=null},addEventListener:function(e,t){var n=this.method.microSeconds();d(this,e,{time:n,fn:t})},removeEventListener:function(e,t){var n=this._addEL[e].find(function(e){return e.fn===t});f(this,e,n)},close:function(){var e,t=this;if(!this.closed)return a.delete(this),this.closed=!0,e=this._prepP||r.PROMISE_RESOLVED_VOID,this._onML=null,this._addEL.message=[],e.then(function(){return Promise.all(Array.from(t._uMP))}).then(function(){return Promise.all(t._befC.map(function(e){return e()}))}).then(function(){return t.method.close(t._state)})},get type(){return this.method.type},get isClosed(){return this.closed}}},{"./method-chooser.js":8,"./options.js":13,"./util.js":14}],2:[function(e,t,n){"use strict";var e=e("./index.es5.js"),o=e.BroadcastChannel,e=e.createLeaderElection;window.BroadcastChannel2=o,window.createLeaderElection=e},{"./index.es5.js":3}],3:[function(e,t,n){"use strict";e=e("./index.js");t.exports={BroadcastChannel:e.BroadcastChannel,createLeaderElection:e.createLeaderElection,clearNodeFolder:e.clearNodeFolder,enforceOptions:e.enforceOptions,beLeader:e.beLeader}},{"./index.js":4}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"BroadcastChannel",{enumerable:!0,get:function(){return o.BroadcastChannel}}),Object.defineProperty(n,"OPEN_BROADCAST_CHANNELS",{enumerable:!0,get:function(){return o.OPEN_BROADCAST_CHANNELS}}),Object.defineProperty(n,"beLeader",{enumerable:!0,get:function(){return i.beLeader}}),Object.defineProperty(n,"clearNodeFolder",{enumerable:!0,get:function(){return o.clearNodeFolder}}),Object.defineProperty(n,"createLeaderElection",{enumerable:!0,get:function(){return r.createLeaderElection}}),Object.defineProperty(n,"enforceOptions",{enumerable:!0,get:function(){return o.enforceOptions}});var o=e("./broadcast-channel.js"),r=e("./leader-election.js"),i=e("./leader-election-util.js")},{"./broadcast-channel.js":1,"./leader-election-util.js":5,"./leader-election.js":7}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.beLeader=function(t){t.isLeader=!0,t._hasLeader=!0;function e(e){"leader"===e.context&&"apply"===e.action&&r(t,"tell"),"leader"!==e.context||"tell"!==e.action||t._dpLC||(t._dpLC=!0,t._dpL(),r(t,"tell"))}var n=(0,o.add)(function(){return t.die()});t._unl.push(n);return t.broadcastChannel.addEventListener("internal",e),t._lstns.push(e),r(t,"tell")},n.sendLeaderMessage=r;var o=e("unload");function r(e,t){t={context:"leader",action:t,token:e.token};return e.broadcastChannel.postInternal(t)}},{unload:20}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.LeaderElectionWebLock=void 0;var o=e("./util.js"),r=e("./leader-election-util.js");(n.LeaderElectionWebLock=function(e,t){var n=this;(this.broadcastChannel=e)._befC.push(function(){return n.die()}),this._options=t,this.isLeader=!1,this.isDead=!1,this.token=(0,o.randomToken)(),this._lstns=[],this._unl=[],this._dpL=function(){},this._dpLC=!1,this._wKMC={},this.lN="pubkey-bc||"+e.method.type+"||"+e.name}).prototype={hasLeader:function(){var t=this;return navigator.locks.query().then(function(e){e=e.held?e.held.filter(function(e){return e.name===t.lN}):[];return!!(e&&0s.token&&n(),"tell"===e.action)&&(n(),s._hasLeader=!0)}),r=i?4*s._options.responseTime:s._options.responseTime,(0,u.sendLeaderMessage)(s,"apply").then(function(){return Promise.race([(0,a.sleep)(r),e.then(function(){return Promise.reject(new Error)})])}).then(function(){return(0,u.sendLeaderMessage)(s,"apply")}).then(function(){return Promise.race([(0,a.sleep)(r),e.then(function(){return Promise.reject(new Error)})])}).catch(function(){}).then(function(){return s.broadcastChannel.removeEventListener("internal",o),!t&&(0,u.beLeader)(s).then(function(){return!0})}));var t,n,e,o,r}).then(function(){s._aplQC=s._aplQC-1}),this._aplQ.then(function(){return s.isLeader}))},awaitLeadership:function(){return this._aLP||(this._aLP=function(r){if(r.isLeader)return a.PROMISE_RESOLVED_VOID;return new Promise(function(e){var t=!1;function n(){t||(t=!0,r.broadcastChannel.removeEventListener("internal",o),e(!0))}r.applyOnce().then(function(){r.isLeader&&n()});(function e(){return(0,a.sleep)(r._options.fallbackInterval).then(function(){if(!r.isDead&&!t)return r.isLeader?void n():r.applyOnce(!0).then(function(){(r.isLeader?n:e)()})})})();var o=function(e){"leader"===e.context&&"death"===e.action&&(r._hasLeader=!1,r.applyOnce().then(function(){r.isLeader&&n()}))};r.broadcastChannel.addEventListener("internal",o),r._lstns.push(o)})}(this)),this._aLP},set onduplicate(e){this._dpL=e},die:function(){var t=this;return this._lstns.forEach(function(e){return t.broadcastChannel.removeEventListener("internal",e)}),this._lstns=[],this._unl.forEach(function(e){return e.remove()}),this._unl=[],this.isLeader&&(this._hasLeader=!1,this.isLeader=!1),this.isDead=!0,(0,u.sendLeaderMessage)(this,"death")}}},{"./leader-election-util.js":5,"./leader-election-web-lock.js":6,"./util.js":14}],8:[function(e,t,n){"use strict";e("@babel/runtime/helpers/typeof");Object.defineProperty(n,"__esModule",{value:!0}),n.chooseMethod=function(t){var e=[].concat(t.methods,s).filter(Boolean);if(t.type){if("simulate"===t.type)return i.SimulateMethod;var n=e.find(function(e){return e.type===t.type});if(n)return n;throw new Error("method-type "+t.type+" not found")}t.webWorkerSupport||(e=e.filter(function(e){return"idb"!==e.type}));n=e.find(function(e){return e.canBeUsed()});{if(n)return n;throw new Error("No usable method found in "+JSON.stringify(s.map(function(e){return e.type})))}};var n=e("./methods/native.js"),o=e("./methods/indexed-db.js"),r=e("./methods/localstorage.js"),i=e("./methods/simulate.js");var s=[n.NativeMethod,o.IndexedDBMethod,r.LocalstorageMethod]},{"./methods/indexed-db.js":9,"./methods/localstorage.js":10,"./methods/native.js":11,"./methods/simulate.js":12,"@babel/runtime/helpers/typeof":15}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.TRANSACTION_SETTINGS=n.IndexedDBMethod=void 0,n.averageResponseTime=E,n.canBeUsed=L,n.cleanOldMessages=v,n.close=g,n.commitIndexedDBTransaction=d,n.create=_,n.createDatabase=u,n.getAllMessages=function(e){var n=e.transaction(c,"readonly",l),o=n.objectStore(c),r=[];return new Promise(function(t){o.openCursor().onsuccess=function(e){e=e.target.result;e?(r.push(e.value),e.continue()):(d(n),t(r))}})},n.getIdb=a,n.getMessagesHigherThan=h,n.getOldMessages=m,n.microSeconds=void 0,n.onMessage=y,n.postMessage=w,n.removeMessagesById=p,n.type=void 0,n.writeMessage=f;var r=e("../util.js"),i=e("oblivious-set"),s=e("../options.js"),e=n.microSeconds=r.microSeconds,o="pubkey.broadcast-channel-0-",c="messages",l=n.TRANSACTION_SETTINGS={durability:"relaxed"};n.type="idb";function a(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof window){if(void 0!==window.mozIndexedDB)return window.mozIndexedDB;if(void 0!==window.webkitIndexedDB)return window.webkitIndexedDB;if(void 0!==window.msIndexedDB)return window.msIndexedDB}return!1}function d(e){e.commit&&e.commit()}function u(e){var n=a().open(o+e);return n.onupgradeneeded=function(e){e.target.result.createObjectStore(c,{keyPath:"id",autoIncrement:!0})},new Promise(function(e,t){n.onerror=function(e){return t(e)},n.onsuccess=function(){e(n.result)}})}function f(e,t,n){var o={uuid:t,time:Date.now(),data:n},r=e.transaction([c],"readwrite",l);return new Promise(function(e,t){r.oncomplete=function(){return e()},r.onerror=function(e){return t(e)},r.objectStore(c).add(o),d(r)})}function h(e,o){var r,i=e.transaction(c,"readonly",l),s=i.objectStore(c),a=[],u=IDBKeyRange.bound(o+1,1/0);return s.getAll?(r=s.getAll(u),new Promise(function(t,n){r.onerror=function(e){return n(e)},r.onsuccess=function(e){t(e.target.result)}})):new Promise(function(t,n){var e=function(){try{return u=IDBKeyRange.bound(o+1,1/0),s.openCursor(u)}catch(e){return s.openCursor()}}();e.onerror=function(e){return n(e)},e.onsuccess=function(e){e=e.target.result;e?e.value.idn.lastCursorId&&(n.lastCursorId=e.id),e}).filter(function(e){return t=n,(e=e).uuid!==t.uuid&&!(t.eMIs.has(e.id)||e.data.time{this._to=!1,o(this)},0))}clear(){this.map.clear()}},n.removeTooOldValues=o,n.now=i},{}],18:[function(e,t,n){var o,r,t=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}try{o="function"==typeof setTimeout?setTimeout:i}catch(e){o=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}function a(t){if(o===setTimeout)return setTimeout(t,0);if((o===i||!o)&&setTimeout)return(o=setTimeout)(t,0);try{return o(t,0)}catch(e){try{return o.call(null,t,0)}catch(e){return o.call(this,t,0)}}}var u,c=[],l=!1,d=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):d=-1,c.length)&&h()}function h(){if(!l){for(var e=a(f),t=(l=!0,c.length);t;){for(u=c,c=[];++d p is keyof o} */
+module.exports = bind.call(call, $hasOwn);
-},{}],367:[function(require,module,exports){
+},{"function-bind":356}],367:[function(require,module,exports){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
var e, m
@@ -12822,7 +12826,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
'use strict';
var GetIntrinsic = require('get-intrinsic');
-var has = require('has');
+var hasOwn = require('hasown');
var channel = require('side-channel')();
var $TypeError = GetIntrinsic('%TypeError%');
@@ -12858,7 +12862,7 @@ var SLOT = {
throw new $TypeError('`slot` must be a string');
}
var slots = channel.get(O);
- return !!slots && has(slots, '$' + slot);
+ return !!slots && hasOwn(slots, '$' + slot);
},
set: function (O, slot, V) {
if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
@@ -12882,7 +12886,7 @@ if (Object.freeze) {
module.exports = SLOT;
-},{"get-intrinsic":358,"has":366,"side-channel":407}],369:[function(require,module,exports){
+},{"get-intrinsic":358,"hasown":366,"side-channel":409}],369:[function(require,module,exports){
'use strict';
var hasToStringTag = require('has-tostringtag/shams')();
@@ -13209,7 +13213,7 @@ module.exports = exported || function isMap(x) {
exports = module.exports = !!(typeof process !== 'undefined' && process.versions && process.versions.node);
}).call(this)}).call(this,require('_process'))
-},{"_process":400}],377:[function(require,module,exports){
+},{"_process":401}],377:[function(require,module,exports){
'use strict';
var numToStr = Number.prototype.toString;
@@ -13434,7 +13438,7 @@ module.exports = function isTypedArray(value) {
return !!whichTypedArray(value);
};
-},{"which-typed-array":414}],384:[function(require,module,exports){
+},{"which-typed-array":416}],384:[function(require,module,exports){
'use strict';
var $WeakMap = typeof WeakMap === 'function' && WeakMap.prototype ? WeakMap : null;
@@ -13766,12 +13770,13 @@ module.exports = function inspect_(obj, options, depth, seen) {
if (isString(obj)) {
return markBoxed(inspect(String(obj)));
}
+ // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
+ /* eslint-env browser */
+ if (typeof window !== 'undefined' && obj === window) {
+ return '{ [object Window] }';
+ }
if (obj === global) {
- /* eslint-env browser */
- if (typeof window !== 'undefined') {
- return '{ [object Window] }';
- }
- return '{ [object global] }';
+ return '{ [object globalThis] }';
}
if (!isDate(obj) && !isRegExp(obj)) {
var ys = arrObjKeys(obj, inspect);
@@ -14440,6 +14445,35 @@ module.exports = function shimAssign() {
},{"./polyfill":397,"define-properties":352}],399:[function(require,module,exports){
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const pkg = __importStar(require("./index.js"));
+module.exports = pkg;
+
+},{"./index.js":400}],400:[function(require,module,exports){
+"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
/**
@@ -14447,21 +14481,21 @@ exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
* a given entry when a new entry is set and the ttl
* of the old one is over
*/
-var ObliviousSet = /** @class */ (function () {
- function ObliviousSet(ttl) {
+class ObliviousSet {
+ ttl;
+ map = new Map();
+ /**
+ * Creating calls to setTimeout() is expensive,
+ * so we only do that if there is not timeout already open.
+ */
+ _to = false;
+ constructor(ttl) {
this.ttl = ttl;
- this.map = new Map();
- /**
- * Creating calls to setTimeout() is expensive,
- * so we only do that if there is not timeout already open.
- */
- this._to = false;
}
- ObliviousSet.prototype.has = function (value) {
+ has(value) {
return this.map.has(value);
- };
- ObliviousSet.prototype.add = function (value) {
- var _this = this;
+ }
+ add(value) {
this.map.set(value, now());
/**
* When a new value is added,
@@ -14471,36 +14505,35 @@ var ObliviousSet = /** @class */ (function () {
*/
if (!this._to) {
this._to = true;
- setTimeout(function () {
- _this._to = false;
- removeTooOldValues(_this);
+ setTimeout(() => {
+ this._to = false;
+ removeTooOldValues(this);
}, 0);
}
- };
- ObliviousSet.prototype.clear = function () {
+ }
+ clear() {
this.map.clear();
- };
- return ObliviousSet;
-}());
+ }
+}
exports.ObliviousSet = ObliviousSet;
/**
* Removes all entries from the set
* where the TTL has expired
*/
function removeTooOldValues(obliviousSet) {
- var olderThen = now() - obliviousSet.ttl;
- var iterator = obliviousSet.map[Symbol.iterator]();
+ const olderThen = now() - obliviousSet.ttl;
+ const iterator = obliviousSet.map[Symbol.iterator]();
/**
* Because we can assume the new values are added at the bottom,
* we start from the top and stop as soon as we reach a non-too-old value.
*/
while (true) {
- var next = iterator.next().value;
+ const next = iterator.next().value;
if (!next) {
return; // no more elements
}
- var value = next[0];
- var time = next[1];
+ const value = next[0];
+ const time = next[1];
if (time < olderThen) {
obliviousSet.map.delete(value);
}
@@ -14512,11 +14545,11 @@ function removeTooOldValues(obliviousSet) {
}
exports.removeTooOldValues = removeTooOldValues;
function now() {
- return new Date().getTime();
+ return Date.now();
}
exports.now = now;
-},{}],400:[function(require,module,exports){
+},{}],401:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
@@ -14702,7 +14735,7 @@ process.chdir = function (dir) {
};
process.umask = function() { return 0; };
-},{}],401:[function(require,module,exports){
+},{}],402:[function(require,module,exports){
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
@@ -15465,7 +15498,7 @@ try {
}
}
-},{}],402:[function(require,module,exports){
+},{}],403:[function(require,module,exports){
'use strict';
var setFunctionName = require('set-function-name');
@@ -15506,7 +15539,7 @@ module.exports = setFunctionName(function flags() {
}, 'get flags', true);
-},{"set-function-name":406}],403:[function(require,module,exports){
+},{"set-function-name":408}],404:[function(require,module,exports){
'use strict';
var define = require('define-properties');
@@ -15526,7 +15559,7 @@ define(flagsBound, {
module.exports = flagsBound;
-},{"./implementation":402,"./polyfill":404,"./shim":405,"call-bind":44,"define-properties":352}],404:[function(require,module,exports){
+},{"./implementation":403,"./polyfill":405,"./shim":406,"call-bind":44,"define-properties":352}],405:[function(require,module,exports){
'use strict';
var implementation = require('./implementation');
@@ -15564,7 +15597,7 @@ module.exports = function getPolyfill() {
return implementation;
};
-},{"./implementation":402,"define-properties":352}],405:[function(require,module,exports){
+},{"./implementation":403,"define-properties":352}],406:[function(require,module,exports){
'use strict';
var supportsDescriptors = require('define-properties').supportsDescriptors;
@@ -15592,7 +15625,50 @@ module.exports = function shimFlags() {
return polyfill;
};
-},{"./polyfill":404,"define-properties":352}],406:[function(require,module,exports){
+},{"./polyfill":405,"define-properties":352}],407:[function(require,module,exports){
+'use strict';
+
+var GetIntrinsic = require('get-intrinsic');
+var define = require('define-data-property');
+var hasDescriptors = require('has-property-descriptors')();
+var gOPD = require('gopd');
+
+var $TypeError = GetIntrinsic('%TypeError%');
+var $floor = GetIntrinsic('%Math.floor%');
+
+module.exports = function setFunctionLength(fn, length) {
+ if (typeof fn !== 'function') {
+ throw new $TypeError('`fn` is not a function');
+ }
+ if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
+ throw new $TypeError('`length` must be a positive 32-bit integer');
+ }
+
+ var loose = arguments.length > 2 && !!arguments[2];
+
+ var functionLengthIsConfigurable = true;
+ var functionLengthIsWritable = true;
+ if ('length' in fn && gOPD) {
+ var desc = gOPD(fn, 'length');
+ if (desc && !desc.configurable) {
+ functionLengthIsConfigurable = false;
+ }
+ if (desc && !desc.writable) {
+ functionLengthIsWritable = false;
+ }
+ }
+
+ if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
+ if (hasDescriptors) {
+ define(fn, 'length', length, true, true);
+ } else {
+ define(fn, 'length', length);
+ }
+ }
+ return fn;
+};
+
+},{"define-data-property":351,"get-intrinsic":358,"gopd":359,"has-property-descriptors":361}],408:[function(require,module,exports){
'use strict';
var define = require('define-data-property');
@@ -15616,7 +15692,7 @@ module.exports = function setFunctionName(fn, name) {
return fn;
};
-},{"define-data-property":351,"functions-have-names":357,"has-property-descriptors":361}],407:[function(require,module,exports){
+},{"define-data-property":351,"functions-have-names":357,"has-property-descriptors":361}],409:[function(require,module,exports){
'use strict';
var GetIntrinsic = require('get-intrinsic');
@@ -15742,7 +15818,7 @@ module.exports = function getSideChannel() {
return channel;
};
-},{"call-bind/callBound":43,"get-intrinsic":358,"object-inspect":387}],408:[function(require,module,exports){
+},{"call-bind/callBound":43,"get-intrinsic":358,"object-inspect":387}],410:[function(require,module,exports){
'use strict';
var SLOT = require('internal-slot');
@@ -15784,7 +15860,7 @@ module.exports = function getStopIterationIterator(origIterator) {
return siIterator;
};
-},{"internal-slot":368}],409:[function(require,module,exports){
+},{"internal-slot":368}],411:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -15836,7 +15912,7 @@ function addBrowser(fn) {
* @link https://stackoverflow.com/a/26193516/3443137
*/
}
-},{}],410:[function(require,module,exports){
+},{}],412:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -15897,7 +15973,7 @@ function getSize() {
return LISTENERS.size;
}
}).call(this)}).call(this,require('_process'))
-},{"./browser.js":409,"./node.js":411,"_process":400}],411:[function(require,module,exports){
+},{"./browser.js":411,"./node.js":413,"_process":401}],413:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -15936,7 +16012,7 @@ function addNode(fn) {
});
}
}).call(this)}).call(this,require('_process'))
-},{"_process":400}],412:[function(require,module,exports){
+},{"_process":401}],414:[function(require,module,exports){
'use strict';
var isString = require('is-string');
@@ -15968,7 +16044,7 @@ module.exports = function whichBoxedPrimitive(value) {
}
};
-},{"is-bigint":371,"is-boolean-object":372,"is-number-object":377,"is-string":381,"is-symbol":382}],413:[function(require,module,exports){
+},{"is-bigint":371,"is-boolean-object":372,"is-number-object":377,"is-string":381,"is-symbol":382}],415:[function(require,module,exports){
'use strict';
var isMap = require('is-map');
@@ -15994,7 +16070,7 @@ module.exports = function whichCollection(value) {
return false;
};
-},{"is-map":375,"is-set":379,"is-weakmap":384,"is-weakset":385}],414:[function(require,module,exports){
+},{"is-map":375,"is-set":379,"is-weakmap":384,"is-weakset":385}],416:[function(require,module,exports){
(function (global){(function (){
'use strict';
@@ -16038,7 +16114,10 @@ if (hasToStringTag && gOPD && getPrototypeOf) {
} else {
forEach(typedArrays, function (typedArray) {
var arr = new g[typedArray]();
- cache['$' + typedArray] = callBind(arr.slice);
+ var fn = arr.slice || arr.set;
+ if (fn) {
+ cache['$' + typedArray] = callBind(fn);
+ }
});
}
@@ -16087,7 +16166,7 @@ module.exports = function whichTypedArray(value) {
};
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"available-typed-arrays":39,"call-bind":44,"call-bind/callBound":43,"for-each":354,"gopd":359,"has-tostringtag/shams":365}],415:[function(require,module,exports){
+},{"available-typed-arrays":39,"call-bind":44,"call-bind/callBound":43,"for-each":354,"gopd":359,"has-tostringtag/shams":365}],417:[function(require,module,exports){
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -16461,7 +16540,7 @@ try {
console.log('error in run-function:');
console.error(error);
}
-},{"../../":2,"./util.js":416,"@babel/polyfill":14,"@babel/runtime/helpers/asyncToGenerator":16,"@babel/runtime/helpers/interopRequireDefault":17,"@babel/runtime/regenerator":20,"async-test-util":25}],416:[function(require,module,exports){
+},{"../../":2,"./util.js":418,"@babel/polyfill":14,"@babel/runtime/helpers/asyncToGenerator":16,"@babel/runtime/helpers/interopRequireDefault":17,"@babel/runtime/regenerator":20,"async-test-util":25}],418:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -16480,4 +16559,4 @@ function getParameterByName(name, url) {
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
-},{}]},{},[415]);
+},{}]},{},[417]);
diff --git a/docs/iframe.js b/docs/iframe.js
index 8e96ffc4..fe7f1ca6 100644
--- a/docs/iframe.js
+++ b/docs/iframe.js
@@ -389,7 +389,7 @@ function beLeader(leaderElector) {
leaderElector._lstns.push(isLeaderListener);
return sendLeaderMessage(leaderElector, 'tell');
}
-},{"unload":325}],5:[function(require,module,exports){
+},{"unload":326}],5:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1420,6 +1420,13 @@ function onMessage(channelState, fn) {
channelState.messagesCallback = fn;
}
function canBeUsed() {
+ // Deno runtime
+ // eslint-disable-next-line
+ if (typeof globalThis !== 'undefined' && globalThis.Deno && globalThis.Deno.args) {
+ return true;
+ }
+
+ // Browser runtime
if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof BroadcastChannel === 'function') {
if (BroadcastChannel._pubkey) {
throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');
@@ -1665,7 +1672,7 @@ require("core-js/fn/promise/finally");
require("core-js/web");
require("regenerator-runtime/runtime");
-},{"core-js/es6":17,"core-js/fn/array/flat-map":18,"core-js/fn/array/includes":19,"core-js/fn/object/entries":20,"core-js/fn/object/get-own-property-descriptors":21,"core-js/fn/object/values":22,"core-js/fn/promise/finally":23,"core-js/fn/string/pad-end":24,"core-js/fn/string/pad-start":25,"core-js/fn/string/trim-end":26,"core-js/fn/string/trim-start":27,"core-js/fn/symbol/async-iterator":28,"core-js/web":320,"regenerator-runtime/runtime":323}],16:[function(require,module,exports){
+},{"core-js/es6":17,"core-js/fn/array/flat-map":18,"core-js/fn/array/includes":19,"core-js/fn/object/entries":20,"core-js/fn/object/get-own-property-descriptors":21,"core-js/fn/object/values":22,"core-js/fn/promise/finally":23,"core-js/fn/string/pad-end":24,"core-js/fn/string/pad-start":25,"core-js/fn/string/trim-end":26,"core-js/fn/string/trim-start":27,"core-js/fn/symbol/async-iterator":28,"core-js/web":320,"regenerator-runtime/runtime":324}],16:[function(require,module,exports){
function _typeof(o) {
"@babel/helpers - typeof";
@@ -8105,6 +8112,35 @@ module.exports = require('../modules/_core');
},{"../modules/_core":66,"../modules/web.dom.iterable":317,"../modules/web.immediate":318,"../modules/web.timers":319}],321:[function(require,module,exports){
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const pkg = __importStar(require("./index.js"));
+module.exports = pkg;
+
+},{"./index.js":322}],322:[function(require,module,exports){
+"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
/**
@@ -8112,21 +8148,21 @@ exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
* a given entry when a new entry is set and the ttl
* of the old one is over
*/
-var ObliviousSet = /** @class */ (function () {
- function ObliviousSet(ttl) {
+class ObliviousSet {
+ ttl;
+ map = new Map();
+ /**
+ * Creating calls to setTimeout() is expensive,
+ * so we only do that if there is not timeout already open.
+ */
+ _to = false;
+ constructor(ttl) {
this.ttl = ttl;
- this.map = new Map();
- /**
- * Creating calls to setTimeout() is expensive,
- * so we only do that if there is not timeout already open.
- */
- this._to = false;
}
- ObliviousSet.prototype.has = function (value) {
+ has(value) {
return this.map.has(value);
- };
- ObliviousSet.prototype.add = function (value) {
- var _this = this;
+ }
+ add(value) {
this.map.set(value, now());
/**
* When a new value is added,
@@ -8136,36 +8172,35 @@ var ObliviousSet = /** @class */ (function () {
*/
if (!this._to) {
this._to = true;
- setTimeout(function () {
- _this._to = false;
- removeTooOldValues(_this);
+ setTimeout(() => {
+ this._to = false;
+ removeTooOldValues(this);
}, 0);
}
- };
- ObliviousSet.prototype.clear = function () {
+ }
+ clear() {
this.map.clear();
- };
- return ObliviousSet;
-}());
+ }
+}
exports.ObliviousSet = ObliviousSet;
/**
* Removes all entries from the set
* where the TTL has expired
*/
function removeTooOldValues(obliviousSet) {
- var olderThen = now() - obliviousSet.ttl;
- var iterator = obliviousSet.map[Symbol.iterator]();
+ const olderThen = now() - obliviousSet.ttl;
+ const iterator = obliviousSet.map[Symbol.iterator]();
/**
* Because we can assume the new values are added at the bottom,
* we start from the top and stop as soon as we reach a non-too-old value.
*/
while (true) {
- var next = iterator.next().value;
+ const next = iterator.next().value;
if (!next) {
return; // no more elements
}
- var value = next[0];
- var time = next[1];
+ const value = next[0];
+ const time = next[1];
if (time < olderThen) {
obliviousSet.map.delete(value);
}
@@ -8177,11 +8212,11 @@ function removeTooOldValues(obliviousSet) {
}
exports.removeTooOldValues = removeTooOldValues;
function now() {
- return new Date().getTime();
+ return Date.now();
}
exports.now = now;
-},{}],322:[function(require,module,exports){
+},{}],323:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
@@ -8367,7 +8402,7 @@ process.chdir = function (dir) {
};
process.umask = function() { return 0; };
-},{}],323:[function(require,module,exports){
+},{}],324:[function(require,module,exports){
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
@@ -9130,7 +9165,7 @@ try {
}
}
-},{}],324:[function(require,module,exports){
+},{}],325:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -9182,7 +9217,7 @@ function addBrowser(fn) {
* @link https://stackoverflow.com/a/26193516/3443137
*/
}
-},{}],325:[function(require,module,exports){
+},{}],326:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -9243,7 +9278,7 @@ function getSize() {
return LISTENERS.size;
}
}).call(this)}).call(this,require('_process'))
-},{"./browser.js":324,"./node.js":326,"_process":322}],326:[function(require,module,exports){
+},{"./browser.js":325,"./node.js":327,"_process":323}],327:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -9282,7 +9317,7 @@ function addNode(fn) {
});
}
}).call(this)}).call(this,require('_process'))
-},{"_process":322}],327:[function(require,module,exports){
+},{"_process":323}],328:[function(require,module,exports){
"use strict";
var _util = require("./util.js");
@@ -9325,7 +9360,7 @@ channel.onmessage = function (msg) {
});
}
};
-},{"../../":2,"./util.js":328,"@babel/polyfill":14}],328:[function(require,module,exports){
+},{"../../":2,"./util.js":329,"@babel/polyfill":14}],329:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -9344,4 +9379,4 @@ function getParameterByName(name, url) {
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
-},{}]},{},[327]);
+},{}]},{},[328]);
diff --git a/docs/index.js b/docs/index.js
index f14428a7..421a0dfd 100644
--- a/docs/index.js
+++ b/docs/index.js
@@ -389,7 +389,7 @@ function beLeader(leaderElector) {
leaderElector._lstns.push(isLeaderListener);
return sendLeaderMessage(leaderElector, 'tell');
}
-},{"unload":325}],5:[function(require,module,exports){
+},{"unload":326}],5:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1420,6 +1420,13 @@ function onMessage(channelState, fn) {
channelState.messagesCallback = fn;
}
function canBeUsed() {
+ // Deno runtime
+ // eslint-disable-next-line
+ if (typeof globalThis !== 'undefined' && globalThis.Deno && globalThis.Deno.args) {
+ return true;
+ }
+
+ // Browser runtime
if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof BroadcastChannel === 'function') {
if (BroadcastChannel._pubkey) {
throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');
@@ -1665,7 +1672,7 @@ require("core-js/fn/promise/finally");
require("core-js/web");
require("regenerator-runtime/runtime");
-},{"core-js/es6":17,"core-js/fn/array/flat-map":18,"core-js/fn/array/includes":19,"core-js/fn/object/entries":20,"core-js/fn/object/get-own-property-descriptors":21,"core-js/fn/object/values":22,"core-js/fn/promise/finally":23,"core-js/fn/string/pad-end":24,"core-js/fn/string/pad-start":25,"core-js/fn/string/trim-end":26,"core-js/fn/string/trim-start":27,"core-js/fn/symbol/async-iterator":28,"core-js/web":320,"regenerator-runtime/runtime":323}],16:[function(require,module,exports){
+},{"core-js/es6":17,"core-js/fn/array/flat-map":18,"core-js/fn/array/includes":19,"core-js/fn/object/entries":20,"core-js/fn/object/get-own-property-descriptors":21,"core-js/fn/object/values":22,"core-js/fn/promise/finally":23,"core-js/fn/string/pad-end":24,"core-js/fn/string/pad-start":25,"core-js/fn/string/trim-end":26,"core-js/fn/string/trim-start":27,"core-js/fn/symbol/async-iterator":28,"core-js/web":320,"regenerator-runtime/runtime":324}],16:[function(require,module,exports){
function _typeof(o) {
"@babel/helpers - typeof";
@@ -8105,6 +8112,35 @@ module.exports = require('../modules/_core');
},{"../modules/_core":66,"../modules/web.dom.iterable":317,"../modules/web.immediate":318,"../modules/web.timers":319}],321:[function(require,module,exports){
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const pkg = __importStar(require("./index.js"));
+module.exports = pkg;
+
+},{"./index.js":322}],322:[function(require,module,exports){
+"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
/**
@@ -8112,21 +8148,21 @@ exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
* a given entry when a new entry is set and the ttl
* of the old one is over
*/
-var ObliviousSet = /** @class */ (function () {
- function ObliviousSet(ttl) {
+class ObliviousSet {
+ ttl;
+ map = new Map();
+ /**
+ * Creating calls to setTimeout() is expensive,
+ * so we only do that if there is not timeout already open.
+ */
+ _to = false;
+ constructor(ttl) {
this.ttl = ttl;
- this.map = new Map();
- /**
- * Creating calls to setTimeout() is expensive,
- * so we only do that if there is not timeout already open.
- */
- this._to = false;
}
- ObliviousSet.prototype.has = function (value) {
+ has(value) {
return this.map.has(value);
- };
- ObliviousSet.prototype.add = function (value) {
- var _this = this;
+ }
+ add(value) {
this.map.set(value, now());
/**
* When a new value is added,
@@ -8136,36 +8172,35 @@ var ObliviousSet = /** @class */ (function () {
*/
if (!this._to) {
this._to = true;
- setTimeout(function () {
- _this._to = false;
- removeTooOldValues(_this);
+ setTimeout(() => {
+ this._to = false;
+ removeTooOldValues(this);
}, 0);
}
- };
- ObliviousSet.prototype.clear = function () {
+ }
+ clear() {
this.map.clear();
- };
- return ObliviousSet;
-}());
+ }
+}
exports.ObliviousSet = ObliviousSet;
/**
* Removes all entries from the set
* where the TTL has expired
*/
function removeTooOldValues(obliviousSet) {
- var olderThen = now() - obliviousSet.ttl;
- var iterator = obliviousSet.map[Symbol.iterator]();
+ const olderThen = now() - obliviousSet.ttl;
+ const iterator = obliviousSet.map[Symbol.iterator]();
/**
* Because we can assume the new values are added at the bottom,
* we start from the top and stop as soon as we reach a non-too-old value.
*/
while (true) {
- var next = iterator.next().value;
+ const next = iterator.next().value;
if (!next) {
return; // no more elements
}
- var value = next[0];
- var time = next[1];
+ const value = next[0];
+ const time = next[1];
if (time < olderThen) {
obliviousSet.map.delete(value);
}
@@ -8177,11 +8212,11 @@ function removeTooOldValues(obliviousSet) {
}
exports.removeTooOldValues = removeTooOldValues;
function now() {
- return new Date().getTime();
+ return Date.now();
}
exports.now = now;
-},{}],322:[function(require,module,exports){
+},{}],323:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
@@ -8367,7 +8402,7 @@ process.chdir = function (dir) {
};
process.umask = function() { return 0; };
-},{}],323:[function(require,module,exports){
+},{}],324:[function(require,module,exports){
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
@@ -9130,7 +9165,7 @@ try {
}
}
-},{}],324:[function(require,module,exports){
+},{}],325:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -9182,7 +9217,7 @@ function addBrowser(fn) {
* @link https://stackoverflow.com/a/26193516/3443137
*/
}
-},{}],325:[function(require,module,exports){
+},{}],326:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -9243,7 +9278,7 @@ function getSize() {
return LISTENERS.size;
}
}).call(this)}).call(this,require('_process'))
-},{"./browser.js":324,"./node.js":326,"_process":322}],326:[function(require,module,exports){
+},{"./browser.js":325,"./node.js":327,"_process":323}],327:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -9282,7 +9317,7 @@ function addNode(fn) {
});
}
}).call(this)}).call(this,require('_process'))
-},{"_process":322}],327:[function(require,module,exports){
+},{"_process":323}],328:[function(require,module,exports){
"use strict";
/* eslint-disable */
@@ -9326,4 +9361,4 @@ channel.onmessage = function (message) {
console.dir('recieved message: ' + message);
addTextToMessageBox('recieved: ' + message);
};
-},{"../../":2,"@babel/polyfill":14}]},{},[327]);
+},{"../../":2,"@babel/polyfill":14}]},{},[328]);
diff --git a/docs/leader-iframe.js b/docs/leader-iframe.js
index b4f0d94c..69ebe9ea 100644
--- a/docs/leader-iframe.js
+++ b/docs/leader-iframe.js
@@ -389,7 +389,7 @@ function beLeader(leaderElector) {
leaderElector._lstns.push(isLeaderListener);
return sendLeaderMessage(leaderElector, 'tell');
}
-},{"unload":325}],5:[function(require,module,exports){
+},{"unload":326}],5:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1420,6 +1420,13 @@ function onMessage(channelState, fn) {
channelState.messagesCallback = fn;
}
function canBeUsed() {
+ // Deno runtime
+ // eslint-disable-next-line
+ if (typeof globalThis !== 'undefined' && globalThis.Deno && globalThis.Deno.args) {
+ return true;
+ }
+
+ // Browser runtime
if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof BroadcastChannel === 'function') {
if (BroadcastChannel._pubkey) {
throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');
@@ -1665,7 +1672,7 @@ require("core-js/fn/promise/finally");
require("core-js/web");
require("regenerator-runtime/runtime");
-},{"core-js/es6":17,"core-js/fn/array/flat-map":18,"core-js/fn/array/includes":19,"core-js/fn/object/entries":20,"core-js/fn/object/get-own-property-descriptors":21,"core-js/fn/object/values":22,"core-js/fn/promise/finally":23,"core-js/fn/string/pad-end":24,"core-js/fn/string/pad-start":25,"core-js/fn/string/trim-end":26,"core-js/fn/string/trim-start":27,"core-js/fn/symbol/async-iterator":28,"core-js/web":320,"regenerator-runtime/runtime":323}],16:[function(require,module,exports){
+},{"core-js/es6":17,"core-js/fn/array/flat-map":18,"core-js/fn/array/includes":19,"core-js/fn/object/entries":20,"core-js/fn/object/get-own-property-descriptors":21,"core-js/fn/object/values":22,"core-js/fn/promise/finally":23,"core-js/fn/string/pad-end":24,"core-js/fn/string/pad-start":25,"core-js/fn/string/trim-end":26,"core-js/fn/string/trim-start":27,"core-js/fn/symbol/async-iterator":28,"core-js/web":320,"regenerator-runtime/runtime":324}],16:[function(require,module,exports){
function _typeof(o) {
"@babel/helpers - typeof";
@@ -8105,6 +8112,35 @@ module.exports = require('../modules/_core');
},{"../modules/_core":66,"../modules/web.dom.iterable":317,"../modules/web.immediate":318,"../modules/web.timers":319}],321:[function(require,module,exports){
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const pkg = __importStar(require("./index.js"));
+module.exports = pkg;
+
+},{"./index.js":322}],322:[function(require,module,exports){
+"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
/**
@@ -8112,21 +8148,21 @@ exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
* a given entry when a new entry is set and the ttl
* of the old one is over
*/
-var ObliviousSet = /** @class */ (function () {
- function ObliviousSet(ttl) {
+class ObliviousSet {
+ ttl;
+ map = new Map();
+ /**
+ * Creating calls to setTimeout() is expensive,
+ * so we only do that if there is not timeout already open.
+ */
+ _to = false;
+ constructor(ttl) {
this.ttl = ttl;
- this.map = new Map();
- /**
- * Creating calls to setTimeout() is expensive,
- * so we only do that if there is not timeout already open.
- */
- this._to = false;
}
- ObliviousSet.prototype.has = function (value) {
+ has(value) {
return this.map.has(value);
- };
- ObliviousSet.prototype.add = function (value) {
- var _this = this;
+ }
+ add(value) {
this.map.set(value, now());
/**
* When a new value is added,
@@ -8136,36 +8172,35 @@ var ObliviousSet = /** @class */ (function () {
*/
if (!this._to) {
this._to = true;
- setTimeout(function () {
- _this._to = false;
- removeTooOldValues(_this);
+ setTimeout(() => {
+ this._to = false;
+ removeTooOldValues(this);
}, 0);
}
- };
- ObliviousSet.prototype.clear = function () {
+ }
+ clear() {
this.map.clear();
- };
- return ObliviousSet;
-}());
+ }
+}
exports.ObliviousSet = ObliviousSet;
/**
* Removes all entries from the set
* where the TTL has expired
*/
function removeTooOldValues(obliviousSet) {
- var olderThen = now() - obliviousSet.ttl;
- var iterator = obliviousSet.map[Symbol.iterator]();
+ const olderThen = now() - obliviousSet.ttl;
+ const iterator = obliviousSet.map[Symbol.iterator]();
/**
* Because we can assume the new values are added at the bottom,
* we start from the top and stop as soon as we reach a non-too-old value.
*/
while (true) {
- var next = iterator.next().value;
+ const next = iterator.next().value;
if (!next) {
return; // no more elements
}
- var value = next[0];
- var time = next[1];
+ const value = next[0];
+ const time = next[1];
if (time < olderThen) {
obliviousSet.map.delete(value);
}
@@ -8177,11 +8212,11 @@ function removeTooOldValues(obliviousSet) {
}
exports.removeTooOldValues = removeTooOldValues;
function now() {
- return new Date().getTime();
+ return Date.now();
}
exports.now = now;
-},{}],322:[function(require,module,exports){
+},{}],323:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
@@ -8367,7 +8402,7 @@ process.chdir = function (dir) {
};
process.umask = function() { return 0; };
-},{}],323:[function(require,module,exports){
+},{}],324:[function(require,module,exports){
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
@@ -9130,7 +9165,7 @@ try {
}
}
-},{}],324:[function(require,module,exports){
+},{}],325:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -9182,7 +9217,7 @@ function addBrowser(fn) {
* @link https://stackoverflow.com/a/26193516/3443137
*/
}
-},{}],325:[function(require,module,exports){
+},{}],326:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -9243,7 +9278,7 @@ function getSize() {
return LISTENERS.size;
}
}).call(this)}).call(this,require('_process'))
-},{"./browser.js":324,"./node.js":326,"_process":322}],326:[function(require,module,exports){
+},{"./browser.js":325,"./node.js":327,"_process":323}],327:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -9282,7 +9317,7 @@ function addNode(fn) {
});
}
}).call(this)}).call(this,require('_process'))
-},{"_process":322}],327:[function(require,module,exports){
+},{"_process":323}],328:[function(require,module,exports){
"use strict";
var _util = require("./util.js");
@@ -9317,7 +9352,7 @@ elector.awaitLeadership().then(function () {
boxEl.innerHTML = 'Leader';
document.title = 'â™› Leader';
});
-},{"../../":2,"./util.js":328,"@babel/polyfill":14}],328:[function(require,module,exports){
+},{"../../":2,"./util.js":329,"@babel/polyfill":14}],329:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -9336,4 +9371,4 @@ function getParameterByName(name, url) {
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
-},{}]},{},[327]);
+},{}]},{},[328]);
diff --git a/docs/worker.js b/docs/worker.js
index 5305767e..4ab196c7 100644
--- a/docs/worker.js
+++ b/docs/worker.js
@@ -389,7 +389,7 @@ function beLeader(leaderElector) {
leaderElector._lstns.push(isLeaderListener);
return sendLeaderMessage(leaderElector, 'tell');
}
-},{"unload":406}],5:[function(require,module,exports){
+},{"unload":408}],5:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1420,6 +1420,13 @@ function onMessage(channelState, fn) {
channelState.messagesCallback = fn;
}
function canBeUsed() {
+ // Deno runtime
+ // eslint-disable-next-line
+ if (typeof globalThis !== 'undefined' && globalThis.Deno && globalThis.Deno.args) {
+ return true;
+ }
+
+ // Browser runtime
if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof BroadcastChannel === 'function') {
if (BroadcastChannel._pubkey) {
throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');
@@ -1665,7 +1672,7 @@ require("core-js/fn/promise/finally");
require("core-js/web");
require("regenerator-runtime/runtime");
-},{"core-js/es6":42,"core-js/fn/array/flat-map":43,"core-js/fn/array/includes":44,"core-js/fn/object/entries":45,"core-js/fn/object/get-own-property-descriptors":46,"core-js/fn/object/values":47,"core-js/fn/promise/finally":48,"core-js/fn/string/pad-end":49,"core-js/fn/string/pad-start":50,"core-js/fn/string/trim-end":51,"core-js/fn/string/trim-start":52,"core-js/fn/symbol/async-iterator":53,"core-js/web":345,"regenerator-runtime/runtime":397}],16:[function(require,module,exports){
+},{"core-js/es6":42,"core-js/fn/array/flat-map":43,"core-js/fn/array/includes":44,"core-js/fn/object/entries":45,"core-js/fn/object/get-own-property-descriptors":46,"core-js/fn/object/values":47,"core-js/fn/promise/finally":48,"core-js/fn/string/pad-end":49,"core-js/fn/string/pad-start":50,"core-js/fn/string/trim-end":51,"core-js/fn/string/trim-start":52,"core-js/fn/symbol/async-iterator":53,"core-js/web":345,"regenerator-runtime/runtime":398}],16:[function(require,module,exports){
function _typeof(o) {
"@babel/helpers - typeof";
@@ -2201,7 +2208,7 @@ function waitUntil(fun) {
*/
function runLoopOnce() {
if (ok) {
- resolve();
+ resolve(ok);
} else if (timedOut) {
reject(new Error('AsyncTestUtil.waitUntil(): reached timeout of ' + timeout + 'ms'));
} else {
@@ -4233,12 +4240,13 @@ module.exports = function callBoundIntrinsic(name, allowMissing) {
var bind = require('function-bind');
var GetIntrinsic = require('get-intrinsic');
+var setFunctionLength = require('set-function-length');
+var $TypeError = GetIntrinsic('%TypeError%');
var $apply = GetIntrinsic('%Function.prototype.apply%');
var $call = GetIntrinsic('%Function.prototype.call%');
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
-var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
var $max = GetIntrinsic('%Math.max%');
@@ -4252,19 +4260,15 @@ if ($defineProperty) {
}
module.exports = function callBind(originalFunction) {
- var func = $reflectApply(bind, $call, arguments);
- if ($gOPD && $defineProperty) {
- var desc = $gOPD(func, 'length');
- if (desc.configurable) {
- // original length, plus the receiver, minus any additional arguments (after the receiver)
- $defineProperty(
- func,
- 'length',
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
- );
- }
+ if (typeof originalFunction !== 'function') {
+ throw new $TypeError('a function is required');
}
- return func;
+ var func = $reflectApply(bind, $call, arguments);
+ return setFunctionLength(
+ func,
+ 1 + $max(0, originalFunction.length - (arguments.length - 1)),
+ true
+ );
};
var applyBind = function applyBind() {
@@ -4277,7 +4281,7 @@ if ($defineProperty) {
module.exports.apply = applyBind;
}
-},{"function-bind":352,"get-intrinsic":354}],41:[function(require,module,exports){
+},{"function-bind":352,"get-intrinsic":354,"set-function-length":403}],41:[function(require,module,exports){
(function (Buffer){(function (){
var clone = (function() {
'use strict';
@@ -11359,7 +11363,7 @@ module.exports = function deepEqual(a, b, opts) {
return internalDeepEqual(a, b, opts, getSideChannel());
};
-},{"array-buffer-byte-length":17,"call-bind/callBound":39,"es-get-iterator":349,"get-intrinsic":354,"is-arguments":365,"is-array-buffer":366,"is-date-object":370,"is-regex":374,"is-shared-array-buffer":376,"isarray":382,"object-is":385,"object-keys":389,"object.assign":392,"regexp.prototype.flags":399,"side-channel":403,"which-boxed-primitive":408,"which-collection":409,"which-typed-array":410}],347:[function(require,module,exports){
+},{"array-buffer-byte-length":17,"call-bind/callBound":39,"es-get-iterator":349,"get-intrinsic":354,"is-arguments":365,"is-array-buffer":366,"is-date-object":370,"is-regex":374,"is-shared-array-buffer":376,"isarray":382,"object-is":385,"object-keys":389,"object.assign":392,"regexp.prototype.flags":400,"side-channel":405,"which-boxed-primitive":410,"which-collection":411,"which-typed-array":412}],347:[function(require,module,exports){
'use strict';
var hasPropertyDescriptors = require('has-property-descriptors')();
@@ -11671,7 +11675,7 @@ if (require('has-symbols')() || require('has-symbols/shams')()) {
}
}).call(this)}).call(this,require('_process'))
-},{"_process":396,"call-bind/callBound":39,"get-intrinsic":354,"has-symbols":359,"has-symbols/shams":360,"is-arguments":365,"is-map":371,"is-set":375,"is-string":377,"isarray":382,"stop-iteration-iterator":404}],350:[function(require,module,exports){
+},{"_process":397,"call-bind/callBound":39,"get-intrinsic":354,"has-symbols":359,"has-symbols/shams":360,"is-arguments":365,"is-map":371,"is-set":375,"is-string":377,"isarray":382,"stop-iteration-iterator":406}],350:[function(require,module,exports){
'use strict';
var isCallable = require('is-callable');
@@ -12078,7 +12082,7 @@ var LEGACY_ALIASES = {
};
var bind = require('function-bind');
-var hasOwn = require('has');
+var hasOwn = require('hasown');
var $concat = bind.call(Function.call, Array.prototype.concat);
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
var $replace = bind.call(Function.call, String.prototype.replace);
@@ -12214,7 +12218,7 @@ module.exports = function GetIntrinsic(name, allowMissing) {
return value;
};
-},{"function-bind":352,"has":362,"has-proto":358,"has-symbols":359}],355:[function(require,module,exports){
+},{"function-bind":352,"has-proto":358,"has-symbols":359,"hasown":362}],355:[function(require,module,exports){
'use strict';
var GetIntrinsic = require('get-intrinsic');
@@ -12363,14 +12367,14 @@ module.exports = function hasToStringTagShams() {
},{"has-symbols/shams":360}],362:[function(require,module,exports){
'use strict';
-var hasOwnProperty = {}.hasOwnProperty;
var call = Function.prototype.call;
+var $hasOwn = Object.prototype.hasOwnProperty;
+var bind = require('function-bind');
-module.exports = call.bind ? call.bind(hasOwnProperty) : function (O, P) {
- return call.call(hasOwnProperty, O, P);
-};
+/** @type {(o: {}, p: PropertyKey) => p is keyof o} */
+module.exports = bind.call(call, $hasOwn);
-},{}],363:[function(require,module,exports){
+},{"function-bind":352}],363:[function(require,module,exports){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
var e, m
@@ -12461,7 +12465,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
'use strict';
var GetIntrinsic = require('get-intrinsic');
-var has = require('has');
+var hasOwn = require('hasown');
var channel = require('side-channel')();
var $TypeError = GetIntrinsic('%TypeError%');
@@ -12497,7 +12501,7 @@ var SLOT = {
throw new $TypeError('`slot` must be a string');
}
var slots = channel.get(O);
- return !!slots && has(slots, '$' + slot);
+ return !!slots && hasOwn(slots, '$' + slot);
},
set: function (O, slot, V) {
if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
@@ -12521,7 +12525,7 @@ if (Object.freeze) {
module.exports = SLOT;
-},{"get-intrinsic":354,"has":362,"side-channel":403}],365:[function(require,module,exports){
+},{"get-intrinsic":354,"hasown":362,"side-channel":405}],365:[function(require,module,exports){
'use strict';
var hasToStringTag = require('has-tostringtag/shams')();
@@ -12848,7 +12852,7 @@ module.exports = exported || function isMap(x) {
exports = module.exports = !!(typeof process !== 'undefined' && process.versions && process.versions.node);
}).call(this)}).call(this,require('_process'))
-},{"_process":396}],373:[function(require,module,exports){
+},{"_process":397}],373:[function(require,module,exports){
'use strict';
var numToStr = Number.prototype.toString;
@@ -13073,7 +13077,7 @@ module.exports = function isTypedArray(value) {
return !!whichTypedArray(value);
};
-},{"which-typed-array":410}],380:[function(require,module,exports){
+},{"which-typed-array":412}],380:[function(require,module,exports){
'use strict';
var $WeakMap = typeof WeakMap === 'function' && WeakMap.prototype ? WeakMap : null;
@@ -13405,12 +13409,13 @@ module.exports = function inspect_(obj, options, depth, seen) {
if (isString(obj)) {
return markBoxed(inspect(String(obj)));
}
+ // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
+ /* eslint-env browser */
+ if (typeof window !== 'undefined' && obj === window) {
+ return '{ [object Window] }';
+ }
if (obj === global) {
- /* eslint-env browser */
- if (typeof window !== 'undefined') {
- return '{ [object Window] }';
- }
- return '{ [object global] }';
+ return '{ [object globalThis] }';
}
if (!isDate(obj) && !isRegExp(obj)) {
var ys = arrObjKeys(obj, inspect);
@@ -14079,6 +14084,35 @@ module.exports = function shimAssign() {
},{"./polyfill":393,"define-properties":348}],395:[function(require,module,exports){
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const pkg = __importStar(require("./index.js"));
+module.exports = pkg;
+
+},{"./index.js":396}],396:[function(require,module,exports){
+"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
/**
@@ -14086,21 +14120,21 @@ exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
* a given entry when a new entry is set and the ttl
* of the old one is over
*/
-var ObliviousSet = /** @class */ (function () {
- function ObliviousSet(ttl) {
+class ObliviousSet {
+ ttl;
+ map = new Map();
+ /**
+ * Creating calls to setTimeout() is expensive,
+ * so we only do that if there is not timeout already open.
+ */
+ _to = false;
+ constructor(ttl) {
this.ttl = ttl;
- this.map = new Map();
- /**
- * Creating calls to setTimeout() is expensive,
- * so we only do that if there is not timeout already open.
- */
- this._to = false;
}
- ObliviousSet.prototype.has = function (value) {
+ has(value) {
return this.map.has(value);
- };
- ObliviousSet.prototype.add = function (value) {
- var _this = this;
+ }
+ add(value) {
this.map.set(value, now());
/**
* When a new value is added,
@@ -14110,36 +14144,35 @@ var ObliviousSet = /** @class */ (function () {
*/
if (!this._to) {
this._to = true;
- setTimeout(function () {
- _this._to = false;
- removeTooOldValues(_this);
+ setTimeout(() => {
+ this._to = false;
+ removeTooOldValues(this);
}, 0);
}
- };
- ObliviousSet.prototype.clear = function () {
+ }
+ clear() {
this.map.clear();
- };
- return ObliviousSet;
-}());
+ }
+}
exports.ObliviousSet = ObliviousSet;
/**
* Removes all entries from the set
* where the TTL has expired
*/
function removeTooOldValues(obliviousSet) {
- var olderThen = now() - obliviousSet.ttl;
- var iterator = obliviousSet.map[Symbol.iterator]();
+ const olderThen = now() - obliviousSet.ttl;
+ const iterator = obliviousSet.map[Symbol.iterator]();
/**
* Because we can assume the new values are added at the bottom,
* we start from the top and stop as soon as we reach a non-too-old value.
*/
while (true) {
- var next = iterator.next().value;
+ const next = iterator.next().value;
if (!next) {
return; // no more elements
}
- var value = next[0];
- var time = next[1];
+ const value = next[0];
+ const time = next[1];
if (time < olderThen) {
obliviousSet.map.delete(value);
}
@@ -14151,11 +14184,11 @@ function removeTooOldValues(obliviousSet) {
}
exports.removeTooOldValues = removeTooOldValues;
function now() {
- return new Date().getTime();
+ return Date.now();
}
exports.now = now;
-},{}],396:[function(require,module,exports){
+},{}],397:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
@@ -14341,7 +14374,7 @@ process.chdir = function (dir) {
};
process.umask = function() { return 0; };
-},{}],397:[function(require,module,exports){
+},{}],398:[function(require,module,exports){
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
@@ -15104,7 +15137,7 @@ try {
}
}
-},{}],398:[function(require,module,exports){
+},{}],399:[function(require,module,exports){
'use strict';
var setFunctionName = require('set-function-name');
@@ -15145,7 +15178,7 @@ module.exports = setFunctionName(function flags() {
}, 'get flags', true);
-},{"set-function-name":402}],399:[function(require,module,exports){
+},{"set-function-name":404}],400:[function(require,module,exports){
'use strict';
var define = require('define-properties');
@@ -15165,7 +15198,7 @@ define(flagsBound, {
module.exports = flagsBound;
-},{"./implementation":398,"./polyfill":400,"./shim":401,"call-bind":40,"define-properties":348}],400:[function(require,module,exports){
+},{"./implementation":399,"./polyfill":401,"./shim":402,"call-bind":40,"define-properties":348}],401:[function(require,module,exports){
'use strict';
var implementation = require('./implementation');
@@ -15203,7 +15236,7 @@ module.exports = function getPolyfill() {
return implementation;
};
-},{"./implementation":398,"define-properties":348}],401:[function(require,module,exports){
+},{"./implementation":399,"define-properties":348}],402:[function(require,module,exports){
'use strict';
var supportsDescriptors = require('define-properties').supportsDescriptors;
@@ -15231,7 +15264,50 @@ module.exports = function shimFlags() {
return polyfill;
};
-},{"./polyfill":400,"define-properties":348}],402:[function(require,module,exports){
+},{"./polyfill":401,"define-properties":348}],403:[function(require,module,exports){
+'use strict';
+
+var GetIntrinsic = require('get-intrinsic');
+var define = require('define-data-property');
+var hasDescriptors = require('has-property-descriptors')();
+var gOPD = require('gopd');
+
+var $TypeError = GetIntrinsic('%TypeError%');
+var $floor = GetIntrinsic('%Math.floor%');
+
+module.exports = function setFunctionLength(fn, length) {
+ if (typeof fn !== 'function') {
+ throw new $TypeError('`fn` is not a function');
+ }
+ if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
+ throw new $TypeError('`length` must be a positive 32-bit integer');
+ }
+
+ var loose = arguments.length > 2 && !!arguments[2];
+
+ var functionLengthIsConfigurable = true;
+ var functionLengthIsWritable = true;
+ if ('length' in fn && gOPD) {
+ var desc = gOPD(fn, 'length');
+ if (desc && !desc.configurable) {
+ functionLengthIsConfigurable = false;
+ }
+ if (desc && !desc.writable) {
+ functionLengthIsWritable = false;
+ }
+ }
+
+ if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
+ if (hasDescriptors) {
+ define(fn, 'length', length, true, true);
+ } else {
+ define(fn, 'length', length);
+ }
+ }
+ return fn;
+};
+
+},{"define-data-property":347,"get-intrinsic":354,"gopd":355,"has-property-descriptors":357}],404:[function(require,module,exports){
'use strict';
var define = require('define-data-property');
@@ -15255,7 +15331,7 @@ module.exports = function setFunctionName(fn, name) {
return fn;
};
-},{"define-data-property":347,"functions-have-names":353,"has-property-descriptors":357}],403:[function(require,module,exports){
+},{"define-data-property":347,"functions-have-names":353,"has-property-descriptors":357}],405:[function(require,module,exports){
'use strict';
var GetIntrinsic = require('get-intrinsic');
@@ -15381,7 +15457,7 @@ module.exports = function getSideChannel() {
return channel;
};
-},{"call-bind/callBound":39,"get-intrinsic":354,"object-inspect":383}],404:[function(require,module,exports){
+},{"call-bind/callBound":39,"get-intrinsic":354,"object-inspect":383}],406:[function(require,module,exports){
'use strict';
var SLOT = require('internal-slot');
@@ -15423,7 +15499,7 @@ module.exports = function getStopIterationIterator(origIterator) {
return siIterator;
};
-},{"internal-slot":364}],405:[function(require,module,exports){
+},{"internal-slot":364}],407:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -15475,7 +15551,7 @@ function addBrowser(fn) {
* @link https://stackoverflow.com/a/26193516/3443137
*/
}
-},{}],406:[function(require,module,exports){
+},{}],408:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -15536,7 +15612,7 @@ function getSize() {
return LISTENERS.size;
}
}).call(this)}).call(this,require('_process'))
-},{"./browser.js":405,"./node.js":407,"_process":396}],407:[function(require,module,exports){
+},{"./browser.js":407,"./node.js":409,"_process":397}],409:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -15575,7 +15651,7 @@ function addNode(fn) {
});
}
}).call(this)}).call(this,require('_process'))
-},{"_process":396}],408:[function(require,module,exports){
+},{"_process":397}],410:[function(require,module,exports){
'use strict';
var isString = require('is-string');
@@ -15607,7 +15683,7 @@ module.exports = function whichBoxedPrimitive(value) {
}
};
-},{"is-bigint":367,"is-boolean-object":368,"is-number-object":373,"is-string":377,"is-symbol":378}],409:[function(require,module,exports){
+},{"is-bigint":367,"is-boolean-object":368,"is-number-object":373,"is-string":377,"is-symbol":378}],411:[function(require,module,exports){
'use strict';
var isMap = require('is-map');
@@ -15633,7 +15709,7 @@ module.exports = function whichCollection(value) {
return false;
};
-},{"is-map":371,"is-set":375,"is-weakmap":380,"is-weakset":381}],410:[function(require,module,exports){
+},{"is-map":371,"is-set":375,"is-weakmap":380,"is-weakset":381}],412:[function(require,module,exports){
(function (global){(function (){
'use strict';
@@ -15677,7 +15753,10 @@ if (hasToStringTag && gOPD && getPrototypeOf) {
} else {
forEach(typedArrays, function (typedArray) {
var arr = new g[typedArray]();
- cache['$' + typedArray] = callBind(arr.slice);
+ var fn = arr.slice || arr.set;
+ if (fn) {
+ cache['$' + typedArray] = callBind(fn);
+ }
});
}
@@ -15726,7 +15805,7 @@ module.exports = function whichTypedArray(value) {
};
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"available-typed-arrays":35,"call-bind":40,"call-bind/callBound":39,"for-each":350,"gopd":355,"has-tostringtag/shams":361}],411:[function(require,module,exports){
+},{"available-typed-arrays":35,"call-bind":40,"call-bind/callBound":39,"for-each":350,"gopd":355,"has-tostringtag/shams":361}],413:[function(require,module,exports){
"use strict";
/* eslint-disable */
@@ -15798,4 +15877,4 @@ self.addEventListener('message', function (e) {
}
;
}, false);
-},{"../../":2,"@babel/polyfill":14,"async-test-util":21}]},{},[411]);
+},{"../../":2,"@babel/polyfill":14,"async-test-util":21}]},{},[413]);
diff --git a/package.json b/package.json
index 17491ae6..236dfd19 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "broadcast-channel",
- "version": "5.5.1",
+ "version": "6.0.0",
"description": "A BroadcastChannel that works in New Browsers, Old Browsers, WebWorkers, NodeJs, Deno and iframes",
"exports": {
".": {
From a278986fcf51a3c3076e892b49322f23c70616a5 Mon Sep 17 00:00:00 2001
From: Daniel Meyer <8926560+pubkey@users.noreply.github.com>
Date: Mon, 27 Nov 2023 23:44:17 +0100
Subject: [PATCH 55/82] bugfix/message-from-before-creation-was-send (#1295)
* FIX got too many messages
* FIX node method
* CLEAR npm cache
* UPDATE deps
* FIX missing event
* FIX e2e tests
* FIX tests
---
.github/workflows/main.yml | 22 +-
.nvmrc | 1 +
docs/e2e.js | 7990 ++++++++++++++++++++++++++++++++-
docs/iframe.js | 62 +-
docs/index.js | 62 +-
docs/leader-iframe.js | 62 +-
docs/worker.js | 62 +-
package.json | 28 +-
src/broadcast-channel.js | 15 +-
src/methods/native.js | 5 +-
src/methods/node.js | 12 +-
src/methods/simulate.js | 23 +-
src/util.js | 16 +-
test/integration.test.js | 38 +-
test/scripts/e2e.js | 24 +-
test/unit/node.method.test.js | 77 +-
16 files changed, 8074 insertions(+), 425 deletions(-)
create mode 100644 .nvmrc
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 105b77a1..e191f58b 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -32,7 +32,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v4.0.0
with:
- node-version: '20.9.0'
+ node-version-file: ".nvmrc"
# https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows
- name: Reuse npm cache folder
@@ -46,10 +46,10 @@ jobs:
./node_modules
./test-electron/node_modules
# invalidate cache when any package.json changes
- key: ${{ runner.os }}-npm-x2-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
+ key: ${{ runner.os }}-npm-x3-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
- ${{ runner.os }}-npm-x2-${{ env.cache-name }}-
- ${{ runner.os }}-npm-x2-
+ ${{ runner.os }}-npm-x3-${{ env.cache-name }}-
+ ${{ runner.os }}-npm-x3-
${{ runner.os }}-
# install
@@ -117,9 +117,9 @@ jobs:
./node_modules
./test-electron/node_modules
# invalidate cache when any package.json changes
- key: ${{ runner.os }}-npm-test-node-x2-${{ matrix.node }}-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
+ key: ${{ runner.os }}-npm-test-node-x3-${{ matrix.node }}-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
- ${{ runner.os }}-npm-test-node-x2-${{ matrix.node }}-${{ env.cache-name }}-
+ ${{ runner.os }}-npm-test-node-x3-${{ matrix.node }}-${{ env.cache-name }}-
${{ runner.os }}-npm-test-node
${{ runner.os }}-test-node
@@ -140,22 +140,22 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v4.0.0
with:
- node-version: '20.9.0'
+ node-version-file: ".nvmrc"
# https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows
- name: Reuse npm cache folder
uses: actions/cache@v3
env:
- cache-name: cache-node-modules
+ cache-name: cache-node-deno-modules
with:
path: |
~/.npm
./node_modules
./test-electron/node_modules
# invalidate cache when any package.json changes
- key: ${{ runner.os }}-npm-test-deno-x2-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
+ key: ${{ runner.os }}-npm-test-deno-x3-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
- ${{ runner.os }}-npm-test-deno-x2-${{ env.cache-name }}-
+ ${{ runner.os }}-npm-test-deno-x3-${{ env.cache-name }}-
${{ runner.os }}-npm-test-deno
${{ runner.os }}-test-deno
@@ -174,7 +174,7 @@ jobs:
/home/runner/.cache/deno
# do not cache based on package.json because deno install randomly fails
# and it would then never succeed on the first run on dependency updateds
- key: ${{ runner.os }}-deno-x2-
+ key: ${{ runner.os }}-deno-x3-
- uses: denoland/setup-deno@v1
with:
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 00000000..d5a15960
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+20.10.0
diff --git a/docs/e2e.js b/docs/e2e.js
index 2c584ea1..481dc34d 100644
--- a/docs/e2e.js
+++ b/docs/e2e.js
@@ -238,18 +238,7 @@ function _startListening(channel) {
var listenerFn = function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (listenerObject) {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- var hundredMsInMicro = 100 * 1000;
- var minMessageTime = listenerObject.time - hundredMsInMicro;
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
@@ -389,7 +378,7 @@ function beLeader(leaderElector) {
leaderElector._lstns.push(isLeaderListener);
return sendLeaderMessage(leaderElector, 'tell');
}
-},{"unload":412}],5:[function(require,module,exports){
+},{"unload":635}],5:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -1392,14 +1381,15 @@ var microSeconds = exports.microSeconds = _util.microSeconds;
var type = exports.type = 'native';
function create(channelName) {
var state = {
+ time: (0, _util.microSeconds)(),
messagesCallback: null,
bc: new BroadcastChannel(channelName),
subFns: [] // subscriberFunctions
};
- state.bc.onmessage = function (msg) {
+ state.bc.onmessage = function (msgEvent) {
if (state.messagesCallback) {
- state.messagesCallback(msg.data);
+ state.messagesCallback(msgEvent.data);
}
};
return state;
@@ -1455,7 +1445,7 @@ var NativeMethod = exports.NativeMethod = {
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.SimulateMethod = void 0;
+exports.SimulateMethod = exports.SIMULATE_DELAY_TIME = void 0;
exports.averageResponseTime = averageResponseTime;
exports.canBeUsed = canBeUsed;
exports.close = close;
@@ -1470,30 +1460,36 @@ var type = exports.type = 'simulate';
var SIMULATE_CHANNELS = new Set();
function create(channelName) {
var state = {
+ time: microSeconds(),
name: channelName,
messagesCallback: null
};
+ console.log('created channel ' + state.counter);
SIMULATE_CHANNELS.add(state);
return state;
}
function close(channelState) {
SIMULATE_CHANNELS["delete"](channelState);
}
+var SIMULATE_DELAY_TIME = exports.SIMULATE_DELAY_TIME = 5;
function postMessage(channelState, messageJson) {
return new Promise(function (res) {
return setTimeout(function () {
var channelArray = Array.from(SIMULATE_CHANNELS);
- channelArray.filter(function (channel) {
- return channel.name === channelState.name;
- }).filter(function (channel) {
- return channel !== channelState;
- }).filter(function (channel) {
- return !!channel.messagesCallback;
- }).forEach(function (channel) {
- return channel.messagesCallback(messageJson);
+ channelArray.forEach(function (channel) {
+ if (channel.name === channelState.name &&
+ // has same name
+ channel !== channelState &&
+ // not own channel
+ !!channel.messagesCallback &&
+ // has subscribers
+ channel.time < messageJson.time // channel not created after postMessage() call
+ ) {
+ channel.messagesCallback(messageJson);
+ }
});
res();
- }, 5);
+ }, SIMULATE_DELAY_TIME);
});
}
function onMessage(channelState, fn) {
@@ -1503,7 +1499,7 @@ function canBeUsed() {
return true;
}
function averageResponseTime() {
- return 5;
+ return SIMULATE_DELAY_TIME;
}
var SimulateMethod = exports.SimulateMethod = {
create: create,
@@ -1596,25 +1592,21 @@ function randomToken() {
return Math.random().toString(36).substring(2);
}
var lastMs = 0;
-var additional = 0;
/**
- * returns the current time in micro-seconds,
+ * Returns the current unix time in micro-seconds,
* WARNING: This is a pseudo-function
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
* This is enough in browsers, and this function will not be used in nodejs.
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
*/
function microSeconds() {
- var ms = Date.now();
- if (ms === lastMs) {
- additional++;
- return ms * 1000 + additional;
- } else {
- lastMs = ms;
- additional = 0;
- return ms * 1000;
+ var ret = Date.now() * 1000; // milliseconds to microseconds
+ if (ret <= lastMs) {
+ ret = lastMs + 1;
}
+ lastMs = ret;
+ return ret;
}
/**
@@ -4642,7 +4634,7 @@ if ($defineProperty) {
module.exports.apply = applyBind;
}
-},{"function-bind":356,"get-intrinsic":358,"set-function-length":407}],45:[function(require,module,exports){
+},{"function-bind":356,"get-intrinsic":358,"set-function-length":630}],45:[function(require,module,exports){
(function (Buffer){(function (){
var clone = (function() {
'use strict';
@@ -11724,7 +11716,7 @@ module.exports = function deepEqual(a, b, opts) {
return internalDeepEqual(a, b, opts, getSideChannel());
};
-},{"array-buffer-byte-length":21,"call-bind/callBound":43,"es-get-iterator":353,"get-intrinsic":358,"is-arguments":369,"is-array-buffer":370,"is-date-object":374,"is-regex":378,"is-shared-array-buffer":380,"isarray":386,"object-is":389,"object-keys":393,"object.assign":396,"regexp.prototype.flags":404,"side-channel":409,"which-boxed-primitive":414,"which-collection":415,"which-typed-array":416}],351:[function(require,module,exports){
+},{"array-buffer-byte-length":21,"call-bind/callBound":43,"es-get-iterator":353,"get-intrinsic":358,"is-arguments":369,"is-array-buffer":370,"is-date-object":374,"is-regex":378,"is-shared-array-buffer":380,"isarray":386,"object-is":389,"object-keys":393,"object.assign":396,"regexp.prototype.flags":404,"side-channel":632,"which-boxed-primitive":637,"which-collection":638,"which-typed-array":639}],351:[function(require,module,exports){
'use strict';
var hasPropertyDescriptors = require('has-property-descriptors')();
@@ -12036,7 +12028,7 @@ if (require('has-symbols')() || require('has-symbols/shams')()) {
}
}).call(this)}).call(this,require('_process'))
-},{"_process":401,"call-bind/callBound":43,"get-intrinsic":358,"has-symbols":363,"has-symbols/shams":364,"is-arguments":369,"is-map":375,"is-set":379,"is-string":381,"isarray":386,"stop-iteration-iterator":410}],354:[function(require,module,exports){
+},{"_process":401,"call-bind/callBound":43,"get-intrinsic":358,"has-symbols":363,"has-symbols/shams":364,"is-arguments":369,"is-map":375,"is-set":379,"is-string":381,"isarray":386,"stop-iteration-iterator":633}],354:[function(require,module,exports){
'use strict';
var isCallable = require('is-callable');
@@ -12886,7 +12878,7 @@ if (Object.freeze) {
module.exports = SLOT;
-},{"get-intrinsic":358,"hasown":366,"side-channel":409}],369:[function(require,module,exports){
+},{"get-intrinsic":358,"hasown":366,"side-channel":632}],369:[function(require,module,exports){
'use strict';
var hasToStringTag = require('has-tostringtag/shams')();
@@ -13438,7 +13430,7 @@ module.exports = function isTypedArray(value) {
return !!whichTypedArray(value);
};
-},{"which-typed-array":416}],384:[function(require,module,exports){
+},{"which-typed-array":639}],384:[function(require,module,exports){
'use strict';
var $WeakMap = typeof WeakMap === 'function' && WeakMap.prototype ? WeakMap : null;
@@ -15539,7 +15531,7 @@ module.exports = setFunctionName(function flags() {
}, 'get flags', true);
-},{"set-function-name":408}],404:[function(require,module,exports){
+},{"set-function-name":631}],404:[function(require,module,exports){
'use strict';
var define = require('define-properties');
@@ -15626,127 +15618,7769 @@ module.exports = function shimFlags() {
};
},{"./polyfill":405,"define-properties":352}],407:[function(require,module,exports){
-'use strict';
-
-var GetIntrinsic = require('get-intrinsic');
-var define = require('define-data-property');
-var hasDescriptors = require('has-property-descriptors')();
-var gOPD = require('gopd');
-
-var $TypeError = GetIntrinsic('%TypeError%');
-var $floor = GetIntrinsic('%Math.floor%');
-
-module.exports = function setFunctionLength(fn, length) {
- if (typeof fn !== 'function') {
- throw new $TypeError('`fn` is not a function');
- }
- if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
- throw new $TypeError('`length` must be a positive 32-bit integer');
- }
-
- var loose = arguments.length > 2 && !!arguments[2];
-
- var functionLengthIsConfigurable = true;
- var functionLengthIsWritable = true;
- if ('length' in fn && gOPD) {
- var desc = gOPD(fn, 'length');
- if (desc && !desc.configurable) {
- functionLengthIsConfigurable = false;
- }
- if (desc && !desc.writable) {
- functionLengthIsWritable = false;
- }
- }
-
- if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
- if (hasDescriptors) {
- define(fn, 'length', length, true, true);
- } else {
- define(fn, 'length', length);
- }
- }
- return fn;
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __exportStar = (this && this.__exportStar) || function(m, exports) {
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.interval = exports.iif = exports.generate = exports.fromEventPattern = exports.fromEvent = exports.from = exports.forkJoin = exports.empty = exports.defer = exports.connectable = exports.concat = exports.combineLatest = exports.bindNodeCallback = exports.bindCallback = exports.UnsubscriptionError = exports.TimeoutError = exports.SequenceError = exports.ObjectUnsubscribedError = exports.NotFoundError = exports.EmptyError = exports.ArgumentOutOfRangeError = exports.firstValueFrom = exports.lastValueFrom = exports.isObservable = exports.identity = exports.noop = exports.pipe = exports.NotificationKind = exports.Notification = exports.Subscriber = exports.Subscription = exports.Scheduler = exports.VirtualAction = exports.VirtualTimeScheduler = exports.animationFrameScheduler = exports.animationFrame = exports.queueScheduler = exports.queue = exports.asyncScheduler = exports.async = exports.asapScheduler = exports.asap = exports.AsyncSubject = exports.ReplaySubject = exports.BehaviorSubject = exports.Subject = exports.animationFrames = exports.observable = exports.ConnectableObservable = exports.Observable = void 0;
+exports.filter = exports.expand = exports.exhaustMap = exports.exhaustAll = exports.exhaust = exports.every = exports.endWith = exports.elementAt = exports.distinctUntilKeyChanged = exports.distinctUntilChanged = exports.distinct = exports.dematerialize = exports.delayWhen = exports.delay = exports.defaultIfEmpty = exports.debounceTime = exports.debounce = exports.count = exports.connect = exports.concatWith = exports.concatMapTo = exports.concatMap = exports.concatAll = exports.combineLatestWith = exports.combineLatestAll = exports.combineAll = exports.catchError = exports.bufferWhen = exports.bufferToggle = exports.bufferTime = exports.bufferCount = exports.buffer = exports.auditTime = exports.audit = exports.config = exports.NEVER = exports.EMPTY = exports.scheduled = exports.zip = exports.using = exports.timer = exports.throwError = exports.range = exports.race = exports.partition = exports.pairs = exports.onErrorResumeNext = exports.of = exports.never = exports.merge = void 0;
+exports.switchMap = exports.switchAll = exports.subscribeOn = exports.startWith = exports.skipWhile = exports.skipUntil = exports.skipLast = exports.skip = exports.single = exports.shareReplay = exports.share = exports.sequenceEqual = exports.scan = exports.sampleTime = exports.sample = exports.refCount = exports.retryWhen = exports.retry = exports.repeatWhen = exports.repeat = exports.reduce = exports.raceWith = exports.publishReplay = exports.publishLast = exports.publishBehavior = exports.publish = exports.pluck = exports.pairwise = exports.onErrorResumeNextWith = exports.observeOn = exports.multicast = exports.min = exports.mergeWith = exports.mergeScan = exports.mergeMapTo = exports.mergeMap = exports.flatMap = exports.mergeAll = exports.max = exports.materialize = exports.mapTo = exports.map = exports.last = exports.isEmpty = exports.ignoreElements = exports.groupBy = exports.first = exports.findIndex = exports.find = exports.finalize = void 0;
+exports.zipWith = exports.zipAll = exports.withLatestFrom = exports.windowWhen = exports.windowToggle = exports.windowTime = exports.windowCount = exports.window = exports.toArray = exports.timestamp = exports.timeoutWith = exports.timeout = exports.timeInterval = exports.throwIfEmpty = exports.throttleTime = exports.throttle = exports.tap = exports.takeWhile = exports.takeUntil = exports.takeLast = exports.take = exports.switchScan = exports.switchMapTo = void 0;
+var Observable_1 = require("./internal/Observable");
+Object.defineProperty(exports, "Observable", { enumerable: true, get: function () { return Observable_1.Observable; } });
+var ConnectableObservable_1 = require("./internal/observable/ConnectableObservable");
+Object.defineProperty(exports, "ConnectableObservable", { enumerable: true, get: function () { return ConnectableObservable_1.ConnectableObservable; } });
+var observable_1 = require("./internal/symbol/observable");
+Object.defineProperty(exports, "observable", { enumerable: true, get: function () { return observable_1.observable; } });
+var animationFrames_1 = require("./internal/observable/dom/animationFrames");
+Object.defineProperty(exports, "animationFrames", { enumerable: true, get: function () { return animationFrames_1.animationFrames; } });
+var Subject_1 = require("./internal/Subject");
+Object.defineProperty(exports, "Subject", { enumerable: true, get: function () { return Subject_1.Subject; } });
+var BehaviorSubject_1 = require("./internal/BehaviorSubject");
+Object.defineProperty(exports, "BehaviorSubject", { enumerable: true, get: function () { return BehaviorSubject_1.BehaviorSubject; } });
+var ReplaySubject_1 = require("./internal/ReplaySubject");
+Object.defineProperty(exports, "ReplaySubject", { enumerable: true, get: function () { return ReplaySubject_1.ReplaySubject; } });
+var AsyncSubject_1 = require("./internal/AsyncSubject");
+Object.defineProperty(exports, "AsyncSubject", { enumerable: true, get: function () { return AsyncSubject_1.AsyncSubject; } });
+var asap_1 = require("./internal/scheduler/asap");
+Object.defineProperty(exports, "asap", { enumerable: true, get: function () { return asap_1.asap; } });
+Object.defineProperty(exports, "asapScheduler", { enumerable: true, get: function () { return asap_1.asapScheduler; } });
+var async_1 = require("./internal/scheduler/async");
+Object.defineProperty(exports, "async", { enumerable: true, get: function () { return async_1.async; } });
+Object.defineProperty(exports, "asyncScheduler", { enumerable: true, get: function () { return async_1.asyncScheduler; } });
+var queue_1 = require("./internal/scheduler/queue");
+Object.defineProperty(exports, "queue", { enumerable: true, get: function () { return queue_1.queue; } });
+Object.defineProperty(exports, "queueScheduler", { enumerable: true, get: function () { return queue_1.queueScheduler; } });
+var animationFrame_1 = require("./internal/scheduler/animationFrame");
+Object.defineProperty(exports, "animationFrame", { enumerable: true, get: function () { return animationFrame_1.animationFrame; } });
+Object.defineProperty(exports, "animationFrameScheduler", { enumerable: true, get: function () { return animationFrame_1.animationFrameScheduler; } });
+var VirtualTimeScheduler_1 = require("./internal/scheduler/VirtualTimeScheduler");
+Object.defineProperty(exports, "VirtualTimeScheduler", { enumerable: true, get: function () { return VirtualTimeScheduler_1.VirtualTimeScheduler; } });
+Object.defineProperty(exports, "VirtualAction", { enumerable: true, get: function () { return VirtualTimeScheduler_1.VirtualAction; } });
+var Scheduler_1 = require("./internal/Scheduler");
+Object.defineProperty(exports, "Scheduler", { enumerable: true, get: function () { return Scheduler_1.Scheduler; } });
+var Subscription_1 = require("./internal/Subscription");
+Object.defineProperty(exports, "Subscription", { enumerable: true, get: function () { return Subscription_1.Subscription; } });
+var Subscriber_1 = require("./internal/Subscriber");
+Object.defineProperty(exports, "Subscriber", { enumerable: true, get: function () { return Subscriber_1.Subscriber; } });
+var Notification_1 = require("./internal/Notification");
+Object.defineProperty(exports, "Notification", { enumerable: true, get: function () { return Notification_1.Notification; } });
+Object.defineProperty(exports, "NotificationKind", { enumerable: true, get: function () { return Notification_1.NotificationKind; } });
+var pipe_1 = require("./internal/util/pipe");
+Object.defineProperty(exports, "pipe", { enumerable: true, get: function () { return pipe_1.pipe; } });
+var noop_1 = require("./internal/util/noop");
+Object.defineProperty(exports, "noop", { enumerable: true, get: function () { return noop_1.noop; } });
+var identity_1 = require("./internal/util/identity");
+Object.defineProperty(exports, "identity", { enumerable: true, get: function () { return identity_1.identity; } });
+var isObservable_1 = require("./internal/util/isObservable");
+Object.defineProperty(exports, "isObservable", { enumerable: true, get: function () { return isObservable_1.isObservable; } });
+var lastValueFrom_1 = require("./internal/lastValueFrom");
+Object.defineProperty(exports, "lastValueFrom", { enumerable: true, get: function () { return lastValueFrom_1.lastValueFrom; } });
+var firstValueFrom_1 = require("./internal/firstValueFrom");
+Object.defineProperty(exports, "firstValueFrom", { enumerable: true, get: function () { return firstValueFrom_1.firstValueFrom; } });
+var ArgumentOutOfRangeError_1 = require("./internal/util/ArgumentOutOfRangeError");
+Object.defineProperty(exports, "ArgumentOutOfRangeError", { enumerable: true, get: function () { return ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; } });
+var EmptyError_1 = require("./internal/util/EmptyError");
+Object.defineProperty(exports, "EmptyError", { enumerable: true, get: function () { return EmptyError_1.EmptyError; } });
+var NotFoundError_1 = require("./internal/util/NotFoundError");
+Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return NotFoundError_1.NotFoundError; } });
+var ObjectUnsubscribedError_1 = require("./internal/util/ObjectUnsubscribedError");
+Object.defineProperty(exports, "ObjectUnsubscribedError", { enumerable: true, get: function () { return ObjectUnsubscribedError_1.ObjectUnsubscribedError; } });
+var SequenceError_1 = require("./internal/util/SequenceError");
+Object.defineProperty(exports, "SequenceError", { enumerable: true, get: function () { return SequenceError_1.SequenceError; } });
+var timeout_1 = require("./internal/operators/timeout");
+Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return timeout_1.TimeoutError; } });
+var UnsubscriptionError_1 = require("./internal/util/UnsubscriptionError");
+Object.defineProperty(exports, "UnsubscriptionError", { enumerable: true, get: function () { return UnsubscriptionError_1.UnsubscriptionError; } });
+var bindCallback_1 = require("./internal/observable/bindCallback");
+Object.defineProperty(exports, "bindCallback", { enumerable: true, get: function () { return bindCallback_1.bindCallback; } });
+var bindNodeCallback_1 = require("./internal/observable/bindNodeCallback");
+Object.defineProperty(exports, "bindNodeCallback", { enumerable: true, get: function () { return bindNodeCallback_1.bindNodeCallback; } });
+var combineLatest_1 = require("./internal/observable/combineLatest");
+Object.defineProperty(exports, "combineLatest", { enumerable: true, get: function () { return combineLatest_1.combineLatest; } });
+var concat_1 = require("./internal/observable/concat");
+Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return concat_1.concat; } });
+var connectable_1 = require("./internal/observable/connectable");
+Object.defineProperty(exports, "connectable", { enumerable: true, get: function () { return connectable_1.connectable; } });
+var defer_1 = require("./internal/observable/defer");
+Object.defineProperty(exports, "defer", { enumerable: true, get: function () { return defer_1.defer; } });
+var empty_1 = require("./internal/observable/empty");
+Object.defineProperty(exports, "empty", { enumerable: true, get: function () { return empty_1.empty; } });
+var forkJoin_1 = require("./internal/observable/forkJoin");
+Object.defineProperty(exports, "forkJoin", { enumerable: true, get: function () { return forkJoin_1.forkJoin; } });
+var from_1 = require("./internal/observable/from");
+Object.defineProperty(exports, "from", { enumerable: true, get: function () { return from_1.from; } });
+var fromEvent_1 = require("./internal/observable/fromEvent");
+Object.defineProperty(exports, "fromEvent", { enumerable: true, get: function () { return fromEvent_1.fromEvent; } });
+var fromEventPattern_1 = require("./internal/observable/fromEventPattern");
+Object.defineProperty(exports, "fromEventPattern", { enumerable: true, get: function () { return fromEventPattern_1.fromEventPattern; } });
+var generate_1 = require("./internal/observable/generate");
+Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return generate_1.generate; } });
+var iif_1 = require("./internal/observable/iif");
+Object.defineProperty(exports, "iif", { enumerable: true, get: function () { return iif_1.iif; } });
+var interval_1 = require("./internal/observable/interval");
+Object.defineProperty(exports, "interval", { enumerable: true, get: function () { return interval_1.interval; } });
+var merge_1 = require("./internal/observable/merge");
+Object.defineProperty(exports, "merge", { enumerable: true, get: function () { return merge_1.merge; } });
+var never_1 = require("./internal/observable/never");
+Object.defineProperty(exports, "never", { enumerable: true, get: function () { return never_1.never; } });
+var of_1 = require("./internal/observable/of");
+Object.defineProperty(exports, "of", { enumerable: true, get: function () { return of_1.of; } });
+var onErrorResumeNext_1 = require("./internal/observable/onErrorResumeNext");
+Object.defineProperty(exports, "onErrorResumeNext", { enumerable: true, get: function () { return onErrorResumeNext_1.onErrorResumeNext; } });
+var pairs_1 = require("./internal/observable/pairs");
+Object.defineProperty(exports, "pairs", { enumerable: true, get: function () { return pairs_1.pairs; } });
+var partition_1 = require("./internal/observable/partition");
+Object.defineProperty(exports, "partition", { enumerable: true, get: function () { return partition_1.partition; } });
+var race_1 = require("./internal/observable/race");
+Object.defineProperty(exports, "race", { enumerable: true, get: function () { return race_1.race; } });
+var range_1 = require("./internal/observable/range");
+Object.defineProperty(exports, "range", { enumerable: true, get: function () { return range_1.range; } });
+var throwError_1 = require("./internal/observable/throwError");
+Object.defineProperty(exports, "throwError", { enumerable: true, get: function () { return throwError_1.throwError; } });
+var timer_1 = require("./internal/observable/timer");
+Object.defineProperty(exports, "timer", { enumerable: true, get: function () { return timer_1.timer; } });
+var using_1 = require("./internal/observable/using");
+Object.defineProperty(exports, "using", { enumerable: true, get: function () { return using_1.using; } });
+var zip_1 = require("./internal/observable/zip");
+Object.defineProperty(exports, "zip", { enumerable: true, get: function () { return zip_1.zip; } });
+var scheduled_1 = require("./internal/scheduled/scheduled");
+Object.defineProperty(exports, "scheduled", { enumerable: true, get: function () { return scheduled_1.scheduled; } });
+var empty_2 = require("./internal/observable/empty");
+Object.defineProperty(exports, "EMPTY", { enumerable: true, get: function () { return empty_2.EMPTY; } });
+var never_2 = require("./internal/observable/never");
+Object.defineProperty(exports, "NEVER", { enumerable: true, get: function () { return never_2.NEVER; } });
+__exportStar(require("./internal/types"), exports);
+var config_1 = require("./internal/config");
+Object.defineProperty(exports, "config", { enumerable: true, get: function () { return config_1.config; } });
+var audit_1 = require("./internal/operators/audit");
+Object.defineProperty(exports, "audit", { enumerable: true, get: function () { return audit_1.audit; } });
+var auditTime_1 = require("./internal/operators/auditTime");
+Object.defineProperty(exports, "auditTime", { enumerable: true, get: function () { return auditTime_1.auditTime; } });
+var buffer_1 = require("./internal/operators/buffer");
+Object.defineProperty(exports, "buffer", { enumerable: true, get: function () { return buffer_1.buffer; } });
+var bufferCount_1 = require("./internal/operators/bufferCount");
+Object.defineProperty(exports, "bufferCount", { enumerable: true, get: function () { return bufferCount_1.bufferCount; } });
+var bufferTime_1 = require("./internal/operators/bufferTime");
+Object.defineProperty(exports, "bufferTime", { enumerable: true, get: function () { return bufferTime_1.bufferTime; } });
+var bufferToggle_1 = require("./internal/operators/bufferToggle");
+Object.defineProperty(exports, "bufferToggle", { enumerable: true, get: function () { return bufferToggle_1.bufferToggle; } });
+var bufferWhen_1 = require("./internal/operators/bufferWhen");
+Object.defineProperty(exports, "bufferWhen", { enumerable: true, get: function () { return bufferWhen_1.bufferWhen; } });
+var catchError_1 = require("./internal/operators/catchError");
+Object.defineProperty(exports, "catchError", { enumerable: true, get: function () { return catchError_1.catchError; } });
+var combineAll_1 = require("./internal/operators/combineAll");
+Object.defineProperty(exports, "combineAll", { enumerable: true, get: function () { return combineAll_1.combineAll; } });
+var combineLatestAll_1 = require("./internal/operators/combineLatestAll");
+Object.defineProperty(exports, "combineLatestAll", { enumerable: true, get: function () { return combineLatestAll_1.combineLatestAll; } });
+var combineLatestWith_1 = require("./internal/operators/combineLatestWith");
+Object.defineProperty(exports, "combineLatestWith", { enumerable: true, get: function () { return combineLatestWith_1.combineLatestWith; } });
+var concatAll_1 = require("./internal/operators/concatAll");
+Object.defineProperty(exports, "concatAll", { enumerable: true, get: function () { return concatAll_1.concatAll; } });
+var concatMap_1 = require("./internal/operators/concatMap");
+Object.defineProperty(exports, "concatMap", { enumerable: true, get: function () { return concatMap_1.concatMap; } });
+var concatMapTo_1 = require("./internal/operators/concatMapTo");
+Object.defineProperty(exports, "concatMapTo", { enumerable: true, get: function () { return concatMapTo_1.concatMapTo; } });
+var concatWith_1 = require("./internal/operators/concatWith");
+Object.defineProperty(exports, "concatWith", { enumerable: true, get: function () { return concatWith_1.concatWith; } });
+var connect_1 = require("./internal/operators/connect");
+Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return connect_1.connect; } });
+var count_1 = require("./internal/operators/count");
+Object.defineProperty(exports, "count", { enumerable: true, get: function () { return count_1.count; } });
+var debounce_1 = require("./internal/operators/debounce");
+Object.defineProperty(exports, "debounce", { enumerable: true, get: function () { return debounce_1.debounce; } });
+var debounceTime_1 = require("./internal/operators/debounceTime");
+Object.defineProperty(exports, "debounceTime", { enumerable: true, get: function () { return debounceTime_1.debounceTime; } });
+var defaultIfEmpty_1 = require("./internal/operators/defaultIfEmpty");
+Object.defineProperty(exports, "defaultIfEmpty", { enumerable: true, get: function () { return defaultIfEmpty_1.defaultIfEmpty; } });
+var delay_1 = require("./internal/operators/delay");
+Object.defineProperty(exports, "delay", { enumerable: true, get: function () { return delay_1.delay; } });
+var delayWhen_1 = require("./internal/operators/delayWhen");
+Object.defineProperty(exports, "delayWhen", { enumerable: true, get: function () { return delayWhen_1.delayWhen; } });
+var dematerialize_1 = require("./internal/operators/dematerialize");
+Object.defineProperty(exports, "dematerialize", { enumerable: true, get: function () { return dematerialize_1.dematerialize; } });
+var distinct_1 = require("./internal/operators/distinct");
+Object.defineProperty(exports, "distinct", { enumerable: true, get: function () { return distinct_1.distinct; } });
+var distinctUntilChanged_1 = require("./internal/operators/distinctUntilChanged");
+Object.defineProperty(exports, "distinctUntilChanged", { enumerable: true, get: function () { return distinctUntilChanged_1.distinctUntilChanged; } });
+var distinctUntilKeyChanged_1 = require("./internal/operators/distinctUntilKeyChanged");
+Object.defineProperty(exports, "distinctUntilKeyChanged", { enumerable: true, get: function () { return distinctUntilKeyChanged_1.distinctUntilKeyChanged; } });
+var elementAt_1 = require("./internal/operators/elementAt");
+Object.defineProperty(exports, "elementAt", { enumerable: true, get: function () { return elementAt_1.elementAt; } });
+var endWith_1 = require("./internal/operators/endWith");
+Object.defineProperty(exports, "endWith", { enumerable: true, get: function () { return endWith_1.endWith; } });
+var every_1 = require("./internal/operators/every");
+Object.defineProperty(exports, "every", { enumerable: true, get: function () { return every_1.every; } });
+var exhaust_1 = require("./internal/operators/exhaust");
+Object.defineProperty(exports, "exhaust", { enumerable: true, get: function () { return exhaust_1.exhaust; } });
+var exhaustAll_1 = require("./internal/operators/exhaustAll");
+Object.defineProperty(exports, "exhaustAll", { enumerable: true, get: function () { return exhaustAll_1.exhaustAll; } });
+var exhaustMap_1 = require("./internal/operators/exhaustMap");
+Object.defineProperty(exports, "exhaustMap", { enumerable: true, get: function () { return exhaustMap_1.exhaustMap; } });
+var expand_1 = require("./internal/operators/expand");
+Object.defineProperty(exports, "expand", { enumerable: true, get: function () { return expand_1.expand; } });
+var filter_1 = require("./internal/operators/filter");
+Object.defineProperty(exports, "filter", { enumerable: true, get: function () { return filter_1.filter; } });
+var finalize_1 = require("./internal/operators/finalize");
+Object.defineProperty(exports, "finalize", { enumerable: true, get: function () { return finalize_1.finalize; } });
+var find_1 = require("./internal/operators/find");
+Object.defineProperty(exports, "find", { enumerable: true, get: function () { return find_1.find; } });
+var findIndex_1 = require("./internal/operators/findIndex");
+Object.defineProperty(exports, "findIndex", { enumerable: true, get: function () { return findIndex_1.findIndex; } });
+var first_1 = require("./internal/operators/first");
+Object.defineProperty(exports, "first", { enumerable: true, get: function () { return first_1.first; } });
+var groupBy_1 = require("./internal/operators/groupBy");
+Object.defineProperty(exports, "groupBy", { enumerable: true, get: function () { return groupBy_1.groupBy; } });
+var ignoreElements_1 = require("./internal/operators/ignoreElements");
+Object.defineProperty(exports, "ignoreElements", { enumerable: true, get: function () { return ignoreElements_1.ignoreElements; } });
+var isEmpty_1 = require("./internal/operators/isEmpty");
+Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return isEmpty_1.isEmpty; } });
+var last_1 = require("./internal/operators/last");
+Object.defineProperty(exports, "last", { enumerable: true, get: function () { return last_1.last; } });
+var map_1 = require("./internal/operators/map");
+Object.defineProperty(exports, "map", { enumerable: true, get: function () { return map_1.map; } });
+var mapTo_1 = require("./internal/operators/mapTo");
+Object.defineProperty(exports, "mapTo", { enumerable: true, get: function () { return mapTo_1.mapTo; } });
+var materialize_1 = require("./internal/operators/materialize");
+Object.defineProperty(exports, "materialize", { enumerable: true, get: function () { return materialize_1.materialize; } });
+var max_1 = require("./internal/operators/max");
+Object.defineProperty(exports, "max", { enumerable: true, get: function () { return max_1.max; } });
+var mergeAll_1 = require("./internal/operators/mergeAll");
+Object.defineProperty(exports, "mergeAll", { enumerable: true, get: function () { return mergeAll_1.mergeAll; } });
+var flatMap_1 = require("./internal/operators/flatMap");
+Object.defineProperty(exports, "flatMap", { enumerable: true, get: function () { return flatMap_1.flatMap; } });
+var mergeMap_1 = require("./internal/operators/mergeMap");
+Object.defineProperty(exports, "mergeMap", { enumerable: true, get: function () { return mergeMap_1.mergeMap; } });
+var mergeMapTo_1 = require("./internal/operators/mergeMapTo");
+Object.defineProperty(exports, "mergeMapTo", { enumerable: true, get: function () { return mergeMapTo_1.mergeMapTo; } });
+var mergeScan_1 = require("./internal/operators/mergeScan");
+Object.defineProperty(exports, "mergeScan", { enumerable: true, get: function () { return mergeScan_1.mergeScan; } });
+var mergeWith_1 = require("./internal/operators/mergeWith");
+Object.defineProperty(exports, "mergeWith", { enumerable: true, get: function () { return mergeWith_1.mergeWith; } });
+var min_1 = require("./internal/operators/min");
+Object.defineProperty(exports, "min", { enumerable: true, get: function () { return min_1.min; } });
+var multicast_1 = require("./internal/operators/multicast");
+Object.defineProperty(exports, "multicast", { enumerable: true, get: function () { return multicast_1.multicast; } });
+var observeOn_1 = require("./internal/operators/observeOn");
+Object.defineProperty(exports, "observeOn", { enumerable: true, get: function () { return observeOn_1.observeOn; } });
+var onErrorResumeNextWith_1 = require("./internal/operators/onErrorResumeNextWith");
+Object.defineProperty(exports, "onErrorResumeNextWith", { enumerable: true, get: function () { return onErrorResumeNextWith_1.onErrorResumeNextWith; } });
+var pairwise_1 = require("./internal/operators/pairwise");
+Object.defineProperty(exports, "pairwise", { enumerable: true, get: function () { return pairwise_1.pairwise; } });
+var pluck_1 = require("./internal/operators/pluck");
+Object.defineProperty(exports, "pluck", { enumerable: true, get: function () { return pluck_1.pluck; } });
+var publish_1 = require("./internal/operators/publish");
+Object.defineProperty(exports, "publish", { enumerable: true, get: function () { return publish_1.publish; } });
+var publishBehavior_1 = require("./internal/operators/publishBehavior");
+Object.defineProperty(exports, "publishBehavior", { enumerable: true, get: function () { return publishBehavior_1.publishBehavior; } });
+var publishLast_1 = require("./internal/operators/publishLast");
+Object.defineProperty(exports, "publishLast", { enumerable: true, get: function () { return publishLast_1.publishLast; } });
+var publishReplay_1 = require("./internal/operators/publishReplay");
+Object.defineProperty(exports, "publishReplay", { enumerable: true, get: function () { return publishReplay_1.publishReplay; } });
+var raceWith_1 = require("./internal/operators/raceWith");
+Object.defineProperty(exports, "raceWith", { enumerable: true, get: function () { return raceWith_1.raceWith; } });
+var reduce_1 = require("./internal/operators/reduce");
+Object.defineProperty(exports, "reduce", { enumerable: true, get: function () { return reduce_1.reduce; } });
+var repeat_1 = require("./internal/operators/repeat");
+Object.defineProperty(exports, "repeat", { enumerable: true, get: function () { return repeat_1.repeat; } });
+var repeatWhen_1 = require("./internal/operators/repeatWhen");
+Object.defineProperty(exports, "repeatWhen", { enumerable: true, get: function () { return repeatWhen_1.repeatWhen; } });
+var retry_1 = require("./internal/operators/retry");
+Object.defineProperty(exports, "retry", { enumerable: true, get: function () { return retry_1.retry; } });
+var retryWhen_1 = require("./internal/operators/retryWhen");
+Object.defineProperty(exports, "retryWhen", { enumerable: true, get: function () { return retryWhen_1.retryWhen; } });
+var refCount_1 = require("./internal/operators/refCount");
+Object.defineProperty(exports, "refCount", { enumerable: true, get: function () { return refCount_1.refCount; } });
+var sample_1 = require("./internal/operators/sample");
+Object.defineProperty(exports, "sample", { enumerable: true, get: function () { return sample_1.sample; } });
+var sampleTime_1 = require("./internal/operators/sampleTime");
+Object.defineProperty(exports, "sampleTime", { enumerable: true, get: function () { return sampleTime_1.sampleTime; } });
+var scan_1 = require("./internal/operators/scan");
+Object.defineProperty(exports, "scan", { enumerable: true, get: function () { return scan_1.scan; } });
+var sequenceEqual_1 = require("./internal/operators/sequenceEqual");
+Object.defineProperty(exports, "sequenceEqual", { enumerable: true, get: function () { return sequenceEqual_1.sequenceEqual; } });
+var share_1 = require("./internal/operators/share");
+Object.defineProperty(exports, "share", { enumerable: true, get: function () { return share_1.share; } });
+var shareReplay_1 = require("./internal/operators/shareReplay");
+Object.defineProperty(exports, "shareReplay", { enumerable: true, get: function () { return shareReplay_1.shareReplay; } });
+var single_1 = require("./internal/operators/single");
+Object.defineProperty(exports, "single", { enumerable: true, get: function () { return single_1.single; } });
+var skip_1 = require("./internal/operators/skip");
+Object.defineProperty(exports, "skip", { enumerable: true, get: function () { return skip_1.skip; } });
+var skipLast_1 = require("./internal/operators/skipLast");
+Object.defineProperty(exports, "skipLast", { enumerable: true, get: function () { return skipLast_1.skipLast; } });
+var skipUntil_1 = require("./internal/operators/skipUntil");
+Object.defineProperty(exports, "skipUntil", { enumerable: true, get: function () { return skipUntil_1.skipUntil; } });
+var skipWhile_1 = require("./internal/operators/skipWhile");
+Object.defineProperty(exports, "skipWhile", { enumerable: true, get: function () { return skipWhile_1.skipWhile; } });
+var startWith_1 = require("./internal/operators/startWith");
+Object.defineProperty(exports, "startWith", { enumerable: true, get: function () { return startWith_1.startWith; } });
+var subscribeOn_1 = require("./internal/operators/subscribeOn");
+Object.defineProperty(exports, "subscribeOn", { enumerable: true, get: function () { return subscribeOn_1.subscribeOn; } });
+var switchAll_1 = require("./internal/operators/switchAll");
+Object.defineProperty(exports, "switchAll", { enumerable: true, get: function () { return switchAll_1.switchAll; } });
+var switchMap_1 = require("./internal/operators/switchMap");
+Object.defineProperty(exports, "switchMap", { enumerable: true, get: function () { return switchMap_1.switchMap; } });
+var switchMapTo_1 = require("./internal/operators/switchMapTo");
+Object.defineProperty(exports, "switchMapTo", { enumerable: true, get: function () { return switchMapTo_1.switchMapTo; } });
+var switchScan_1 = require("./internal/operators/switchScan");
+Object.defineProperty(exports, "switchScan", { enumerable: true, get: function () { return switchScan_1.switchScan; } });
+var take_1 = require("./internal/operators/take");
+Object.defineProperty(exports, "take", { enumerable: true, get: function () { return take_1.take; } });
+var takeLast_1 = require("./internal/operators/takeLast");
+Object.defineProperty(exports, "takeLast", { enumerable: true, get: function () { return takeLast_1.takeLast; } });
+var takeUntil_1 = require("./internal/operators/takeUntil");
+Object.defineProperty(exports, "takeUntil", { enumerable: true, get: function () { return takeUntil_1.takeUntil; } });
+var takeWhile_1 = require("./internal/operators/takeWhile");
+Object.defineProperty(exports, "takeWhile", { enumerable: true, get: function () { return takeWhile_1.takeWhile; } });
+var tap_1 = require("./internal/operators/tap");
+Object.defineProperty(exports, "tap", { enumerable: true, get: function () { return tap_1.tap; } });
+var throttle_1 = require("./internal/operators/throttle");
+Object.defineProperty(exports, "throttle", { enumerable: true, get: function () { return throttle_1.throttle; } });
+var throttleTime_1 = require("./internal/operators/throttleTime");
+Object.defineProperty(exports, "throttleTime", { enumerable: true, get: function () { return throttleTime_1.throttleTime; } });
+var throwIfEmpty_1 = require("./internal/operators/throwIfEmpty");
+Object.defineProperty(exports, "throwIfEmpty", { enumerable: true, get: function () { return throwIfEmpty_1.throwIfEmpty; } });
+var timeInterval_1 = require("./internal/operators/timeInterval");
+Object.defineProperty(exports, "timeInterval", { enumerable: true, get: function () { return timeInterval_1.timeInterval; } });
+var timeout_2 = require("./internal/operators/timeout");
+Object.defineProperty(exports, "timeout", { enumerable: true, get: function () { return timeout_2.timeout; } });
+var timeoutWith_1 = require("./internal/operators/timeoutWith");
+Object.defineProperty(exports, "timeoutWith", { enumerable: true, get: function () { return timeoutWith_1.timeoutWith; } });
+var timestamp_1 = require("./internal/operators/timestamp");
+Object.defineProperty(exports, "timestamp", { enumerable: true, get: function () { return timestamp_1.timestamp; } });
+var toArray_1 = require("./internal/operators/toArray");
+Object.defineProperty(exports, "toArray", { enumerable: true, get: function () { return toArray_1.toArray; } });
+var window_1 = require("./internal/operators/window");
+Object.defineProperty(exports, "window", { enumerable: true, get: function () { return window_1.window; } });
+var windowCount_1 = require("./internal/operators/windowCount");
+Object.defineProperty(exports, "windowCount", { enumerable: true, get: function () { return windowCount_1.windowCount; } });
+var windowTime_1 = require("./internal/operators/windowTime");
+Object.defineProperty(exports, "windowTime", { enumerable: true, get: function () { return windowTime_1.windowTime; } });
+var windowToggle_1 = require("./internal/operators/windowToggle");
+Object.defineProperty(exports, "windowToggle", { enumerable: true, get: function () { return windowToggle_1.windowToggle; } });
+var windowWhen_1 = require("./internal/operators/windowWhen");
+Object.defineProperty(exports, "windowWhen", { enumerable: true, get: function () { return windowWhen_1.windowWhen; } });
+var withLatestFrom_1 = require("./internal/operators/withLatestFrom");
+Object.defineProperty(exports, "withLatestFrom", { enumerable: true, get: function () { return withLatestFrom_1.withLatestFrom; } });
+var zipAll_1 = require("./internal/operators/zipAll");
+Object.defineProperty(exports, "zipAll", { enumerable: true, get: function () { return zipAll_1.zipAll; } });
+var zipWith_1 = require("./internal/operators/zipWith");
+Object.defineProperty(exports, "zipWith", { enumerable: true, get: function () { return zipWith_1.zipWith; } });
+
+},{"./internal/AsyncSubject":408,"./internal/BehaviorSubject":409,"./internal/Notification":410,"./internal/Observable":412,"./internal/ReplaySubject":413,"./internal/Scheduler":414,"./internal/Subject":415,"./internal/Subscriber":416,"./internal/Subscription":417,"./internal/config":418,"./internal/firstValueFrom":419,"./internal/lastValueFrom":420,"./internal/observable/ConnectableObservable":421,"./internal/observable/bindCallback":422,"./internal/observable/bindNodeCallback":424,"./internal/observable/combineLatest":425,"./internal/observable/concat":426,"./internal/observable/connectable":427,"./internal/observable/defer":428,"./internal/observable/dom/animationFrames":429,"./internal/observable/empty":430,"./internal/observable/forkJoin":431,"./internal/observable/from":432,"./internal/observable/fromEvent":433,"./internal/observable/fromEventPattern":434,"./internal/observable/generate":436,"./internal/observable/iif":437,"./internal/observable/interval":439,"./internal/observable/merge":440,"./internal/observable/never":441,"./internal/observable/of":442,"./internal/observable/onErrorResumeNext":443,"./internal/observable/pairs":444,"./internal/observable/partition":445,"./internal/observable/race":446,"./internal/observable/range":447,"./internal/observable/throwError":448,"./internal/observable/timer":449,"./internal/observable/using":450,"./internal/observable/zip":451,"./internal/operators/audit":453,"./internal/operators/auditTime":454,"./internal/operators/buffer":455,"./internal/operators/bufferCount":456,"./internal/operators/bufferTime":457,"./internal/operators/bufferToggle":458,"./internal/operators/bufferWhen":459,"./internal/operators/catchError":460,"./internal/operators/combineAll":461,"./internal/operators/combineLatestAll":463,"./internal/operators/combineLatestWith":464,"./internal/operators/concatAll":466,"./internal/operators/concatMap":467,"./internal/operators/concatMapTo":468,"./internal/operators/concatWith":469,"./internal/operators/connect":470,"./internal/operators/count":471,"./internal/operators/debounce":472,"./internal/operators/debounceTime":473,"./internal/operators/defaultIfEmpty":474,"./internal/operators/delay":475,"./internal/operators/delayWhen":476,"./internal/operators/dematerialize":477,"./internal/operators/distinct":478,"./internal/operators/distinctUntilChanged":479,"./internal/operators/distinctUntilKeyChanged":480,"./internal/operators/elementAt":481,"./internal/operators/endWith":482,"./internal/operators/every":483,"./internal/operators/exhaust":484,"./internal/operators/exhaustAll":485,"./internal/operators/exhaustMap":486,"./internal/operators/expand":487,"./internal/operators/filter":488,"./internal/operators/finalize":489,"./internal/operators/find":490,"./internal/operators/findIndex":491,"./internal/operators/first":492,"./internal/operators/flatMap":493,"./internal/operators/groupBy":494,"./internal/operators/ignoreElements":495,"./internal/operators/isEmpty":496,"./internal/operators/last":498,"./internal/operators/map":499,"./internal/operators/mapTo":500,"./internal/operators/materialize":501,"./internal/operators/max":502,"./internal/operators/mergeAll":504,"./internal/operators/mergeMap":506,"./internal/operators/mergeMapTo":507,"./internal/operators/mergeScan":508,"./internal/operators/mergeWith":509,"./internal/operators/min":510,"./internal/operators/multicast":511,"./internal/operators/observeOn":512,"./internal/operators/onErrorResumeNextWith":513,"./internal/operators/pairwise":514,"./internal/operators/pluck":515,"./internal/operators/publish":516,"./internal/operators/publishBehavior":517,"./internal/operators/publishLast":518,"./internal/operators/publishReplay":519,"./internal/operators/raceWith":520,"./internal/operators/reduce":521,"./internal/operators/refCount":522,"./internal/operators/repeat":523,"./internal/operators/repeatWhen":524,"./internal/operators/retry":525,"./internal/operators/retryWhen":526,"./internal/operators/sample":527,"./internal/operators/sampleTime":528,"./internal/operators/scan":529,"./internal/operators/sequenceEqual":531,"./internal/operators/share":532,"./internal/operators/shareReplay":533,"./internal/operators/single":534,"./internal/operators/skip":535,"./internal/operators/skipLast":536,"./internal/operators/skipUntil":537,"./internal/operators/skipWhile":538,"./internal/operators/startWith":539,"./internal/operators/subscribeOn":540,"./internal/operators/switchAll":541,"./internal/operators/switchMap":542,"./internal/operators/switchMapTo":543,"./internal/operators/switchScan":544,"./internal/operators/take":545,"./internal/operators/takeLast":546,"./internal/operators/takeUntil":547,"./internal/operators/takeWhile":548,"./internal/operators/tap":549,"./internal/operators/throttle":550,"./internal/operators/throttleTime":551,"./internal/operators/throwIfEmpty":552,"./internal/operators/timeInterval":553,"./internal/operators/timeout":554,"./internal/operators/timeoutWith":555,"./internal/operators/timestamp":556,"./internal/operators/toArray":557,"./internal/operators/window":558,"./internal/operators/windowCount":559,"./internal/operators/windowTime":560,"./internal/operators/windowToggle":561,"./internal/operators/windowWhen":562,"./internal/operators/withLatestFrom":563,"./internal/operators/zipAll":565,"./internal/operators/zipWith":566,"./internal/scheduled/scheduled":573,"./internal/scheduler/VirtualTimeScheduler":583,"./internal/scheduler/animationFrame":584,"./internal/scheduler/asap":586,"./internal/scheduler/async":587,"./internal/scheduler/queue":592,"./internal/symbol/observable":595,"./internal/types":596,"./internal/util/ArgumentOutOfRangeError":597,"./internal/util/EmptyError":598,"./internal/util/NotFoundError":600,"./internal/util/ObjectUnsubscribedError":601,"./internal/util/SequenceError":602,"./internal/util/UnsubscriptionError":603,"./internal/util/identity":612,"./internal/util/isObservable":619,"./internal/util/noop":625,"./internal/util/pipe":627}],408:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AsyncSubject = void 0;
+var Subject_1 = require("./Subject");
+var AsyncSubject = (function (_super) {
+ __extends(AsyncSubject, _super);
+ function AsyncSubject() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this._value = null;
+ _this._hasValue = false;
+ _this._isComplete = false;
+ return _this;
+ }
+ AsyncSubject.prototype._checkFinalizedStatuses = function (subscriber) {
+ var _a = this, hasError = _a.hasError, _hasValue = _a._hasValue, _value = _a._value, thrownError = _a.thrownError, isStopped = _a.isStopped, _isComplete = _a._isComplete;
+ if (hasError) {
+ subscriber.error(thrownError);
+ }
+ else if (isStopped || _isComplete) {
+ _hasValue && subscriber.next(_value);
+ subscriber.complete();
+ }
+ };
+ AsyncSubject.prototype.next = function (value) {
+ if (!this.isStopped) {
+ this._value = value;
+ this._hasValue = true;
+ }
+ };
+ AsyncSubject.prototype.complete = function () {
+ var _a = this, _hasValue = _a._hasValue, _value = _a._value, _isComplete = _a._isComplete;
+ if (!_isComplete) {
+ this._isComplete = true;
+ _hasValue && _super.prototype.next.call(this, _value);
+ _super.prototype.complete.call(this);
+ }
+ };
+ return AsyncSubject;
+}(Subject_1.Subject));
+exports.AsyncSubject = AsyncSubject;
-},{"define-data-property":351,"get-intrinsic":358,"gopd":359,"has-property-descriptors":361}],408:[function(require,module,exports){
-'use strict';
-
-var define = require('define-data-property');
-var hasDescriptors = require('has-property-descriptors')();
-var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames();
-
-var $TypeError = TypeError;
+},{"./Subject":415}],409:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.BehaviorSubject = void 0;
+var Subject_1 = require("./Subject");
+var BehaviorSubject = (function (_super) {
+ __extends(BehaviorSubject, _super);
+ function BehaviorSubject(_value) {
+ var _this = _super.call(this) || this;
+ _this._value = _value;
+ return _this;
+ }
+ Object.defineProperty(BehaviorSubject.prototype, "value", {
+ get: function () {
+ return this.getValue();
+ },
+ enumerable: false,
+ configurable: true
+ });
+ BehaviorSubject.prototype._subscribe = function (subscriber) {
+ var subscription = _super.prototype._subscribe.call(this, subscriber);
+ !subscription.closed && subscriber.next(this._value);
+ return subscription;
+ };
+ BehaviorSubject.prototype.getValue = function () {
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;
+ if (hasError) {
+ throw thrownError;
+ }
+ this._throwIfClosed();
+ return _value;
+ };
+ BehaviorSubject.prototype.next = function (value) {
+ _super.prototype.next.call(this, (this._value = value));
+ };
+ return BehaviorSubject;
+}(Subject_1.Subject));
+exports.BehaviorSubject = BehaviorSubject;
-module.exports = function setFunctionName(fn, name) {
- if (typeof fn !== 'function') {
- throw new $TypeError('`fn` is not a function');
- }
- var loose = arguments.length > 2 && !!arguments[2];
- if (!loose || functionsHaveConfigurableNames) {
- if (hasDescriptors) {
- define(fn, 'name', name, true, true);
- } else {
- define(fn, 'name', name);
- }
- }
- return fn;
-};
+},{"./Subject":415}],410:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.observeNotification = exports.Notification = exports.NotificationKind = void 0;
+var empty_1 = require("./observable/empty");
+var of_1 = require("./observable/of");
+var throwError_1 = require("./observable/throwError");
+var isFunction_1 = require("./util/isFunction");
+var NotificationKind;
+(function (NotificationKind) {
+ NotificationKind["NEXT"] = "N";
+ NotificationKind["ERROR"] = "E";
+ NotificationKind["COMPLETE"] = "C";
+})(NotificationKind = exports.NotificationKind || (exports.NotificationKind = {}));
+var Notification = (function () {
+ function Notification(kind, value, error) {
+ this.kind = kind;
+ this.value = value;
+ this.error = error;
+ this.hasValue = kind === 'N';
+ }
+ Notification.prototype.observe = function (observer) {
+ return observeNotification(this, observer);
+ };
+ Notification.prototype.do = function (nextHandler, errorHandler, completeHandler) {
+ var _a = this, kind = _a.kind, value = _a.value, error = _a.error;
+ return kind === 'N' ? nextHandler === null || nextHandler === void 0 ? void 0 : nextHandler(value) : kind === 'E' ? errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler(error) : completeHandler === null || completeHandler === void 0 ? void 0 : completeHandler();
+ };
+ Notification.prototype.accept = function (nextOrObserver, error, complete) {
+ var _a;
+ return isFunction_1.isFunction((_a = nextOrObserver) === null || _a === void 0 ? void 0 : _a.next)
+ ? this.observe(nextOrObserver)
+ : this.do(nextOrObserver, error, complete);
+ };
+ Notification.prototype.toObservable = function () {
+ var _a = this, kind = _a.kind, value = _a.value, error = _a.error;
+ var result = kind === 'N'
+ ?
+ of_1.of(value)
+ :
+ kind === 'E'
+ ?
+ throwError_1.throwError(function () { return error; })
+ :
+ kind === 'C'
+ ?
+ empty_1.EMPTY
+ :
+ 0;
+ if (!result) {
+ throw new TypeError("Unexpected notification kind " + kind);
+ }
+ return result;
+ };
+ Notification.createNext = function (value) {
+ return new Notification('N', value);
+ };
+ Notification.createError = function (err) {
+ return new Notification('E', undefined, err);
+ };
+ Notification.createComplete = function () {
+ return Notification.completeNotification;
+ };
+ Notification.completeNotification = new Notification('C');
+ return Notification;
+}());
+exports.Notification = Notification;
+function observeNotification(notification, observer) {
+ var _a, _b, _c;
+ var _d = notification, kind = _d.kind, value = _d.value, error = _d.error;
+ if (typeof kind !== 'string') {
+ throw new TypeError('Invalid notification, missing "kind"');
+ }
+ kind === 'N' ? (_a = observer.next) === null || _a === void 0 ? void 0 : _a.call(observer, value) : kind === 'E' ? (_b = observer.error) === null || _b === void 0 ? void 0 : _b.call(observer, error) : (_c = observer.complete) === null || _c === void 0 ? void 0 : _c.call(observer);
+}
+exports.observeNotification = observeNotification;
-},{"define-data-property":351,"functions-have-names":357,"has-property-descriptors":361}],409:[function(require,module,exports){
-'use strict';
+},{"./observable/empty":430,"./observable/of":442,"./observable/throwError":448,"./util/isFunction":616}],411:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.createNotification = exports.nextNotification = exports.errorNotification = exports.COMPLETE_NOTIFICATION = void 0;
+exports.COMPLETE_NOTIFICATION = (function () { return createNotification('C', undefined, undefined); })();
+function errorNotification(error) {
+ return createNotification('E', undefined, error);
+}
+exports.errorNotification = errorNotification;
+function nextNotification(value) {
+ return createNotification('N', value, undefined);
+}
+exports.nextNotification = nextNotification;
+function createNotification(kind, value, error) {
+ return {
+ kind: kind,
+ value: value,
+ error: error,
+ };
+}
+exports.createNotification = createNotification;
-var GetIntrinsic = require('get-intrinsic');
-var callBound = require('call-bind/callBound');
-var inspect = require('object-inspect');
+},{}],412:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Observable = void 0;
+var Subscriber_1 = require("./Subscriber");
+var Subscription_1 = require("./Subscription");
+var observable_1 = require("./symbol/observable");
+var pipe_1 = require("./util/pipe");
+var config_1 = require("./config");
+var isFunction_1 = require("./util/isFunction");
+var errorContext_1 = require("./util/errorContext");
+var Observable = (function () {
+ function Observable(subscribe) {
+ if (subscribe) {
+ this._subscribe = subscribe;
+ }
+ }
+ Observable.prototype.lift = function (operator) {
+ var observable = new Observable();
+ observable.source = this;
+ observable.operator = operator;
+ return observable;
+ };
+ Observable.prototype.subscribe = function (observerOrNext, error, complete) {
+ var _this = this;
+ var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new Subscriber_1.SafeSubscriber(observerOrNext, error, complete);
+ errorContext_1.errorContext(function () {
+ var _a = _this, operator = _a.operator, source = _a.source;
+ subscriber.add(operator
+ ?
+ operator.call(subscriber, source)
+ : source
+ ?
+ _this._subscribe(subscriber)
+ :
+ _this._trySubscribe(subscriber));
+ });
+ return subscriber;
+ };
+ Observable.prototype._trySubscribe = function (sink) {
+ try {
+ return this._subscribe(sink);
+ }
+ catch (err) {
+ sink.error(err);
+ }
+ };
+ Observable.prototype.forEach = function (next, promiseCtor) {
+ var _this = this;
+ promiseCtor = getPromiseCtor(promiseCtor);
+ return new promiseCtor(function (resolve, reject) {
+ var subscriber = new Subscriber_1.SafeSubscriber({
+ next: function (value) {
+ try {
+ next(value);
+ }
+ catch (err) {
+ reject(err);
+ subscriber.unsubscribe();
+ }
+ },
+ error: reject,
+ complete: resolve,
+ });
+ _this.subscribe(subscriber);
+ });
+ };
+ Observable.prototype._subscribe = function (subscriber) {
+ var _a;
+ return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
+ };
+ Observable.prototype[observable_1.observable] = function () {
+ return this;
+ };
+ Observable.prototype.pipe = function () {
+ var operations = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ operations[_i] = arguments[_i];
+ }
+ return pipe_1.pipeFromArray(operations)(this);
+ };
+ Observable.prototype.toPromise = function (promiseCtor) {
+ var _this = this;
+ promiseCtor = getPromiseCtor(promiseCtor);
+ return new promiseCtor(function (resolve, reject) {
+ var value;
+ _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
+ });
+ };
+ Observable.create = function (subscribe) {
+ return new Observable(subscribe);
+ };
+ return Observable;
+}());
+exports.Observable = Observable;
+function getPromiseCtor(promiseCtor) {
+ var _a;
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config_1.config.Promise) !== null && _a !== void 0 ? _a : Promise;
+}
+function isObserver(value) {
+ return value && isFunction_1.isFunction(value.next) && isFunction_1.isFunction(value.error) && isFunction_1.isFunction(value.complete);
+}
+function isSubscriber(value) {
+ return (value && value instanceof Subscriber_1.Subscriber) || (isObserver(value) && Subscription_1.isSubscription(value));
+}
-var $TypeError = GetIntrinsic('%TypeError%');
-var $WeakMap = GetIntrinsic('%WeakMap%', true);
-var $Map = GetIntrinsic('%Map%', true);
+},{"./Subscriber":416,"./Subscription":417,"./config":418,"./symbol/observable":595,"./util/errorContext":610,"./util/isFunction":616,"./util/pipe":627}],413:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ReplaySubject = void 0;
+var Subject_1 = require("./Subject");
+var dateTimestampProvider_1 = require("./scheduler/dateTimestampProvider");
+var ReplaySubject = (function (_super) {
+ __extends(ReplaySubject, _super);
+ function ReplaySubject(_bufferSize, _windowTime, _timestampProvider) {
+ if (_bufferSize === void 0) { _bufferSize = Infinity; }
+ if (_windowTime === void 0) { _windowTime = Infinity; }
+ if (_timestampProvider === void 0) { _timestampProvider = dateTimestampProvider_1.dateTimestampProvider; }
+ var _this = _super.call(this) || this;
+ _this._bufferSize = _bufferSize;
+ _this._windowTime = _windowTime;
+ _this._timestampProvider = _timestampProvider;
+ _this._buffer = [];
+ _this._infiniteTimeWindow = true;
+ _this._infiniteTimeWindow = _windowTime === Infinity;
+ _this._bufferSize = Math.max(1, _bufferSize);
+ _this._windowTime = Math.max(1, _windowTime);
+ return _this;
+ }
+ ReplaySubject.prototype.next = function (value) {
+ var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime;
+ if (!isStopped) {
+ _buffer.push(value);
+ !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
+ }
+ this._trimBuffer();
+ _super.prototype.next.call(this, value);
+ };
+ ReplaySubject.prototype._subscribe = function (subscriber) {
+ this._throwIfClosed();
+ this._trimBuffer();
+ var subscription = this._innerSubscribe(subscriber);
+ var _a = this, _infiniteTimeWindow = _a._infiniteTimeWindow, _buffer = _a._buffer;
+ var copy = _buffer.slice();
+ for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
+ subscriber.next(copy[i]);
+ }
+ this._checkFinalizedStatuses(subscriber);
+ return subscription;
+ };
+ ReplaySubject.prototype._trimBuffer = function () {
+ var _a = this, _bufferSize = _a._bufferSize, _timestampProvider = _a._timestampProvider, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow;
+ var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
+ _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
+ if (!_infiniteTimeWindow) {
+ var now = _timestampProvider.now();
+ var last = 0;
+ for (var i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
+ last = i;
+ }
+ last && _buffer.splice(0, last + 1);
+ }
+ };
+ return ReplaySubject;
+}(Subject_1.Subject));
+exports.ReplaySubject = ReplaySubject;
-var $weakMapGet = callBound('WeakMap.prototype.get', true);
-var $weakMapSet = callBound('WeakMap.prototype.set', true);
-var $weakMapHas = callBound('WeakMap.prototype.has', true);
-var $mapGet = callBound('Map.prototype.get', true);
-var $mapSet = callBound('Map.prototype.set', true);
-var $mapHas = callBound('Map.prototype.has', true);
+},{"./Subject":415,"./scheduler/dateTimestampProvider":588}],414:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Scheduler = void 0;
+var dateTimestampProvider_1 = require("./scheduler/dateTimestampProvider");
+var Scheduler = (function () {
+ function Scheduler(schedulerActionCtor, now) {
+ if (now === void 0) { now = Scheduler.now; }
+ this.schedulerActionCtor = schedulerActionCtor;
+ this.now = now;
+ }
+ Scheduler.prototype.schedule = function (work, delay, state) {
+ if (delay === void 0) { delay = 0; }
+ return new this.schedulerActionCtor(this, work).schedule(state, delay);
+ };
+ Scheduler.now = dateTimestampProvider_1.dateTimestampProvider.now;
+ return Scheduler;
+}());
+exports.Scheduler = Scheduler;
-/*
- * This function traverses the list returning the node corresponding to the
- * given key.
- *
- * That node is also moved to the head of the list, so that if it's accessed
- * again we don't need to traverse the whole list. By doing so, all the recently
- * used nodes can be accessed relatively quickly.
- */
-var listGetNode = function (list, key) { // eslint-disable-line consistent-return
- for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
- if (curr.key === key) {
- prev.next = curr.next;
- curr.next = list.next;
- list.next = curr; // eslint-disable-line no-param-reassign
- return curr;
- }
- }
+},{"./scheduler/dateTimestampProvider":588}],415:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+var __values = (this && this.__values) || function(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AnonymousSubject = exports.Subject = void 0;
+var Observable_1 = require("./Observable");
+var Subscription_1 = require("./Subscription");
+var ObjectUnsubscribedError_1 = require("./util/ObjectUnsubscribedError");
+var arrRemove_1 = require("./util/arrRemove");
+var errorContext_1 = require("./util/errorContext");
+var Subject = (function (_super) {
+ __extends(Subject, _super);
+ function Subject() {
+ var _this = _super.call(this) || this;
+ _this.closed = false;
+ _this.currentObservers = null;
+ _this.observers = [];
+ _this.isStopped = false;
+ _this.hasError = false;
+ _this.thrownError = null;
+ return _this;
+ }
+ Subject.prototype.lift = function (operator) {
+ var subject = new AnonymousSubject(this, this);
+ subject.operator = operator;
+ return subject;
+ };
+ Subject.prototype._throwIfClosed = function () {
+ if (this.closed) {
+ throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
+ }
+ };
+ Subject.prototype.next = function (value) {
+ var _this = this;
+ errorContext_1.errorContext(function () {
+ var e_1, _a;
+ _this._throwIfClosed();
+ if (!_this.isStopped) {
+ if (!_this.currentObservers) {
+ _this.currentObservers = Array.from(_this.observers);
+ }
+ try {
+ for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
+ var observer = _c.value;
+ observer.next(value);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ }
+ });
+ };
+ Subject.prototype.error = function (err) {
+ var _this = this;
+ errorContext_1.errorContext(function () {
+ _this._throwIfClosed();
+ if (!_this.isStopped) {
+ _this.hasError = _this.isStopped = true;
+ _this.thrownError = err;
+ var observers = _this.observers;
+ while (observers.length) {
+ observers.shift().error(err);
+ }
+ }
+ });
+ };
+ Subject.prototype.complete = function () {
+ var _this = this;
+ errorContext_1.errorContext(function () {
+ _this._throwIfClosed();
+ if (!_this.isStopped) {
+ _this.isStopped = true;
+ var observers = _this.observers;
+ while (observers.length) {
+ observers.shift().complete();
+ }
+ }
+ });
+ };
+ Subject.prototype.unsubscribe = function () {
+ this.isStopped = this.closed = true;
+ this.observers = this.currentObservers = null;
+ };
+ Object.defineProperty(Subject.prototype, "observed", {
+ get: function () {
+ var _a;
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
+ },
+ enumerable: false,
+ configurable: true
+ });
+ Subject.prototype._trySubscribe = function (subscriber) {
+ this._throwIfClosed();
+ return _super.prototype._trySubscribe.call(this, subscriber);
+ };
+ Subject.prototype._subscribe = function (subscriber) {
+ this._throwIfClosed();
+ this._checkFinalizedStatuses(subscriber);
+ return this._innerSubscribe(subscriber);
+ };
+ Subject.prototype._innerSubscribe = function (subscriber) {
+ var _this = this;
+ var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
+ if (hasError || isStopped) {
+ return Subscription_1.EMPTY_SUBSCRIPTION;
+ }
+ this.currentObservers = null;
+ observers.push(subscriber);
+ return new Subscription_1.Subscription(function () {
+ _this.currentObservers = null;
+ arrRemove_1.arrRemove(observers, subscriber);
+ });
+ };
+ Subject.prototype._checkFinalizedStatuses = function (subscriber) {
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
+ if (hasError) {
+ subscriber.error(thrownError);
+ }
+ else if (isStopped) {
+ subscriber.complete();
+ }
+ };
+ Subject.prototype.asObservable = function () {
+ var observable = new Observable_1.Observable();
+ observable.source = this;
+ return observable;
+ };
+ Subject.create = function (destination, source) {
+ return new AnonymousSubject(destination, source);
+ };
+ return Subject;
+}(Observable_1.Observable));
+exports.Subject = Subject;
+var AnonymousSubject = (function (_super) {
+ __extends(AnonymousSubject, _super);
+ function AnonymousSubject(destination, source) {
+ var _this = _super.call(this) || this;
+ _this.destination = destination;
+ _this.source = source;
+ return _this;
+ }
+ AnonymousSubject.prototype.next = function (value) {
+ var _a, _b;
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
+ };
+ AnonymousSubject.prototype.error = function (err) {
+ var _a, _b;
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
+ };
+ AnonymousSubject.prototype.complete = function () {
+ var _a, _b;
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
+ };
+ AnonymousSubject.prototype._subscribe = function (subscriber) {
+ var _a, _b;
+ return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : Subscription_1.EMPTY_SUBSCRIPTION;
+ };
+ return AnonymousSubject;
+}(Subject));
+exports.AnonymousSubject = AnonymousSubject;
-var listGet = function (objects, key) {
- var node = listGetNode(objects, key);
- return node && node.value;
-};
-var listSet = function (objects, key, value) {
- var node = listGetNode(objects, key);
- if (node) {
- node.value = value;
- } else {
- // Prepend the new node to the beginning of the list
- objects.next = { // eslint-disable-line no-param-reassign
- key: key,
- next: objects.next,
- value: value
- };
- }
-};
-var listHas = function (objects, key) {
+},{"./Observable":412,"./Subscription":417,"./util/ObjectUnsubscribedError":601,"./util/arrRemove":607,"./util/errorContext":610}],416:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.EMPTY_OBSERVER = exports.SafeSubscriber = exports.Subscriber = void 0;
+var isFunction_1 = require("./util/isFunction");
+var Subscription_1 = require("./Subscription");
+var config_1 = require("./config");
+var reportUnhandledError_1 = require("./util/reportUnhandledError");
+var noop_1 = require("./util/noop");
+var NotificationFactories_1 = require("./NotificationFactories");
+var timeoutProvider_1 = require("./scheduler/timeoutProvider");
+var errorContext_1 = require("./util/errorContext");
+var Subscriber = (function (_super) {
+ __extends(Subscriber, _super);
+ function Subscriber(destination) {
+ var _this = _super.call(this) || this;
+ _this.isStopped = false;
+ if (destination) {
+ _this.destination = destination;
+ if (Subscription_1.isSubscription(destination)) {
+ destination.add(_this);
+ }
+ }
+ else {
+ _this.destination = exports.EMPTY_OBSERVER;
+ }
+ return _this;
+ }
+ Subscriber.create = function (next, error, complete) {
+ return new SafeSubscriber(next, error, complete);
+ };
+ Subscriber.prototype.next = function (value) {
+ if (this.isStopped) {
+ handleStoppedNotification(NotificationFactories_1.nextNotification(value), this);
+ }
+ else {
+ this._next(value);
+ }
+ };
+ Subscriber.prototype.error = function (err) {
+ if (this.isStopped) {
+ handleStoppedNotification(NotificationFactories_1.errorNotification(err), this);
+ }
+ else {
+ this.isStopped = true;
+ this._error(err);
+ }
+ };
+ Subscriber.prototype.complete = function () {
+ if (this.isStopped) {
+ handleStoppedNotification(NotificationFactories_1.COMPLETE_NOTIFICATION, this);
+ }
+ else {
+ this.isStopped = true;
+ this._complete();
+ }
+ };
+ Subscriber.prototype.unsubscribe = function () {
+ if (!this.closed) {
+ this.isStopped = true;
+ _super.prototype.unsubscribe.call(this);
+ this.destination = null;
+ }
+ };
+ Subscriber.prototype._next = function (value) {
+ this.destination.next(value);
+ };
+ Subscriber.prototype._error = function (err) {
+ try {
+ this.destination.error(err);
+ }
+ finally {
+ this.unsubscribe();
+ }
+ };
+ Subscriber.prototype._complete = function () {
+ try {
+ this.destination.complete();
+ }
+ finally {
+ this.unsubscribe();
+ }
+ };
+ return Subscriber;
+}(Subscription_1.Subscription));
+exports.Subscriber = Subscriber;
+var _bind = Function.prototype.bind;
+function bind(fn, thisArg) {
+ return _bind.call(fn, thisArg);
+}
+var ConsumerObserver = (function () {
+ function ConsumerObserver(partialObserver) {
+ this.partialObserver = partialObserver;
+ }
+ ConsumerObserver.prototype.next = function (value) {
+ var partialObserver = this.partialObserver;
+ if (partialObserver.next) {
+ try {
+ partialObserver.next(value);
+ }
+ catch (error) {
+ handleUnhandledError(error);
+ }
+ }
+ };
+ ConsumerObserver.prototype.error = function (err) {
+ var partialObserver = this.partialObserver;
+ if (partialObserver.error) {
+ try {
+ partialObserver.error(err);
+ }
+ catch (error) {
+ handleUnhandledError(error);
+ }
+ }
+ else {
+ handleUnhandledError(err);
+ }
+ };
+ ConsumerObserver.prototype.complete = function () {
+ var partialObserver = this.partialObserver;
+ if (partialObserver.complete) {
+ try {
+ partialObserver.complete();
+ }
+ catch (error) {
+ handleUnhandledError(error);
+ }
+ }
+ };
+ return ConsumerObserver;
+}());
+var SafeSubscriber = (function (_super) {
+ __extends(SafeSubscriber, _super);
+ function SafeSubscriber(observerOrNext, error, complete) {
+ var _this = _super.call(this) || this;
+ var partialObserver;
+ if (isFunction_1.isFunction(observerOrNext) || !observerOrNext) {
+ partialObserver = {
+ next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
+ error: error !== null && error !== void 0 ? error : undefined,
+ complete: complete !== null && complete !== void 0 ? complete : undefined,
+ };
+ }
+ else {
+ var context_1;
+ if (_this && config_1.config.useDeprecatedNextContext) {
+ context_1 = Object.create(observerOrNext);
+ context_1.unsubscribe = function () { return _this.unsubscribe(); };
+ partialObserver = {
+ next: observerOrNext.next && bind(observerOrNext.next, context_1),
+ error: observerOrNext.error && bind(observerOrNext.error, context_1),
+ complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
+ };
+ }
+ else {
+ partialObserver = observerOrNext;
+ }
+ }
+ _this.destination = new ConsumerObserver(partialObserver);
+ return _this;
+ }
+ return SafeSubscriber;
+}(Subscriber));
+exports.SafeSubscriber = SafeSubscriber;
+function handleUnhandledError(error) {
+ if (config_1.config.useDeprecatedSynchronousErrorHandling) {
+ errorContext_1.captureError(error);
+ }
+ else {
+ reportUnhandledError_1.reportUnhandledError(error);
+ }
+}
+function defaultErrorHandler(err) {
+ throw err;
+}
+function handleStoppedNotification(notification, subscriber) {
+ var onStoppedNotification = config_1.config.onStoppedNotification;
+ onStoppedNotification && timeoutProvider_1.timeoutProvider.setTimeout(function () { return onStoppedNotification(notification, subscriber); });
+}
+exports.EMPTY_OBSERVER = {
+ closed: true,
+ next: noop_1.noop,
+ error: defaultErrorHandler,
+ complete: noop_1.noop,
+};
+
+},{"./NotificationFactories":411,"./Subscription":417,"./config":418,"./scheduler/timeoutProvider":593,"./util/errorContext":610,"./util/isFunction":616,"./util/noop":625,"./util/reportUnhandledError":628}],417:[function(require,module,exports){
+"use strict";
+var __values = (this && this.__values) || function(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+};
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isSubscription = exports.EMPTY_SUBSCRIPTION = exports.Subscription = void 0;
+var isFunction_1 = require("./util/isFunction");
+var UnsubscriptionError_1 = require("./util/UnsubscriptionError");
+var arrRemove_1 = require("./util/arrRemove");
+var Subscription = (function () {
+ function Subscription(initialTeardown) {
+ this.initialTeardown = initialTeardown;
+ this.closed = false;
+ this._parentage = null;
+ this._finalizers = null;
+ }
+ Subscription.prototype.unsubscribe = function () {
+ var e_1, _a, e_2, _b;
+ var errors;
+ if (!this.closed) {
+ this.closed = true;
+ var _parentage = this._parentage;
+ if (_parentage) {
+ this._parentage = null;
+ if (Array.isArray(_parentage)) {
+ try {
+ for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
+ var parent_1 = _parentage_1_1.value;
+ parent_1.remove(this);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ }
+ else {
+ _parentage.remove(this);
+ }
+ }
+ var initialFinalizer = this.initialTeardown;
+ if (isFunction_1.isFunction(initialFinalizer)) {
+ try {
+ initialFinalizer();
+ }
+ catch (e) {
+ errors = e instanceof UnsubscriptionError_1.UnsubscriptionError ? e.errors : [e];
+ }
+ }
+ var _finalizers = this._finalizers;
+ if (_finalizers) {
+ this._finalizers = null;
+ try {
+ for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
+ var finalizer = _finalizers_1_1.value;
+ try {
+ execFinalizer(finalizer);
+ }
+ catch (err) {
+ errors = errors !== null && errors !== void 0 ? errors : [];
+ if (err instanceof UnsubscriptionError_1.UnsubscriptionError) {
+ errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
+ }
+ else {
+ errors.push(err);
+ }
+ }
+ }
+ }
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
+ finally {
+ try {
+ if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
+ }
+ finally { if (e_2) throw e_2.error; }
+ }
+ }
+ if (errors) {
+ throw new UnsubscriptionError_1.UnsubscriptionError(errors);
+ }
+ }
+ };
+ Subscription.prototype.add = function (teardown) {
+ var _a;
+ if (teardown && teardown !== this) {
+ if (this.closed) {
+ execFinalizer(teardown);
+ }
+ else {
+ if (teardown instanceof Subscription) {
+ if (teardown.closed || teardown._hasParent(this)) {
+ return;
+ }
+ teardown._addParent(this);
+ }
+ (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
+ }
+ }
+ };
+ Subscription.prototype._hasParent = function (parent) {
+ var _parentage = this._parentage;
+ return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
+ };
+ Subscription.prototype._addParent = function (parent) {
+ var _parentage = this._parentage;
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
+ };
+ Subscription.prototype._removeParent = function (parent) {
+ var _parentage = this._parentage;
+ if (_parentage === parent) {
+ this._parentage = null;
+ }
+ else if (Array.isArray(_parentage)) {
+ arrRemove_1.arrRemove(_parentage, parent);
+ }
+ };
+ Subscription.prototype.remove = function (teardown) {
+ var _finalizers = this._finalizers;
+ _finalizers && arrRemove_1.arrRemove(_finalizers, teardown);
+ if (teardown instanceof Subscription) {
+ teardown._removeParent(this);
+ }
+ };
+ Subscription.EMPTY = (function () {
+ var empty = new Subscription();
+ empty.closed = true;
+ return empty;
+ })();
+ return Subscription;
+}());
+exports.Subscription = Subscription;
+exports.EMPTY_SUBSCRIPTION = Subscription.EMPTY;
+function isSubscription(value) {
+ return (value instanceof Subscription ||
+ (value && 'closed' in value && isFunction_1.isFunction(value.remove) && isFunction_1.isFunction(value.add) && isFunction_1.isFunction(value.unsubscribe)));
+}
+exports.isSubscription = isSubscription;
+function execFinalizer(finalizer) {
+ if (isFunction_1.isFunction(finalizer)) {
+ finalizer();
+ }
+ else {
+ finalizer.unsubscribe();
+ }
+}
+
+},{"./util/UnsubscriptionError":603,"./util/arrRemove":607,"./util/isFunction":616}],418:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.config = void 0;
+exports.config = {
+ onUnhandledError: null,
+ onStoppedNotification: null,
+ Promise: undefined,
+ useDeprecatedSynchronousErrorHandling: false,
+ useDeprecatedNextContext: false,
+};
+
+},{}],419:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.firstValueFrom = void 0;
+var EmptyError_1 = require("./util/EmptyError");
+var Subscriber_1 = require("./Subscriber");
+function firstValueFrom(source, config) {
+ var hasConfig = typeof config === 'object';
+ return new Promise(function (resolve, reject) {
+ var subscriber = new Subscriber_1.SafeSubscriber({
+ next: function (value) {
+ resolve(value);
+ subscriber.unsubscribe();
+ },
+ error: reject,
+ complete: function () {
+ if (hasConfig) {
+ resolve(config.defaultValue);
+ }
+ else {
+ reject(new EmptyError_1.EmptyError());
+ }
+ },
+ });
+ source.subscribe(subscriber);
+ });
+}
+exports.firstValueFrom = firstValueFrom;
+
+},{"./Subscriber":416,"./util/EmptyError":598}],420:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.lastValueFrom = void 0;
+var EmptyError_1 = require("./util/EmptyError");
+function lastValueFrom(source, config) {
+ var hasConfig = typeof config === 'object';
+ return new Promise(function (resolve, reject) {
+ var _hasValue = false;
+ var _value;
+ source.subscribe({
+ next: function (value) {
+ _value = value;
+ _hasValue = true;
+ },
+ error: reject,
+ complete: function () {
+ if (_hasValue) {
+ resolve(_value);
+ }
+ else if (hasConfig) {
+ resolve(config.defaultValue);
+ }
+ else {
+ reject(new EmptyError_1.EmptyError());
+ }
+ },
+ });
+ });
+}
+exports.lastValueFrom = lastValueFrom;
+
+},{"./util/EmptyError":598}],421:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ConnectableObservable = void 0;
+var Observable_1 = require("../Observable");
+var Subscription_1 = require("../Subscription");
+var refCount_1 = require("../operators/refCount");
+var OperatorSubscriber_1 = require("../operators/OperatorSubscriber");
+var lift_1 = require("../util/lift");
+var ConnectableObservable = (function (_super) {
+ __extends(ConnectableObservable, _super);
+ function ConnectableObservable(source, subjectFactory) {
+ var _this = _super.call(this) || this;
+ _this.source = source;
+ _this.subjectFactory = subjectFactory;
+ _this._subject = null;
+ _this._refCount = 0;
+ _this._connection = null;
+ if (lift_1.hasLift(source)) {
+ _this.lift = source.lift;
+ }
+ return _this;
+ }
+ ConnectableObservable.prototype._subscribe = function (subscriber) {
+ return this.getSubject().subscribe(subscriber);
+ };
+ ConnectableObservable.prototype.getSubject = function () {
+ var subject = this._subject;
+ if (!subject || subject.isStopped) {
+ this._subject = this.subjectFactory();
+ }
+ return this._subject;
+ };
+ ConnectableObservable.prototype._teardown = function () {
+ this._refCount = 0;
+ var _connection = this._connection;
+ this._subject = this._connection = null;
+ _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe();
+ };
+ ConnectableObservable.prototype.connect = function () {
+ var _this = this;
+ var connection = this._connection;
+ if (!connection) {
+ connection = this._connection = new Subscription_1.Subscription();
+ var subject_1 = this.getSubject();
+ connection.add(this.source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subject_1, undefined, function () {
+ _this._teardown();
+ subject_1.complete();
+ }, function (err) {
+ _this._teardown();
+ subject_1.error(err);
+ }, function () { return _this._teardown(); })));
+ if (connection.closed) {
+ this._connection = null;
+ connection = Subscription_1.Subscription.EMPTY;
+ }
+ }
+ return connection;
+ };
+ ConnectableObservable.prototype.refCount = function () {
+ return refCount_1.refCount()(this);
+ };
+ return ConnectableObservable;
+}(Observable_1.Observable));
+exports.ConnectableObservable = ConnectableObservable;
+
+},{"../Observable":412,"../Subscription":417,"../operators/OperatorSubscriber":452,"../operators/refCount":522,"../util/lift":623}],422:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.bindCallback = void 0;
+var bindCallbackInternals_1 = require("./bindCallbackInternals");
+function bindCallback(callbackFunc, resultSelector, scheduler) {
+ return bindCallbackInternals_1.bindCallbackInternals(false, callbackFunc, resultSelector, scheduler);
+}
+exports.bindCallback = bindCallback;
+
+},{"./bindCallbackInternals":423}],423:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.bindCallbackInternals = void 0;
+var isScheduler_1 = require("../util/isScheduler");
+var Observable_1 = require("../Observable");
+var subscribeOn_1 = require("../operators/subscribeOn");
+var mapOneOrManyArgs_1 = require("../util/mapOneOrManyArgs");
+var observeOn_1 = require("../operators/observeOn");
+var AsyncSubject_1 = require("../AsyncSubject");
+function bindCallbackInternals(isNodeStyle, callbackFunc, resultSelector, scheduler) {
+ if (resultSelector) {
+ if (isScheduler_1.isScheduler(resultSelector)) {
+ scheduler = resultSelector;
+ }
+ else {
+ return function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return bindCallbackInternals(isNodeStyle, callbackFunc, scheduler)
+ .apply(this, args)
+ .pipe(mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector));
+ };
+ }
+ }
+ if (scheduler) {
+ return function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return bindCallbackInternals(isNodeStyle, callbackFunc)
+ .apply(this, args)
+ .pipe(subscribeOn_1.subscribeOn(scheduler), observeOn_1.observeOn(scheduler));
+ };
+ }
+ return function () {
+ var _this = this;
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var subject = new AsyncSubject_1.AsyncSubject();
+ var uninitialized = true;
+ return new Observable_1.Observable(function (subscriber) {
+ var subs = subject.subscribe(subscriber);
+ if (uninitialized) {
+ uninitialized = false;
+ var isAsync_1 = false;
+ var isComplete_1 = false;
+ callbackFunc.apply(_this, __spreadArray(__spreadArray([], __read(args)), [
+ function () {
+ var results = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ results[_i] = arguments[_i];
+ }
+ if (isNodeStyle) {
+ var err = results.shift();
+ if (err != null) {
+ subject.error(err);
+ return;
+ }
+ }
+ subject.next(1 < results.length ? results : results[0]);
+ isComplete_1 = true;
+ if (isAsync_1) {
+ subject.complete();
+ }
+ },
+ ]));
+ if (isComplete_1) {
+ subject.complete();
+ }
+ isAsync_1 = true;
+ }
+ return subs;
+ });
+ };
+}
+exports.bindCallbackInternals = bindCallbackInternals;
+
+},{"../AsyncSubject":408,"../Observable":412,"../operators/observeOn":512,"../operators/subscribeOn":540,"../util/isScheduler":622,"../util/mapOneOrManyArgs":624}],424:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.bindNodeCallback = void 0;
+var bindCallbackInternals_1 = require("./bindCallbackInternals");
+function bindNodeCallback(callbackFunc, resultSelector, scheduler) {
+ return bindCallbackInternals_1.bindCallbackInternals(true, callbackFunc, resultSelector, scheduler);
+}
+exports.bindNodeCallback = bindNodeCallback;
+
+},{"./bindCallbackInternals":423}],425:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.combineLatestInit = exports.combineLatest = void 0;
+var Observable_1 = require("../Observable");
+var argsArgArrayOrObject_1 = require("../util/argsArgArrayOrObject");
+var from_1 = require("./from");
+var identity_1 = require("../util/identity");
+var mapOneOrManyArgs_1 = require("../util/mapOneOrManyArgs");
+var args_1 = require("../util/args");
+var createObject_1 = require("../util/createObject");
+var OperatorSubscriber_1 = require("../operators/OperatorSubscriber");
+var executeSchedule_1 = require("../util/executeSchedule");
+function combineLatest() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var scheduler = args_1.popScheduler(args);
+ var resultSelector = args_1.popResultSelector(args);
+ var _a = argsArgArrayOrObject_1.argsArgArrayOrObject(args), observables = _a.args, keys = _a.keys;
+ if (observables.length === 0) {
+ return from_1.from([], scheduler);
+ }
+ var result = new Observable_1.Observable(combineLatestInit(observables, scheduler, keys
+ ?
+ function (values) { return createObject_1.createObject(keys, values); }
+ :
+ identity_1.identity));
+ return resultSelector ? result.pipe(mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector)) : result;
+}
+exports.combineLatest = combineLatest;
+function combineLatestInit(observables, scheduler, valueTransform) {
+ if (valueTransform === void 0) { valueTransform = identity_1.identity; }
+ return function (subscriber) {
+ maybeSchedule(scheduler, function () {
+ var length = observables.length;
+ var values = new Array(length);
+ var active = length;
+ var remainingFirstValues = length;
+ var _loop_1 = function (i) {
+ maybeSchedule(scheduler, function () {
+ var source = from_1.from(observables[i], scheduler);
+ var hasFirstValue = false;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ values[i] = value;
+ if (!hasFirstValue) {
+ hasFirstValue = true;
+ remainingFirstValues--;
+ }
+ if (!remainingFirstValues) {
+ subscriber.next(valueTransform(values.slice()));
+ }
+ }, function () {
+ if (!--active) {
+ subscriber.complete();
+ }
+ }));
+ }, subscriber);
+ };
+ for (var i = 0; i < length; i++) {
+ _loop_1(i);
+ }
+ }, subscriber);
+ };
+}
+exports.combineLatestInit = combineLatestInit;
+function maybeSchedule(scheduler, execute, subscription) {
+ if (scheduler) {
+ executeSchedule_1.executeSchedule(subscription, scheduler, execute);
+ }
+ else {
+ execute();
+ }
+}
+
+},{"../Observable":412,"../operators/OperatorSubscriber":452,"../util/args":604,"../util/argsArgArrayOrObject":605,"../util/createObject":609,"../util/executeSchedule":611,"../util/identity":612,"../util/mapOneOrManyArgs":624,"./from":432}],426:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.concat = void 0;
+var concatAll_1 = require("../operators/concatAll");
+var args_1 = require("../util/args");
+var from_1 = require("./from");
+function concat() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return concatAll_1.concatAll()(from_1.from(args, args_1.popScheduler(args)));
+}
+exports.concat = concat;
+
+},{"../operators/concatAll":466,"../util/args":604,"./from":432}],427:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.connectable = void 0;
+var Subject_1 = require("../Subject");
+var Observable_1 = require("../Observable");
+var defer_1 = require("./defer");
+var DEFAULT_CONFIG = {
+ connector: function () { return new Subject_1.Subject(); },
+ resetOnDisconnect: true,
+};
+function connectable(source, config) {
+ if (config === void 0) { config = DEFAULT_CONFIG; }
+ var connection = null;
+ var connector = config.connector, _a = config.resetOnDisconnect, resetOnDisconnect = _a === void 0 ? true : _a;
+ var subject = connector();
+ var result = new Observable_1.Observable(function (subscriber) {
+ return subject.subscribe(subscriber);
+ });
+ result.connect = function () {
+ if (!connection || connection.closed) {
+ connection = defer_1.defer(function () { return source; }).subscribe(subject);
+ if (resetOnDisconnect) {
+ connection.add(function () { return (subject = connector()); });
+ }
+ }
+ return connection;
+ };
+ return result;
+}
+exports.connectable = connectable;
+
+},{"../Observable":412,"../Subject":415,"./defer":428}],428:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.defer = void 0;
+var Observable_1 = require("../Observable");
+var innerFrom_1 = require("./innerFrom");
+function defer(observableFactory) {
+ return new Observable_1.Observable(function (subscriber) {
+ innerFrom_1.innerFrom(observableFactory()).subscribe(subscriber);
+ });
+}
+exports.defer = defer;
+
+},{"../Observable":412,"./innerFrom":438}],429:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.animationFrames = void 0;
+var Observable_1 = require("../../Observable");
+var performanceTimestampProvider_1 = require("../../scheduler/performanceTimestampProvider");
+var animationFrameProvider_1 = require("../../scheduler/animationFrameProvider");
+function animationFrames(timestampProvider) {
+ return timestampProvider ? animationFramesFactory(timestampProvider) : DEFAULT_ANIMATION_FRAMES;
+}
+exports.animationFrames = animationFrames;
+function animationFramesFactory(timestampProvider) {
+ return new Observable_1.Observable(function (subscriber) {
+ var provider = timestampProvider || performanceTimestampProvider_1.performanceTimestampProvider;
+ var start = provider.now();
+ var id = 0;
+ var run = function () {
+ if (!subscriber.closed) {
+ id = animationFrameProvider_1.animationFrameProvider.requestAnimationFrame(function (timestamp) {
+ id = 0;
+ var now = provider.now();
+ subscriber.next({
+ timestamp: timestampProvider ? now : timestamp,
+ elapsed: now - start,
+ });
+ run();
+ });
+ }
+ };
+ run();
+ return function () {
+ if (id) {
+ animationFrameProvider_1.animationFrameProvider.cancelAnimationFrame(id);
+ }
+ };
+ });
+}
+var DEFAULT_ANIMATION_FRAMES = animationFramesFactory();
+
+},{"../../Observable":412,"../../scheduler/animationFrameProvider":585,"../../scheduler/performanceTimestampProvider":591}],430:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.empty = exports.EMPTY = void 0;
+var Observable_1 = require("../Observable");
+exports.EMPTY = new Observable_1.Observable(function (subscriber) { return subscriber.complete(); });
+function empty(scheduler) {
+ return scheduler ? emptyScheduled(scheduler) : exports.EMPTY;
+}
+exports.empty = empty;
+function emptyScheduled(scheduler) {
+ return new Observable_1.Observable(function (subscriber) { return scheduler.schedule(function () { return subscriber.complete(); }); });
+}
+
+},{"../Observable":412}],431:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.forkJoin = void 0;
+var Observable_1 = require("../Observable");
+var argsArgArrayOrObject_1 = require("../util/argsArgArrayOrObject");
+var innerFrom_1 = require("./innerFrom");
+var args_1 = require("../util/args");
+var OperatorSubscriber_1 = require("../operators/OperatorSubscriber");
+var mapOneOrManyArgs_1 = require("../util/mapOneOrManyArgs");
+var createObject_1 = require("../util/createObject");
+function forkJoin() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var resultSelector = args_1.popResultSelector(args);
+ var _a = argsArgArrayOrObject_1.argsArgArrayOrObject(args), sources = _a.args, keys = _a.keys;
+ var result = new Observable_1.Observable(function (subscriber) {
+ var length = sources.length;
+ if (!length) {
+ subscriber.complete();
+ return;
+ }
+ var values = new Array(length);
+ var remainingCompletions = length;
+ var remainingEmissions = length;
+ var _loop_1 = function (sourceIndex) {
+ var hasValue = false;
+ innerFrom_1.innerFrom(sources[sourceIndex]).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ if (!hasValue) {
+ hasValue = true;
+ remainingEmissions--;
+ }
+ values[sourceIndex] = value;
+ }, function () { return remainingCompletions--; }, undefined, function () {
+ if (!remainingCompletions || !hasValue) {
+ if (!remainingEmissions) {
+ subscriber.next(keys ? createObject_1.createObject(keys, values) : values);
+ }
+ subscriber.complete();
+ }
+ }));
+ };
+ for (var sourceIndex = 0; sourceIndex < length; sourceIndex++) {
+ _loop_1(sourceIndex);
+ }
+ });
+ return resultSelector ? result.pipe(mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector)) : result;
+}
+exports.forkJoin = forkJoin;
+
+},{"../Observable":412,"../operators/OperatorSubscriber":452,"../util/args":604,"../util/argsArgArrayOrObject":605,"../util/createObject":609,"../util/mapOneOrManyArgs":624,"./innerFrom":438}],432:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.from = void 0;
+var scheduled_1 = require("../scheduled/scheduled");
+var innerFrom_1 = require("./innerFrom");
+function from(input, scheduler) {
+ return scheduler ? scheduled_1.scheduled(input, scheduler) : innerFrom_1.innerFrom(input);
+}
+exports.from = from;
+
+},{"../scheduled/scheduled":573,"./innerFrom":438}],433:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.fromEvent = void 0;
+var innerFrom_1 = require("../observable/innerFrom");
+var Observable_1 = require("../Observable");
+var mergeMap_1 = require("../operators/mergeMap");
+var isArrayLike_1 = require("../util/isArrayLike");
+var isFunction_1 = require("../util/isFunction");
+var mapOneOrManyArgs_1 = require("../util/mapOneOrManyArgs");
+var nodeEventEmitterMethods = ['addListener', 'removeListener'];
+var eventTargetMethods = ['addEventListener', 'removeEventListener'];
+var jqueryMethods = ['on', 'off'];
+function fromEvent(target, eventName, options, resultSelector) {
+ if (isFunction_1.isFunction(options)) {
+ resultSelector = options;
+ options = undefined;
+ }
+ if (resultSelector) {
+ return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector));
+ }
+ var _a = __read(isEventTarget(target)
+ ? eventTargetMethods.map(function (methodName) { return function (handler) { return target[methodName](eventName, handler, options); }; })
+ :
+ isNodeStyleEventEmitter(target)
+ ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName))
+ : isJQueryStyleEventEmitter(target)
+ ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName))
+ : [], 2), add = _a[0], remove = _a[1];
+ if (!add) {
+ if (isArrayLike_1.isArrayLike(target)) {
+ return mergeMap_1.mergeMap(function (subTarget) { return fromEvent(subTarget, eventName, options); })(innerFrom_1.innerFrom(target));
+ }
+ }
+ if (!add) {
+ throw new TypeError('Invalid event target');
+ }
+ return new Observable_1.Observable(function (subscriber) {
+ var handler = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return subscriber.next(1 < args.length ? args : args[0]);
+ };
+ add(handler);
+ return function () { return remove(handler); };
+ });
+}
+exports.fromEvent = fromEvent;
+function toCommonHandlerRegistry(target, eventName) {
+ return function (methodName) { return function (handler) { return target[methodName](eventName, handler); }; };
+}
+function isNodeStyleEventEmitter(target) {
+ return isFunction_1.isFunction(target.addListener) && isFunction_1.isFunction(target.removeListener);
+}
+function isJQueryStyleEventEmitter(target) {
+ return isFunction_1.isFunction(target.on) && isFunction_1.isFunction(target.off);
+}
+function isEventTarget(target) {
+ return isFunction_1.isFunction(target.addEventListener) && isFunction_1.isFunction(target.removeEventListener);
+}
+
+},{"../Observable":412,"../observable/innerFrom":438,"../operators/mergeMap":506,"../util/isArrayLike":613,"../util/isFunction":616,"../util/mapOneOrManyArgs":624}],434:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.fromEventPattern = void 0;
+var Observable_1 = require("../Observable");
+var isFunction_1 = require("../util/isFunction");
+var mapOneOrManyArgs_1 = require("../util/mapOneOrManyArgs");
+function fromEventPattern(addHandler, removeHandler, resultSelector) {
+ if (resultSelector) {
+ return fromEventPattern(addHandler, removeHandler).pipe(mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector));
+ }
+ return new Observable_1.Observable(function (subscriber) {
+ var handler = function () {
+ var e = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ e[_i] = arguments[_i];
+ }
+ return subscriber.next(e.length === 1 ? e[0] : e);
+ };
+ var retValue = addHandler(handler);
+ return isFunction_1.isFunction(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined;
+ });
+}
+exports.fromEventPattern = fromEventPattern;
+
+},{"../Observable":412,"../util/isFunction":616,"../util/mapOneOrManyArgs":624}],435:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.fromSubscribable = void 0;
+var Observable_1 = require("../Observable");
+function fromSubscribable(subscribable) {
+ return new Observable_1.Observable(function (subscriber) { return subscribable.subscribe(subscriber); });
+}
+exports.fromSubscribable = fromSubscribable;
+
+},{"../Observable":412}],436:[function(require,module,exports){
+"use strict";
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ 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;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.generate = void 0;
+var identity_1 = require("../util/identity");
+var isScheduler_1 = require("../util/isScheduler");
+var defer_1 = require("./defer");
+var scheduleIterable_1 = require("../scheduled/scheduleIterable");
+function generate(initialStateOrOptions, condition, iterate, resultSelectorOrScheduler, scheduler) {
+ var _a, _b;
+ var resultSelector;
+ var initialState;
+ if (arguments.length === 1) {
+ (_a = initialStateOrOptions, initialState = _a.initialState, condition = _a.condition, iterate = _a.iterate, _b = _a.resultSelector, resultSelector = _b === void 0 ? identity_1.identity : _b, scheduler = _a.scheduler);
+ }
+ else {
+ initialState = initialStateOrOptions;
+ if (!resultSelectorOrScheduler || isScheduler_1.isScheduler(resultSelectorOrScheduler)) {
+ resultSelector = identity_1.identity;
+ scheduler = resultSelectorOrScheduler;
+ }
+ else {
+ resultSelector = resultSelectorOrScheduler;
+ }
+ }
+ function gen() {
+ var state;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ state = initialState;
+ _a.label = 1;
+ case 1:
+ if (!(!condition || condition(state))) return [3, 4];
+ return [4, resultSelector(state)];
+ case 2:
+ _a.sent();
+ _a.label = 3;
+ case 3:
+ state = iterate(state);
+ return [3, 1];
+ case 4: return [2];
+ }
+ });
+ }
+ return defer_1.defer((scheduler
+ ?
+ function () { return scheduleIterable_1.scheduleIterable(gen(), scheduler); }
+ :
+ gen));
+}
+exports.generate = generate;
+
+},{"../scheduled/scheduleIterable":569,"../util/identity":612,"../util/isScheduler":622,"./defer":428}],437:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.iif = void 0;
+var defer_1 = require("./defer");
+function iif(condition, trueResult, falseResult) {
+ return defer_1.defer(function () { return (condition() ? trueResult : falseResult); });
+}
+exports.iif = iif;
+
+},{"./defer":428}],438:[function(require,module,exports){
+(function (process){(function (){
+"use strict";
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ 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;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+var __asyncValues = (this && this.__asyncValues) || function (o) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var m = o[Symbol.asyncIterator], i;
+ 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);
+ 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); }); }; }
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
+};
+var __values = (this && this.__values) || function(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.fromReadableStreamLike = exports.fromAsyncIterable = exports.fromIterable = exports.fromPromise = exports.fromArrayLike = exports.fromInteropObservable = exports.innerFrom = void 0;
+var isArrayLike_1 = require("../util/isArrayLike");
+var isPromise_1 = require("../util/isPromise");
+var Observable_1 = require("../Observable");
+var isInteropObservable_1 = require("../util/isInteropObservable");
+var isAsyncIterable_1 = require("../util/isAsyncIterable");
+var throwUnobservableError_1 = require("../util/throwUnobservableError");
+var isIterable_1 = require("../util/isIterable");
+var isReadableStreamLike_1 = require("../util/isReadableStreamLike");
+var isFunction_1 = require("../util/isFunction");
+var reportUnhandledError_1 = require("../util/reportUnhandledError");
+var observable_1 = require("../symbol/observable");
+function innerFrom(input) {
+ if (input instanceof Observable_1.Observable) {
+ return input;
+ }
+ if (input != null) {
+ if (isInteropObservable_1.isInteropObservable(input)) {
+ return fromInteropObservable(input);
+ }
+ if (isArrayLike_1.isArrayLike(input)) {
+ return fromArrayLike(input);
+ }
+ if (isPromise_1.isPromise(input)) {
+ return fromPromise(input);
+ }
+ if (isAsyncIterable_1.isAsyncIterable(input)) {
+ return fromAsyncIterable(input);
+ }
+ if (isIterable_1.isIterable(input)) {
+ return fromIterable(input);
+ }
+ if (isReadableStreamLike_1.isReadableStreamLike(input)) {
+ return fromReadableStreamLike(input);
+ }
+ }
+ throw throwUnobservableError_1.createInvalidObservableTypeError(input);
+}
+exports.innerFrom = innerFrom;
+function fromInteropObservable(obj) {
+ return new Observable_1.Observable(function (subscriber) {
+ var obs = obj[observable_1.observable]();
+ if (isFunction_1.isFunction(obs.subscribe)) {
+ return obs.subscribe(subscriber);
+ }
+ throw new TypeError('Provided object does not correctly implement Symbol.observable');
+ });
+}
+exports.fromInteropObservable = fromInteropObservable;
+function fromArrayLike(array) {
+ return new Observable_1.Observable(function (subscriber) {
+ for (var i = 0; i < array.length && !subscriber.closed; i++) {
+ subscriber.next(array[i]);
+ }
+ subscriber.complete();
+ });
+}
+exports.fromArrayLike = fromArrayLike;
+function fromPromise(promise) {
+ return new Observable_1.Observable(function (subscriber) {
+ promise
+ .then(function (value) {
+ if (!subscriber.closed) {
+ subscriber.next(value);
+ subscriber.complete();
+ }
+ }, function (err) { return subscriber.error(err); })
+ .then(null, reportUnhandledError_1.reportUnhandledError);
+ });
+}
+exports.fromPromise = fromPromise;
+function fromIterable(iterable) {
+ return new Observable_1.Observable(function (subscriber) {
+ var e_1, _a;
+ try {
+ for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
+ var value = iterable_1_1.value;
+ subscriber.next(value);
+ if (subscriber.closed) {
+ return;
+ }
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) _a.call(iterable_1);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ subscriber.complete();
+ });
+}
+exports.fromIterable = fromIterable;
+function fromAsyncIterable(asyncIterable) {
+ return new Observable_1.Observable(function (subscriber) {
+ process(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
+ });
+}
+exports.fromAsyncIterable = fromAsyncIterable;
+function fromReadableStreamLike(readableStream) {
+ return fromAsyncIterable(isReadableStreamLike_1.readableStreamLikeToAsyncGenerator(readableStream));
+}
+exports.fromReadableStreamLike = fromReadableStreamLike;
+function process(asyncIterable, subscriber) {
+ var asyncIterable_1, asyncIterable_1_1;
+ var e_2, _a;
+ return __awaiter(this, void 0, void 0, function () {
+ var value, e_2_1;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ _b.trys.push([0, 5, 6, 11]);
+ asyncIterable_1 = __asyncValues(asyncIterable);
+ _b.label = 1;
+ case 1: return [4, asyncIterable_1.next()];
+ case 2:
+ if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4];
+ value = asyncIterable_1_1.value;
+ subscriber.next(value);
+ if (subscriber.closed) {
+ return [2];
+ }
+ _b.label = 3;
+ case 3: return [3, 1];
+ case 4: return [3, 11];
+ case 5:
+ e_2_1 = _b.sent();
+ e_2 = { error: e_2_1 };
+ return [3, 11];
+ case 6:
+ _b.trys.push([6, , 9, 10]);
+ if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return))) return [3, 8];
+ return [4, _a.call(asyncIterable_1)];
+ case 7:
+ _b.sent();
+ _b.label = 8;
+ case 8: return [3, 10];
+ case 9:
+ if (e_2) throw e_2.error;
+ return [7];
+ case 10: return [7];
+ case 11:
+ subscriber.complete();
+ return [2];
+ }
+ });
+ });
+}
+
+}).call(this)}).call(this,require('_process'))
+},{"../Observable":412,"../symbol/observable":595,"../util/isArrayLike":613,"../util/isAsyncIterable":614,"../util/isFunction":616,"../util/isInteropObservable":617,"../util/isIterable":618,"../util/isPromise":620,"../util/isReadableStreamLike":621,"../util/reportUnhandledError":628,"../util/throwUnobservableError":629,"_process":401}],439:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.interval = void 0;
+var async_1 = require("../scheduler/async");
+var timer_1 = require("./timer");
+function interval(period, scheduler) {
+ if (period === void 0) { period = 0; }
+ if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
+ if (period < 0) {
+ period = 0;
+ }
+ return timer_1.timer(period, period, scheduler);
+}
+exports.interval = interval;
+
+},{"../scheduler/async":587,"./timer":449}],440:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.merge = void 0;
+var mergeAll_1 = require("../operators/mergeAll");
+var innerFrom_1 = require("./innerFrom");
+var empty_1 = require("./empty");
+var args_1 = require("../util/args");
+var from_1 = require("./from");
+function merge() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var scheduler = args_1.popScheduler(args);
+ var concurrent = args_1.popNumber(args, Infinity);
+ var sources = args;
+ return !sources.length
+ ?
+ empty_1.EMPTY
+ : sources.length === 1
+ ?
+ innerFrom_1.innerFrom(sources[0])
+ :
+ mergeAll_1.mergeAll(concurrent)(from_1.from(sources, scheduler));
+}
+exports.merge = merge;
+
+},{"../operators/mergeAll":504,"../util/args":604,"./empty":430,"./from":432,"./innerFrom":438}],441:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.never = exports.NEVER = void 0;
+var Observable_1 = require("../Observable");
+var noop_1 = require("../util/noop");
+exports.NEVER = new Observable_1.Observable(noop_1.noop);
+function never() {
+ return exports.NEVER;
+}
+exports.never = never;
+
+},{"../Observable":412,"../util/noop":625}],442:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.of = void 0;
+var args_1 = require("../util/args");
+var from_1 = require("./from");
+function of() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var scheduler = args_1.popScheduler(args);
+ return from_1.from(args, scheduler);
+}
+exports.of = of;
+
+},{"../util/args":604,"./from":432}],443:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.onErrorResumeNext = void 0;
+var Observable_1 = require("../Observable");
+var argsOrArgArray_1 = require("../util/argsOrArgArray");
+var OperatorSubscriber_1 = require("../operators/OperatorSubscriber");
+var noop_1 = require("../util/noop");
+var innerFrom_1 = require("./innerFrom");
+function onErrorResumeNext() {
+ var sources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ sources[_i] = arguments[_i];
+ }
+ var nextSources = argsOrArgArray_1.argsOrArgArray(sources);
+ return new Observable_1.Observable(function (subscriber) {
+ var sourceIndex = 0;
+ var subscribeNext = function () {
+ if (sourceIndex < nextSources.length) {
+ var nextSource = void 0;
+ try {
+ nextSource = innerFrom_1.innerFrom(nextSources[sourceIndex++]);
+ }
+ catch (err) {
+ subscribeNext();
+ return;
+ }
+ var innerSubscriber = new OperatorSubscriber_1.OperatorSubscriber(subscriber, undefined, noop_1.noop, noop_1.noop);
+ nextSource.subscribe(innerSubscriber);
+ innerSubscriber.add(subscribeNext);
+ }
+ else {
+ subscriber.complete();
+ }
+ };
+ subscribeNext();
+ });
+}
+exports.onErrorResumeNext = onErrorResumeNext;
+
+},{"../Observable":412,"../operators/OperatorSubscriber":452,"../util/argsOrArgArray":606,"../util/noop":625,"./innerFrom":438}],444:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.pairs = void 0;
+var from_1 = require("./from");
+function pairs(obj, scheduler) {
+ return from_1.from(Object.entries(obj), scheduler);
+}
+exports.pairs = pairs;
+
+},{"./from":432}],445:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.partition = void 0;
+var not_1 = require("../util/not");
+var filter_1 = require("../operators/filter");
+var innerFrom_1 = require("./innerFrom");
+function partition(source, predicate, thisArg) {
+ return [filter_1.filter(predicate, thisArg)(innerFrom_1.innerFrom(source)), filter_1.filter(not_1.not(predicate, thisArg))(innerFrom_1.innerFrom(source))];
+}
+exports.partition = partition;
+
+},{"../operators/filter":488,"../util/not":626,"./innerFrom":438}],446:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.raceInit = exports.race = void 0;
+var Observable_1 = require("../Observable");
+var innerFrom_1 = require("./innerFrom");
+var argsOrArgArray_1 = require("../util/argsOrArgArray");
+var OperatorSubscriber_1 = require("../operators/OperatorSubscriber");
+function race() {
+ var sources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ sources[_i] = arguments[_i];
+ }
+ sources = argsOrArgArray_1.argsOrArgArray(sources);
+ return sources.length === 1 ? innerFrom_1.innerFrom(sources[0]) : new Observable_1.Observable(raceInit(sources));
+}
+exports.race = race;
+function raceInit(sources) {
+ return function (subscriber) {
+ var subscriptions = [];
+ var _loop_1 = function (i) {
+ subscriptions.push(innerFrom_1.innerFrom(sources[i]).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ if (subscriptions) {
+ for (var s = 0; s < subscriptions.length; s++) {
+ s !== i && subscriptions[s].unsubscribe();
+ }
+ subscriptions = null;
+ }
+ subscriber.next(value);
+ })));
+ };
+ for (var i = 0; subscriptions && !subscriber.closed && i < sources.length; i++) {
+ _loop_1(i);
+ }
+ };
+}
+exports.raceInit = raceInit;
+
+},{"../Observable":412,"../operators/OperatorSubscriber":452,"../util/argsOrArgArray":606,"./innerFrom":438}],447:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.range = void 0;
+var Observable_1 = require("../Observable");
+var empty_1 = require("./empty");
+function range(start, count, scheduler) {
+ if (count == null) {
+ count = start;
+ start = 0;
+ }
+ if (count <= 0) {
+ return empty_1.EMPTY;
+ }
+ var end = count + start;
+ return new Observable_1.Observable(scheduler
+ ?
+ function (subscriber) {
+ var n = start;
+ return scheduler.schedule(function () {
+ if (n < end) {
+ subscriber.next(n++);
+ this.schedule();
+ }
+ else {
+ subscriber.complete();
+ }
+ });
+ }
+ :
+ function (subscriber) {
+ var n = start;
+ while (n < end && !subscriber.closed) {
+ subscriber.next(n++);
+ }
+ subscriber.complete();
+ });
+}
+exports.range = range;
+
+},{"../Observable":412,"./empty":430}],448:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.throwError = void 0;
+var Observable_1 = require("../Observable");
+var isFunction_1 = require("../util/isFunction");
+function throwError(errorOrErrorFactory, scheduler) {
+ var errorFactory = isFunction_1.isFunction(errorOrErrorFactory) ? errorOrErrorFactory : function () { return errorOrErrorFactory; };
+ var init = function (subscriber) { return subscriber.error(errorFactory()); };
+ return new Observable_1.Observable(scheduler ? function (subscriber) { return scheduler.schedule(init, 0, subscriber); } : init);
+}
+exports.throwError = throwError;
+
+},{"../Observable":412,"../util/isFunction":616}],449:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.timer = void 0;
+var Observable_1 = require("../Observable");
+var async_1 = require("../scheduler/async");
+var isScheduler_1 = require("../util/isScheduler");
+var isDate_1 = require("../util/isDate");
+function timer(dueTime, intervalOrScheduler, scheduler) {
+ if (dueTime === void 0) { dueTime = 0; }
+ if (scheduler === void 0) { scheduler = async_1.async; }
+ var intervalDuration = -1;
+ if (intervalOrScheduler != null) {
+ if (isScheduler_1.isScheduler(intervalOrScheduler)) {
+ scheduler = intervalOrScheduler;
+ }
+ else {
+ intervalDuration = intervalOrScheduler;
+ }
+ }
+ return new Observable_1.Observable(function (subscriber) {
+ var due = isDate_1.isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
+ if (due < 0) {
+ due = 0;
+ }
+ var n = 0;
+ return scheduler.schedule(function () {
+ if (!subscriber.closed) {
+ subscriber.next(n++);
+ if (0 <= intervalDuration) {
+ this.schedule(undefined, intervalDuration);
+ }
+ else {
+ subscriber.complete();
+ }
+ }
+ }, due);
+ });
+}
+exports.timer = timer;
+
+},{"../Observable":412,"../scheduler/async":587,"../util/isDate":615,"../util/isScheduler":622}],450:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.using = void 0;
+var Observable_1 = require("../Observable");
+var innerFrom_1 = require("./innerFrom");
+var empty_1 = require("./empty");
+function using(resourceFactory, observableFactory) {
+ return new Observable_1.Observable(function (subscriber) {
+ var resource = resourceFactory();
+ var result = observableFactory(resource);
+ var source = result ? innerFrom_1.innerFrom(result) : empty_1.EMPTY;
+ source.subscribe(subscriber);
+ return function () {
+ if (resource) {
+ resource.unsubscribe();
+ }
+ };
+ });
+}
+exports.using = using;
+
+},{"../Observable":412,"./empty":430,"./innerFrom":438}],451:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.zip = void 0;
+var Observable_1 = require("../Observable");
+var innerFrom_1 = require("./innerFrom");
+var argsOrArgArray_1 = require("../util/argsOrArgArray");
+var empty_1 = require("./empty");
+var OperatorSubscriber_1 = require("../operators/OperatorSubscriber");
+var args_1 = require("../util/args");
+function zip() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var resultSelector = args_1.popResultSelector(args);
+ var sources = argsOrArgArray_1.argsOrArgArray(args);
+ return sources.length
+ ? new Observable_1.Observable(function (subscriber) {
+ var buffers = sources.map(function () { return []; });
+ var completed = sources.map(function () { return false; });
+ subscriber.add(function () {
+ buffers = completed = null;
+ });
+ var _loop_1 = function (sourceIndex) {
+ innerFrom_1.innerFrom(sources[sourceIndex]).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ buffers[sourceIndex].push(value);
+ if (buffers.every(function (buffer) { return buffer.length; })) {
+ var result = buffers.map(function (buffer) { return buffer.shift(); });
+ subscriber.next(resultSelector ? resultSelector.apply(void 0, __spreadArray([], __read(result))) : result);
+ if (buffers.some(function (buffer, i) { return !buffer.length && completed[i]; })) {
+ subscriber.complete();
+ }
+ }
+ }, function () {
+ completed[sourceIndex] = true;
+ !buffers[sourceIndex].length && subscriber.complete();
+ }));
+ };
+ for (var sourceIndex = 0; !subscriber.closed && sourceIndex < sources.length; sourceIndex++) {
+ _loop_1(sourceIndex);
+ }
+ return function () {
+ buffers = completed = null;
+ };
+ })
+ : empty_1.EMPTY;
+}
+exports.zip = zip;
+
+},{"../Observable":412,"../operators/OperatorSubscriber":452,"../util/args":604,"../util/argsOrArgArray":606,"./empty":430,"./innerFrom":438}],452:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.OperatorSubscriber = exports.createOperatorSubscriber = void 0;
+var Subscriber_1 = require("../Subscriber");
+function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
+ return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
+}
+exports.createOperatorSubscriber = createOperatorSubscriber;
+var OperatorSubscriber = (function (_super) {
+ __extends(OperatorSubscriber, _super);
+ function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
+ var _this = _super.call(this, destination) || this;
+ _this.onFinalize = onFinalize;
+ _this.shouldUnsubscribe = shouldUnsubscribe;
+ _this._next = onNext
+ ? function (value) {
+ try {
+ onNext(value);
+ }
+ catch (err) {
+ destination.error(err);
+ }
+ }
+ : _super.prototype._next;
+ _this._error = onError
+ ? function (err) {
+ try {
+ onError(err);
+ }
+ catch (err) {
+ destination.error(err);
+ }
+ finally {
+ this.unsubscribe();
+ }
+ }
+ : _super.prototype._error;
+ _this._complete = onComplete
+ ? function () {
+ try {
+ onComplete();
+ }
+ catch (err) {
+ destination.error(err);
+ }
+ finally {
+ this.unsubscribe();
+ }
+ }
+ : _super.prototype._complete;
+ return _this;
+ }
+ OperatorSubscriber.prototype.unsubscribe = function () {
+ var _a;
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
+ var closed_1 = this.closed;
+ _super.prototype.unsubscribe.call(this);
+ !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
+ }
+ };
+ return OperatorSubscriber;
+}(Subscriber_1.Subscriber));
+exports.OperatorSubscriber = OperatorSubscriber;
+
+},{"../Subscriber":416}],453:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.audit = void 0;
+var lift_1 = require("../util/lift");
+var innerFrom_1 = require("../observable/innerFrom");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function audit(durationSelector) {
+ return lift_1.operate(function (source, subscriber) {
+ var hasValue = false;
+ var lastValue = null;
+ var durationSubscriber = null;
+ var isComplete = false;
+ var endDuration = function () {
+ durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
+ durationSubscriber = null;
+ if (hasValue) {
+ hasValue = false;
+ var value = lastValue;
+ lastValue = null;
+ subscriber.next(value);
+ }
+ isComplete && subscriber.complete();
+ };
+ var cleanupDuration = function () {
+ durationSubscriber = null;
+ isComplete && subscriber.complete();
+ };
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ hasValue = true;
+ lastValue = value;
+ if (!durationSubscriber) {
+ innerFrom_1.innerFrom(durationSelector(value)).subscribe((durationSubscriber = OperatorSubscriber_1.createOperatorSubscriber(subscriber, endDuration, cleanupDuration)));
+ }
+ }, function () {
+ isComplete = true;
+ (!hasValue || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();
+ }));
+ });
+}
+exports.audit = audit;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"./OperatorSubscriber":452}],454:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.auditTime = void 0;
+var async_1 = require("../scheduler/async");
+var audit_1 = require("./audit");
+var timer_1 = require("../observable/timer");
+function auditTime(duration, scheduler) {
+ if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
+ return audit_1.audit(function () { return timer_1.timer(duration, scheduler); });
+}
+exports.auditTime = auditTime;
+
+},{"../observable/timer":449,"../scheduler/async":587,"./audit":453}],455:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.buffer = void 0;
+var lift_1 = require("../util/lift");
+var noop_1 = require("../util/noop");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var innerFrom_1 = require("../observable/innerFrom");
+function buffer(closingNotifier) {
+ return lift_1.operate(function (source, subscriber) {
+ var currentBuffer = [];
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) { return currentBuffer.push(value); }, function () {
+ subscriber.next(currentBuffer);
+ subscriber.complete();
+ }));
+ innerFrom_1.innerFrom(closingNotifier).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
+ var b = currentBuffer;
+ currentBuffer = [];
+ subscriber.next(b);
+ }, noop_1.noop));
+ return function () {
+ currentBuffer = null;
+ };
+ });
+}
+exports.buffer = buffer;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],456:[function(require,module,exports){
+"use strict";
+var __values = (this && this.__values) || function(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.bufferCount = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var arrRemove_1 = require("../util/arrRemove");
+function bufferCount(bufferSize, startBufferEvery) {
+ if (startBufferEvery === void 0) { startBufferEvery = null; }
+ startBufferEvery = startBufferEvery !== null && startBufferEvery !== void 0 ? startBufferEvery : bufferSize;
+ return lift_1.operate(function (source, subscriber) {
+ var buffers = [];
+ var count = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var e_1, _a, e_2, _b;
+ var toEmit = null;
+ if (count++ % startBufferEvery === 0) {
+ buffers.push([]);
+ }
+ try {
+ for (var buffers_1 = __values(buffers), buffers_1_1 = buffers_1.next(); !buffers_1_1.done; buffers_1_1 = buffers_1.next()) {
+ var buffer = buffers_1_1.value;
+ buffer.push(value);
+ if (bufferSize <= buffer.length) {
+ toEmit = toEmit !== null && toEmit !== void 0 ? toEmit : [];
+ toEmit.push(buffer);
+ }
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (buffers_1_1 && !buffers_1_1.done && (_a = buffers_1.return)) _a.call(buffers_1);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ if (toEmit) {
+ try {
+ for (var toEmit_1 = __values(toEmit), toEmit_1_1 = toEmit_1.next(); !toEmit_1_1.done; toEmit_1_1 = toEmit_1.next()) {
+ var buffer = toEmit_1_1.value;
+ arrRemove_1.arrRemove(buffers, buffer);
+ subscriber.next(buffer);
+ }
+ }
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
+ finally {
+ try {
+ if (toEmit_1_1 && !toEmit_1_1.done && (_b = toEmit_1.return)) _b.call(toEmit_1);
+ }
+ finally { if (e_2) throw e_2.error; }
+ }
+ }
+ }, function () {
+ var e_3, _a;
+ try {
+ for (var buffers_2 = __values(buffers), buffers_2_1 = buffers_2.next(); !buffers_2_1.done; buffers_2_1 = buffers_2.next()) {
+ var buffer = buffers_2_1.value;
+ subscriber.next(buffer);
+ }
+ }
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
+ finally {
+ try {
+ if (buffers_2_1 && !buffers_2_1.done && (_a = buffers_2.return)) _a.call(buffers_2);
+ }
+ finally { if (e_3) throw e_3.error; }
+ }
+ subscriber.complete();
+ }, undefined, function () {
+ buffers = null;
+ }));
+ });
+}
+exports.bufferCount = bufferCount;
+
+},{"../util/arrRemove":607,"../util/lift":623,"./OperatorSubscriber":452}],457:[function(require,module,exports){
+"use strict";
+var __values = (this && this.__values) || function(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.bufferTime = void 0;
+var Subscription_1 = require("../Subscription");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var arrRemove_1 = require("../util/arrRemove");
+var async_1 = require("../scheduler/async");
+var args_1 = require("../util/args");
+var executeSchedule_1 = require("../util/executeSchedule");
+function bufferTime(bufferTimeSpan) {
+ var _a, _b;
+ var otherArgs = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ otherArgs[_i - 1] = arguments[_i];
+ }
+ var scheduler = (_a = args_1.popScheduler(otherArgs)) !== null && _a !== void 0 ? _a : async_1.asyncScheduler;
+ var bufferCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;
+ var maxBufferSize = otherArgs[1] || Infinity;
+ return lift_1.operate(function (source, subscriber) {
+ var bufferRecords = [];
+ var restartOnEmit = false;
+ var emit = function (record) {
+ var buffer = record.buffer, subs = record.subs;
+ subs.unsubscribe();
+ arrRemove_1.arrRemove(bufferRecords, record);
+ subscriber.next(buffer);
+ restartOnEmit && startBuffer();
+ };
+ var startBuffer = function () {
+ if (bufferRecords) {
+ var subs = new Subscription_1.Subscription();
+ subscriber.add(subs);
+ var buffer = [];
+ var record_1 = {
+ buffer: buffer,
+ subs: subs,
+ };
+ bufferRecords.push(record_1);
+ executeSchedule_1.executeSchedule(subs, scheduler, function () { return emit(record_1); }, bufferTimeSpan);
+ }
+ };
+ if (bufferCreationInterval !== null && bufferCreationInterval >= 0) {
+ executeSchedule_1.executeSchedule(subscriber, scheduler, startBuffer, bufferCreationInterval, true);
+ }
+ else {
+ restartOnEmit = true;
+ }
+ startBuffer();
+ var bufferTimeSubscriber = OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var e_1, _a;
+ var recordsCopy = bufferRecords.slice();
+ try {
+ for (var recordsCopy_1 = __values(recordsCopy), recordsCopy_1_1 = recordsCopy_1.next(); !recordsCopy_1_1.done; recordsCopy_1_1 = recordsCopy_1.next()) {
+ var record = recordsCopy_1_1.value;
+ var buffer = record.buffer;
+ buffer.push(value);
+ maxBufferSize <= buffer.length && emit(record);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (recordsCopy_1_1 && !recordsCopy_1_1.done && (_a = recordsCopy_1.return)) _a.call(recordsCopy_1);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ }, function () {
+ while (bufferRecords === null || bufferRecords === void 0 ? void 0 : bufferRecords.length) {
+ subscriber.next(bufferRecords.shift().buffer);
+ }
+ bufferTimeSubscriber === null || bufferTimeSubscriber === void 0 ? void 0 : bufferTimeSubscriber.unsubscribe();
+ subscriber.complete();
+ subscriber.unsubscribe();
+ }, undefined, function () { return (bufferRecords = null); });
+ source.subscribe(bufferTimeSubscriber);
+ });
+}
+exports.bufferTime = bufferTime;
+
+},{"../Subscription":417,"../scheduler/async":587,"../util/args":604,"../util/arrRemove":607,"../util/executeSchedule":611,"../util/lift":623,"./OperatorSubscriber":452}],458:[function(require,module,exports){
+"use strict";
+var __values = (this && this.__values) || function(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.bufferToggle = void 0;
+var Subscription_1 = require("../Subscription");
+var lift_1 = require("../util/lift");
+var innerFrom_1 = require("../observable/innerFrom");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var noop_1 = require("../util/noop");
+var arrRemove_1 = require("../util/arrRemove");
+function bufferToggle(openings, closingSelector) {
+ return lift_1.operate(function (source, subscriber) {
+ var buffers = [];
+ innerFrom_1.innerFrom(openings).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (openValue) {
+ var buffer = [];
+ buffers.push(buffer);
+ var closingSubscription = new Subscription_1.Subscription();
+ var emitBuffer = function () {
+ arrRemove_1.arrRemove(buffers, buffer);
+ subscriber.next(buffer);
+ closingSubscription.unsubscribe();
+ };
+ closingSubscription.add(innerFrom_1.innerFrom(closingSelector(openValue)).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, emitBuffer, noop_1.noop)));
+ }, noop_1.noop));
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var e_1, _a;
+ try {
+ for (var buffers_1 = __values(buffers), buffers_1_1 = buffers_1.next(); !buffers_1_1.done; buffers_1_1 = buffers_1.next()) {
+ var buffer = buffers_1_1.value;
+ buffer.push(value);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (buffers_1_1 && !buffers_1_1.done && (_a = buffers_1.return)) _a.call(buffers_1);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ }, function () {
+ while (buffers.length > 0) {
+ subscriber.next(buffers.shift());
+ }
+ subscriber.complete();
+ }));
+ });
+}
+exports.bufferToggle = bufferToggle;
+
+},{"../Subscription":417,"../observable/innerFrom":438,"../util/arrRemove":607,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],459:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.bufferWhen = void 0;
+var lift_1 = require("../util/lift");
+var noop_1 = require("../util/noop");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var innerFrom_1 = require("../observable/innerFrom");
+function bufferWhen(closingSelector) {
+ return lift_1.operate(function (source, subscriber) {
+ var buffer = null;
+ var closingSubscriber = null;
+ var openBuffer = function () {
+ closingSubscriber === null || closingSubscriber === void 0 ? void 0 : closingSubscriber.unsubscribe();
+ var b = buffer;
+ buffer = [];
+ b && subscriber.next(b);
+ innerFrom_1.innerFrom(closingSelector()).subscribe((closingSubscriber = OperatorSubscriber_1.createOperatorSubscriber(subscriber, openBuffer, noop_1.noop)));
+ };
+ openBuffer();
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) { return buffer === null || buffer === void 0 ? void 0 : buffer.push(value); }, function () {
+ buffer && subscriber.next(buffer);
+ subscriber.complete();
+ }, undefined, function () { return (buffer = closingSubscriber = null); }));
+ });
+}
+exports.bufferWhen = bufferWhen;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],460:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.catchError = void 0;
+var innerFrom_1 = require("../observable/innerFrom");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var lift_1 = require("../util/lift");
+function catchError(selector) {
+ return lift_1.operate(function (source, subscriber) {
+ var innerSub = null;
+ var syncUnsub = false;
+ var handledResult;
+ innerSub = source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, undefined, undefined, function (err) {
+ handledResult = innerFrom_1.innerFrom(selector(err, catchError(selector)(source)));
+ if (innerSub) {
+ innerSub.unsubscribe();
+ innerSub = null;
+ handledResult.subscribe(subscriber);
+ }
+ else {
+ syncUnsub = true;
+ }
+ }));
+ if (syncUnsub) {
+ innerSub.unsubscribe();
+ innerSub = null;
+ handledResult.subscribe(subscriber);
+ }
+ });
+}
+exports.catchError = catchError;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"./OperatorSubscriber":452}],461:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.combineAll = void 0;
+var combineLatestAll_1 = require("./combineLatestAll");
+exports.combineAll = combineLatestAll_1.combineLatestAll;
+
+},{"./combineLatestAll":463}],462:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.combineLatest = void 0;
+var combineLatest_1 = require("../observable/combineLatest");
+var lift_1 = require("../util/lift");
+var argsOrArgArray_1 = require("../util/argsOrArgArray");
+var mapOneOrManyArgs_1 = require("../util/mapOneOrManyArgs");
+var pipe_1 = require("../util/pipe");
+var args_1 = require("../util/args");
+function combineLatest() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var resultSelector = args_1.popResultSelector(args);
+ return resultSelector
+ ? pipe_1.pipe(combineLatest.apply(void 0, __spreadArray([], __read(args))), mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector))
+ : lift_1.operate(function (source, subscriber) {
+ combineLatest_1.combineLatestInit(__spreadArray([source], __read(argsOrArgArray_1.argsOrArgArray(args))))(subscriber);
+ });
+}
+exports.combineLatest = combineLatest;
+
+},{"../observable/combineLatest":425,"../util/args":604,"../util/argsOrArgArray":606,"../util/lift":623,"../util/mapOneOrManyArgs":624,"../util/pipe":627}],463:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.combineLatestAll = void 0;
+var combineLatest_1 = require("../observable/combineLatest");
+var joinAllInternals_1 = require("./joinAllInternals");
+function combineLatestAll(project) {
+ return joinAllInternals_1.joinAllInternals(combineLatest_1.combineLatest, project);
+}
+exports.combineLatestAll = combineLatestAll;
+
+},{"../observable/combineLatest":425,"./joinAllInternals":497}],464:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.combineLatestWith = void 0;
+var combineLatest_1 = require("./combineLatest");
+function combineLatestWith() {
+ var otherSources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ otherSources[_i] = arguments[_i];
+ }
+ return combineLatest_1.combineLatest.apply(void 0, __spreadArray([], __read(otherSources)));
+}
+exports.combineLatestWith = combineLatestWith;
+
+},{"./combineLatest":462}],465:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.concat = void 0;
+var lift_1 = require("../util/lift");
+var concatAll_1 = require("./concatAll");
+var args_1 = require("../util/args");
+var from_1 = require("../observable/from");
+function concat() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var scheduler = args_1.popScheduler(args);
+ return lift_1.operate(function (source, subscriber) {
+ concatAll_1.concatAll()(from_1.from(__spreadArray([source], __read(args)), scheduler)).subscribe(subscriber);
+ });
+}
+exports.concat = concat;
+
+},{"../observable/from":432,"../util/args":604,"../util/lift":623,"./concatAll":466}],466:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.concatAll = void 0;
+var mergeAll_1 = require("./mergeAll");
+function concatAll() {
+ return mergeAll_1.mergeAll(1);
+}
+exports.concatAll = concatAll;
+
+},{"./mergeAll":504}],467:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.concatMap = void 0;
+var mergeMap_1 = require("./mergeMap");
+var isFunction_1 = require("../util/isFunction");
+function concatMap(project, resultSelector) {
+ return isFunction_1.isFunction(resultSelector) ? mergeMap_1.mergeMap(project, resultSelector, 1) : mergeMap_1.mergeMap(project, 1);
+}
+exports.concatMap = concatMap;
+
+},{"../util/isFunction":616,"./mergeMap":506}],468:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.concatMapTo = void 0;
+var concatMap_1 = require("./concatMap");
+var isFunction_1 = require("../util/isFunction");
+function concatMapTo(innerObservable, resultSelector) {
+ return isFunction_1.isFunction(resultSelector) ? concatMap_1.concatMap(function () { return innerObservable; }, resultSelector) : concatMap_1.concatMap(function () { return innerObservable; });
+}
+exports.concatMapTo = concatMapTo;
+
+},{"../util/isFunction":616,"./concatMap":467}],469:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.concatWith = void 0;
+var concat_1 = require("./concat");
+function concatWith() {
+ var otherSources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ otherSources[_i] = arguments[_i];
+ }
+ return concat_1.concat.apply(void 0, __spreadArray([], __read(otherSources)));
+}
+exports.concatWith = concatWith;
+
+},{"./concat":465}],470:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.connect = void 0;
+var Subject_1 = require("../Subject");
+var innerFrom_1 = require("../observable/innerFrom");
+var lift_1 = require("../util/lift");
+var fromSubscribable_1 = require("../observable/fromSubscribable");
+var DEFAULT_CONFIG = {
+ connector: function () { return new Subject_1.Subject(); },
+};
+function connect(selector, config) {
+ if (config === void 0) { config = DEFAULT_CONFIG; }
+ var connector = config.connector;
+ return lift_1.operate(function (source, subscriber) {
+ var subject = connector();
+ innerFrom_1.innerFrom(selector(fromSubscribable_1.fromSubscribable(subject))).subscribe(subscriber);
+ subscriber.add(source.subscribe(subject));
+ });
+}
+exports.connect = connect;
+
+},{"../Subject":415,"../observable/fromSubscribable":435,"../observable/innerFrom":438,"../util/lift":623}],471:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.count = void 0;
+var reduce_1 = require("./reduce");
+function count(predicate) {
+ return reduce_1.reduce(function (total, value, i) { return (!predicate || predicate(value, i) ? total + 1 : total); }, 0);
+}
+exports.count = count;
+
+},{"./reduce":521}],472:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.debounce = void 0;
+var lift_1 = require("../util/lift");
+var noop_1 = require("../util/noop");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var innerFrom_1 = require("../observable/innerFrom");
+function debounce(durationSelector) {
+ return lift_1.operate(function (source, subscriber) {
+ var hasValue = false;
+ var lastValue = null;
+ var durationSubscriber = null;
+ var emit = function () {
+ durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
+ durationSubscriber = null;
+ if (hasValue) {
+ hasValue = false;
+ var value = lastValue;
+ lastValue = null;
+ subscriber.next(value);
+ }
+ };
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
+ hasValue = true;
+ lastValue = value;
+ durationSubscriber = OperatorSubscriber_1.createOperatorSubscriber(subscriber, emit, noop_1.noop);
+ innerFrom_1.innerFrom(durationSelector(value)).subscribe(durationSubscriber);
+ }, function () {
+ emit();
+ subscriber.complete();
+ }, undefined, function () {
+ lastValue = durationSubscriber = null;
+ }));
+ });
+}
+exports.debounce = debounce;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],473:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.debounceTime = void 0;
+var async_1 = require("../scheduler/async");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function debounceTime(dueTime, scheduler) {
+ if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
+ return lift_1.operate(function (source, subscriber) {
+ var activeTask = null;
+ var lastValue = null;
+ var lastTime = null;
+ var emit = function () {
+ if (activeTask) {
+ activeTask.unsubscribe();
+ activeTask = null;
+ var value = lastValue;
+ lastValue = null;
+ subscriber.next(value);
+ }
+ };
+ function emitWhenIdle() {
+ var targetTime = lastTime + dueTime;
+ var now = scheduler.now();
+ if (now < targetTime) {
+ activeTask = this.schedule(undefined, targetTime - now);
+ subscriber.add(activeTask);
+ return;
+ }
+ emit();
+ }
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ lastValue = value;
+ lastTime = scheduler.now();
+ if (!activeTask) {
+ activeTask = scheduler.schedule(emitWhenIdle, dueTime);
+ subscriber.add(activeTask);
+ }
+ }, function () {
+ emit();
+ subscriber.complete();
+ }, undefined, function () {
+ lastValue = activeTask = null;
+ }));
+ });
+}
+exports.debounceTime = debounceTime;
+
+},{"../scheduler/async":587,"../util/lift":623,"./OperatorSubscriber":452}],474:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.defaultIfEmpty = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function defaultIfEmpty(defaultValue) {
+ return lift_1.operate(function (source, subscriber) {
+ var hasValue = false;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ hasValue = true;
+ subscriber.next(value);
+ }, function () {
+ if (!hasValue) {
+ subscriber.next(defaultValue);
+ }
+ subscriber.complete();
+ }));
+ });
+}
+exports.defaultIfEmpty = defaultIfEmpty;
+
+},{"../util/lift":623,"./OperatorSubscriber":452}],475:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.delay = void 0;
+var async_1 = require("../scheduler/async");
+var delayWhen_1 = require("./delayWhen");
+var timer_1 = require("../observable/timer");
+function delay(due, scheduler) {
+ if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
+ var duration = timer_1.timer(due, scheduler);
+ return delayWhen_1.delayWhen(function () { return duration; });
+}
+exports.delay = delay;
+
+},{"../observable/timer":449,"../scheduler/async":587,"./delayWhen":476}],476:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.delayWhen = void 0;
+var concat_1 = require("../observable/concat");
+var take_1 = require("./take");
+var ignoreElements_1 = require("./ignoreElements");
+var mapTo_1 = require("./mapTo");
+var mergeMap_1 = require("./mergeMap");
+var innerFrom_1 = require("../observable/innerFrom");
+function delayWhen(delayDurationSelector, subscriptionDelay) {
+ if (subscriptionDelay) {
+ return function (source) {
+ return concat_1.concat(subscriptionDelay.pipe(take_1.take(1), ignoreElements_1.ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
+ };
+ }
+ return mergeMap_1.mergeMap(function (value, index) { return innerFrom_1.innerFrom(delayDurationSelector(value, index)).pipe(take_1.take(1), mapTo_1.mapTo(value)); });
+}
+exports.delayWhen = delayWhen;
+
+},{"../observable/concat":426,"../observable/innerFrom":438,"./ignoreElements":495,"./mapTo":500,"./mergeMap":506,"./take":545}],477:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.dematerialize = void 0;
+var Notification_1 = require("../Notification");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function dematerialize() {
+ return lift_1.operate(function (source, subscriber) {
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (notification) { return Notification_1.observeNotification(notification, subscriber); }));
+ });
+}
+exports.dematerialize = dematerialize;
+
+},{"../Notification":410,"../util/lift":623,"./OperatorSubscriber":452}],478:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.distinct = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var noop_1 = require("../util/noop");
+var innerFrom_1 = require("../observable/innerFrom");
+function distinct(keySelector, flushes) {
+ return lift_1.operate(function (source, subscriber) {
+ var distinctKeys = new Set();
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var key = keySelector ? keySelector(value) : value;
+ if (!distinctKeys.has(key)) {
+ distinctKeys.add(key);
+ subscriber.next(value);
+ }
+ }));
+ flushes && innerFrom_1.innerFrom(flushes).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () { return distinctKeys.clear(); }, noop_1.noop));
+ });
+}
+exports.distinct = distinct;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],479:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.distinctUntilChanged = void 0;
+var identity_1 = require("../util/identity");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function distinctUntilChanged(comparator, keySelector) {
+ if (keySelector === void 0) { keySelector = identity_1.identity; }
+ comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
+ return lift_1.operate(function (source, subscriber) {
+ var previousKey;
+ var first = true;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var currentKey = keySelector(value);
+ if (first || !comparator(previousKey, currentKey)) {
+ first = false;
+ previousKey = currentKey;
+ subscriber.next(value);
+ }
+ }));
+ });
+}
+exports.distinctUntilChanged = distinctUntilChanged;
+function defaultCompare(a, b) {
+ return a === b;
+}
+
+},{"../util/identity":612,"../util/lift":623,"./OperatorSubscriber":452}],480:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.distinctUntilKeyChanged = void 0;
+var distinctUntilChanged_1 = require("./distinctUntilChanged");
+function distinctUntilKeyChanged(key, compare) {
+ return distinctUntilChanged_1.distinctUntilChanged(function (x, y) { return compare ? compare(x[key], y[key]) : x[key] === y[key]; });
+}
+exports.distinctUntilKeyChanged = distinctUntilKeyChanged;
+
+},{"./distinctUntilChanged":479}],481:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.elementAt = void 0;
+var ArgumentOutOfRangeError_1 = require("../util/ArgumentOutOfRangeError");
+var filter_1 = require("./filter");
+var throwIfEmpty_1 = require("./throwIfEmpty");
+var defaultIfEmpty_1 = require("./defaultIfEmpty");
+var take_1 = require("./take");
+function elementAt(index, defaultValue) {
+ if (index < 0) {
+ throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError();
+ }
+ var hasDefaultValue = arguments.length >= 2;
+ return function (source) {
+ return source.pipe(filter_1.filter(function (v, i) { return i === index; }), take_1.take(1), hasDefaultValue ? defaultIfEmpty_1.defaultIfEmpty(defaultValue) : throwIfEmpty_1.throwIfEmpty(function () { return new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError(); }));
+ };
+}
+exports.elementAt = elementAt;
+
+},{"../util/ArgumentOutOfRangeError":597,"./defaultIfEmpty":474,"./filter":488,"./take":545,"./throwIfEmpty":552}],482:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.endWith = void 0;
+var concat_1 = require("../observable/concat");
+var of_1 = require("../observable/of");
+function endWith() {
+ var values = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ values[_i] = arguments[_i];
+ }
+ return function (source) { return concat_1.concat(source, of_1.of.apply(void 0, __spreadArray([], __read(values)))); };
+}
+exports.endWith = endWith;
+
+},{"../observable/concat":426,"../observable/of":442}],483:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.every = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function every(predicate, thisArg) {
+ return lift_1.operate(function (source, subscriber) {
+ var index = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ if (!predicate.call(thisArg, value, index++, source)) {
+ subscriber.next(false);
+ subscriber.complete();
+ }
+ }, function () {
+ subscriber.next(true);
+ subscriber.complete();
+ }));
+ });
+}
+exports.every = every;
+
+},{"../util/lift":623,"./OperatorSubscriber":452}],484:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.exhaust = void 0;
+var exhaustAll_1 = require("./exhaustAll");
+exports.exhaust = exhaustAll_1.exhaustAll;
+
+},{"./exhaustAll":485}],485:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.exhaustAll = void 0;
+var exhaustMap_1 = require("./exhaustMap");
+var identity_1 = require("../util/identity");
+function exhaustAll() {
+ return exhaustMap_1.exhaustMap(identity_1.identity);
+}
+exports.exhaustAll = exhaustAll;
+
+},{"../util/identity":612,"./exhaustMap":486}],486:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.exhaustMap = void 0;
+var map_1 = require("./map");
+var innerFrom_1 = require("../observable/innerFrom");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function exhaustMap(project, resultSelector) {
+ if (resultSelector) {
+ return function (source) {
+ return source.pipe(exhaustMap(function (a, i) { return innerFrom_1.innerFrom(project(a, i)).pipe(map_1.map(function (b, ii) { return resultSelector(a, b, i, ii); })); }));
+ };
+ }
+ return lift_1.operate(function (source, subscriber) {
+ var index = 0;
+ var innerSub = null;
+ var isComplete = false;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (outerValue) {
+ if (!innerSub) {
+ innerSub = OperatorSubscriber_1.createOperatorSubscriber(subscriber, undefined, function () {
+ innerSub = null;
+ isComplete && subscriber.complete();
+ });
+ innerFrom_1.innerFrom(project(outerValue, index++)).subscribe(innerSub);
+ }
+ }, function () {
+ isComplete = true;
+ !innerSub && subscriber.complete();
+ }));
+ });
+}
+exports.exhaustMap = exhaustMap;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"./OperatorSubscriber":452,"./map":499}],487:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.expand = void 0;
+var lift_1 = require("../util/lift");
+var mergeInternals_1 = require("./mergeInternals");
+function expand(project, concurrent, scheduler) {
+ if (concurrent === void 0) { concurrent = Infinity; }
+ concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
+ return lift_1.operate(function (source, subscriber) {
+ return mergeInternals_1.mergeInternals(source, subscriber, project, concurrent, undefined, true, scheduler);
+ });
+}
+exports.expand = expand;
+
+},{"../util/lift":623,"./mergeInternals":505}],488:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.filter = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function filter(predicate, thisArg) {
+ return lift_1.operate(function (source, subscriber) {
+ var index = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) { return predicate.call(thisArg, value, index++) && subscriber.next(value); }));
+ });
+}
+exports.filter = filter;
+
+},{"../util/lift":623,"./OperatorSubscriber":452}],489:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.finalize = void 0;
+var lift_1 = require("../util/lift");
+function finalize(callback) {
+ return lift_1.operate(function (source, subscriber) {
+ try {
+ source.subscribe(subscriber);
+ }
+ finally {
+ subscriber.add(callback);
+ }
+ });
+}
+exports.finalize = finalize;
+
+},{"../util/lift":623}],490:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.createFind = exports.find = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function find(predicate, thisArg) {
+ return lift_1.operate(createFind(predicate, thisArg, 'value'));
+}
+exports.find = find;
+function createFind(predicate, thisArg, emit) {
+ var findIndex = emit === 'index';
+ return function (source, subscriber) {
+ var index = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var i = index++;
+ if (predicate.call(thisArg, value, i, source)) {
+ subscriber.next(findIndex ? i : value);
+ subscriber.complete();
+ }
+ }, function () {
+ subscriber.next(findIndex ? -1 : undefined);
+ subscriber.complete();
+ }));
+ };
+}
+exports.createFind = createFind;
+
+},{"../util/lift":623,"./OperatorSubscriber":452}],491:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.findIndex = void 0;
+var lift_1 = require("../util/lift");
+var find_1 = require("./find");
+function findIndex(predicate, thisArg) {
+ return lift_1.operate(find_1.createFind(predicate, thisArg, 'index'));
+}
+exports.findIndex = findIndex;
+
+},{"../util/lift":623,"./find":490}],492:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.first = void 0;
+var EmptyError_1 = require("../util/EmptyError");
+var filter_1 = require("./filter");
+var take_1 = require("./take");
+var defaultIfEmpty_1 = require("./defaultIfEmpty");
+var throwIfEmpty_1 = require("./throwIfEmpty");
+var identity_1 = require("../util/identity");
+function first(predicate, defaultValue) {
+ var hasDefaultValue = arguments.length >= 2;
+ return function (source) {
+ return source.pipe(predicate ? filter_1.filter(function (v, i) { return predicate(v, i, source); }) : identity_1.identity, take_1.take(1), hasDefaultValue ? defaultIfEmpty_1.defaultIfEmpty(defaultValue) : throwIfEmpty_1.throwIfEmpty(function () { return new EmptyError_1.EmptyError(); }));
+ };
+}
+exports.first = first;
+
+},{"../util/EmptyError":598,"../util/identity":612,"./defaultIfEmpty":474,"./filter":488,"./take":545,"./throwIfEmpty":552}],493:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.flatMap = void 0;
+var mergeMap_1 = require("./mergeMap");
+exports.flatMap = mergeMap_1.mergeMap;
+
+},{"./mergeMap":506}],494:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.groupBy = void 0;
+var Observable_1 = require("../Observable");
+var innerFrom_1 = require("../observable/innerFrom");
+var Subject_1 = require("../Subject");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function groupBy(keySelector, elementOrOptions, duration, connector) {
+ return lift_1.operate(function (source, subscriber) {
+ var element;
+ if (!elementOrOptions || typeof elementOrOptions === 'function') {
+ element = elementOrOptions;
+ }
+ else {
+ (duration = elementOrOptions.duration, element = elementOrOptions.element, connector = elementOrOptions.connector);
+ }
+ var groups = new Map();
+ var notify = function (cb) {
+ groups.forEach(cb);
+ cb(subscriber);
+ };
+ var handleError = function (err) { return notify(function (consumer) { return consumer.error(err); }); };
+ var activeGroups = 0;
+ var teardownAttempted = false;
+ var groupBySourceSubscriber = new OperatorSubscriber_1.OperatorSubscriber(subscriber, function (value) {
+ try {
+ var key_1 = keySelector(value);
+ var group_1 = groups.get(key_1);
+ if (!group_1) {
+ groups.set(key_1, (group_1 = connector ? connector() : new Subject_1.Subject()));
+ var grouped = createGroupedObservable(key_1, group_1);
+ subscriber.next(grouped);
+ if (duration) {
+ var durationSubscriber_1 = OperatorSubscriber_1.createOperatorSubscriber(group_1, function () {
+ group_1.complete();
+ durationSubscriber_1 === null || durationSubscriber_1 === void 0 ? void 0 : durationSubscriber_1.unsubscribe();
+ }, undefined, undefined, function () { return groups.delete(key_1); });
+ groupBySourceSubscriber.add(innerFrom_1.innerFrom(duration(grouped)).subscribe(durationSubscriber_1));
+ }
+ }
+ group_1.next(element ? element(value) : value);
+ }
+ catch (err) {
+ handleError(err);
+ }
+ }, function () { return notify(function (consumer) { return consumer.complete(); }); }, handleError, function () { return groups.clear(); }, function () {
+ teardownAttempted = true;
+ return activeGroups === 0;
+ });
+ source.subscribe(groupBySourceSubscriber);
+ function createGroupedObservable(key, groupSubject) {
+ var result = new Observable_1.Observable(function (groupSubscriber) {
+ activeGroups++;
+ var innerSub = groupSubject.subscribe(groupSubscriber);
+ return function () {
+ innerSub.unsubscribe();
+ --activeGroups === 0 && teardownAttempted && groupBySourceSubscriber.unsubscribe();
+ };
+ });
+ result.key = key;
+ return result;
+ }
+ });
+}
+exports.groupBy = groupBy;
+
+},{"../Observable":412,"../Subject":415,"../observable/innerFrom":438,"../util/lift":623,"./OperatorSubscriber":452}],495:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ignoreElements = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var noop_1 = require("../util/noop");
+function ignoreElements() {
+ return lift_1.operate(function (source, subscriber) {
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, noop_1.noop));
+ });
+}
+exports.ignoreElements = ignoreElements;
+
+},{"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],496:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isEmpty = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function isEmpty() {
+ return lift_1.operate(function (source, subscriber) {
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
+ subscriber.next(false);
+ subscriber.complete();
+ }, function () {
+ subscriber.next(true);
+ subscriber.complete();
+ }));
+ });
+}
+exports.isEmpty = isEmpty;
+
+},{"../util/lift":623,"./OperatorSubscriber":452}],497:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.joinAllInternals = void 0;
+var identity_1 = require("../util/identity");
+var mapOneOrManyArgs_1 = require("../util/mapOneOrManyArgs");
+var pipe_1 = require("../util/pipe");
+var mergeMap_1 = require("./mergeMap");
+var toArray_1 = require("./toArray");
+function joinAllInternals(joinFn, project) {
+ return pipe_1.pipe(toArray_1.toArray(), mergeMap_1.mergeMap(function (sources) { return joinFn(sources); }), project ? mapOneOrManyArgs_1.mapOneOrManyArgs(project) : identity_1.identity);
+}
+exports.joinAllInternals = joinAllInternals;
+
+},{"../util/identity":612,"../util/mapOneOrManyArgs":624,"../util/pipe":627,"./mergeMap":506,"./toArray":557}],498:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.last = void 0;
+var EmptyError_1 = require("../util/EmptyError");
+var filter_1 = require("./filter");
+var takeLast_1 = require("./takeLast");
+var throwIfEmpty_1 = require("./throwIfEmpty");
+var defaultIfEmpty_1 = require("./defaultIfEmpty");
+var identity_1 = require("../util/identity");
+function last(predicate, defaultValue) {
+ var hasDefaultValue = arguments.length >= 2;
+ return function (source) {
+ return source.pipe(predicate ? filter_1.filter(function (v, i) { return predicate(v, i, source); }) : identity_1.identity, takeLast_1.takeLast(1), hasDefaultValue ? defaultIfEmpty_1.defaultIfEmpty(defaultValue) : throwIfEmpty_1.throwIfEmpty(function () { return new EmptyError_1.EmptyError(); }));
+ };
+}
+exports.last = last;
+
+},{"../util/EmptyError":598,"../util/identity":612,"./defaultIfEmpty":474,"./filter":488,"./takeLast":546,"./throwIfEmpty":552}],499:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.map = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function map(project, thisArg) {
+ return lift_1.operate(function (source, subscriber) {
+ var index = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ subscriber.next(project.call(thisArg, value, index++));
+ }));
+ });
+}
+exports.map = map;
+
+},{"../util/lift":623,"./OperatorSubscriber":452}],500:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.mapTo = void 0;
+var map_1 = require("./map");
+function mapTo(value) {
+ return map_1.map(function () { return value; });
+}
+exports.mapTo = mapTo;
+
+},{"./map":499}],501:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.materialize = void 0;
+var Notification_1 = require("../Notification");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function materialize() {
+ return lift_1.operate(function (source, subscriber) {
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ subscriber.next(Notification_1.Notification.createNext(value));
+ }, function () {
+ subscriber.next(Notification_1.Notification.createComplete());
+ subscriber.complete();
+ }, function (err) {
+ subscriber.next(Notification_1.Notification.createError(err));
+ subscriber.complete();
+ }));
+ });
+}
+exports.materialize = materialize;
+
+},{"../Notification":410,"../util/lift":623,"./OperatorSubscriber":452}],502:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.max = void 0;
+var reduce_1 = require("./reduce");
+var isFunction_1 = require("../util/isFunction");
+function max(comparer) {
+ return reduce_1.reduce(isFunction_1.isFunction(comparer) ? function (x, y) { return (comparer(x, y) > 0 ? x : y); } : function (x, y) { return (x > y ? x : y); });
+}
+exports.max = max;
+
+},{"../util/isFunction":616,"./reduce":521}],503:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.merge = void 0;
+var lift_1 = require("../util/lift");
+var argsOrArgArray_1 = require("../util/argsOrArgArray");
+var mergeAll_1 = require("./mergeAll");
+var args_1 = require("../util/args");
+var from_1 = require("../observable/from");
+function merge() {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var scheduler = args_1.popScheduler(args);
+ var concurrent = args_1.popNumber(args, Infinity);
+ args = argsOrArgArray_1.argsOrArgArray(args);
+ return lift_1.operate(function (source, subscriber) {
+ mergeAll_1.mergeAll(concurrent)(from_1.from(__spreadArray([source], __read(args)), scheduler)).subscribe(subscriber);
+ });
+}
+exports.merge = merge;
+
+},{"../observable/from":432,"../util/args":604,"../util/argsOrArgArray":606,"../util/lift":623,"./mergeAll":504}],504:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.mergeAll = void 0;
+var mergeMap_1 = require("./mergeMap");
+var identity_1 = require("../util/identity");
+function mergeAll(concurrent) {
+ if (concurrent === void 0) { concurrent = Infinity; }
+ return mergeMap_1.mergeMap(identity_1.identity, concurrent);
+}
+exports.mergeAll = mergeAll;
+
+},{"../util/identity":612,"./mergeMap":506}],505:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.mergeInternals = void 0;
+var innerFrom_1 = require("../observable/innerFrom");
+var executeSchedule_1 = require("../util/executeSchedule");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
+ var buffer = [];
+ var active = 0;
+ var index = 0;
+ var isComplete = false;
+ var checkComplete = function () {
+ if (isComplete && !buffer.length && !active) {
+ subscriber.complete();
+ }
+ };
+ var outerNext = function (value) { return (active < concurrent ? doInnerSub(value) : buffer.push(value)); };
+ var doInnerSub = function (value) {
+ expand && subscriber.next(value);
+ active++;
+ var innerComplete = false;
+ innerFrom_1.innerFrom(project(value, index++)).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (innerValue) {
+ onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
+ if (expand) {
+ outerNext(innerValue);
+ }
+ else {
+ subscriber.next(innerValue);
+ }
+ }, function () {
+ innerComplete = true;
+ }, undefined, function () {
+ if (innerComplete) {
+ try {
+ active--;
+ var _loop_1 = function () {
+ var bufferedValue = buffer.shift();
+ if (innerSubScheduler) {
+ executeSchedule_1.executeSchedule(subscriber, innerSubScheduler, function () { return doInnerSub(bufferedValue); });
+ }
+ else {
+ doInnerSub(bufferedValue);
+ }
+ };
+ while (buffer.length && active < concurrent) {
+ _loop_1();
+ }
+ checkComplete();
+ }
+ catch (err) {
+ subscriber.error(err);
+ }
+ }
+ }));
+ };
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, outerNext, function () {
+ isComplete = true;
+ checkComplete();
+ }));
+ return function () {
+ additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
+ };
+}
+exports.mergeInternals = mergeInternals;
+
+},{"../observable/innerFrom":438,"../util/executeSchedule":611,"./OperatorSubscriber":452}],506:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.mergeMap = void 0;
+var map_1 = require("./map");
+var innerFrom_1 = require("../observable/innerFrom");
+var lift_1 = require("../util/lift");
+var mergeInternals_1 = require("./mergeInternals");
+var isFunction_1 = require("../util/isFunction");
+function mergeMap(project, resultSelector, concurrent) {
+ if (concurrent === void 0) { concurrent = Infinity; }
+ if (isFunction_1.isFunction(resultSelector)) {
+ return mergeMap(function (a, i) { return map_1.map(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom_1.innerFrom(project(a, i))); }, concurrent);
+ }
+ else if (typeof resultSelector === 'number') {
+ concurrent = resultSelector;
+ }
+ return lift_1.operate(function (source, subscriber) { return mergeInternals_1.mergeInternals(source, subscriber, project, concurrent); });
+}
+exports.mergeMap = mergeMap;
+
+},{"../observable/innerFrom":438,"../util/isFunction":616,"../util/lift":623,"./map":499,"./mergeInternals":505}],507:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.mergeMapTo = void 0;
+var mergeMap_1 = require("./mergeMap");
+var isFunction_1 = require("../util/isFunction");
+function mergeMapTo(innerObservable, resultSelector, concurrent) {
+ if (concurrent === void 0) { concurrent = Infinity; }
+ if (isFunction_1.isFunction(resultSelector)) {
+ return mergeMap_1.mergeMap(function () { return innerObservable; }, resultSelector, concurrent);
+ }
+ if (typeof resultSelector === 'number') {
+ concurrent = resultSelector;
+ }
+ return mergeMap_1.mergeMap(function () { return innerObservable; }, concurrent);
+}
+exports.mergeMapTo = mergeMapTo;
+
+},{"../util/isFunction":616,"./mergeMap":506}],508:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.mergeScan = void 0;
+var lift_1 = require("../util/lift");
+var mergeInternals_1 = require("./mergeInternals");
+function mergeScan(accumulator, seed, concurrent) {
+ if (concurrent === void 0) { concurrent = Infinity; }
+ return lift_1.operate(function (source, subscriber) {
+ var state = seed;
+ return mergeInternals_1.mergeInternals(source, subscriber, function (value, index) { return accumulator(state, value, index); }, concurrent, function (value) {
+ state = value;
+ }, false, undefined, function () { return (state = null); });
+ });
+}
+exports.mergeScan = mergeScan;
+
+},{"../util/lift":623,"./mergeInternals":505}],509:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.mergeWith = void 0;
+var merge_1 = require("./merge");
+function mergeWith() {
+ var otherSources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ otherSources[_i] = arguments[_i];
+ }
+ return merge_1.merge.apply(void 0, __spreadArray([], __read(otherSources)));
+}
+exports.mergeWith = mergeWith;
+
+},{"./merge":503}],510:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.min = void 0;
+var reduce_1 = require("./reduce");
+var isFunction_1 = require("../util/isFunction");
+function min(comparer) {
+ return reduce_1.reduce(isFunction_1.isFunction(comparer) ? function (x, y) { return (comparer(x, y) < 0 ? x : y); } : function (x, y) { return (x < y ? x : y); });
+}
+exports.min = min;
+
+},{"../util/isFunction":616,"./reduce":521}],511:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.multicast = void 0;
+var ConnectableObservable_1 = require("../observable/ConnectableObservable");
+var isFunction_1 = require("../util/isFunction");
+var connect_1 = require("./connect");
+function multicast(subjectOrSubjectFactory, selector) {
+ var subjectFactory = isFunction_1.isFunction(subjectOrSubjectFactory) ? subjectOrSubjectFactory : function () { return subjectOrSubjectFactory; };
+ if (isFunction_1.isFunction(selector)) {
+ return connect_1.connect(selector, {
+ connector: subjectFactory,
+ });
+ }
+ return function (source) { return new ConnectableObservable_1.ConnectableObservable(source, subjectFactory); };
+}
+exports.multicast = multicast;
+
+},{"../observable/ConnectableObservable":421,"../util/isFunction":616,"./connect":470}],512:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.observeOn = void 0;
+var executeSchedule_1 = require("../util/executeSchedule");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function observeOn(scheduler, delay) {
+ if (delay === void 0) { delay = 0; }
+ return lift_1.operate(function (source, subscriber) {
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) { return executeSchedule_1.executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule_1.executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule_1.executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
+ });
+}
+exports.observeOn = observeOn;
+
+},{"../util/executeSchedule":611,"../util/lift":623,"./OperatorSubscriber":452}],513:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.onErrorResumeNext = exports.onErrorResumeNextWith = void 0;
+var argsOrArgArray_1 = require("../util/argsOrArgArray");
+var onErrorResumeNext_1 = require("../observable/onErrorResumeNext");
+function onErrorResumeNextWith() {
+ var sources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ sources[_i] = arguments[_i];
+ }
+ var nextSources = argsOrArgArray_1.argsOrArgArray(sources);
+ return function (source) { return onErrorResumeNext_1.onErrorResumeNext.apply(void 0, __spreadArray([source], __read(nextSources))); };
+}
+exports.onErrorResumeNextWith = onErrorResumeNextWith;
+exports.onErrorResumeNext = onErrorResumeNextWith;
+
+},{"../observable/onErrorResumeNext":443,"../util/argsOrArgArray":606}],514:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.pairwise = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function pairwise() {
+ return lift_1.operate(function (source, subscriber) {
+ var prev;
+ var hasPrev = false;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var p = prev;
+ prev = value;
+ hasPrev && subscriber.next([p, value]);
+ hasPrev = true;
+ }));
+ });
+}
+exports.pairwise = pairwise;
+
+},{"../util/lift":623,"./OperatorSubscriber":452}],515:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.pluck = void 0;
+var map_1 = require("./map");
+function pluck() {
+ var properties = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ properties[_i] = arguments[_i];
+ }
+ var length = properties.length;
+ if (length === 0) {
+ throw new Error('list of properties cannot be empty.');
+ }
+ return map_1.map(function (x) {
+ var currentProp = x;
+ for (var i = 0; i < length; i++) {
+ var p = currentProp === null || currentProp === void 0 ? void 0 : currentProp[properties[i]];
+ if (typeof p !== 'undefined') {
+ currentProp = p;
+ }
+ else {
+ return undefined;
+ }
+ }
+ return currentProp;
+ });
+}
+exports.pluck = pluck;
+
+},{"./map":499}],516:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.publish = void 0;
+var Subject_1 = require("../Subject");
+var multicast_1 = require("./multicast");
+var connect_1 = require("./connect");
+function publish(selector) {
+ return selector ? function (source) { return connect_1.connect(selector)(source); } : function (source) { return multicast_1.multicast(new Subject_1.Subject())(source); };
+}
+exports.publish = publish;
+
+},{"../Subject":415,"./connect":470,"./multicast":511}],517:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.publishBehavior = void 0;
+var BehaviorSubject_1 = require("../BehaviorSubject");
+var ConnectableObservable_1 = require("../observable/ConnectableObservable");
+function publishBehavior(initialValue) {
+ return function (source) {
+ var subject = new BehaviorSubject_1.BehaviorSubject(initialValue);
+ return new ConnectableObservable_1.ConnectableObservable(source, function () { return subject; });
+ };
+}
+exports.publishBehavior = publishBehavior;
+
+},{"../BehaviorSubject":409,"../observable/ConnectableObservable":421}],518:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.publishLast = void 0;
+var AsyncSubject_1 = require("../AsyncSubject");
+var ConnectableObservable_1 = require("../observable/ConnectableObservable");
+function publishLast() {
+ return function (source) {
+ var subject = new AsyncSubject_1.AsyncSubject();
+ return new ConnectableObservable_1.ConnectableObservable(source, function () { return subject; });
+ };
+}
+exports.publishLast = publishLast;
+
+},{"../AsyncSubject":408,"../observable/ConnectableObservable":421}],519:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.publishReplay = void 0;
+var ReplaySubject_1 = require("../ReplaySubject");
+var multicast_1 = require("./multicast");
+var isFunction_1 = require("../util/isFunction");
+function publishReplay(bufferSize, windowTime, selectorOrScheduler, timestampProvider) {
+ if (selectorOrScheduler && !isFunction_1.isFunction(selectorOrScheduler)) {
+ timestampProvider = selectorOrScheduler;
+ }
+ var selector = isFunction_1.isFunction(selectorOrScheduler) ? selectorOrScheduler : undefined;
+ return function (source) { return multicast_1.multicast(new ReplaySubject_1.ReplaySubject(bufferSize, windowTime, timestampProvider), selector)(source); };
+}
+exports.publishReplay = publishReplay;
+
+},{"../ReplaySubject":413,"../util/isFunction":616,"./multicast":511}],520:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.raceWith = void 0;
+var race_1 = require("../observable/race");
+var lift_1 = require("../util/lift");
+var identity_1 = require("../util/identity");
+function raceWith() {
+ var otherSources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ otherSources[_i] = arguments[_i];
+ }
+ return !otherSources.length
+ ? identity_1.identity
+ : lift_1.operate(function (source, subscriber) {
+ race_1.raceInit(__spreadArray([source], __read(otherSources)))(subscriber);
+ });
+}
+exports.raceWith = raceWith;
+
+},{"../observable/race":446,"../util/identity":612,"../util/lift":623}],521:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.reduce = void 0;
+var scanInternals_1 = require("./scanInternals");
+var lift_1 = require("../util/lift");
+function reduce(accumulator, seed) {
+ return lift_1.operate(scanInternals_1.scanInternals(accumulator, seed, arguments.length >= 2, false, true));
+}
+exports.reduce = reduce;
+
+},{"../util/lift":623,"./scanInternals":530}],522:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.refCount = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function refCount() {
+ return lift_1.operate(function (source, subscriber) {
+ var connection = null;
+ source._refCount++;
+ var refCounter = OperatorSubscriber_1.createOperatorSubscriber(subscriber, undefined, undefined, undefined, function () {
+ if (!source || source._refCount <= 0 || 0 < --source._refCount) {
+ connection = null;
+ return;
+ }
+ var sharedConnection = source._connection;
+ var conn = connection;
+ connection = null;
+ if (sharedConnection && (!conn || sharedConnection === conn)) {
+ sharedConnection.unsubscribe();
+ }
+ subscriber.unsubscribe();
+ });
+ source.subscribe(refCounter);
+ if (!refCounter.closed) {
+ connection = source.connect();
+ }
+ });
+}
+exports.refCount = refCount;
+
+},{"../util/lift":623,"./OperatorSubscriber":452}],523:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.repeat = void 0;
+var empty_1 = require("../observable/empty");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var innerFrom_1 = require("../observable/innerFrom");
+var timer_1 = require("../observable/timer");
+function repeat(countOrConfig) {
+ var _a;
+ var count = Infinity;
+ var delay;
+ if (countOrConfig != null) {
+ if (typeof countOrConfig === 'object') {
+ (_a = countOrConfig.count, count = _a === void 0 ? Infinity : _a, delay = countOrConfig.delay);
+ }
+ else {
+ count = countOrConfig;
+ }
+ }
+ return count <= 0
+ ? function () { return empty_1.EMPTY; }
+ : lift_1.operate(function (source, subscriber) {
+ var soFar = 0;
+ var sourceSub;
+ var resubscribe = function () {
+ sourceSub === null || sourceSub === void 0 ? void 0 : sourceSub.unsubscribe();
+ sourceSub = null;
+ if (delay != null) {
+ var notifier = typeof delay === 'number' ? timer_1.timer(delay) : innerFrom_1.innerFrom(delay(soFar));
+ var notifierSubscriber_1 = OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
+ notifierSubscriber_1.unsubscribe();
+ subscribeToSource();
+ });
+ notifier.subscribe(notifierSubscriber_1);
+ }
+ else {
+ subscribeToSource();
+ }
+ };
+ var subscribeToSource = function () {
+ var syncUnsub = false;
+ sourceSub = source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, undefined, function () {
+ if (++soFar < count) {
+ if (sourceSub) {
+ resubscribe();
+ }
+ else {
+ syncUnsub = true;
+ }
+ }
+ else {
+ subscriber.complete();
+ }
+ }));
+ if (syncUnsub) {
+ resubscribe();
+ }
+ };
+ subscribeToSource();
+ });
+}
+exports.repeat = repeat;
+
+},{"../observable/empty":430,"../observable/innerFrom":438,"../observable/timer":449,"../util/lift":623,"./OperatorSubscriber":452}],524:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.repeatWhen = void 0;
+var innerFrom_1 = require("../observable/innerFrom");
+var Subject_1 = require("../Subject");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function repeatWhen(notifier) {
+ return lift_1.operate(function (source, subscriber) {
+ var innerSub;
+ var syncResub = false;
+ var completions$;
+ var isNotifierComplete = false;
+ var isMainComplete = false;
+ var checkComplete = function () { return isMainComplete && isNotifierComplete && (subscriber.complete(), true); };
+ var getCompletionSubject = function () {
+ if (!completions$) {
+ completions$ = new Subject_1.Subject();
+ innerFrom_1.innerFrom(notifier(completions$)).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
+ if (innerSub) {
+ subscribeForRepeatWhen();
+ }
+ else {
+ syncResub = true;
+ }
+ }, function () {
+ isNotifierComplete = true;
+ checkComplete();
+ }));
+ }
+ return completions$;
+ };
+ var subscribeForRepeatWhen = function () {
+ isMainComplete = false;
+ innerSub = source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, undefined, function () {
+ isMainComplete = true;
+ !checkComplete() && getCompletionSubject().next();
+ }));
+ if (syncResub) {
+ innerSub.unsubscribe();
+ innerSub = null;
+ syncResub = false;
+ subscribeForRepeatWhen();
+ }
+ };
+ subscribeForRepeatWhen();
+ });
+}
+exports.repeatWhen = repeatWhen;
+
+},{"../Subject":415,"../observable/innerFrom":438,"../util/lift":623,"./OperatorSubscriber":452}],525:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.retry = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var identity_1 = require("../util/identity");
+var timer_1 = require("../observable/timer");
+var innerFrom_1 = require("../observable/innerFrom");
+function retry(configOrCount) {
+ if (configOrCount === void 0) { configOrCount = Infinity; }
+ var config;
+ if (configOrCount && typeof configOrCount === 'object') {
+ config = configOrCount;
+ }
+ else {
+ config = {
+ count: configOrCount,
+ };
+ }
+ var _a = config.count, count = _a === void 0 ? Infinity : _a, delay = config.delay, _b = config.resetOnSuccess, resetOnSuccess = _b === void 0 ? false : _b;
+ return count <= 0
+ ? identity_1.identity
+ : lift_1.operate(function (source, subscriber) {
+ var soFar = 0;
+ var innerSub;
+ var subscribeForRetry = function () {
+ var syncUnsub = false;
+ innerSub = source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ if (resetOnSuccess) {
+ soFar = 0;
+ }
+ subscriber.next(value);
+ }, undefined, function (err) {
+ if (soFar++ < count) {
+ var resub_1 = function () {
+ if (innerSub) {
+ innerSub.unsubscribe();
+ innerSub = null;
+ subscribeForRetry();
+ }
+ else {
+ syncUnsub = true;
+ }
+ };
+ if (delay != null) {
+ var notifier = typeof delay === 'number' ? timer_1.timer(delay) : innerFrom_1.innerFrom(delay(err, soFar));
+ var notifierSubscriber_1 = OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
+ notifierSubscriber_1.unsubscribe();
+ resub_1();
+ }, function () {
+ subscriber.complete();
+ });
+ notifier.subscribe(notifierSubscriber_1);
+ }
+ else {
+ resub_1();
+ }
+ }
+ else {
+ subscriber.error(err);
+ }
+ }));
+ if (syncUnsub) {
+ innerSub.unsubscribe();
+ innerSub = null;
+ subscribeForRetry();
+ }
+ };
+ subscribeForRetry();
+ });
+}
+exports.retry = retry;
+
+},{"../observable/innerFrom":438,"../observable/timer":449,"../util/identity":612,"../util/lift":623,"./OperatorSubscriber":452}],526:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.retryWhen = void 0;
+var innerFrom_1 = require("../observable/innerFrom");
+var Subject_1 = require("../Subject");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function retryWhen(notifier) {
+ return lift_1.operate(function (source, subscriber) {
+ var innerSub;
+ var syncResub = false;
+ var errors$;
+ var subscribeForRetryWhen = function () {
+ innerSub = source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, undefined, undefined, function (err) {
+ if (!errors$) {
+ errors$ = new Subject_1.Subject();
+ innerFrom_1.innerFrom(notifier(errors$)).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
+ return innerSub ? subscribeForRetryWhen() : (syncResub = true);
+ }));
+ }
+ if (errors$) {
+ errors$.next(err);
+ }
+ }));
+ if (syncResub) {
+ innerSub.unsubscribe();
+ innerSub = null;
+ syncResub = false;
+ subscribeForRetryWhen();
+ }
+ };
+ subscribeForRetryWhen();
+ });
+}
+exports.retryWhen = retryWhen;
+
+},{"../Subject":415,"../observable/innerFrom":438,"../util/lift":623,"./OperatorSubscriber":452}],527:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.sample = void 0;
+var innerFrom_1 = require("../observable/innerFrom");
+var lift_1 = require("../util/lift");
+var noop_1 = require("../util/noop");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function sample(notifier) {
+ return lift_1.operate(function (source, subscriber) {
+ var hasValue = false;
+ var lastValue = null;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ hasValue = true;
+ lastValue = value;
+ }));
+ innerFrom_1.innerFrom(notifier).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
+ if (hasValue) {
+ hasValue = false;
+ var value = lastValue;
+ lastValue = null;
+ subscriber.next(value);
+ }
+ }, noop_1.noop));
+ });
+}
+exports.sample = sample;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],528:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.sampleTime = void 0;
+var async_1 = require("../scheduler/async");
+var sample_1 = require("./sample");
+var interval_1 = require("../observable/interval");
+function sampleTime(period, scheduler) {
+ if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
+ return sample_1.sample(interval_1.interval(period, scheduler));
+}
+exports.sampleTime = sampleTime;
+
+},{"../observable/interval":439,"../scheduler/async":587,"./sample":527}],529:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.scan = void 0;
+var lift_1 = require("../util/lift");
+var scanInternals_1 = require("./scanInternals");
+function scan(accumulator, seed) {
+ return lift_1.operate(scanInternals_1.scanInternals(accumulator, seed, arguments.length >= 2, true));
+}
+exports.scan = scan;
+
+},{"../util/lift":623,"./scanInternals":530}],530:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.scanInternals = void 0;
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
+ return function (source, subscriber) {
+ var hasState = hasSeed;
+ var state = seed;
+ var index = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var i = index++;
+ state = hasState
+ ?
+ accumulator(state, value, i)
+ :
+ ((hasState = true), value);
+ emitOnNext && subscriber.next(state);
+ }, emitBeforeComplete &&
+ (function () {
+ hasState && subscriber.next(state);
+ subscriber.complete();
+ })));
+ };
+}
+exports.scanInternals = scanInternals;
+
+},{"./OperatorSubscriber":452}],531:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.sequenceEqual = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var innerFrom_1 = require("../observable/innerFrom");
+function sequenceEqual(compareTo, comparator) {
+ if (comparator === void 0) { comparator = function (a, b) { return a === b; }; }
+ return lift_1.operate(function (source, subscriber) {
+ var aState = createState();
+ var bState = createState();
+ var emit = function (isEqual) {
+ subscriber.next(isEqual);
+ subscriber.complete();
+ };
+ var createSubscriber = function (selfState, otherState) {
+ var sequenceEqualSubscriber = OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (a) {
+ var buffer = otherState.buffer, complete = otherState.complete;
+ if (buffer.length === 0) {
+ complete ? emit(false) : selfState.buffer.push(a);
+ }
+ else {
+ !comparator(a, buffer.shift()) && emit(false);
+ }
+ }, function () {
+ selfState.complete = true;
+ var complete = otherState.complete, buffer = otherState.buffer;
+ complete && emit(buffer.length === 0);
+ sequenceEqualSubscriber === null || sequenceEqualSubscriber === void 0 ? void 0 : sequenceEqualSubscriber.unsubscribe();
+ });
+ return sequenceEqualSubscriber;
+ };
+ source.subscribe(createSubscriber(aState, bState));
+ innerFrom_1.innerFrom(compareTo).subscribe(createSubscriber(bState, aState));
+ });
+}
+exports.sequenceEqual = sequenceEqual;
+function createState() {
+ return {
+ buffer: [],
+ complete: false,
+ };
+}
+
+},{"../observable/innerFrom":438,"../util/lift":623,"./OperatorSubscriber":452}],532:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.share = void 0;
+var innerFrom_1 = require("../observable/innerFrom");
+var Subject_1 = require("../Subject");
+var Subscriber_1 = require("../Subscriber");
+var lift_1 = require("../util/lift");
+function share(options) {
+ if (options === void 0) { options = {}; }
+ var _a = options.connector, connector = _a === void 0 ? function () { return new Subject_1.Subject(); } : _a, _b = options.resetOnError, resetOnError = _b === void 0 ? true : _b, _c = options.resetOnComplete, resetOnComplete = _c === void 0 ? true : _c, _d = options.resetOnRefCountZero, resetOnRefCountZero = _d === void 0 ? true : _d;
+ return function (wrapperSource) {
+ var connection;
+ var resetConnection;
+ var subject;
+ var refCount = 0;
+ var hasCompleted = false;
+ var hasErrored = false;
+ var cancelReset = function () {
+ resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
+ resetConnection = undefined;
+ };
+ var reset = function () {
+ cancelReset();
+ connection = subject = undefined;
+ hasCompleted = hasErrored = false;
+ };
+ var resetAndUnsubscribe = function () {
+ var conn = connection;
+ reset();
+ conn === null || conn === void 0 ? void 0 : conn.unsubscribe();
+ };
+ return lift_1.operate(function (source, subscriber) {
+ refCount++;
+ if (!hasErrored && !hasCompleted) {
+ cancelReset();
+ }
+ var dest = (subject = subject !== null && subject !== void 0 ? subject : connector());
+ subscriber.add(function () {
+ refCount--;
+ if (refCount === 0 && !hasErrored && !hasCompleted) {
+ resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
+ }
+ });
+ dest.subscribe(subscriber);
+ if (!connection &&
+ refCount > 0) {
+ connection = new Subscriber_1.SafeSubscriber({
+ next: function (value) { return dest.next(value); },
+ error: function (err) {
+ hasErrored = true;
+ cancelReset();
+ resetConnection = handleReset(reset, resetOnError, err);
+ dest.error(err);
+ },
+ complete: function () {
+ hasCompleted = true;
+ cancelReset();
+ resetConnection = handleReset(reset, resetOnComplete);
+ dest.complete();
+ },
+ });
+ innerFrom_1.innerFrom(source).subscribe(connection);
+ }
+ })(wrapperSource);
+ };
+}
+exports.share = share;
+function handleReset(reset, on) {
+ var args = [];
+ for (var _i = 2; _i < arguments.length; _i++) {
+ args[_i - 2] = arguments[_i];
+ }
+ if (on === true) {
+ reset();
+ return;
+ }
+ if (on === false) {
+ return;
+ }
+ var onSubscriber = new Subscriber_1.SafeSubscriber({
+ next: function () {
+ onSubscriber.unsubscribe();
+ reset();
+ },
+ });
+ return innerFrom_1.innerFrom(on.apply(void 0, __spreadArray([], __read(args)))).subscribe(onSubscriber);
+}
+
+},{"../Subject":415,"../Subscriber":416,"../observable/innerFrom":438,"../util/lift":623}],533:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.shareReplay = void 0;
+var ReplaySubject_1 = require("../ReplaySubject");
+var share_1 = require("./share");
+function shareReplay(configOrBufferSize, windowTime, scheduler) {
+ var _a, _b, _c;
+ var bufferSize;
+ var refCount = false;
+ if (configOrBufferSize && typeof configOrBufferSize === 'object') {
+ (_a = configOrBufferSize.bufferSize, bufferSize = _a === void 0 ? Infinity : _a, _b = configOrBufferSize.windowTime, windowTime = _b === void 0 ? Infinity : _b, _c = configOrBufferSize.refCount, refCount = _c === void 0 ? false : _c, scheduler = configOrBufferSize.scheduler);
+ }
+ else {
+ bufferSize = (configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity);
+ }
+ return share_1.share({
+ connector: function () { return new ReplaySubject_1.ReplaySubject(bufferSize, windowTime, scheduler); },
+ resetOnError: true,
+ resetOnComplete: false,
+ resetOnRefCountZero: refCount,
+ });
+}
+exports.shareReplay = shareReplay;
+
+},{"../ReplaySubject":413,"./share":532}],534:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.single = void 0;
+var EmptyError_1 = require("../util/EmptyError");
+var SequenceError_1 = require("../util/SequenceError");
+var NotFoundError_1 = require("../util/NotFoundError");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function single(predicate) {
+ return lift_1.operate(function (source, subscriber) {
+ var hasValue = false;
+ var singleValue;
+ var seenValue = false;
+ var index = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ seenValue = true;
+ if (!predicate || predicate(value, index++, source)) {
+ hasValue && subscriber.error(new SequenceError_1.SequenceError('Too many matching values'));
+ hasValue = true;
+ singleValue = value;
+ }
+ }, function () {
+ if (hasValue) {
+ subscriber.next(singleValue);
+ subscriber.complete();
+ }
+ else {
+ subscriber.error(seenValue ? new NotFoundError_1.NotFoundError('No matching values') : new EmptyError_1.EmptyError());
+ }
+ }));
+ });
+}
+exports.single = single;
+
+},{"../util/EmptyError":598,"../util/NotFoundError":600,"../util/SequenceError":602,"../util/lift":623,"./OperatorSubscriber":452}],535:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.skip = void 0;
+var filter_1 = require("./filter");
+function skip(count) {
+ return filter_1.filter(function (_, index) { return count <= index; });
+}
+exports.skip = skip;
+
+},{"./filter":488}],536:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.skipLast = void 0;
+var identity_1 = require("../util/identity");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function skipLast(skipCount) {
+ return skipCount <= 0
+ ?
+ identity_1.identity
+ : lift_1.operate(function (source, subscriber) {
+ var ring = new Array(skipCount);
+ var seen = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var valueIndex = seen++;
+ if (valueIndex < skipCount) {
+ ring[valueIndex] = value;
+ }
+ else {
+ var index = valueIndex % skipCount;
+ var oldValue = ring[index];
+ ring[index] = value;
+ subscriber.next(oldValue);
+ }
+ }));
+ return function () {
+ ring = null;
+ };
+ });
+}
+exports.skipLast = skipLast;
+
+},{"../util/identity":612,"../util/lift":623,"./OperatorSubscriber":452}],537:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.skipUntil = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var innerFrom_1 = require("../observable/innerFrom");
+var noop_1 = require("../util/noop");
+function skipUntil(notifier) {
+ return lift_1.operate(function (source, subscriber) {
+ var taking = false;
+ var skipSubscriber = OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
+ skipSubscriber === null || skipSubscriber === void 0 ? void 0 : skipSubscriber.unsubscribe();
+ taking = true;
+ }, noop_1.noop);
+ innerFrom_1.innerFrom(notifier).subscribe(skipSubscriber);
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) { return taking && subscriber.next(value); }));
+ });
+}
+exports.skipUntil = skipUntil;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],538:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.skipWhile = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function skipWhile(predicate) {
+ return lift_1.operate(function (source, subscriber) {
+ var taking = false;
+ var index = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) { return (taking || (taking = !predicate(value, index++))) && subscriber.next(value); }));
+ });
+}
+exports.skipWhile = skipWhile;
+
+},{"../util/lift":623,"./OperatorSubscriber":452}],539:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.startWith = void 0;
+var concat_1 = require("../observable/concat");
+var args_1 = require("../util/args");
+var lift_1 = require("../util/lift");
+function startWith() {
+ var values = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ values[_i] = arguments[_i];
+ }
+ var scheduler = args_1.popScheduler(values);
+ return lift_1.operate(function (source, subscriber) {
+ (scheduler ? concat_1.concat(values, source, scheduler) : concat_1.concat(values, source)).subscribe(subscriber);
+ });
+}
+exports.startWith = startWith;
+
+},{"../observable/concat":426,"../util/args":604,"../util/lift":623}],540:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.subscribeOn = void 0;
+var lift_1 = require("../util/lift");
+function subscribeOn(scheduler, delay) {
+ if (delay === void 0) { delay = 0; }
+ return lift_1.operate(function (source, subscriber) {
+ subscriber.add(scheduler.schedule(function () { return source.subscribe(subscriber); }, delay));
+ });
+}
+exports.subscribeOn = subscribeOn;
+
+},{"../util/lift":623}],541:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.switchAll = void 0;
+var switchMap_1 = require("./switchMap");
+var identity_1 = require("../util/identity");
+function switchAll() {
+ return switchMap_1.switchMap(identity_1.identity);
+}
+exports.switchAll = switchAll;
+
+},{"../util/identity":612,"./switchMap":542}],542:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.switchMap = void 0;
+var innerFrom_1 = require("../observable/innerFrom");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function switchMap(project, resultSelector) {
+ return lift_1.operate(function (source, subscriber) {
+ var innerSubscriber = null;
+ var index = 0;
+ var isComplete = false;
+ var checkComplete = function () { return isComplete && !innerSubscriber && subscriber.complete(); };
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
+ var innerIndex = 0;
+ var outerIndex = index++;
+ innerFrom_1.innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
+ innerSubscriber = null;
+ checkComplete();
+ })));
+ }, function () {
+ isComplete = true;
+ checkComplete();
+ }));
+ });
+}
+exports.switchMap = switchMap;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"./OperatorSubscriber":452}],543:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.switchMapTo = void 0;
+var switchMap_1 = require("./switchMap");
+var isFunction_1 = require("../util/isFunction");
+function switchMapTo(innerObservable, resultSelector) {
+ return isFunction_1.isFunction(resultSelector) ? switchMap_1.switchMap(function () { return innerObservable; }, resultSelector) : switchMap_1.switchMap(function () { return innerObservable; });
+}
+exports.switchMapTo = switchMapTo;
+
+},{"../util/isFunction":616,"./switchMap":542}],544:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.switchScan = void 0;
+var switchMap_1 = require("./switchMap");
+var lift_1 = require("../util/lift");
+function switchScan(accumulator, seed) {
+ return lift_1.operate(function (source, subscriber) {
+ var state = seed;
+ switchMap_1.switchMap(function (value, index) { return accumulator(state, value, index); }, function (_, innerValue) { return ((state = innerValue), innerValue); })(source).subscribe(subscriber);
+ return function () {
+ state = null;
+ };
+ });
+}
+exports.switchScan = switchScan;
+
+},{"../util/lift":623,"./switchMap":542}],545:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.take = void 0;
+var empty_1 = require("../observable/empty");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function take(count) {
+ return count <= 0
+ ?
+ function () { return empty_1.EMPTY; }
+ : lift_1.operate(function (source, subscriber) {
+ var seen = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ if (++seen <= count) {
+ subscriber.next(value);
+ if (count <= seen) {
+ subscriber.complete();
+ }
+ }
+ }));
+ });
+}
+exports.take = take;
+
+},{"../observable/empty":430,"../util/lift":623,"./OperatorSubscriber":452}],546:[function(require,module,exports){
+"use strict";
+var __values = (this && this.__values) || function(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.takeLast = void 0;
+var empty_1 = require("../observable/empty");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function takeLast(count) {
+ return count <= 0
+ ? function () { return empty_1.EMPTY; }
+ : lift_1.operate(function (source, subscriber) {
+ var buffer = [];
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ buffer.push(value);
+ count < buffer.length && buffer.shift();
+ }, function () {
+ var e_1, _a;
+ try {
+ for (var buffer_1 = __values(buffer), buffer_1_1 = buffer_1.next(); !buffer_1_1.done; buffer_1_1 = buffer_1.next()) {
+ var value = buffer_1_1.value;
+ subscriber.next(value);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (buffer_1_1 && !buffer_1_1.done && (_a = buffer_1.return)) _a.call(buffer_1);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ subscriber.complete();
+ }, undefined, function () {
+ buffer = null;
+ }));
+ });
+}
+exports.takeLast = takeLast;
+
+},{"../observable/empty":430,"../util/lift":623,"./OperatorSubscriber":452}],547:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.takeUntil = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var innerFrom_1 = require("../observable/innerFrom");
+var noop_1 = require("../util/noop");
+function takeUntil(notifier) {
+ return lift_1.operate(function (source, subscriber) {
+ innerFrom_1.innerFrom(notifier).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () { return subscriber.complete(); }, noop_1.noop));
+ !subscriber.closed && source.subscribe(subscriber);
+ });
+}
+exports.takeUntil = takeUntil;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],548:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.takeWhile = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function takeWhile(predicate, inclusive) {
+ if (inclusive === void 0) { inclusive = false; }
+ return lift_1.operate(function (source, subscriber) {
+ var index = 0;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var result = predicate(value, index++);
+ (result || inclusive) && subscriber.next(value);
+ !result && subscriber.complete();
+ }));
+ });
+}
+exports.takeWhile = takeWhile;
+
+},{"../util/lift":623,"./OperatorSubscriber":452}],549:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.tap = void 0;
+var isFunction_1 = require("../util/isFunction");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var identity_1 = require("../util/identity");
+function tap(observerOrNext, error, complete) {
+ var tapObserver = isFunction_1.isFunction(observerOrNext) || error || complete
+ ?
+ { next: observerOrNext, error: error, complete: complete }
+ : observerOrNext;
+ return tapObserver
+ ? lift_1.operate(function (source, subscriber) {
+ var _a;
+ (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
+ var isUnsub = true;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var _a;
+ (_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
+ subscriber.next(value);
+ }, function () {
+ var _a;
+ isUnsub = false;
+ (_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
+ subscriber.complete();
+ }, function (err) {
+ var _a;
+ isUnsub = false;
+ (_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);
+ subscriber.error(err);
+ }, function () {
+ var _a, _b;
+ if (isUnsub) {
+ (_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
+ }
+ (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
+ }));
+ })
+ :
+ identity_1.identity;
+}
+exports.tap = tap;
+
+},{"../util/identity":612,"../util/isFunction":616,"../util/lift":623,"./OperatorSubscriber":452}],550:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.throttle = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var innerFrom_1 = require("../observable/innerFrom");
+function throttle(durationSelector, config) {
+ return lift_1.operate(function (source, subscriber) {
+ var _a = config !== null && config !== void 0 ? config : {}, _b = _a.leading, leading = _b === void 0 ? true : _b, _c = _a.trailing, trailing = _c === void 0 ? false : _c;
+ var hasValue = false;
+ var sendValue = null;
+ var throttled = null;
+ var isComplete = false;
+ var endThrottling = function () {
+ throttled === null || throttled === void 0 ? void 0 : throttled.unsubscribe();
+ throttled = null;
+ if (trailing) {
+ send();
+ isComplete && subscriber.complete();
+ }
+ };
+ var cleanupThrottling = function () {
+ throttled = null;
+ isComplete && subscriber.complete();
+ };
+ var startThrottle = function (value) {
+ return (throttled = innerFrom_1.innerFrom(durationSelector(value)).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, endThrottling, cleanupThrottling)));
+ };
+ var send = function () {
+ if (hasValue) {
+ hasValue = false;
+ var value = sendValue;
+ sendValue = null;
+ subscriber.next(value);
+ !isComplete && startThrottle(value);
+ }
+ };
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ hasValue = true;
+ sendValue = value;
+ !(throttled && !throttled.closed) && (leading ? send() : startThrottle(value));
+ }, function () {
+ isComplete = true;
+ !(trailing && hasValue && throttled && !throttled.closed) && subscriber.complete();
+ }));
+ });
+}
+exports.throttle = throttle;
+
+},{"../observable/innerFrom":438,"../util/lift":623,"./OperatorSubscriber":452}],551:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.throttleTime = void 0;
+var async_1 = require("../scheduler/async");
+var throttle_1 = require("./throttle");
+var timer_1 = require("../observable/timer");
+function throttleTime(duration, scheduler, config) {
+ if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
+ var duration$ = timer_1.timer(duration, scheduler);
+ return throttle_1.throttle(function () { return duration$; }, config);
+}
+exports.throttleTime = throttleTime;
+
+},{"../observable/timer":449,"../scheduler/async":587,"./throttle":550}],552:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.throwIfEmpty = void 0;
+var EmptyError_1 = require("../util/EmptyError");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function throwIfEmpty(errorFactory) {
+ if (errorFactory === void 0) { errorFactory = defaultErrorFactory; }
+ return lift_1.operate(function (source, subscriber) {
+ var hasValue = false;
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ hasValue = true;
+ subscriber.next(value);
+ }, function () { return (hasValue ? subscriber.complete() : subscriber.error(errorFactory())); }));
+ });
+}
+exports.throwIfEmpty = throwIfEmpty;
+function defaultErrorFactory() {
+ return new EmptyError_1.EmptyError();
+}
+
+},{"../util/EmptyError":598,"../util/lift":623,"./OperatorSubscriber":452}],553:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.TimeInterval = exports.timeInterval = void 0;
+var async_1 = require("../scheduler/async");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function timeInterval(scheduler) {
+ if (scheduler === void 0) { scheduler = async_1.asyncScheduler; }
+ return lift_1.operate(function (source, subscriber) {
+ var last = scheduler.now();
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var now = scheduler.now();
+ var interval = now - last;
+ last = now;
+ subscriber.next(new TimeInterval(value, interval));
+ }));
+ });
+}
+exports.timeInterval = timeInterval;
+var TimeInterval = (function () {
+ function TimeInterval(value, interval) {
+ this.value = value;
+ this.interval = interval;
+ }
+ return TimeInterval;
+}());
+exports.TimeInterval = TimeInterval;
+
+},{"../scheduler/async":587,"../util/lift":623,"./OperatorSubscriber":452}],554:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.timeout = exports.TimeoutError = void 0;
+var async_1 = require("../scheduler/async");
+var isDate_1 = require("../util/isDate");
+var lift_1 = require("../util/lift");
+var innerFrom_1 = require("../observable/innerFrom");
+var createErrorClass_1 = require("../util/createErrorClass");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var executeSchedule_1 = require("../util/executeSchedule");
+exports.TimeoutError = createErrorClass_1.createErrorClass(function (_super) {
+ return function TimeoutErrorImpl(info) {
+ if (info === void 0) { info = null; }
+ _super(this);
+ this.message = 'Timeout has occurred';
+ this.name = 'TimeoutError';
+ this.info = info;
+ };
+});
+function timeout(config, schedulerArg) {
+ var _a = (isDate_1.isValidDate(config) ? { first: config } : typeof config === 'number' ? { each: config } : config), first = _a.first, each = _a.each, _b = _a.with, _with = _b === void 0 ? timeoutErrorFactory : _b, _c = _a.scheduler, scheduler = _c === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : async_1.asyncScheduler : _c, _d = _a.meta, meta = _d === void 0 ? null : _d;
+ if (first == null && each == null) {
+ throw new TypeError('No timeout provided.');
+ }
+ return lift_1.operate(function (source, subscriber) {
+ var originalSourceSubscription;
+ var timerSubscription;
+ var lastValue = null;
+ var seen = 0;
+ var startTimer = function (delay) {
+ timerSubscription = executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
+ try {
+ originalSourceSubscription.unsubscribe();
+ innerFrom_1.innerFrom(_with({
+ meta: meta,
+ lastValue: lastValue,
+ seen: seen,
+ })).subscribe(subscriber);
+ }
+ catch (err) {
+ subscriber.error(err);
+ }
+ }, delay);
+ };
+ originalSourceSubscription = source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
+ seen++;
+ subscriber.next((lastValue = value));
+ each > 0 && startTimer(each);
+ }, undefined, undefined, function () {
+ if (!(timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.closed)) {
+ timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
+ }
+ lastValue = null;
+ }));
+ !seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
+ });
+}
+exports.timeout = timeout;
+function timeoutErrorFactory(info) {
+ throw new exports.TimeoutError(info);
+}
+
+},{"../observable/innerFrom":438,"../scheduler/async":587,"../util/createErrorClass":608,"../util/executeSchedule":611,"../util/isDate":615,"../util/lift":623,"./OperatorSubscriber":452}],555:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.timeoutWith = void 0;
+var async_1 = require("../scheduler/async");
+var isDate_1 = require("../util/isDate");
+var timeout_1 = require("./timeout");
+function timeoutWith(due, withObservable, scheduler) {
+ var first;
+ var each;
+ var _with;
+ scheduler = scheduler !== null && scheduler !== void 0 ? scheduler : async_1.async;
+ if (isDate_1.isValidDate(due)) {
+ first = due;
+ }
+ else if (typeof due === 'number') {
+ each = due;
+ }
+ if (withObservable) {
+ _with = function () { return withObservable; };
+ }
+ else {
+ throw new TypeError('No observable provided to switch to');
+ }
+ if (first == null && each == null) {
+ throw new TypeError('No timeout provided.');
+ }
+ return timeout_1.timeout({
+ first: first,
+ each: each,
+ scheduler: scheduler,
+ with: _with,
+ });
+}
+exports.timeoutWith = timeoutWith;
+
+},{"../scheduler/async":587,"../util/isDate":615,"./timeout":554}],556:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.timestamp = void 0;
+var dateTimestampProvider_1 = require("../scheduler/dateTimestampProvider");
+var map_1 = require("./map");
+function timestamp(timestampProvider) {
+ if (timestampProvider === void 0) { timestampProvider = dateTimestampProvider_1.dateTimestampProvider; }
+ return map_1.map(function (value) { return ({ value: value, timestamp: timestampProvider.now() }); });
+}
+exports.timestamp = timestamp;
+
+},{"../scheduler/dateTimestampProvider":588,"./map":499}],557:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.toArray = void 0;
+var reduce_1 = require("./reduce");
+var lift_1 = require("../util/lift");
+var arrReducer = function (arr, value) { return (arr.push(value), arr); };
+function toArray() {
+ return lift_1.operate(function (source, subscriber) {
+ reduce_1.reduce(arrReducer, [])(source).subscribe(subscriber);
+ });
+}
+exports.toArray = toArray;
+
+},{"../util/lift":623,"./reduce":521}],558:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.window = void 0;
+var Subject_1 = require("../Subject");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var noop_1 = require("../util/noop");
+var innerFrom_1 = require("../observable/innerFrom");
+function window(windowBoundaries) {
+ return lift_1.operate(function (source, subscriber) {
+ var windowSubject = new Subject_1.Subject();
+ subscriber.next(windowSubject.asObservable());
+ var errorHandler = function (err) {
+ windowSubject.error(err);
+ subscriber.error(err);
+ };
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) { return windowSubject === null || windowSubject === void 0 ? void 0 : windowSubject.next(value); }, function () {
+ windowSubject.complete();
+ subscriber.complete();
+ }, errorHandler));
+ innerFrom_1.innerFrom(windowBoundaries).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function () {
+ windowSubject.complete();
+ subscriber.next((windowSubject = new Subject_1.Subject()));
+ }, noop_1.noop, errorHandler));
+ return function () {
+ windowSubject === null || windowSubject === void 0 ? void 0 : windowSubject.unsubscribe();
+ windowSubject = null;
+ };
+ });
+}
+exports.window = window;
+
+},{"../Subject":415,"../observable/innerFrom":438,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],559:[function(require,module,exports){
+"use strict";
+var __values = (this && this.__values) || function(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.windowCount = void 0;
+var Subject_1 = require("../Subject");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+function windowCount(windowSize, startWindowEvery) {
+ if (startWindowEvery === void 0) { startWindowEvery = 0; }
+ var startEvery = startWindowEvery > 0 ? startWindowEvery : windowSize;
+ return lift_1.operate(function (source, subscriber) {
+ var windows = [new Subject_1.Subject()];
+ var starts = [];
+ var count = 0;
+ subscriber.next(windows[0].asObservable());
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var e_1, _a;
+ try {
+ for (var windows_1 = __values(windows), windows_1_1 = windows_1.next(); !windows_1_1.done; windows_1_1 = windows_1.next()) {
+ var window_1 = windows_1_1.value;
+ window_1.next(value);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (windows_1_1 && !windows_1_1.done && (_a = windows_1.return)) _a.call(windows_1);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ var c = count - windowSize + 1;
+ if (c >= 0 && c % startEvery === 0) {
+ windows.shift().complete();
+ }
+ if (++count % startEvery === 0) {
+ var window_2 = new Subject_1.Subject();
+ windows.push(window_2);
+ subscriber.next(window_2.asObservable());
+ }
+ }, function () {
+ while (windows.length > 0) {
+ windows.shift().complete();
+ }
+ subscriber.complete();
+ }, function (err) {
+ while (windows.length > 0) {
+ windows.shift().error(err);
+ }
+ subscriber.error(err);
+ }, function () {
+ starts = null;
+ windows = null;
+ }));
+ });
+}
+exports.windowCount = windowCount;
+
+},{"../Subject":415,"../util/lift":623,"./OperatorSubscriber":452}],560:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.windowTime = void 0;
+var Subject_1 = require("../Subject");
+var async_1 = require("../scheduler/async");
+var Subscription_1 = require("../Subscription");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var arrRemove_1 = require("../util/arrRemove");
+var args_1 = require("../util/args");
+var executeSchedule_1 = require("../util/executeSchedule");
+function windowTime(windowTimeSpan) {
+ var _a, _b;
+ var otherArgs = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ otherArgs[_i - 1] = arguments[_i];
+ }
+ var scheduler = (_a = args_1.popScheduler(otherArgs)) !== null && _a !== void 0 ? _a : async_1.asyncScheduler;
+ var windowCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;
+ var maxWindowSize = otherArgs[1] || Infinity;
+ return lift_1.operate(function (source, subscriber) {
+ var windowRecords = [];
+ var restartOnClose = false;
+ var closeWindow = function (record) {
+ var window = record.window, subs = record.subs;
+ window.complete();
+ subs.unsubscribe();
+ arrRemove_1.arrRemove(windowRecords, record);
+ restartOnClose && startWindow();
+ };
+ var startWindow = function () {
+ if (windowRecords) {
+ var subs = new Subscription_1.Subscription();
+ subscriber.add(subs);
+ var window_1 = new Subject_1.Subject();
+ var record_1 = {
+ window: window_1,
+ subs: subs,
+ seen: 0,
+ };
+ windowRecords.push(record_1);
+ subscriber.next(window_1.asObservable());
+ executeSchedule_1.executeSchedule(subs, scheduler, function () { return closeWindow(record_1); }, windowTimeSpan);
+ }
+ };
+ if (windowCreationInterval !== null && windowCreationInterval >= 0) {
+ executeSchedule_1.executeSchedule(subscriber, scheduler, startWindow, windowCreationInterval, true);
+ }
+ else {
+ restartOnClose = true;
+ }
+ startWindow();
+ var loop = function (cb) { return windowRecords.slice().forEach(cb); };
+ var terminate = function (cb) {
+ loop(function (_a) {
+ var window = _a.window;
+ return cb(window);
+ });
+ cb(subscriber);
+ subscriber.unsubscribe();
+ };
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ loop(function (record) {
+ record.window.next(value);
+ maxWindowSize <= ++record.seen && closeWindow(record);
+ });
+ }, function () { return terminate(function (consumer) { return consumer.complete(); }); }, function (err) { return terminate(function (consumer) { return consumer.error(err); }); }));
+ return function () {
+ windowRecords = null;
+ };
+ });
+}
+exports.windowTime = windowTime;
+
+},{"../Subject":415,"../Subscription":417,"../scheduler/async":587,"../util/args":604,"../util/arrRemove":607,"../util/executeSchedule":611,"../util/lift":623,"./OperatorSubscriber":452}],561:[function(require,module,exports){
+"use strict";
+var __values = (this && this.__values) || function(o) {
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
+ if (m) return m.call(o);
+ if (o && typeof o.length === "number") return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.windowToggle = void 0;
+var Subject_1 = require("../Subject");
+var Subscription_1 = require("../Subscription");
+var lift_1 = require("../util/lift");
+var innerFrom_1 = require("../observable/innerFrom");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var noop_1 = require("../util/noop");
+var arrRemove_1 = require("../util/arrRemove");
+function windowToggle(openings, closingSelector) {
+ return lift_1.operate(function (source, subscriber) {
+ var windows = [];
+ var handleError = function (err) {
+ while (0 < windows.length) {
+ windows.shift().error(err);
+ }
+ subscriber.error(err);
+ };
+ innerFrom_1.innerFrom(openings).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (openValue) {
+ var window = new Subject_1.Subject();
+ windows.push(window);
+ var closingSubscription = new Subscription_1.Subscription();
+ var closeWindow = function () {
+ arrRemove_1.arrRemove(windows, window);
+ window.complete();
+ closingSubscription.unsubscribe();
+ };
+ var closingNotifier;
+ try {
+ closingNotifier = innerFrom_1.innerFrom(closingSelector(openValue));
+ }
+ catch (err) {
+ handleError(err);
+ return;
+ }
+ subscriber.next(window.asObservable());
+ closingSubscription.add(closingNotifier.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, closeWindow, noop_1.noop, handleError)));
+ }, noop_1.noop));
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ var e_1, _a;
+ var windowsCopy = windows.slice();
+ try {
+ for (var windowsCopy_1 = __values(windowsCopy), windowsCopy_1_1 = windowsCopy_1.next(); !windowsCopy_1_1.done; windowsCopy_1_1 = windowsCopy_1.next()) {
+ var window_1 = windowsCopy_1_1.value;
+ window_1.next(value);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (windowsCopy_1_1 && !windowsCopy_1_1.done && (_a = windowsCopy_1.return)) _a.call(windowsCopy_1);
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ }, function () {
+ while (0 < windows.length) {
+ windows.shift().complete();
+ }
+ subscriber.complete();
+ }, handleError, function () {
+ while (0 < windows.length) {
+ windows.shift().unsubscribe();
+ }
+ }));
+ });
+}
+exports.windowToggle = windowToggle;
+
+},{"../Subject":415,"../Subscription":417,"../observable/innerFrom":438,"../util/arrRemove":607,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],562:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.windowWhen = void 0;
+var Subject_1 = require("../Subject");
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var innerFrom_1 = require("../observable/innerFrom");
+function windowWhen(closingSelector) {
+ return lift_1.operate(function (source, subscriber) {
+ var window;
+ var closingSubscriber;
+ var handleError = function (err) {
+ window.error(err);
+ subscriber.error(err);
+ };
+ var openWindow = function () {
+ closingSubscriber === null || closingSubscriber === void 0 ? void 0 : closingSubscriber.unsubscribe();
+ window === null || window === void 0 ? void 0 : window.complete();
+ window = new Subject_1.Subject();
+ subscriber.next(window.asObservable());
+ var closingNotifier;
+ try {
+ closingNotifier = innerFrom_1.innerFrom(closingSelector());
+ }
+ catch (err) {
+ handleError(err);
+ return;
+ }
+ closingNotifier.subscribe((closingSubscriber = OperatorSubscriber_1.createOperatorSubscriber(subscriber, openWindow, openWindow, handleError)));
+ };
+ openWindow();
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) { return window.next(value); }, function () {
+ window.complete();
+ subscriber.complete();
+ }, handleError, function () {
+ closingSubscriber === null || closingSubscriber === void 0 ? void 0 : closingSubscriber.unsubscribe();
+ window = null;
+ }));
+ });
+}
+exports.windowWhen = windowWhen;
+
+},{"../Subject":415,"../observable/innerFrom":438,"../util/lift":623,"./OperatorSubscriber":452}],563:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.withLatestFrom = void 0;
+var lift_1 = require("../util/lift");
+var OperatorSubscriber_1 = require("./OperatorSubscriber");
+var innerFrom_1 = require("../observable/innerFrom");
+var identity_1 = require("../util/identity");
+var noop_1 = require("../util/noop");
+var args_1 = require("../util/args");
+function withLatestFrom() {
+ var inputs = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ inputs[_i] = arguments[_i];
+ }
+ var project = args_1.popResultSelector(inputs);
+ return lift_1.operate(function (source, subscriber) {
+ var len = inputs.length;
+ var otherValues = new Array(len);
+ var hasValue = inputs.map(function () { return false; });
+ var ready = false;
+ var _loop_1 = function (i) {
+ innerFrom_1.innerFrom(inputs[i]).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ otherValues[i] = value;
+ if (!ready && !hasValue[i]) {
+ hasValue[i] = true;
+ (ready = hasValue.every(identity_1.identity)) && (hasValue = null);
+ }
+ }, noop_1.noop));
+ };
+ for (var i = 0; i < len; i++) {
+ _loop_1(i);
+ }
+ source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
+ if (ready) {
+ var values = __spreadArray([value], __read(otherValues));
+ subscriber.next(project ? project.apply(void 0, __spreadArray([], __read(values))) : values);
+ }
+ }));
+ });
+}
+exports.withLatestFrom = withLatestFrom;
+
+},{"../observable/innerFrom":438,"../util/args":604,"../util/identity":612,"../util/lift":623,"../util/noop":625,"./OperatorSubscriber":452}],564:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.zip = void 0;
+var zip_1 = require("../observable/zip");
+var lift_1 = require("../util/lift");
+function zip() {
+ var sources = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ sources[_i] = arguments[_i];
+ }
+ return lift_1.operate(function (source, subscriber) {
+ zip_1.zip.apply(void 0, __spreadArray([source], __read(sources))).subscribe(subscriber);
+ });
+}
+exports.zip = zip;
+
+},{"../observable/zip":451,"../util/lift":623}],565:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.zipAll = void 0;
+var zip_1 = require("../observable/zip");
+var joinAllInternals_1 = require("./joinAllInternals");
+function zipAll(project) {
+ return joinAllInternals_1.joinAllInternals(zip_1.zip, project);
+}
+exports.zipAll = zipAll;
+
+},{"../observable/zip":451,"./joinAllInternals":497}],566:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.zipWith = void 0;
+var zip_1 = require("./zip");
+function zipWith() {
+ var otherInputs = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ otherInputs[_i] = arguments[_i];
+ }
+ return zip_1.zip.apply(void 0, __spreadArray([], __read(otherInputs)));
+}
+exports.zipWith = zipWith;
+
+},{"./zip":564}],567:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.scheduleArray = void 0;
+var Observable_1 = require("../Observable");
+function scheduleArray(input, scheduler) {
+ return new Observable_1.Observable(function (subscriber) {
+ var i = 0;
+ return scheduler.schedule(function () {
+ if (i === input.length) {
+ subscriber.complete();
+ }
+ else {
+ subscriber.next(input[i++]);
+ if (!subscriber.closed) {
+ this.schedule();
+ }
+ }
+ });
+ });
+}
+exports.scheduleArray = scheduleArray;
+
+},{"../Observable":412}],568:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.scheduleAsyncIterable = void 0;
+var Observable_1 = require("../Observable");
+var executeSchedule_1 = require("../util/executeSchedule");
+function scheduleAsyncIterable(input, scheduler) {
+ if (!input) {
+ throw new Error('Iterable cannot be null');
+ }
+ return new Observable_1.Observable(function (subscriber) {
+ executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
+ var iterator = input[Symbol.asyncIterator]();
+ executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
+ iterator.next().then(function (result) {
+ if (result.done) {
+ subscriber.complete();
+ }
+ else {
+ subscriber.next(result.value);
+ }
+ });
+ }, 0, true);
+ });
+ });
+}
+exports.scheduleAsyncIterable = scheduleAsyncIterable;
+
+},{"../Observable":412,"../util/executeSchedule":611}],569:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.scheduleIterable = void 0;
+var Observable_1 = require("../Observable");
+var iterator_1 = require("../symbol/iterator");
+var isFunction_1 = require("../util/isFunction");
+var executeSchedule_1 = require("../util/executeSchedule");
+function scheduleIterable(input, scheduler) {
+ return new Observable_1.Observable(function (subscriber) {
+ var iterator;
+ executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
+ iterator = input[iterator_1.iterator]();
+ executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
+ var _a;
+ var value;
+ var done;
+ try {
+ (_a = iterator.next(), value = _a.value, done = _a.done);
+ }
+ catch (err) {
+ subscriber.error(err);
+ return;
+ }
+ if (done) {
+ subscriber.complete();
+ }
+ else {
+ subscriber.next(value);
+ }
+ }, 0, true);
+ });
+ return function () { return isFunction_1.isFunction(iterator === null || iterator === void 0 ? void 0 : iterator.return) && iterator.return(); };
+ });
+}
+exports.scheduleIterable = scheduleIterable;
+
+},{"../Observable":412,"../symbol/iterator":594,"../util/executeSchedule":611,"../util/isFunction":616}],570:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.scheduleObservable = void 0;
+var innerFrom_1 = require("../observable/innerFrom");
+var observeOn_1 = require("../operators/observeOn");
+var subscribeOn_1 = require("../operators/subscribeOn");
+function scheduleObservable(input, scheduler) {
+ return innerFrom_1.innerFrom(input).pipe(subscribeOn_1.subscribeOn(scheduler), observeOn_1.observeOn(scheduler));
+}
+exports.scheduleObservable = scheduleObservable;
+
+},{"../observable/innerFrom":438,"../operators/observeOn":512,"../operators/subscribeOn":540}],571:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.schedulePromise = void 0;
+var innerFrom_1 = require("../observable/innerFrom");
+var observeOn_1 = require("../operators/observeOn");
+var subscribeOn_1 = require("../operators/subscribeOn");
+function schedulePromise(input, scheduler) {
+ return innerFrom_1.innerFrom(input).pipe(subscribeOn_1.subscribeOn(scheduler), observeOn_1.observeOn(scheduler));
+}
+exports.schedulePromise = schedulePromise;
+
+},{"../observable/innerFrom":438,"../operators/observeOn":512,"../operators/subscribeOn":540}],572:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.scheduleReadableStreamLike = void 0;
+var scheduleAsyncIterable_1 = require("./scheduleAsyncIterable");
+var isReadableStreamLike_1 = require("../util/isReadableStreamLike");
+function scheduleReadableStreamLike(input, scheduler) {
+ return scheduleAsyncIterable_1.scheduleAsyncIterable(isReadableStreamLike_1.readableStreamLikeToAsyncGenerator(input), scheduler);
+}
+exports.scheduleReadableStreamLike = scheduleReadableStreamLike;
+
+},{"../util/isReadableStreamLike":621,"./scheduleAsyncIterable":568}],573:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.scheduled = void 0;
+var scheduleObservable_1 = require("./scheduleObservable");
+var schedulePromise_1 = require("./schedulePromise");
+var scheduleArray_1 = require("./scheduleArray");
+var scheduleIterable_1 = require("./scheduleIterable");
+var scheduleAsyncIterable_1 = require("./scheduleAsyncIterable");
+var isInteropObservable_1 = require("../util/isInteropObservable");
+var isPromise_1 = require("../util/isPromise");
+var isArrayLike_1 = require("../util/isArrayLike");
+var isIterable_1 = require("../util/isIterable");
+var isAsyncIterable_1 = require("../util/isAsyncIterable");
+var throwUnobservableError_1 = require("../util/throwUnobservableError");
+var isReadableStreamLike_1 = require("../util/isReadableStreamLike");
+var scheduleReadableStreamLike_1 = require("./scheduleReadableStreamLike");
+function scheduled(input, scheduler) {
+ if (input != null) {
+ if (isInteropObservable_1.isInteropObservable(input)) {
+ return scheduleObservable_1.scheduleObservable(input, scheduler);
+ }
+ if (isArrayLike_1.isArrayLike(input)) {
+ return scheduleArray_1.scheduleArray(input, scheduler);
+ }
+ if (isPromise_1.isPromise(input)) {
+ return schedulePromise_1.schedulePromise(input, scheduler);
+ }
+ if (isAsyncIterable_1.isAsyncIterable(input)) {
+ return scheduleAsyncIterable_1.scheduleAsyncIterable(input, scheduler);
+ }
+ if (isIterable_1.isIterable(input)) {
+ return scheduleIterable_1.scheduleIterable(input, scheduler);
+ }
+ if (isReadableStreamLike_1.isReadableStreamLike(input)) {
+ return scheduleReadableStreamLike_1.scheduleReadableStreamLike(input, scheduler);
+ }
+ }
+ throw throwUnobservableError_1.createInvalidObservableTypeError(input);
+}
+exports.scheduled = scheduled;
+
+},{"../util/isArrayLike":613,"../util/isAsyncIterable":614,"../util/isInteropObservable":617,"../util/isIterable":618,"../util/isPromise":620,"../util/isReadableStreamLike":621,"../util/throwUnobservableError":629,"./scheduleArray":567,"./scheduleAsyncIterable":568,"./scheduleIterable":569,"./scheduleObservable":570,"./schedulePromise":571,"./scheduleReadableStreamLike":572}],574:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Action = void 0;
+var Subscription_1 = require("../Subscription");
+var Action = (function (_super) {
+ __extends(Action, _super);
+ function Action(scheduler, work) {
+ return _super.call(this) || this;
+ }
+ Action.prototype.schedule = function (state, delay) {
+ if (delay === void 0) { delay = 0; }
+ return this;
+ };
+ return Action;
+}(Subscription_1.Subscription));
+exports.Action = Action;
+
+},{"../Subscription":417}],575:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AnimationFrameAction = void 0;
+var AsyncAction_1 = require("./AsyncAction");
+var animationFrameProvider_1 = require("./animationFrameProvider");
+var AnimationFrameAction = (function (_super) {
+ __extends(AnimationFrameAction, _super);
+ function AnimationFrameAction(scheduler, work) {
+ var _this = _super.call(this, scheduler, work) || this;
+ _this.scheduler = scheduler;
+ _this.work = work;
+ return _this;
+ }
+ AnimationFrameAction.prototype.requestAsyncId = function (scheduler, id, delay) {
+ if (delay === void 0) { delay = 0; }
+ if (delay !== null && delay > 0) {
+ return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
+ }
+ scheduler.actions.push(this);
+ return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider_1.animationFrameProvider.requestAnimationFrame(function () { return scheduler.flush(undefined); }));
+ };
+ AnimationFrameAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
+ var _a;
+ if (delay === void 0) { delay = 0; }
+ if (delay != null ? delay > 0 : this.delay > 0) {
+ return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
+ }
+ var actions = scheduler.actions;
+ if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
+ animationFrameProvider_1.animationFrameProvider.cancelAnimationFrame(id);
+ scheduler._scheduled = undefined;
+ }
+ return undefined;
+ };
+ return AnimationFrameAction;
+}(AsyncAction_1.AsyncAction));
+exports.AnimationFrameAction = AnimationFrameAction;
+
+},{"./AsyncAction":579,"./animationFrameProvider":585}],576:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AnimationFrameScheduler = void 0;
+var AsyncScheduler_1 = require("./AsyncScheduler");
+var AnimationFrameScheduler = (function (_super) {
+ __extends(AnimationFrameScheduler, _super);
+ function AnimationFrameScheduler() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ AnimationFrameScheduler.prototype.flush = function (action) {
+ this._active = true;
+ var flushId = this._scheduled;
+ this._scheduled = undefined;
+ var actions = this.actions;
+ var error;
+ action = action || actions.shift();
+ do {
+ if ((error = action.execute(action.state, action.delay))) {
+ break;
+ }
+ } while ((action = actions[0]) && action.id === flushId && actions.shift());
+ this._active = false;
+ if (error) {
+ while ((action = actions[0]) && action.id === flushId && actions.shift()) {
+ action.unsubscribe();
+ }
+ throw error;
+ }
+ };
+ return AnimationFrameScheduler;
+}(AsyncScheduler_1.AsyncScheduler));
+exports.AnimationFrameScheduler = AnimationFrameScheduler;
+
+},{"./AsyncScheduler":580}],577:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AsapAction = void 0;
+var AsyncAction_1 = require("./AsyncAction");
+var immediateProvider_1 = require("./immediateProvider");
+var AsapAction = (function (_super) {
+ __extends(AsapAction, _super);
+ function AsapAction(scheduler, work) {
+ var _this = _super.call(this, scheduler, work) || this;
+ _this.scheduler = scheduler;
+ _this.work = work;
+ return _this;
+ }
+ AsapAction.prototype.requestAsyncId = function (scheduler, id, delay) {
+ if (delay === void 0) { delay = 0; }
+ if (delay !== null && delay > 0) {
+ return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
+ }
+ scheduler.actions.push(this);
+ return scheduler._scheduled || (scheduler._scheduled = immediateProvider_1.immediateProvider.setImmediate(scheduler.flush.bind(scheduler, undefined)));
+ };
+ AsapAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
+ var _a;
+ if (delay === void 0) { delay = 0; }
+ if (delay != null ? delay > 0 : this.delay > 0) {
+ return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
+ }
+ var actions = scheduler.actions;
+ if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
+ immediateProvider_1.immediateProvider.clearImmediate(id);
+ if (scheduler._scheduled === id) {
+ scheduler._scheduled = undefined;
+ }
+ }
+ return undefined;
+ };
+ return AsapAction;
+}(AsyncAction_1.AsyncAction));
+exports.AsapAction = AsapAction;
+
+},{"./AsyncAction":579,"./immediateProvider":589}],578:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AsapScheduler = void 0;
+var AsyncScheduler_1 = require("./AsyncScheduler");
+var AsapScheduler = (function (_super) {
+ __extends(AsapScheduler, _super);
+ function AsapScheduler() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ AsapScheduler.prototype.flush = function (action) {
+ this._active = true;
+ var flushId = this._scheduled;
+ this._scheduled = undefined;
+ var actions = this.actions;
+ var error;
+ action = action || actions.shift();
+ do {
+ if ((error = action.execute(action.state, action.delay))) {
+ break;
+ }
+ } while ((action = actions[0]) && action.id === flushId && actions.shift());
+ this._active = false;
+ if (error) {
+ while ((action = actions[0]) && action.id === flushId && actions.shift()) {
+ action.unsubscribe();
+ }
+ throw error;
+ }
+ };
+ return AsapScheduler;
+}(AsyncScheduler_1.AsyncScheduler));
+exports.AsapScheduler = AsapScheduler;
+
+},{"./AsyncScheduler":580}],579:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AsyncAction = void 0;
+var Action_1 = require("./Action");
+var intervalProvider_1 = require("./intervalProvider");
+var arrRemove_1 = require("../util/arrRemove");
+var AsyncAction = (function (_super) {
+ __extends(AsyncAction, _super);
+ function AsyncAction(scheduler, work) {
+ var _this = _super.call(this, scheduler, work) || this;
+ _this.scheduler = scheduler;
+ _this.work = work;
+ _this.pending = false;
+ return _this;
+ }
+ AsyncAction.prototype.schedule = function (state, delay) {
+ var _a;
+ if (delay === void 0) { delay = 0; }
+ if (this.closed) {
+ return this;
+ }
+ this.state = state;
+ var id = this.id;
+ var scheduler = this.scheduler;
+ if (id != null) {
+ this.id = this.recycleAsyncId(scheduler, id, delay);
+ }
+ this.pending = true;
+ this.delay = delay;
+ this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
+ return this;
+ };
+ AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
+ if (delay === void 0) { delay = 0; }
+ return intervalProvider_1.intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
+ };
+ AsyncAction.prototype.recycleAsyncId = function (_scheduler, id, delay) {
+ if (delay === void 0) { delay = 0; }
+ if (delay != null && this.delay === delay && this.pending === false) {
+ return id;
+ }
+ if (id != null) {
+ intervalProvider_1.intervalProvider.clearInterval(id);
+ }
+ return undefined;
+ };
+ AsyncAction.prototype.execute = function (state, delay) {
+ if (this.closed) {
+ return new Error('executing a cancelled action');
+ }
+ this.pending = false;
+ var error = this._execute(state, delay);
+ if (error) {
+ return error;
+ }
+ else if (this.pending === false && this.id != null) {
+ this.id = this.recycleAsyncId(this.scheduler, this.id, null);
+ }
+ };
+ AsyncAction.prototype._execute = function (state, _delay) {
+ var errored = false;
+ var errorValue;
+ try {
+ this.work(state);
+ }
+ catch (e) {
+ errored = true;
+ errorValue = e ? e : new Error('Scheduled action threw falsy error');
+ }
+ if (errored) {
+ this.unsubscribe();
+ return errorValue;
+ }
+ };
+ AsyncAction.prototype.unsubscribe = function () {
+ if (!this.closed) {
+ var _a = this, id = _a.id, scheduler = _a.scheduler;
+ var actions = scheduler.actions;
+ this.work = this.state = this.scheduler = null;
+ this.pending = false;
+ arrRemove_1.arrRemove(actions, this);
+ if (id != null) {
+ this.id = this.recycleAsyncId(scheduler, id, null);
+ }
+ this.delay = null;
+ _super.prototype.unsubscribe.call(this);
+ }
+ };
+ return AsyncAction;
+}(Action_1.Action));
+exports.AsyncAction = AsyncAction;
+
+},{"../util/arrRemove":607,"./Action":574,"./intervalProvider":590}],580:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.AsyncScheduler = void 0;
+var Scheduler_1 = require("../Scheduler");
+var AsyncScheduler = (function (_super) {
+ __extends(AsyncScheduler, _super);
+ function AsyncScheduler(SchedulerAction, now) {
+ if (now === void 0) { now = Scheduler_1.Scheduler.now; }
+ var _this = _super.call(this, SchedulerAction, now) || this;
+ _this.actions = [];
+ _this._active = false;
+ return _this;
+ }
+ AsyncScheduler.prototype.flush = function (action) {
+ var actions = this.actions;
+ if (this._active) {
+ actions.push(action);
+ return;
+ }
+ var error;
+ this._active = true;
+ do {
+ if ((error = action.execute(action.state, action.delay))) {
+ break;
+ }
+ } while ((action = actions.shift()));
+ this._active = false;
+ if (error) {
+ while ((action = actions.shift())) {
+ action.unsubscribe();
+ }
+ throw error;
+ }
+ };
+ return AsyncScheduler;
+}(Scheduler_1.Scheduler));
+exports.AsyncScheduler = AsyncScheduler;
+
+},{"../Scheduler":414}],581:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.QueueAction = void 0;
+var AsyncAction_1 = require("./AsyncAction");
+var QueueAction = (function (_super) {
+ __extends(QueueAction, _super);
+ function QueueAction(scheduler, work) {
+ var _this = _super.call(this, scheduler, work) || this;
+ _this.scheduler = scheduler;
+ _this.work = work;
+ return _this;
+ }
+ QueueAction.prototype.schedule = function (state, delay) {
+ if (delay === void 0) { delay = 0; }
+ if (delay > 0) {
+ return _super.prototype.schedule.call(this, state, delay);
+ }
+ this.delay = delay;
+ this.state = state;
+ this.scheduler.flush(this);
+ return this;
+ };
+ QueueAction.prototype.execute = function (state, delay) {
+ return delay > 0 || this.closed ? _super.prototype.execute.call(this, state, delay) : this._execute(state, delay);
+ };
+ QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {
+ if (delay === void 0) { delay = 0; }
+ if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
+ return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
+ }
+ scheduler.flush(this);
+ return 0;
+ };
+ return QueueAction;
+}(AsyncAction_1.AsyncAction));
+exports.QueueAction = QueueAction;
+
+},{"./AsyncAction":579}],582:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.QueueScheduler = void 0;
+var AsyncScheduler_1 = require("./AsyncScheduler");
+var QueueScheduler = (function (_super) {
+ __extends(QueueScheduler, _super);
+ function QueueScheduler() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ return QueueScheduler;
+}(AsyncScheduler_1.AsyncScheduler));
+exports.QueueScheduler = QueueScheduler;
+
+},{"./AsyncScheduler":580}],583:[function(require,module,exports){
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.VirtualAction = exports.VirtualTimeScheduler = void 0;
+var AsyncAction_1 = require("./AsyncAction");
+var Subscription_1 = require("../Subscription");
+var AsyncScheduler_1 = require("./AsyncScheduler");
+var VirtualTimeScheduler = (function (_super) {
+ __extends(VirtualTimeScheduler, _super);
+ function VirtualTimeScheduler(schedulerActionCtor, maxFrames) {
+ if (schedulerActionCtor === void 0) { schedulerActionCtor = VirtualAction; }
+ if (maxFrames === void 0) { maxFrames = Infinity; }
+ var _this = _super.call(this, schedulerActionCtor, function () { return _this.frame; }) || this;
+ _this.maxFrames = maxFrames;
+ _this.frame = 0;
+ _this.index = -1;
+ return _this;
+ }
+ VirtualTimeScheduler.prototype.flush = function () {
+ var _a = this, actions = _a.actions, maxFrames = _a.maxFrames;
+ var error;
+ var action;
+ while ((action = actions[0]) && action.delay <= maxFrames) {
+ actions.shift();
+ this.frame = action.delay;
+ if ((error = action.execute(action.state, action.delay))) {
+ break;
+ }
+ }
+ if (error) {
+ while ((action = actions.shift())) {
+ action.unsubscribe();
+ }
+ throw error;
+ }
+ };
+ VirtualTimeScheduler.frameTimeFactor = 10;
+ return VirtualTimeScheduler;
+}(AsyncScheduler_1.AsyncScheduler));
+exports.VirtualTimeScheduler = VirtualTimeScheduler;
+var VirtualAction = (function (_super) {
+ __extends(VirtualAction, _super);
+ function VirtualAction(scheduler, work, index) {
+ if (index === void 0) { index = (scheduler.index += 1); }
+ var _this = _super.call(this, scheduler, work) || this;
+ _this.scheduler = scheduler;
+ _this.work = work;
+ _this.index = index;
+ _this.active = true;
+ _this.index = scheduler.index = index;
+ return _this;
+ }
+ VirtualAction.prototype.schedule = function (state, delay) {
+ if (delay === void 0) { delay = 0; }
+ if (Number.isFinite(delay)) {
+ if (!this.id) {
+ return _super.prototype.schedule.call(this, state, delay);
+ }
+ this.active = false;
+ var action = new VirtualAction(this.scheduler, this.work);
+ this.add(action);
+ return action.schedule(state, delay);
+ }
+ else {
+ return Subscription_1.Subscription.EMPTY;
+ }
+ };
+ VirtualAction.prototype.requestAsyncId = function (scheduler, id, delay) {
+ if (delay === void 0) { delay = 0; }
+ this.delay = scheduler.frame + delay;
+ var actions = scheduler.actions;
+ actions.push(this);
+ actions.sort(VirtualAction.sortActions);
+ return 1;
+ };
+ VirtualAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
+ if (delay === void 0) { delay = 0; }
+ return undefined;
+ };
+ VirtualAction.prototype._execute = function (state, delay) {
+ if (this.active === true) {
+ return _super.prototype._execute.call(this, state, delay);
+ }
+ };
+ VirtualAction.sortActions = function (a, b) {
+ if (a.delay === b.delay) {
+ if (a.index === b.index) {
+ return 0;
+ }
+ else if (a.index > b.index) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+ }
+ else if (a.delay > b.delay) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+ };
+ return VirtualAction;
+}(AsyncAction_1.AsyncAction));
+exports.VirtualAction = VirtualAction;
+
+},{"../Subscription":417,"./AsyncAction":579,"./AsyncScheduler":580}],584:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.animationFrame = exports.animationFrameScheduler = void 0;
+var AnimationFrameAction_1 = require("./AnimationFrameAction");
+var AnimationFrameScheduler_1 = require("./AnimationFrameScheduler");
+exports.animationFrameScheduler = new AnimationFrameScheduler_1.AnimationFrameScheduler(AnimationFrameAction_1.AnimationFrameAction);
+exports.animationFrame = exports.animationFrameScheduler;
+
+},{"./AnimationFrameAction":575,"./AnimationFrameScheduler":576}],585:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.animationFrameProvider = void 0;
+var Subscription_1 = require("../Subscription");
+exports.animationFrameProvider = {
+ schedule: function (callback) {
+ var request = requestAnimationFrame;
+ var cancel = cancelAnimationFrame;
+ var delegate = exports.animationFrameProvider.delegate;
+ if (delegate) {
+ request = delegate.requestAnimationFrame;
+ cancel = delegate.cancelAnimationFrame;
+ }
+ var handle = request(function (timestamp) {
+ cancel = undefined;
+ callback(timestamp);
+ });
+ return new Subscription_1.Subscription(function () { return cancel === null || cancel === void 0 ? void 0 : cancel(handle); });
+ },
+ requestAnimationFrame: function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var delegate = exports.animationFrameProvider.delegate;
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
+ },
+ cancelAnimationFrame: function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var delegate = exports.animationFrameProvider.delegate;
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
+ },
+ delegate: undefined,
+};
+
+},{"../Subscription":417}],586:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.asap = exports.asapScheduler = void 0;
+var AsapAction_1 = require("./AsapAction");
+var AsapScheduler_1 = require("./AsapScheduler");
+exports.asapScheduler = new AsapScheduler_1.AsapScheduler(AsapAction_1.AsapAction);
+exports.asap = exports.asapScheduler;
+
+},{"./AsapAction":577,"./AsapScheduler":578}],587:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.async = exports.asyncScheduler = void 0;
+var AsyncAction_1 = require("./AsyncAction");
+var AsyncScheduler_1 = require("./AsyncScheduler");
+exports.asyncScheduler = new AsyncScheduler_1.AsyncScheduler(AsyncAction_1.AsyncAction);
+exports.async = exports.asyncScheduler;
+
+},{"./AsyncAction":579,"./AsyncScheduler":580}],588:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.dateTimestampProvider = void 0;
+exports.dateTimestampProvider = {
+ now: function () {
+ return (exports.dateTimestampProvider.delegate || Date).now();
+ },
+ delegate: undefined,
+};
+
+},{}],589:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.immediateProvider = void 0;
+var Immediate_1 = require("../util/Immediate");
+var setImmediate = Immediate_1.Immediate.setImmediate, clearImmediate = Immediate_1.Immediate.clearImmediate;
+exports.immediateProvider = {
+ setImmediate: function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ var delegate = exports.immediateProvider.delegate;
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.setImmediate) || setImmediate).apply(void 0, __spreadArray([], __read(args)));
+ },
+ clearImmediate: function (handle) {
+ var delegate = exports.immediateProvider.delegate;
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearImmediate) || clearImmediate)(handle);
+ },
+ delegate: undefined,
+};
+
+},{"../util/Immediate":599}],590:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.intervalProvider = void 0;
+exports.intervalProvider = {
+ setInterval: function (handler, timeout) {
+ var args = [];
+ for (var _i = 2; _i < arguments.length; _i++) {
+ args[_i - 2] = arguments[_i];
+ }
+ var delegate = exports.intervalProvider.delegate;
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
+ return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
+ }
+ return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
+ },
+ clearInterval: function (handle) {
+ var delegate = exports.intervalProvider.delegate;
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
+ },
+ delegate: undefined,
+};
+
+},{}],591:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.performanceTimestampProvider = void 0;
+exports.performanceTimestampProvider = {
+ now: function () {
+ return (exports.performanceTimestampProvider.delegate || performance).now();
+ },
+ delegate: undefined,
+};
+
+},{}],592:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.queue = exports.queueScheduler = void 0;
+var QueueAction_1 = require("./QueueAction");
+var QueueScheduler_1 = require("./QueueScheduler");
+exports.queueScheduler = new QueueScheduler_1.QueueScheduler(QueueAction_1.QueueAction);
+exports.queue = exports.queueScheduler;
+
+},{"./QueueAction":581,"./QueueScheduler":582}],593:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.timeoutProvider = void 0;
+exports.timeoutProvider = {
+ setTimeout: function (handler, timeout) {
+ var args = [];
+ for (var _i = 2; _i < arguments.length; _i++) {
+ args[_i - 2] = arguments[_i];
+ }
+ var delegate = exports.timeoutProvider.delegate;
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
+ return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
+ }
+ return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
+ },
+ clearTimeout: function (handle) {
+ var delegate = exports.timeoutProvider.delegate;
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
+ },
+ delegate: undefined,
+};
+
+},{}],594:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.iterator = exports.getSymbolIterator = void 0;
+function getSymbolIterator() {
+ if (typeof Symbol !== 'function' || !Symbol.iterator) {
+ return '@@iterator';
+ }
+ return Symbol.iterator;
+}
+exports.getSymbolIterator = getSymbolIterator;
+exports.iterator = getSymbolIterator();
+
+},{}],595:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.observable = void 0;
+exports.observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
+
+},{}],596:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+
+},{}],597:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ArgumentOutOfRangeError = void 0;
+var createErrorClass_1 = require("./createErrorClass");
+exports.ArgumentOutOfRangeError = createErrorClass_1.createErrorClass(function (_super) {
+ return function ArgumentOutOfRangeErrorImpl() {
+ _super(this);
+ this.name = 'ArgumentOutOfRangeError';
+ this.message = 'argument out of range';
+ };
+});
+
+},{"./createErrorClass":608}],598:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.EmptyError = void 0;
+var createErrorClass_1 = require("./createErrorClass");
+exports.EmptyError = createErrorClass_1.createErrorClass(function (_super) { return function EmptyErrorImpl() {
+ _super(this);
+ this.name = 'EmptyError';
+ this.message = 'no elements in sequence';
+}; });
+
+},{"./createErrorClass":608}],599:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.TestTools = exports.Immediate = void 0;
+var nextHandle = 1;
+var resolved;
+var activeHandles = {};
+function findAndClearHandle(handle) {
+ if (handle in activeHandles) {
+ delete activeHandles[handle];
+ return true;
+ }
+ return false;
+}
+exports.Immediate = {
+ setImmediate: function (cb) {
+ var handle = nextHandle++;
+ activeHandles[handle] = true;
+ if (!resolved) {
+ resolved = Promise.resolve();
+ }
+ resolved.then(function () { return findAndClearHandle(handle) && cb(); });
+ return handle;
+ },
+ clearImmediate: function (handle) {
+ findAndClearHandle(handle);
+ },
+};
+exports.TestTools = {
+ pending: function () {
+ return Object.keys(activeHandles).length;
+ }
+};
+
+},{}],600:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.NotFoundError = void 0;
+var createErrorClass_1 = require("./createErrorClass");
+exports.NotFoundError = createErrorClass_1.createErrorClass(function (_super) {
+ return function NotFoundErrorImpl(message) {
+ _super(this);
+ this.name = 'NotFoundError';
+ this.message = message;
+ };
+});
+
+},{"./createErrorClass":608}],601:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ObjectUnsubscribedError = void 0;
+var createErrorClass_1 = require("./createErrorClass");
+exports.ObjectUnsubscribedError = createErrorClass_1.createErrorClass(function (_super) {
+ return function ObjectUnsubscribedErrorImpl() {
+ _super(this);
+ this.name = 'ObjectUnsubscribedError';
+ this.message = 'object unsubscribed';
+ };
+});
+
+},{"./createErrorClass":608}],602:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.SequenceError = void 0;
+var createErrorClass_1 = require("./createErrorClass");
+exports.SequenceError = createErrorClass_1.createErrorClass(function (_super) {
+ return function SequenceErrorImpl(message) {
+ _super(this);
+ this.name = 'SequenceError';
+ this.message = message;
+ };
+});
+
+},{"./createErrorClass":608}],603:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.UnsubscriptionError = void 0;
+var createErrorClass_1 = require("./createErrorClass");
+exports.UnsubscriptionError = createErrorClass_1.createErrorClass(function (_super) {
+ return function UnsubscriptionErrorImpl(errors) {
+ _super(this);
+ this.message = errors
+ ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
+ : '';
+ this.name = 'UnsubscriptionError';
+ this.errors = errors;
+ };
+});
+
+},{"./createErrorClass":608}],604:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.popNumber = exports.popScheduler = exports.popResultSelector = void 0;
+var isFunction_1 = require("./isFunction");
+var isScheduler_1 = require("./isScheduler");
+function last(arr) {
+ return arr[arr.length - 1];
+}
+function popResultSelector(args) {
+ return isFunction_1.isFunction(last(args)) ? args.pop() : undefined;
+}
+exports.popResultSelector = popResultSelector;
+function popScheduler(args) {
+ return isScheduler_1.isScheduler(last(args)) ? args.pop() : undefined;
+}
+exports.popScheduler = popScheduler;
+function popNumber(args, defaultValue) {
+ return typeof last(args) === 'number' ? args.pop() : defaultValue;
+}
+exports.popNumber = popNumber;
+
+},{"./isFunction":616,"./isScheduler":622}],605:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.argsArgArrayOrObject = void 0;
+var isArray = Array.isArray;
+var getPrototypeOf = Object.getPrototypeOf, objectProto = Object.prototype, getKeys = Object.keys;
+function argsArgArrayOrObject(args) {
+ if (args.length === 1) {
+ var first_1 = args[0];
+ if (isArray(first_1)) {
+ return { args: first_1, keys: null };
+ }
+ if (isPOJO(first_1)) {
+ var keys = getKeys(first_1);
+ return {
+ args: keys.map(function (key) { return first_1[key]; }),
+ keys: keys,
+ };
+ }
+ }
+ return { args: args, keys: null };
+}
+exports.argsArgArrayOrObject = argsArgArrayOrObject;
+function isPOJO(obj) {
+ return obj && typeof obj === 'object' && getPrototypeOf(obj) === objectProto;
+}
+
+},{}],606:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.argsOrArgArray = void 0;
+var isArray = Array.isArray;
+function argsOrArgArray(args) {
+ return args.length === 1 && isArray(args[0]) ? args[0] : args;
+}
+exports.argsOrArgArray = argsOrArgArray;
+
+},{}],607:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.arrRemove = void 0;
+function arrRemove(arr, item) {
+ if (arr) {
+ var index = arr.indexOf(item);
+ 0 <= index && arr.splice(index, 1);
+ }
+}
+exports.arrRemove = arrRemove;
+
+},{}],608:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.createErrorClass = void 0;
+function createErrorClass(createImpl) {
+ var _super = function (instance) {
+ Error.call(instance);
+ instance.stack = new Error().stack;
+ };
+ var ctorFunc = createImpl(_super);
+ ctorFunc.prototype = Object.create(Error.prototype);
+ ctorFunc.prototype.constructor = ctorFunc;
+ return ctorFunc;
+}
+exports.createErrorClass = createErrorClass;
+
+},{}],609:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.createObject = void 0;
+function createObject(keys, values) {
+ return keys.reduce(function (result, key, i) { return ((result[key] = values[i]), result); }, {});
+}
+exports.createObject = createObject;
+
+},{}],610:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.captureError = exports.errorContext = void 0;
+var config_1 = require("../config");
+var context = null;
+function errorContext(cb) {
+ if (config_1.config.useDeprecatedSynchronousErrorHandling) {
+ var isRoot = !context;
+ if (isRoot) {
+ context = { errorThrown: false, error: null };
+ }
+ cb();
+ if (isRoot) {
+ var _a = context, errorThrown = _a.errorThrown, error = _a.error;
+ context = null;
+ if (errorThrown) {
+ throw error;
+ }
+ }
+ }
+ else {
+ cb();
+ }
+}
+exports.errorContext = errorContext;
+function captureError(err) {
+ if (config_1.config.useDeprecatedSynchronousErrorHandling && context) {
+ context.errorThrown = true;
+ context.error = err;
+ }
+}
+exports.captureError = captureError;
+
+},{"../config":418}],611:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.executeSchedule = void 0;
+function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
+ if (delay === void 0) { delay = 0; }
+ if (repeat === void 0) { repeat = false; }
+ var scheduleSubscription = scheduler.schedule(function () {
+ work();
+ if (repeat) {
+ parentSubscription.add(this.schedule(null, delay));
+ }
+ else {
+ this.unsubscribe();
+ }
+ }, delay);
+ parentSubscription.add(scheduleSubscription);
+ if (!repeat) {
+ return scheduleSubscription;
+ }
+}
+exports.executeSchedule = executeSchedule;
+
+},{}],612:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.identity = void 0;
+function identity(x) {
+ return x;
+}
+exports.identity = identity;
+
+},{}],613:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isArrayLike = void 0;
+exports.isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
+
+},{}],614:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isAsyncIterable = void 0;
+var isFunction_1 = require("./isFunction");
+function isAsyncIterable(obj) {
+ return Symbol.asyncIterator && isFunction_1.isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
+}
+exports.isAsyncIterable = isAsyncIterable;
+
+},{"./isFunction":616}],615:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isValidDate = void 0;
+function isValidDate(value) {
+ return value instanceof Date && !isNaN(value);
+}
+exports.isValidDate = isValidDate;
+
+},{}],616:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isFunction = void 0;
+function isFunction(value) {
+ return typeof value === 'function';
+}
+exports.isFunction = isFunction;
+
+},{}],617:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isInteropObservable = void 0;
+var observable_1 = require("../symbol/observable");
+var isFunction_1 = require("./isFunction");
+function isInteropObservable(input) {
+ return isFunction_1.isFunction(input[observable_1.observable]);
+}
+exports.isInteropObservable = isInteropObservable;
+
+},{"../symbol/observable":595,"./isFunction":616}],618:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isIterable = void 0;
+var iterator_1 = require("../symbol/iterator");
+var isFunction_1 = require("./isFunction");
+function isIterable(input) {
+ return isFunction_1.isFunction(input === null || input === void 0 ? void 0 : input[iterator_1.iterator]);
+}
+exports.isIterable = isIterable;
+
+},{"../symbol/iterator":594,"./isFunction":616}],619:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isObservable = void 0;
+var Observable_1 = require("../Observable");
+var isFunction_1 = require("./isFunction");
+function isObservable(obj) {
+ return !!obj && (obj instanceof Observable_1.Observable || (isFunction_1.isFunction(obj.lift) && isFunction_1.isFunction(obj.subscribe)));
+}
+exports.isObservable = isObservable;
+
+},{"../Observable":412,"./isFunction":616}],620:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isPromise = void 0;
+var isFunction_1 = require("./isFunction");
+function isPromise(value) {
+ return isFunction_1.isFunction(value === null || value === void 0 ? void 0 : value.then);
+}
+exports.isPromise = isPromise;
+
+},{"./isFunction":616}],621:[function(require,module,exports){
+"use strict";
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ 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;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
+var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
+ 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); }); }; }
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
+ function fulfill(value) { resume("next", value); }
+ function reject(value) { resume("throw", value); }
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isReadableStreamLike = exports.readableStreamLikeToAsyncGenerator = void 0;
+var isFunction_1 = require("./isFunction");
+function readableStreamLikeToAsyncGenerator(readableStream) {
+ return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
+ var reader, _a, value, done;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ reader = readableStream.getReader();
+ _b.label = 1;
+ case 1:
+ _b.trys.push([1, , 9, 10]);
+ _b.label = 2;
+ case 2:
+ if (!true) return [3, 8];
+ return [4, __await(reader.read())];
+ case 3:
+ _a = _b.sent(), value = _a.value, done = _a.done;
+ if (!done) return [3, 5];
+ return [4, __await(void 0)];
+ case 4: return [2, _b.sent()];
+ case 5: return [4, __await(value)];
+ case 6: return [4, _b.sent()];
+ case 7:
+ _b.sent();
+ return [3, 2];
+ case 8: return [3, 10];
+ case 9:
+ reader.releaseLock();
+ return [7];
+ case 10: return [2];
+ }
+ });
+ });
+}
+exports.readableStreamLikeToAsyncGenerator = readableStreamLikeToAsyncGenerator;
+function isReadableStreamLike(obj) {
+ return isFunction_1.isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
+}
+exports.isReadableStreamLike = isReadableStreamLike;
+
+},{"./isFunction":616}],622:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isScheduler = void 0;
+var isFunction_1 = require("./isFunction");
+function isScheduler(value) {
+ return value && isFunction_1.isFunction(value.schedule);
+}
+exports.isScheduler = isScheduler;
+
+},{"./isFunction":616}],623:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.operate = exports.hasLift = void 0;
+var isFunction_1 = require("./isFunction");
+function hasLift(source) {
+ return isFunction_1.isFunction(source === null || source === void 0 ? void 0 : source.lift);
+}
+exports.hasLift = hasLift;
+function operate(init) {
+ return function (source) {
+ if (hasLift(source)) {
+ return source.lift(function (liftedSource) {
+ try {
+ return init(liftedSource, this);
+ }
+ catch (err) {
+ this.error(err);
+ }
+ });
+ }
+ throw new TypeError('Unable to lift unknown Observable type');
+ };
+}
+exports.operate = operate;
+
+},{"./isFunction":616}],624:[function(require,module,exports){
+"use strict";
+var __read = (this && this.__read) || function (o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+};
+var __spreadArray = (this && this.__spreadArray) || function (to, from) {
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
+ to[j] = from[i];
+ return to;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.mapOneOrManyArgs = void 0;
+var map_1 = require("../operators/map");
+var isArray = Array.isArray;
+function callOrApply(fn, args) {
+ return isArray(args) ? fn.apply(void 0, __spreadArray([], __read(args))) : fn(args);
+}
+function mapOneOrManyArgs(fn) {
+ return map_1.map(function (args) { return callOrApply(fn, args); });
+}
+exports.mapOneOrManyArgs = mapOneOrManyArgs;
+
+},{"../operators/map":499}],625:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.noop = void 0;
+function noop() { }
+exports.noop = noop;
+
+},{}],626:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.not = void 0;
+function not(pred, thisArg) {
+ return function (value, index) { return !pred.call(thisArg, value, index); };
+}
+exports.not = not;
+
+},{}],627:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.pipeFromArray = exports.pipe = void 0;
+var identity_1 = require("./identity");
+function pipe() {
+ var fns = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ fns[_i] = arguments[_i];
+ }
+ return pipeFromArray(fns);
+}
+exports.pipe = pipe;
+function pipeFromArray(fns) {
+ if (fns.length === 0) {
+ return identity_1.identity;
+ }
+ if (fns.length === 1) {
+ return fns[0];
+ }
+ return function piped(input) {
+ return fns.reduce(function (prev, fn) { return fn(prev); }, input);
+ };
+}
+exports.pipeFromArray = pipeFromArray;
+
+},{"./identity":612}],628:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.reportUnhandledError = void 0;
+var config_1 = require("../config");
+var timeoutProvider_1 = require("../scheduler/timeoutProvider");
+function reportUnhandledError(err) {
+ timeoutProvider_1.timeoutProvider.setTimeout(function () {
+ var onUnhandledError = config_1.config.onUnhandledError;
+ if (onUnhandledError) {
+ onUnhandledError(err);
+ }
+ else {
+ throw err;
+ }
+ });
+}
+exports.reportUnhandledError = reportUnhandledError;
+
+},{"../config":418,"../scheduler/timeoutProvider":593}],629:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.createInvalidObservableTypeError = void 0;
+function createInvalidObservableTypeError(input) {
+ return new TypeError("You provided " + (input !== null && typeof input === 'object' ? 'an invalid object' : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
+}
+exports.createInvalidObservableTypeError = createInvalidObservableTypeError;
+
+},{}],630:[function(require,module,exports){
+'use strict';
+
+var GetIntrinsic = require('get-intrinsic');
+var define = require('define-data-property');
+var hasDescriptors = require('has-property-descriptors')();
+var gOPD = require('gopd');
+
+var $TypeError = GetIntrinsic('%TypeError%');
+var $floor = GetIntrinsic('%Math.floor%');
+
+module.exports = function setFunctionLength(fn, length) {
+ if (typeof fn !== 'function') {
+ throw new $TypeError('`fn` is not a function');
+ }
+ if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
+ throw new $TypeError('`length` must be a positive 32-bit integer');
+ }
+
+ var loose = arguments.length > 2 && !!arguments[2];
+
+ var functionLengthIsConfigurable = true;
+ var functionLengthIsWritable = true;
+ if ('length' in fn && gOPD) {
+ var desc = gOPD(fn, 'length');
+ if (desc && !desc.configurable) {
+ functionLengthIsConfigurable = false;
+ }
+ if (desc && !desc.writable) {
+ functionLengthIsWritable = false;
+ }
+ }
+
+ if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
+ if (hasDescriptors) {
+ define(fn, 'length', length, true, true);
+ } else {
+ define(fn, 'length', length);
+ }
+ }
+ return fn;
+};
+
+},{"define-data-property":351,"get-intrinsic":358,"gopd":359,"has-property-descriptors":361}],631:[function(require,module,exports){
+'use strict';
+
+var define = require('define-data-property');
+var hasDescriptors = require('has-property-descriptors')();
+var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames();
+
+var $TypeError = TypeError;
+
+module.exports = function setFunctionName(fn, name) {
+ if (typeof fn !== 'function') {
+ throw new $TypeError('`fn` is not a function');
+ }
+ var loose = arguments.length > 2 && !!arguments[2];
+ if (!loose || functionsHaveConfigurableNames) {
+ if (hasDescriptors) {
+ define(fn, 'name', name, true, true);
+ } else {
+ define(fn, 'name', name);
+ }
+ }
+ return fn;
+};
+
+},{"define-data-property":351,"functions-have-names":357,"has-property-descriptors":361}],632:[function(require,module,exports){
+'use strict';
+
+var GetIntrinsic = require('get-intrinsic');
+var callBound = require('call-bind/callBound');
+var inspect = require('object-inspect');
+
+var $TypeError = GetIntrinsic('%TypeError%');
+var $WeakMap = GetIntrinsic('%WeakMap%', true);
+var $Map = GetIntrinsic('%Map%', true);
+
+var $weakMapGet = callBound('WeakMap.prototype.get', true);
+var $weakMapSet = callBound('WeakMap.prototype.set', true);
+var $weakMapHas = callBound('WeakMap.prototype.has', true);
+var $mapGet = callBound('Map.prototype.get', true);
+var $mapSet = callBound('Map.prototype.set', true);
+var $mapHas = callBound('Map.prototype.has', true);
+
+/*
+ * This function traverses the list returning the node corresponding to the
+ * given key.
+ *
+ * That node is also moved to the head of the list, so that if it's accessed
+ * again we don't need to traverse the whole list. By doing so, all the recently
+ * used nodes can be accessed relatively quickly.
+ */
+var listGetNode = function (list, key) { // eslint-disable-line consistent-return
+ for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
+ if (curr.key === key) {
+ prev.next = curr.next;
+ curr.next = list.next;
+ list.next = curr; // eslint-disable-line no-param-reassign
+ return curr;
+ }
+ }
+};
+
+var listGet = function (objects, key) {
+ var node = listGetNode(objects, key);
+ return node && node.value;
+};
+var listSet = function (objects, key, value) {
+ var node = listGetNode(objects, key);
+ if (node) {
+ node.value = value;
+ } else {
+ // Prepend the new node to the beginning of the list
+ objects.next = { // eslint-disable-line no-param-reassign
+ key: key,
+ next: objects.next,
+ value: value
+ };
+ }
+};
+var listHas = function (objects, key) {
return !!listGetNode(objects, key);
};
@@ -15818,7 +23452,7 @@ module.exports = function getSideChannel() {
return channel;
};
-},{"call-bind/callBound":43,"get-intrinsic":358,"object-inspect":387}],410:[function(require,module,exports){
+},{"call-bind/callBound":43,"get-intrinsic":358,"object-inspect":387}],633:[function(require,module,exports){
'use strict';
var SLOT = require('internal-slot');
@@ -15860,7 +23494,7 @@ module.exports = function getStopIterationIterator(origIterator) {
return siIterator;
};
-},{"internal-slot":368}],411:[function(require,module,exports){
+},{"internal-slot":368}],634:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -15912,7 +23546,7 @@ function addBrowser(fn) {
* @link https://stackoverflow.com/a/26193516/3443137
*/
}
-},{}],412:[function(require,module,exports){
+},{}],635:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -15973,7 +23607,7 @@ function getSize() {
return LISTENERS.size;
}
}).call(this)}).call(this,require('_process'))
-},{"./browser.js":411,"./node.js":413,"_process":401}],413:[function(require,module,exports){
+},{"./browser.js":634,"./node.js":636,"_process":401}],636:[function(require,module,exports){
(function (process){(function (){
"use strict";
@@ -16012,7 +23646,7 @@ function addNode(fn) {
});
}
}).call(this)}).call(this,require('_process'))
-},{"_process":401}],414:[function(require,module,exports){
+},{"_process":401}],637:[function(require,module,exports){
'use strict';
var isString = require('is-string');
@@ -16044,7 +23678,7 @@ module.exports = function whichBoxedPrimitive(value) {
}
};
-},{"is-bigint":371,"is-boolean-object":372,"is-number-object":377,"is-string":381,"is-symbol":382}],415:[function(require,module,exports){
+},{"is-bigint":371,"is-boolean-object":372,"is-number-object":377,"is-string":381,"is-symbol":382}],638:[function(require,module,exports){
'use strict';
var isMap = require('is-map');
@@ -16070,7 +23704,7 @@ module.exports = function whichCollection(value) {
return false;
};
-},{"is-map":375,"is-set":379,"is-weakmap":384,"is-weakset":385}],416:[function(require,module,exports){
+},{"is-map":375,"is-set":379,"is-weakmap":384,"is-weakset":385}],639:[function(require,module,exports){
(function (global){(function (){
'use strict';
@@ -16166,13 +23800,14 @@ module.exports = function whichTypedArray(value) {
};
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"available-typed-arrays":39,"call-bind":44,"call-bind/callBound":43,"for-each":354,"gopd":359,"has-tostringtag/shams":365}],417:[function(require,module,exports){
+},{"available-typed-arrays":39,"call-bind":44,"call-bind/callBound":43,"for-each":354,"gopd":359,"has-tostringtag/shams":365}],640:[function(require,module,exports){
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _util = require("./util.js");
+var _rxjs = require("rxjs");
/* eslint-disable */
/**
* used in docs/e2e.html
@@ -16419,7 +24054,7 @@ function run() {
// Worker test
window.startWorkerTest = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
- var worker, t, perRun, k, done, amountTime;
+ var worker, t, perRun, k, done, messages$, workerListener, amountTime;
return _regenerator["default"].wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
@@ -16460,13 +24095,18 @@ function run() {
perRun = 100;
k = 0;
done = 0;
- case 14:
+ messages$ = new _rxjs.Subject();
+ workerListener = function workerListener(msg) {
+ messages$.next(msg);
+ };
+ channel.addEventListener('message', workerListener);
+ case 17:
if (!(t > 0)) {
- _context5.next = 20;
+ _context5.next = 23;
break;
}
t--;
- _context5.next = 18;
+ _context5.next = 21;
return Promise.all(new Array(perRun).fill(0).map( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
var msgId, waitForResponsePromise;
return _regenerator["default"].wrap(function _callee4$(_context4) {
@@ -16481,17 +24121,16 @@ function run() {
case 3:
msgId = 'worker-test-' + startTime + '-' + k++;
waitForResponsePromise = new Promise(function (res) {
- var listener = function listener(msg) {
+ var sub = messages$.subscribe(function (msg) {
if (msg.answer == true && msg.original.id === msgId) {
console.dir('msg for response:;:');
console.dir(msg);
done++;
messageCountWorkerContainer.innerHTML = done;
- channel.removeEventListener('message', listener);
+ sub.unsubscribe();
res();
}
- };
- channel.addEventListener('message', listener);
+ });
});
channel.postMessage({
from: 'main-worker',
@@ -16515,15 +24154,16 @@ function run() {
}
}, _callee4);
}))));
- case 18:
- _context5.next = 14;
+ case 21:
+ _context5.next = 17;
break;
- case 20:
+ case 23:
+ channel.removeEventListener('message', workerListener);
body.style.backgroundColor = 'green';
stateContainer.innerHTML = 'SUCCESS';
amountTime = new Date().getTime() - startTime;
document.getElementById('time-amount').innerHTML = amountTime + 'ms';
- case 24:
+ case 28:
case "end":
return _context5.stop();
}
@@ -16540,7 +24180,7 @@ try {
console.log('error in run-function:');
console.error(error);
}
-},{"../../":2,"./util.js":418,"@babel/polyfill":14,"@babel/runtime/helpers/asyncToGenerator":16,"@babel/runtime/helpers/interopRequireDefault":17,"@babel/runtime/regenerator":20,"async-test-util":25}],418:[function(require,module,exports){
+},{"../../":2,"./util.js":641,"@babel/polyfill":14,"@babel/runtime/helpers/asyncToGenerator":16,"@babel/runtime/helpers/interopRequireDefault":17,"@babel/runtime/regenerator":20,"async-test-util":25,"rxjs":407}],641:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -16559,4 +24199,4 @@ function getParameterByName(name, url) {
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
-},{}]},{},[417]);
+},{}]},{},[640]);
diff --git a/docs/iframe.js b/docs/iframe.js
index fe7f1ca6..646f205c 100644
--- a/docs/iframe.js
+++ b/docs/iframe.js
@@ -238,18 +238,7 @@ function _startListening(channel) {
var listenerFn = function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (listenerObject) {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- var hundredMsInMicro = 100 * 1000;
- var minMessageTime = listenerObject.time - hundredMsInMicro;
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
@@ -1392,14 +1381,15 @@ var microSeconds = exports.microSeconds = _util.microSeconds;
var type = exports.type = 'native';
function create(channelName) {
var state = {
+ time: (0, _util.microSeconds)(),
messagesCallback: null,
bc: new BroadcastChannel(channelName),
subFns: [] // subscriberFunctions
};
- state.bc.onmessage = function (msg) {
+ state.bc.onmessage = function (msgEvent) {
if (state.messagesCallback) {
- state.messagesCallback(msg.data);
+ state.messagesCallback(msgEvent.data);
}
};
return state;
@@ -1455,7 +1445,7 @@ var NativeMethod = exports.NativeMethod = {
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.SimulateMethod = void 0;
+exports.SimulateMethod = exports.SIMULATE_DELAY_TIME = void 0;
exports.averageResponseTime = averageResponseTime;
exports.canBeUsed = canBeUsed;
exports.close = close;
@@ -1470,30 +1460,36 @@ var type = exports.type = 'simulate';
var SIMULATE_CHANNELS = new Set();
function create(channelName) {
var state = {
+ time: microSeconds(),
name: channelName,
messagesCallback: null
};
+ console.log('created channel ' + state.counter);
SIMULATE_CHANNELS.add(state);
return state;
}
function close(channelState) {
SIMULATE_CHANNELS["delete"](channelState);
}
+var SIMULATE_DELAY_TIME = exports.SIMULATE_DELAY_TIME = 5;
function postMessage(channelState, messageJson) {
return new Promise(function (res) {
return setTimeout(function () {
var channelArray = Array.from(SIMULATE_CHANNELS);
- channelArray.filter(function (channel) {
- return channel.name === channelState.name;
- }).filter(function (channel) {
- return channel !== channelState;
- }).filter(function (channel) {
- return !!channel.messagesCallback;
- }).forEach(function (channel) {
- return channel.messagesCallback(messageJson);
+ channelArray.forEach(function (channel) {
+ if (channel.name === channelState.name &&
+ // has same name
+ channel !== channelState &&
+ // not own channel
+ !!channel.messagesCallback &&
+ // has subscribers
+ channel.time < messageJson.time // channel not created after postMessage() call
+ ) {
+ channel.messagesCallback(messageJson);
+ }
});
res();
- }, 5);
+ }, SIMULATE_DELAY_TIME);
});
}
function onMessage(channelState, fn) {
@@ -1503,7 +1499,7 @@ function canBeUsed() {
return true;
}
function averageResponseTime() {
- return 5;
+ return SIMULATE_DELAY_TIME;
}
var SimulateMethod = exports.SimulateMethod = {
create: create,
@@ -1596,25 +1592,21 @@ function randomToken() {
return Math.random().toString(36).substring(2);
}
var lastMs = 0;
-var additional = 0;
/**
- * returns the current time in micro-seconds,
+ * Returns the current unix time in micro-seconds,
* WARNING: This is a pseudo-function
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
* This is enough in browsers, and this function will not be used in nodejs.
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
*/
function microSeconds() {
- var ms = Date.now();
- if (ms === lastMs) {
- additional++;
- return ms * 1000 + additional;
- } else {
- lastMs = ms;
- additional = 0;
- return ms * 1000;
+ var ret = Date.now() * 1000; // milliseconds to microseconds
+ if (ret <= lastMs) {
+ ret = lastMs + 1;
}
+ lastMs = ret;
+ return ret;
}
/**
diff --git a/docs/index.js b/docs/index.js
index 421a0dfd..01d38746 100644
--- a/docs/index.js
+++ b/docs/index.js
@@ -238,18 +238,7 @@ function _startListening(channel) {
var listenerFn = function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (listenerObject) {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- var hundredMsInMicro = 100 * 1000;
- var minMessageTime = listenerObject.time - hundredMsInMicro;
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
@@ -1392,14 +1381,15 @@ var microSeconds = exports.microSeconds = _util.microSeconds;
var type = exports.type = 'native';
function create(channelName) {
var state = {
+ time: (0, _util.microSeconds)(),
messagesCallback: null,
bc: new BroadcastChannel(channelName),
subFns: [] // subscriberFunctions
};
- state.bc.onmessage = function (msg) {
+ state.bc.onmessage = function (msgEvent) {
if (state.messagesCallback) {
- state.messagesCallback(msg.data);
+ state.messagesCallback(msgEvent.data);
}
};
return state;
@@ -1455,7 +1445,7 @@ var NativeMethod = exports.NativeMethod = {
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.SimulateMethod = void 0;
+exports.SimulateMethod = exports.SIMULATE_DELAY_TIME = void 0;
exports.averageResponseTime = averageResponseTime;
exports.canBeUsed = canBeUsed;
exports.close = close;
@@ -1470,30 +1460,36 @@ var type = exports.type = 'simulate';
var SIMULATE_CHANNELS = new Set();
function create(channelName) {
var state = {
+ time: microSeconds(),
name: channelName,
messagesCallback: null
};
+ console.log('created channel ' + state.counter);
SIMULATE_CHANNELS.add(state);
return state;
}
function close(channelState) {
SIMULATE_CHANNELS["delete"](channelState);
}
+var SIMULATE_DELAY_TIME = exports.SIMULATE_DELAY_TIME = 5;
function postMessage(channelState, messageJson) {
return new Promise(function (res) {
return setTimeout(function () {
var channelArray = Array.from(SIMULATE_CHANNELS);
- channelArray.filter(function (channel) {
- return channel.name === channelState.name;
- }).filter(function (channel) {
- return channel !== channelState;
- }).filter(function (channel) {
- return !!channel.messagesCallback;
- }).forEach(function (channel) {
- return channel.messagesCallback(messageJson);
+ channelArray.forEach(function (channel) {
+ if (channel.name === channelState.name &&
+ // has same name
+ channel !== channelState &&
+ // not own channel
+ !!channel.messagesCallback &&
+ // has subscribers
+ channel.time < messageJson.time // channel not created after postMessage() call
+ ) {
+ channel.messagesCallback(messageJson);
+ }
});
res();
- }, 5);
+ }, SIMULATE_DELAY_TIME);
});
}
function onMessage(channelState, fn) {
@@ -1503,7 +1499,7 @@ function canBeUsed() {
return true;
}
function averageResponseTime() {
- return 5;
+ return SIMULATE_DELAY_TIME;
}
var SimulateMethod = exports.SimulateMethod = {
create: create,
@@ -1596,25 +1592,21 @@ function randomToken() {
return Math.random().toString(36).substring(2);
}
var lastMs = 0;
-var additional = 0;
/**
- * returns the current time in micro-seconds,
+ * Returns the current unix time in micro-seconds,
* WARNING: This is a pseudo-function
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
* This is enough in browsers, and this function will not be used in nodejs.
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
*/
function microSeconds() {
- var ms = Date.now();
- if (ms === lastMs) {
- additional++;
- return ms * 1000 + additional;
- } else {
- lastMs = ms;
- additional = 0;
- return ms * 1000;
+ var ret = Date.now() * 1000; // milliseconds to microseconds
+ if (ret <= lastMs) {
+ ret = lastMs + 1;
}
+ lastMs = ret;
+ return ret;
}
/**
diff --git a/docs/leader-iframe.js b/docs/leader-iframe.js
index 69ebe9ea..a12c6ced 100644
--- a/docs/leader-iframe.js
+++ b/docs/leader-iframe.js
@@ -238,18 +238,7 @@ function _startListening(channel) {
var listenerFn = function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (listenerObject) {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- var hundredMsInMicro = 100 * 1000;
- var minMessageTime = listenerObject.time - hundredMsInMicro;
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
@@ -1392,14 +1381,15 @@ var microSeconds = exports.microSeconds = _util.microSeconds;
var type = exports.type = 'native';
function create(channelName) {
var state = {
+ time: (0, _util.microSeconds)(),
messagesCallback: null,
bc: new BroadcastChannel(channelName),
subFns: [] // subscriberFunctions
};
- state.bc.onmessage = function (msg) {
+ state.bc.onmessage = function (msgEvent) {
if (state.messagesCallback) {
- state.messagesCallback(msg.data);
+ state.messagesCallback(msgEvent.data);
}
};
return state;
@@ -1455,7 +1445,7 @@ var NativeMethod = exports.NativeMethod = {
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.SimulateMethod = void 0;
+exports.SimulateMethod = exports.SIMULATE_DELAY_TIME = void 0;
exports.averageResponseTime = averageResponseTime;
exports.canBeUsed = canBeUsed;
exports.close = close;
@@ -1470,30 +1460,36 @@ var type = exports.type = 'simulate';
var SIMULATE_CHANNELS = new Set();
function create(channelName) {
var state = {
+ time: microSeconds(),
name: channelName,
messagesCallback: null
};
+ console.log('created channel ' + state.counter);
SIMULATE_CHANNELS.add(state);
return state;
}
function close(channelState) {
SIMULATE_CHANNELS["delete"](channelState);
}
+var SIMULATE_DELAY_TIME = exports.SIMULATE_DELAY_TIME = 5;
function postMessage(channelState, messageJson) {
return new Promise(function (res) {
return setTimeout(function () {
var channelArray = Array.from(SIMULATE_CHANNELS);
- channelArray.filter(function (channel) {
- return channel.name === channelState.name;
- }).filter(function (channel) {
- return channel !== channelState;
- }).filter(function (channel) {
- return !!channel.messagesCallback;
- }).forEach(function (channel) {
- return channel.messagesCallback(messageJson);
+ channelArray.forEach(function (channel) {
+ if (channel.name === channelState.name &&
+ // has same name
+ channel !== channelState &&
+ // not own channel
+ !!channel.messagesCallback &&
+ // has subscribers
+ channel.time < messageJson.time // channel not created after postMessage() call
+ ) {
+ channel.messagesCallback(messageJson);
+ }
});
res();
- }, 5);
+ }, SIMULATE_DELAY_TIME);
});
}
function onMessage(channelState, fn) {
@@ -1503,7 +1499,7 @@ function canBeUsed() {
return true;
}
function averageResponseTime() {
- return 5;
+ return SIMULATE_DELAY_TIME;
}
var SimulateMethod = exports.SimulateMethod = {
create: create,
@@ -1596,25 +1592,21 @@ function randomToken() {
return Math.random().toString(36).substring(2);
}
var lastMs = 0;
-var additional = 0;
/**
- * returns the current time in micro-seconds,
+ * Returns the current unix time in micro-seconds,
* WARNING: This is a pseudo-function
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
* This is enough in browsers, and this function will not be used in nodejs.
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
*/
function microSeconds() {
- var ms = Date.now();
- if (ms === lastMs) {
- additional++;
- return ms * 1000 + additional;
- } else {
- lastMs = ms;
- additional = 0;
- return ms * 1000;
+ var ret = Date.now() * 1000; // milliseconds to microseconds
+ if (ret <= lastMs) {
+ ret = lastMs + 1;
}
+ lastMs = ret;
+ return ret;
}
/**
diff --git a/docs/worker.js b/docs/worker.js
index 4ab196c7..7524d2e9 100644
--- a/docs/worker.js
+++ b/docs/worker.js
@@ -238,18 +238,7 @@ function _startListening(channel) {
var listenerFn = function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (listenerObject) {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- var hundredMsInMicro = 100 * 1000;
- var minMessageTime = listenerObject.time - hundredMsInMicro;
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
@@ -1392,14 +1381,15 @@ var microSeconds = exports.microSeconds = _util.microSeconds;
var type = exports.type = 'native';
function create(channelName) {
var state = {
+ time: (0, _util.microSeconds)(),
messagesCallback: null,
bc: new BroadcastChannel(channelName),
subFns: [] // subscriberFunctions
};
- state.bc.onmessage = function (msg) {
+ state.bc.onmessage = function (msgEvent) {
if (state.messagesCallback) {
- state.messagesCallback(msg.data);
+ state.messagesCallback(msgEvent.data);
}
};
return state;
@@ -1455,7 +1445,7 @@ var NativeMethod = exports.NativeMethod = {
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.SimulateMethod = void 0;
+exports.SimulateMethod = exports.SIMULATE_DELAY_TIME = void 0;
exports.averageResponseTime = averageResponseTime;
exports.canBeUsed = canBeUsed;
exports.close = close;
@@ -1470,30 +1460,36 @@ var type = exports.type = 'simulate';
var SIMULATE_CHANNELS = new Set();
function create(channelName) {
var state = {
+ time: microSeconds(),
name: channelName,
messagesCallback: null
};
+ console.log('created channel ' + state.counter);
SIMULATE_CHANNELS.add(state);
return state;
}
function close(channelState) {
SIMULATE_CHANNELS["delete"](channelState);
}
+var SIMULATE_DELAY_TIME = exports.SIMULATE_DELAY_TIME = 5;
function postMessage(channelState, messageJson) {
return new Promise(function (res) {
return setTimeout(function () {
var channelArray = Array.from(SIMULATE_CHANNELS);
- channelArray.filter(function (channel) {
- return channel.name === channelState.name;
- }).filter(function (channel) {
- return channel !== channelState;
- }).filter(function (channel) {
- return !!channel.messagesCallback;
- }).forEach(function (channel) {
- return channel.messagesCallback(messageJson);
+ channelArray.forEach(function (channel) {
+ if (channel.name === channelState.name &&
+ // has same name
+ channel !== channelState &&
+ // not own channel
+ !!channel.messagesCallback &&
+ // has subscribers
+ channel.time < messageJson.time // channel not created after postMessage() call
+ ) {
+ channel.messagesCallback(messageJson);
+ }
});
res();
- }, 5);
+ }, SIMULATE_DELAY_TIME);
});
}
function onMessage(channelState, fn) {
@@ -1503,7 +1499,7 @@ function canBeUsed() {
return true;
}
function averageResponseTime() {
- return 5;
+ return SIMULATE_DELAY_TIME;
}
var SimulateMethod = exports.SimulateMethod = {
create: create,
@@ -1596,25 +1592,21 @@ function randomToken() {
return Math.random().toString(36).substring(2);
}
var lastMs = 0;
-var additional = 0;
/**
- * returns the current time in micro-seconds,
+ * Returns the current unix time in micro-seconds,
* WARNING: This is a pseudo-function
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
* This is enough in browsers, and this function will not be used in nodejs.
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
*/
function microSeconds() {
- var ms = Date.now();
- if (ms === lastMs) {
- additional++;
- return ms * 1000 + additional;
- } else {
- lastMs = ms;
- additional = 0;
- return ms * 1000;
+ var ret = Date.now() * 1000; // milliseconds to microseconds
+ if (ret <= lastMs) {
+ ret = lastMs + 1;
}
+ lastMs = ret;
+ return ret;
}
/**
diff --git a/package.json b/package.json
index 236dfd19..6c92bdef 100644
--- a/package.json
+++ b/package.json
@@ -99,22 +99,23 @@
"lint"
],
"dependencies": {
- "@babel/runtime": "7.23.2",
+ "@babel/runtime": "7.23.4",
"oblivious-set": "1.4.0",
"p-queue": "6.6.2",
"unload": "2.4.1"
},
"devDependencies": {
- "@babel/cli": "7.23.0",
- "@babel/core": "7.23.2",
+ "@babel/cli": "7.23.4",
+ "@babel/core": "7.23.3",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
- "@babel/plugin-transform-member-expression-literals": "7.22.5",
- "@babel/plugin-transform-property-literals": "7.22.5",
- "@babel/plugin-transform-runtime": "7.23.2",
+ "@babel/plugin-transform-member-expression-literals": "7.23.3",
+ "@babel/plugin-transform-property-literals": "7.23.3",
+ "@babel/plugin-transform-runtime": "7.23.4",
"@babel/polyfill": "7.12.1",
- "@babel/preset-env": "7.23.2",
- "@babel/types": "7.23.0",
- "@types/core-js": "2.5.7",
+ "@babel/preset-env": "7.23.3",
+ "@babel/types": "7.23.4",
+ "@rollup/plugin-terser": "0.4.4",
+ "@types/core-js": "2.5.8",
"assert": "2.1.0",
"async-test-util": "2.2.1",
"browserify": "17.0.0",
@@ -125,7 +126,7 @@
"copyfiles": "2.4.1",
"cross-env": "7.0.3",
"detect-node": "2.1.0",
- "eslint": "8.52.0",
+ "eslint": "8.54.0",
"gzip-size-cli": "5.1.0",
"http-server": "14.1.1",
"jest": "29.7.0",
@@ -147,11 +148,10 @@
"random-int": "3.0.0",
"random-token": "0.0.8",
"rimraf": "5.0.5",
- "rollup": "4.1.5",
- "@rollup/plugin-terser": "0.4.4",
- "testcafe": "3.3.0",
+ "rollup": "4.6.0",
+ "testcafe": "3.4.0",
"ts-node": "10.9.1",
- "typescript": "5.2.2",
+ "typescript": "5.3.2",
"uglify-js": "3.17.4",
"watchify": "4.0.0",
"webpack": "5.89.0",
diff --git a/src/broadcast-channel.js b/src/broadcast-channel.js
index f37d9eb5..75088df4 100644
--- a/src/broadcast-channel.js
+++ b/src/broadcast-channel.js
@@ -193,7 +193,6 @@ function _post(broadcastChannel, type, msg) {
const awaitPrepare = broadcastChannel._prepP ? broadcastChannel._prepP : PROMISE_RESOLVED_VOID;
return awaitPrepare.then(() => {
-
const sendPromise = broadcastChannel.method.postMessage(
broadcastChannel._state,
msgObj
@@ -249,19 +248,7 @@ function _startListening(channel) {
const listenerFn = msgObj => {
channel._addEL[msgObj.type]
.forEach(listenerObject => {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- const hundredMsInMicro = 100 * 1000;
- const minMessageTime = listenerObject.time - hundredMsInMicro;
-
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
diff --git a/src/methods/native.js b/src/methods/native.js
index fa14d229..44228eda 100644
--- a/src/methods/native.js
+++ b/src/methods/native.js
@@ -10,14 +10,15 @@ export const type = 'native';
export function create(channelName) {
const state = {
+ time: micro(),
messagesCallback: null,
bc: new BroadcastChannel(channelName),
subFns: [] // subscriberFunctions
};
- state.bc.onmessage = msg => {
+ state.bc.onmessage = msgEvent => {
if (state.messagesCallback) {
- state.messagesCallback(msg.data);
+ state.messagesCallback(msgEvent.data);
}
};
diff --git a/src/methods/node.js b/src/methods/node.js
index e27626e2..37dfde3a 100644
--- a/src/methods/node.js
+++ b/src/methods/node.js
@@ -272,11 +272,15 @@ export async function openClientConnection(channelName, readerUuid) {
* @return {Promise}
*/
export function writeMessage(channelName, readerUuid, messageJson, paths) {
+
+ let time = messageJson.time;
+ if (!time) {
+ time = microSeconds();
+ }
+
paths = paths || getPaths(channelName);
- const time = microSeconds();
const writeObject = {
uuid: readerUuid,
- time,
data: messageJson
};
@@ -451,8 +455,8 @@ export function _filterMessage(msgObj, state) {
if (msgObj.senderUuid === state.uuid) return false; // not send by own
if (state.emittedMessagesIds.has(msgObj.token)) return false; // not already emitted
if (!state.messagesCallback) return false; // no listener
- if (msgObj.time < state.messagesCallbackTime) return false; // not older then onMessageCallback
- if (msgObj.time < state.time) return false; // msgObj is older then channel
+ if (msgObj.time < state.messagesCallbackTime) return false; // not older than onMessageCallback
+ if (msgObj.time < state.time) return false; // msgObj is older than channel
state.emittedMessagesIds.add(msgObj.token);
return true;
diff --git a/src/methods/simulate.js b/src/methods/simulate.js
index f1e0cb6b..467f3261 100644
--- a/src/methods/simulate.js
+++ b/src/methods/simulate.js
@@ -10,11 +10,11 @@ const SIMULATE_CHANNELS = new Set();
export function create(channelName) {
const state = {
+ time: microSeconds(),
name: channelName,
messagesCallback: null
};
SIMULATE_CHANNELS.add(state);
-
return state;
}
@@ -22,16 +22,23 @@ export function close(channelState) {
SIMULATE_CHANNELS.delete(channelState);
}
+export const SIMULATE_DELAY_TIME = 5;
+
export function postMessage(channelState, messageJson) {
return new Promise(res => setTimeout(() => {
const channelArray = Array.from(SIMULATE_CHANNELS);
- channelArray
- .filter(channel => channel.name === channelState.name)
- .filter(channel => channel !== channelState)
- .filter(channel => !!channel.messagesCallback)
- .forEach(channel => channel.messagesCallback(messageJson));
+ channelArray.forEach(channel => {
+ if (
+ channel.name === channelState.name && // has same name
+ channel !== channelState && // not own channel
+ !!channel.messagesCallback && // has subscribers
+ channel.time < messageJson.time // channel not created after postMessage() call
+ ) {
+ channel.messagesCallback(messageJson);
+ }
+ });
res();
- }, 5));
+ }, SIMULATE_DELAY_TIME));
}
export function onMessage(channelState, fn) {
@@ -44,7 +51,7 @@ export function canBeUsed() {
export function averageResponseTime() {
- return 5;
+ return SIMULATE_DELAY_TIME;
}
export const SimulateMethod = {
diff --git a/src/util.js b/src/util.js
index 5737ccad..b21592b9 100644
--- a/src/util.js
+++ b/src/util.js
@@ -28,25 +28,21 @@ export function randomToken() {
let lastMs = 0;
-let additional = 0;
/**
- * returns the current time in micro-seconds,
+ * Returns the current unix time in micro-seconds,
* WARNING: This is a pseudo-function
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
* This is enough in browsers, and this function will not be used in nodejs.
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
*/
export function microSeconds() {
- const ms = Date.now();
- if (ms === lastMs) {
- additional++;
- return ms * 1000 + additional;
- } else {
- lastMs = ms;
- additional = 0;
- return ms * 1000;
+ let ret = Date.now() * 1000; // milliseconds to microseconds
+ if (ret <= lastMs) {
+ ret = lastMs + 1;
}
+ lastMs = ret;
+ return ret;
}
/**
diff --git a/test/integration.test.js b/test/integration.test.js
index c64768eb..15203451 100644
--- a/test/integration.test.js
+++ b/test/integration.test.js
@@ -194,7 +194,7 @@ function runTest(channelOptions) {
/**
* We have to wait 200ms here because only 'too old' messages should be filtered out.
- * Becuase the JavaScript time precision is not good enough, we also emit messages that are only a bit off.
+ * Because the JavaScript time precision is not good enough, we also emit messages that are only a bit off.
* This ensures we do not miss out messages which would be way more critical then getting additionals.
*/
await AsyncTestUtil.wait(200);
@@ -253,14 +253,13 @@ function runTest(channelOptions) {
channel.close();
otherChannel.close();
});
- it('should not read messages created before the channel was created', async () => {
+ it('should not read messages created before the channel was created (one message)', async () => {
await AsyncTestUtil.wait(100);
const channelName = AsyncTestUtil.randomString(12);
const channel = new BroadcastChannel(channelName, channelOptions);
await channel.postMessage('foo1');
- await AsyncTestUtil.wait(50);
const otherChannel = new BroadcastChannel(channelName, channelOptions);
const emittedOther = [];
@@ -274,6 +273,35 @@ function runTest(channelOptions) {
assert.equal(emittedOther.length, 2);
+ await channel.close();
+ await otherChannel.close();
+ });
+ it('should not read messages created before the channel was created (many messages)', async () => {
+ await AsyncTestUtil.wait(100);
+
+ const channelName = AsyncTestUtil.randomString(12);
+ const channel = new BroadcastChannel(channelName, channelOptions);
+
+ new Array(10).fill(0).forEach(() => {
+ /**
+ * Do not await here!
+ * It should not receive these messages even
+ * when the postMessage() was called but not finished yet.
+ */
+ channel.postMessage('msg_from_before');
+ });
+ const otherChannel = new BroadcastChannel(channelName, channelOptions);
+ const emittedOther = [];
+ otherChannel.onmessage = msg => emittedOther.push(msg);
+
+ await channel.postMessage('foo2');
+ await channel.postMessage('foo3');
+
+ await AsyncTestUtil.waitUntil(() => emittedOther.length >= 2);
+ await AsyncTestUtil.wait(100);
+
+ assert.equal(emittedOther.length, 2);
+
channel.close();
otherChannel.close();
});
@@ -743,13 +771,13 @@ if (isNode) {
useOptions.push({
type: 'node',
node: {
- useFastPath: true
+ useFastPath: false
}
});
useOptions.push({
type: 'node',
node: {
- useFastPath: false
+ useFastPath: true
}
});
} else {
diff --git a/test/scripts/e2e.js b/test/scripts/e2e.js
index 5a2095db..f501fd61 100644
--- a/test/scripts/e2e.js
+++ b/test/scripts/e2e.js
@@ -14,7 +14,9 @@ var {
randomNumber,
randomBoolean
} = require('async-test-util');
-
+import {
+ Subject
+} from 'rxjs';
function run() {
console.log('run()');
@@ -136,6 +138,8 @@ function run() {
});
});
}
+
+ await wait(1000);
console.log('========== START SENDING MESSAGES ' + channel.type);
startTime = new Date().getTime();
channel.postMessage({
@@ -258,6 +262,15 @@ function run() {
const perRun = 100;
let k = 0;
let done = 0;
+
+
+ const messages$ = new Subject();
+ const workerListener = msg => {
+ messages$.next(msg);
+ }
+ channel.addEventListener('message', workerListener);
+ await wait(1000);
+
while (t > 0) {
t--;
await Promise.all(
@@ -269,17 +282,16 @@ function run() {
const msgId = 'worker-test-' + startTime + '-' + k++;
const waitForResponsePromise = new Promise(res => {
- const listener = msg => {
+ const sub = messages$.subscribe(msg => {
if (msg.answer == true && msg.original.id === msgId) {
console.dir('msg for response:;:');
console.dir(msg);
done++;
messageCountWorkerContainer.innerHTML = done;
- channel.removeEventListener('message', listener);
+ sub.unsubscribe();
res();
}
- };
- channel.addEventListener('message', listener);
+ });
});
channel.postMessage({
from: 'main-worker',
@@ -300,6 +312,8 @@ function run() {
);
}
+ channel.removeEventListener('message', workerListener);
+
body.style.backgroundColor = 'green';
stateContainer.innerHTML = 'SUCCESS'
const amountTime = new Date().getTime() - startTime;
diff --git a/test/unit/node.method.test.js b/test/unit/node.method.test.js
index 4cb7cc64..dd21283e 100644
--- a/test/unit/node.method.test.js
+++ b/test/unit/node.method.test.js
@@ -127,11 +127,11 @@ describe('unit/node.method.test.js', () => {
await NodeMethod.ensureFoldersExist(channelName);
const sockets = await Promise.all(
new Array(2).fill(0)
- .map(async () => {
- const readerUuid = AsyncTestUtil.randomString(6);
- const socket = await NodeMethod.createSocketEventEmitter(channelName, readerUuid);
- return socket;
- })
+ .map(async () => {
+ const readerUuid = AsyncTestUtil.randomString(6);
+ const socket = await NodeMethod.createSocketEventEmitter(channelName, readerUuid);
+ return socket;
+ })
);
sockets.forEach(socket => socket.server.close());
});
@@ -143,12 +143,12 @@ describe('unit/node.method.test.js', () => {
// ensure we have more then 30 channel-folders
const sockets = await Promise.all(
new Array(35).fill(0)
- .map(async () => {
- const uid = AsyncTestUtil.randomString(6);
- const cN = AsyncTestUtil.randomString(12);
- await NodeMethod.ensureFoldersExist(cN);
- return NodeMethod.createSocketEventEmitter(cN, uid);
- })
+ .map(async () => {
+ const uid = AsyncTestUtil.randomString(6);
+ const cN = AsyncTestUtil.randomString(12);
+ await NodeMethod.ensureFoldersExist(cN);
+ return NodeMethod.createSocketEventEmitter(cN, uid);
+ })
);
await NodeMethod.ensureFoldersExist(channelName);
@@ -199,7 +199,11 @@ describe('unit/node.method.test.js', () => {
foo: 'bar'
};
- const msgObj = await NodeMethod.writeMessage(channelName, readerUuid, messageJson);
+ const msgObj = await NodeMethod.writeMessage(
+ channelName,
+ readerUuid,
+ messageJson
+ );
const exists = require('fs').existsSync(msgObj.path);
assert.ok(exists);
@@ -216,12 +220,12 @@ describe('unit/node.method.test.js', () => {
const sockets = await Promise.all(
new Array(5).fill(0)
- .map(() => AsyncTestUtil.randomString(6))
- .map(async (readerUuid) => {
- await NodeMethod.createSocketInfoFile(channelName, readerUuid);
- const s = await NodeMethod.createSocketEventEmitter(channelName, readerUuid);
- return s;
- })
+ .map(() => AsyncTestUtil.randomString(6))
+ .map(async (readerUuid) => {
+ await NodeMethod.createSocketInfoFile(channelName, readerUuid);
+ const s = await NodeMethod.createSocketEventEmitter(channelName, readerUuid);
+ return s;
+ })
);
const uuids = await NodeMethod.getReadersUuids(channelName);
@@ -266,7 +270,6 @@ describe('unit/node.method.test.js', () => {
const messages = await NodeMethod.getAllMessages(channelName);
assert.equal(messages.length, 2);
assert.ok(messages[0].path);
- assert.ok(messages[0].time);
assert.ok(messages[0].senderUuid);
assert.ok(messages[0].token);
});
@@ -299,7 +302,7 @@ describe('unit/node.method.test.js', () => {
// write 5 messages
await Promise.all(
new Array(5).fill(0)
- .map(() => NodeMethod.writeMessage(channelName, readerUuid, messageJson))
+ .map(() => NodeMethod.writeMessage(channelName, readerUuid, messageJson))
);
// w8 until they time out
@@ -437,7 +440,7 @@ describe('unit/node.method.test.js', () => {
});
});
describe('other', () => {
- it('should have cleaned up the messages', async function() {
+ it('should have cleaned up the messages', async function () {
this.timeout(1000 * 20); // slow on windows
const channelOptions = {
node: {
@@ -454,7 +457,7 @@ describe('unit/node.method.test.js', () => {
// send 100 messages
await Promise.all(
new Array(100).fill(0)
- .map(() => NodeMethod.postMessage(channelStateOwn, msgJson))
+ .map(() => NodeMethod.postMessage(channelStateOwn, msgJson))
);
// w8 until ttl has reached
@@ -463,7 +466,7 @@ describe('unit/node.method.test.js', () => {
// send 100 messages again to trigger cleanup
await Promise.all(
new Array(100).fill(0)
- .map(() => NodeMethod.postMessage(channelStateOwn, msgJson))
+ .map(() => NodeMethod.postMessage(channelStateOwn, msgJson))
);
// ensure only the last 100 messages are here
@@ -508,15 +511,15 @@ describe('unit/node.method.test.js', () => {
const channelName = AsyncTestUtil.randomString(12);
const readers = await Promise.all(
new Array(50).fill(0)
- .map(async () => {
- const channelState = await NodeMethod.create(channelName);
- const emitted = [];
- NodeMethod.onMessage(channelState, msg => emitted.push(msg), new Date().getMilliseconds());
- return {
- channelState,
- emitted
- };
- })
+ .map(async () => {
+ const channelState = await NodeMethod.create(channelName);
+ const emitted = [];
+ NodeMethod.onMessage(channelState, msg => emitted.push(msg), new Date().getMilliseconds());
+ return {
+ channelState,
+ emitted
+ };
+ })
);
const senderState = await NodeMethod.create(channelName);
@@ -524,9 +527,9 @@ describe('unit/node.method.test.js', () => {
// send 100 messages
await Promise.all(
new Array(100).fill(0)
- .map(() => NodeMethod.postMessage(senderState, {
- foo: 'bar'
- }))
+ .map(() => NodeMethod.postMessage(senderState, {
+ foo: 'bar'
+ }))
);
await AsyncTestUtil.waitUntil(() => {
@@ -553,8 +556,8 @@ describe('unit/node.method.test.js', () => {
const otherStates = await Promise.all(
new Array(10)
- .fill(0)
- .map(() => NodeMethod.create(channelName))
+ .fill(0)
+ .map(() => NodeMethod.create(channelName))
);
NodeMethod.refreshReaderClients(channelStateOwn);
From 5b0f7aa15e8f9c8032a36863332a7580f0d93f11 Mon Sep 17 00:00:00 2001
From: pubkey <8926560+pubkey@users.noreply.github.com>
Date: Mon, 27 Nov 2023 23:46:27 +0100
Subject: [PATCH 56/82] 7.0.0
---
CHANGELOG.md | 4 ++
dist/es5node/broadcast-channel.js | 13 +-----
dist/es5node/methods/native.js | 5 ++-
dist/es5node/methods/node.js | 10 +++--
dist/es5node/methods/simulate.js | 27 +++++++------
dist/es5node/util.js | 16 +++-----
dist/esbrowser/broadcast-channel.js | 13 +-----
dist/esbrowser/methods/native.js | 5 ++-
dist/esbrowser/methods/node.js | 10 +++--
dist/esbrowser/methods/simulate.js | 25 +++++++-----
dist/esbrowser/util.js | 16 +++-----
dist/esnode/broadcast-channel.js | 13 +-----
dist/esnode/methods/native.js | 5 ++-
dist/esnode/methods/node.js | 10 +++--
dist/esnode/methods/simulate.js | 25 +++++++-----
dist/esnode/util.js | 16 +++-----
dist/lib/broadcast-channel.js | 13 +-----
dist/lib/browser.js | 61 ++++++++++++-----------------
dist/lib/browser.min.js | 2 +-
dist/lib/methods/native.js | 5 ++-
dist/lib/methods/node.js | 10 +++--
dist/lib/methods/simulate.js | 27 +++++++------
dist/lib/util.js | 16 +++-----
docs/e2e.js | 22 ++++++-----
docs/iframe.js | 1 -
docs/index.js | 1 -
docs/leader-iframe.js | 1 -
docs/worker.js | 1 -
package.json | 2 +-
29 files changed, 171 insertions(+), 204 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d6655f43..c3e054d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,10 @@
## X.X.X (comming soon)
+## 7.0.0 (27 November 2023)
+
+- CHANGE do not emit messages that have been existed before the channel was created.
+
## 6.0.0 (30 October 2023)
- ADD support for the Deno runtime
diff --git a/dist/es5node/broadcast-channel.js b/dist/es5node/broadcast-channel.js
index 07f70413..8cfed316 100644
--- a/dist/es5node/broadcast-channel.js
+++ b/dist/es5node/broadcast-channel.js
@@ -237,18 +237,7 @@ function _startListening(channel) {
var listenerFn = function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (listenerObject) {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- var hundredMsInMicro = 100 * 1000;
- var minMessageTime = listenerObject.time - hundredMsInMicro;
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
diff --git a/dist/es5node/methods/native.js b/dist/es5node/methods/native.js
index 0ae3d2c1..9f6d0dff 100644
--- a/dist/es5node/methods/native.js
+++ b/dist/es5node/methods/native.js
@@ -17,14 +17,15 @@ var microSeconds = exports.microSeconds = _util.microSeconds;
var type = exports.type = 'native';
function create(channelName) {
var state = {
+ time: (0, _util.microSeconds)(),
messagesCallback: null,
bc: new BroadcastChannel(channelName),
subFns: [] // subscriberFunctions
};
- state.bc.onmessage = function (msg) {
+ state.bc.onmessage = function (msgEvent) {
if (state.messagesCallback) {
- state.messagesCallback(msg.data);
+ state.messagesCallback(msgEvent.data);
}
};
return state;
diff --git a/dist/es5node/methods/node.js b/dist/es5node/methods/node.js
index e67c3425..97cad7b7 100644
--- a/dist/es5node/methods/node.js
+++ b/dist/es5node/methods/node.js
@@ -440,11 +440,13 @@ function _openClientConnection() {
return _openClientConnection.apply(this, arguments);
}
function writeMessage(channelName, readerUuid, messageJson, paths) {
+ var time = messageJson.time;
+ if (!time) {
+ time = microSeconds();
+ }
paths = paths || getPaths(channelName);
- var time = microSeconds();
var writeObject = {
uuid: readerUuid,
- time: time,
data: messageJson
};
var token = (0, _util2.randomToken)();
@@ -687,8 +689,8 @@ function _filterMessage(msgObj, state) {
if (msgObj.senderUuid === state.uuid) return false; // not send by own
if (state.emittedMessagesIds.has(msgObj.token)) return false; // not already emitted
if (!state.messagesCallback) return false; // no listener
- if (msgObj.time < state.messagesCallbackTime) return false; // not older then onMessageCallback
- if (msgObj.time < state.time) return false; // msgObj is older then channel
+ if (msgObj.time < state.messagesCallbackTime) return false; // not older than onMessageCallback
+ if (msgObj.time < state.time) return false; // msgObj is older than channel
state.emittedMessagesIds.add(msgObj.token);
return true;
diff --git a/dist/es5node/methods/simulate.js b/dist/es5node/methods/simulate.js
index 99077bad..f9d7afd3 100644
--- a/dist/es5node/methods/simulate.js
+++ b/dist/es5node/methods/simulate.js
@@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.SimulateMethod = void 0;
+exports.SimulateMethod = exports.SIMULATE_DELAY_TIME = void 0;
exports.averageResponseTime = averageResponseTime;
exports.canBeUsed = canBeUsed;
exports.close = close;
@@ -18,6 +18,7 @@ var type = exports.type = 'simulate';
var SIMULATE_CHANNELS = new Set();
function create(channelName) {
var state = {
+ time: microSeconds(),
name: channelName,
messagesCallback: null
};
@@ -27,21 +28,25 @@ function create(channelName) {
function close(channelState) {
SIMULATE_CHANNELS["delete"](channelState);
}
+var SIMULATE_DELAY_TIME = exports.SIMULATE_DELAY_TIME = 5;
function postMessage(channelState, messageJson) {
return new Promise(function (res) {
return setTimeout(function () {
var channelArray = Array.from(SIMULATE_CHANNELS);
- channelArray.filter(function (channel) {
- return channel.name === channelState.name;
- }).filter(function (channel) {
- return channel !== channelState;
- }).filter(function (channel) {
- return !!channel.messagesCallback;
- }).forEach(function (channel) {
- return channel.messagesCallback(messageJson);
+ channelArray.forEach(function (channel) {
+ if (channel.name === channelState.name &&
+ // has same name
+ channel !== channelState &&
+ // not own channel
+ !!channel.messagesCallback &&
+ // has subscribers
+ channel.time < messageJson.time // channel not created after postMessage() call
+ ) {
+ channel.messagesCallback(messageJson);
+ }
});
res();
- }, 5);
+ }, SIMULATE_DELAY_TIME);
});
}
function onMessage(channelState, fn) {
@@ -51,7 +56,7 @@ function canBeUsed() {
return true;
}
function averageResponseTime() {
- return 5;
+ return SIMULATE_DELAY_TIME;
}
var SimulateMethod = exports.SimulateMethod = {
create: create,
diff --git a/dist/es5node/util.js b/dist/es5node/util.js
index 7a81b411..2c50eb73 100644
--- a/dist/es5node/util.js
+++ b/dist/es5node/util.js
@@ -38,25 +38,21 @@ function randomToken() {
return Math.random().toString(36).substring(2);
}
var lastMs = 0;
-var additional = 0;
/**
- * returns the current time in micro-seconds,
+ * Returns the current unix time in micro-seconds,
* WARNING: This is a pseudo-function
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
* This is enough in browsers, and this function will not be used in nodejs.
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
*/
function microSeconds() {
- var ms = Date.now();
- if (ms === lastMs) {
- additional++;
- return ms * 1000 + additional;
- } else {
- lastMs = ms;
- additional = 0;
- return ms * 1000;
+ var ret = Date.now() * 1000; // milliseconds to microseconds
+ if (ret <= lastMs) {
+ ret = lastMs + 1;
}
+ lastMs = ret;
+ return ret;
}
/**
diff --git a/dist/esbrowser/broadcast-channel.js b/dist/esbrowser/broadcast-channel.js
index c2d44376..a9150fb4 100644
--- a/dist/esbrowser/broadcast-channel.js
+++ b/dist/esbrowser/broadcast-channel.js
@@ -230,18 +230,7 @@ function _startListening(channel) {
var listenerFn = function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (listenerObject) {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- var hundredMsInMicro = 100 * 1000;
- var minMessageTime = listenerObject.time - hundredMsInMicro;
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
diff --git a/dist/esbrowser/methods/native.js b/dist/esbrowser/methods/native.js
index 6c1bbf88..9e38e952 100644
--- a/dist/esbrowser/methods/native.js
+++ b/dist/esbrowser/methods/native.js
@@ -3,14 +3,15 @@ export var microSeconds = micro;
export var type = 'native';
export function create(channelName) {
var state = {
+ time: micro(),
messagesCallback: null,
bc: new BroadcastChannel(channelName),
subFns: [] // subscriberFunctions
};
- state.bc.onmessage = function (msg) {
+ state.bc.onmessage = function (msgEvent) {
if (state.messagesCallback) {
- state.messagesCallback(msg.data);
+ state.messagesCallback(msgEvent.data);
}
};
return state;
diff --git a/dist/esbrowser/methods/node.js b/dist/esbrowser/methods/node.js
index 31bd7da1..6fb420be 100644
--- a/dist/esbrowser/methods/node.js
+++ b/dist/esbrowser/methods/node.js
@@ -407,11 +407,13 @@ function _openClientConnection() {
return _openClientConnection.apply(this, arguments);
}
export function writeMessage(channelName, readerUuid, messageJson, paths) {
+ var time = messageJson.time;
+ if (!time) {
+ time = microSeconds();
+ }
paths = paths || getPaths(channelName);
- var time = microSeconds();
var writeObject = {
uuid: readerUuid,
- time: time,
data: messageJson
};
var token = randomToken();
@@ -654,8 +656,8 @@ export function _filterMessage(msgObj, state) {
if (msgObj.senderUuid === state.uuid) return false; // not send by own
if (state.emittedMessagesIds.has(msgObj.token)) return false; // not already emitted
if (!state.messagesCallback) return false; // no listener
- if (msgObj.time < state.messagesCallbackTime) return false; // not older then onMessageCallback
- if (msgObj.time < state.time) return false; // msgObj is older then channel
+ if (msgObj.time < state.messagesCallbackTime) return false; // not older than onMessageCallback
+ if (msgObj.time < state.time) return false; // msgObj is older than channel
state.emittedMessagesIds.add(msgObj.token);
return true;
diff --git a/dist/esbrowser/methods/simulate.js b/dist/esbrowser/methods/simulate.js
index b9debb13..9d624539 100644
--- a/dist/esbrowser/methods/simulate.js
+++ b/dist/esbrowser/methods/simulate.js
@@ -4,6 +4,7 @@ export var type = 'simulate';
var SIMULATE_CHANNELS = new Set();
export function create(channelName) {
var state = {
+ time: microSeconds(),
name: channelName,
messagesCallback: null
};
@@ -13,21 +14,25 @@ export function create(channelName) {
export function close(channelState) {
SIMULATE_CHANNELS["delete"](channelState);
}
+export var SIMULATE_DELAY_TIME = 5;
export function postMessage(channelState, messageJson) {
return new Promise(function (res) {
return setTimeout(function () {
var channelArray = Array.from(SIMULATE_CHANNELS);
- channelArray.filter(function (channel) {
- return channel.name === channelState.name;
- }).filter(function (channel) {
- return channel !== channelState;
- }).filter(function (channel) {
- return !!channel.messagesCallback;
- }).forEach(function (channel) {
- return channel.messagesCallback(messageJson);
+ channelArray.forEach(function (channel) {
+ if (channel.name === channelState.name &&
+ // has same name
+ channel !== channelState &&
+ // not own channel
+ !!channel.messagesCallback &&
+ // has subscribers
+ channel.time < messageJson.time // channel not created after postMessage() call
+ ) {
+ channel.messagesCallback(messageJson);
+ }
});
res();
- }, 5);
+ }, SIMULATE_DELAY_TIME);
});
}
export function onMessage(channelState, fn) {
@@ -37,7 +42,7 @@ export function canBeUsed() {
return true;
}
export function averageResponseTime() {
- return 5;
+ return SIMULATE_DELAY_TIME;
}
export var SimulateMethod = {
create: create,
diff --git a/dist/esbrowser/util.js b/dist/esbrowser/util.js
index 697cd8fc..e8160cbf 100644
--- a/dist/esbrowser/util.js
+++ b/dist/esbrowser/util.js
@@ -26,25 +26,21 @@ export function randomToken() {
return Math.random().toString(36).substring(2);
}
var lastMs = 0;
-var additional = 0;
/**
- * returns the current time in micro-seconds,
+ * Returns the current unix time in micro-seconds,
* WARNING: This is a pseudo-function
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
* This is enough in browsers, and this function will not be used in nodejs.
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
*/
export function microSeconds() {
- var ms = Date.now();
- if (ms === lastMs) {
- additional++;
- return ms * 1000 + additional;
- } else {
- lastMs = ms;
- additional = 0;
- return ms * 1000;
+ var ret = Date.now() * 1000; // milliseconds to microseconds
+ if (ret <= lastMs) {
+ ret = lastMs + 1;
}
+ lastMs = ret;
+ return ret;
}
/**
diff --git a/dist/esnode/broadcast-channel.js b/dist/esnode/broadcast-channel.js
index c2d44376..a9150fb4 100644
--- a/dist/esnode/broadcast-channel.js
+++ b/dist/esnode/broadcast-channel.js
@@ -230,18 +230,7 @@ function _startListening(channel) {
var listenerFn = function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (listenerObject) {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- var hundredMsInMicro = 100 * 1000;
- var minMessageTime = listenerObject.time - hundredMsInMicro;
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
diff --git a/dist/esnode/methods/native.js b/dist/esnode/methods/native.js
index 6c1bbf88..9e38e952 100644
--- a/dist/esnode/methods/native.js
+++ b/dist/esnode/methods/native.js
@@ -3,14 +3,15 @@ export var microSeconds = micro;
export var type = 'native';
export function create(channelName) {
var state = {
+ time: micro(),
messagesCallback: null,
bc: new BroadcastChannel(channelName),
subFns: [] // subscriberFunctions
};
- state.bc.onmessage = function (msg) {
+ state.bc.onmessage = function (msgEvent) {
if (state.messagesCallback) {
- state.messagesCallback(msg.data);
+ state.messagesCallback(msgEvent.data);
}
};
return state;
diff --git a/dist/esnode/methods/node.js b/dist/esnode/methods/node.js
index 31bd7da1..6fb420be 100644
--- a/dist/esnode/methods/node.js
+++ b/dist/esnode/methods/node.js
@@ -407,11 +407,13 @@ function _openClientConnection() {
return _openClientConnection.apply(this, arguments);
}
export function writeMessage(channelName, readerUuid, messageJson, paths) {
+ var time = messageJson.time;
+ if (!time) {
+ time = microSeconds();
+ }
paths = paths || getPaths(channelName);
- var time = microSeconds();
var writeObject = {
uuid: readerUuid,
- time: time,
data: messageJson
};
var token = randomToken();
@@ -654,8 +656,8 @@ export function _filterMessage(msgObj, state) {
if (msgObj.senderUuid === state.uuid) return false; // not send by own
if (state.emittedMessagesIds.has(msgObj.token)) return false; // not already emitted
if (!state.messagesCallback) return false; // no listener
- if (msgObj.time < state.messagesCallbackTime) return false; // not older then onMessageCallback
- if (msgObj.time < state.time) return false; // msgObj is older then channel
+ if (msgObj.time < state.messagesCallbackTime) return false; // not older than onMessageCallback
+ if (msgObj.time < state.time) return false; // msgObj is older than channel
state.emittedMessagesIds.add(msgObj.token);
return true;
diff --git a/dist/esnode/methods/simulate.js b/dist/esnode/methods/simulate.js
index b9debb13..9d624539 100644
--- a/dist/esnode/methods/simulate.js
+++ b/dist/esnode/methods/simulate.js
@@ -4,6 +4,7 @@ export var type = 'simulate';
var SIMULATE_CHANNELS = new Set();
export function create(channelName) {
var state = {
+ time: microSeconds(),
name: channelName,
messagesCallback: null
};
@@ -13,21 +14,25 @@ export function create(channelName) {
export function close(channelState) {
SIMULATE_CHANNELS["delete"](channelState);
}
+export var SIMULATE_DELAY_TIME = 5;
export function postMessage(channelState, messageJson) {
return new Promise(function (res) {
return setTimeout(function () {
var channelArray = Array.from(SIMULATE_CHANNELS);
- channelArray.filter(function (channel) {
- return channel.name === channelState.name;
- }).filter(function (channel) {
- return channel !== channelState;
- }).filter(function (channel) {
- return !!channel.messagesCallback;
- }).forEach(function (channel) {
- return channel.messagesCallback(messageJson);
+ channelArray.forEach(function (channel) {
+ if (channel.name === channelState.name &&
+ // has same name
+ channel !== channelState &&
+ // not own channel
+ !!channel.messagesCallback &&
+ // has subscribers
+ channel.time < messageJson.time // channel not created after postMessage() call
+ ) {
+ channel.messagesCallback(messageJson);
+ }
});
res();
- }, 5);
+ }, SIMULATE_DELAY_TIME);
});
}
export function onMessage(channelState, fn) {
@@ -37,7 +42,7 @@ export function canBeUsed() {
return true;
}
export function averageResponseTime() {
- return 5;
+ return SIMULATE_DELAY_TIME;
}
export var SimulateMethod = {
create: create,
diff --git a/dist/esnode/util.js b/dist/esnode/util.js
index 697cd8fc..e8160cbf 100644
--- a/dist/esnode/util.js
+++ b/dist/esnode/util.js
@@ -26,25 +26,21 @@ export function randomToken() {
return Math.random().toString(36).substring(2);
}
var lastMs = 0;
-var additional = 0;
/**
- * returns the current time in micro-seconds,
+ * Returns the current unix time in micro-seconds,
* WARNING: This is a pseudo-function
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
* This is enough in browsers, and this function will not be used in nodejs.
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
*/
export function microSeconds() {
- var ms = Date.now();
- if (ms === lastMs) {
- additional++;
- return ms * 1000 + additional;
- } else {
- lastMs = ms;
- additional = 0;
- return ms * 1000;
+ var ret = Date.now() * 1000; // milliseconds to microseconds
+ if (ret <= lastMs) {
+ ret = lastMs + 1;
}
+ lastMs = ret;
+ return ret;
}
/**
diff --git a/dist/lib/broadcast-channel.js b/dist/lib/broadcast-channel.js
index 07f70413..8cfed316 100644
--- a/dist/lib/broadcast-channel.js
+++ b/dist/lib/broadcast-channel.js
@@ -237,18 +237,7 @@ function _startListening(channel) {
var listenerFn = function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (listenerObject) {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- var hundredMsInMicro = 100 * 1000;
- var minMessageTime = listenerObject.time - hundredMsInMicro;
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
diff --git a/dist/lib/browser.js b/dist/lib/browser.js
index 13b5d399..5d4b78d5 100644
--- a/dist/lib/browser.js
+++ b/dist/lib/browser.js
@@ -238,18 +238,7 @@ function _startListening(channel) {
var listenerFn = function listenerFn(msgObj) {
channel._addEL[msgObj.type].forEach(function (listenerObject) {
- /**
- * Getting the current time in JavaScript has no good precision.
- * So instead of only listening to events that happened 'after' the listener
- * was added, we also listen to events that happened 100ms before it.
- * This ensures that when another process, like a WebWorker, sends events
- * we do not miss them out because their timestamp is a bit off compared to the main process.
- * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.
- * @link https://johnresig.com/blog/accuracy-of-javascript-time/
- */
- var hundredMsInMicro = 100 * 1000;
- var minMessageTime = listenerObject.time - hundredMsInMicro;
- if (msgObj.time >= minMessageTime) {
+ if (msgObj.time >= listenerObject.time) {
listenerObject.fn(msgObj.data);
}
});
@@ -1400,14 +1389,15 @@ var microSeconds = exports.microSeconds = _util.microSeconds;
var type = exports.type = 'native';
function create(channelName) {
var state = {
+ time: (0, _util.microSeconds)(),
messagesCallback: null,
bc: new BroadcastChannel(channelName),
subFns: [] // subscriberFunctions
};
- state.bc.onmessage = function (msg) {
+ state.bc.onmessage = function (msgEvent) {
if (state.messagesCallback) {
- state.messagesCallback(msg.data);
+ state.messagesCallback(msgEvent.data);
}
};
return state;
@@ -1463,7 +1453,7 @@ var NativeMethod = exports.NativeMethod = {
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.SimulateMethod = void 0;
+exports.SimulateMethod = exports.SIMULATE_DELAY_TIME = void 0;
exports.averageResponseTime = averageResponseTime;
exports.canBeUsed = canBeUsed;
exports.close = close;
@@ -1478,6 +1468,7 @@ var type = exports.type = 'simulate';
var SIMULATE_CHANNELS = new Set();
function create(channelName) {
var state = {
+ time: microSeconds(),
name: channelName,
messagesCallback: null
};
@@ -1487,21 +1478,25 @@ function create(channelName) {
function close(channelState) {
SIMULATE_CHANNELS["delete"](channelState);
}
+var SIMULATE_DELAY_TIME = exports.SIMULATE_DELAY_TIME = 5;
function postMessage(channelState, messageJson) {
return new Promise(function (res) {
return setTimeout(function () {
var channelArray = Array.from(SIMULATE_CHANNELS);
- channelArray.filter(function (channel) {
- return channel.name === channelState.name;
- }).filter(function (channel) {
- return channel !== channelState;
- }).filter(function (channel) {
- return !!channel.messagesCallback;
- }).forEach(function (channel) {
- return channel.messagesCallback(messageJson);
+ channelArray.forEach(function (channel) {
+ if (channel.name === channelState.name &&
+ // has same name
+ channel !== channelState &&
+ // not own channel
+ !!channel.messagesCallback &&
+ // has subscribers
+ channel.time < messageJson.time // channel not created after postMessage() call
+ ) {
+ channel.messagesCallback(messageJson);
+ }
});
res();
- }, 5);
+ }, SIMULATE_DELAY_TIME);
});
}
function onMessage(channelState, fn) {
@@ -1511,7 +1506,7 @@ function canBeUsed() {
return true;
}
function averageResponseTime() {
- return 5;
+ return SIMULATE_DELAY_TIME;
}
var SimulateMethod = exports.SimulateMethod = {
create: create,
@@ -1604,25 +1599,21 @@ function randomToken() {
return Math.random().toString(36).substring(2);
}
var lastMs = 0;
-var additional = 0;
/**
- * returns the current time in micro-seconds,
+ * Returns the current unix time in micro-seconds,
* WARNING: This is a pseudo-function
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
* This is enough in browsers, and this function will not be used in nodejs.
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
*/
function microSeconds() {
- var ms = Date.now();
- if (ms === lastMs) {
- additional++;
- return ms * 1000 + additional;
- } else {
- lastMs = ms;
- additional = 0;
- return ms * 1000;
+ var ret = Date.now() * 1000; // milliseconds to microseconds
+ if (ret <= lastMs) {
+ ret = lastMs + 1;
}
+ lastMs = ret;
+ return ret;
}
/**
diff --git a/dist/lib/browser.min.js b/dist/lib/browser.min.js
index 7e09252a..530a9ca4 100644
--- a/dist/lib/browser.min.js
+++ b/dist/lib/browser.min.js
@@ -1 +1 @@
-!function o(r,i,s){function a(t,e){if(!i[t]){if(!r[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(u)return u(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}n=i[t]={exports:{}},r[t][0].call(n.exports,function(e){return a(r[t][1][e]||e)},n,n.exports,o,r,i,s)}return i[t].exports}for(var u="function"==typeof require&&require,e=0;e=t&&e.fn(n.data)})},r=i.method.microSeconds(),i._prepP?i._prepP.then(function(){i._iL=!0,i.method.onMessage(i._state,o,r)}):(i._iL=!0,i.method.onMessage(i._state,o,r)))}function f(e,t,n){e._addEL[t]=e._addEL[t].filter(function(e){return e!==n});t=e;t._iL&&!l(t)&&(t._iL=!1,e=t.method.microSeconds(),t.method.onMessage(t._state,null,e))}e._pubkey=!0,e.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return c(this,"message",e)},postInternal:function(e){return c(this,"internal",e)},set onmessage(e){var t={time:this.method.microSeconds(),fn:e};f(this,"message",this._onML),e&&"function"==typeof e?(this._onML=t,d(this,"message",t)):this._onML=null},addEventListener:function(e,t){var n=this.method.microSeconds();d(this,e,{time:n,fn:t})},removeEventListener:function(e,t){var n=this._addEL[e].find(function(e){return e.fn===t});f(this,e,n)},close:function(){var e,t=this;if(!this.closed)return a.delete(this),this.closed=!0,e=this._prepP||r.PROMISE_RESOLVED_VOID,this._onML=null,this._addEL.message=[],e.then(function(){return Promise.all(Array.from(t._uMP))}).then(function(){return Promise.all(t._befC.map(function(e){return e()}))}).then(function(){return t.method.close(t._state)})},get type(){return this.method.type},get isClosed(){return this.closed}}},{"./method-chooser.js":8,"./options.js":13,"./util.js":14}],2:[function(e,t,n){"use strict";var e=e("./index.es5.js"),o=e.BroadcastChannel,e=e.createLeaderElection;window.BroadcastChannel2=o,window.createLeaderElection=e},{"./index.es5.js":3}],3:[function(e,t,n){"use strict";e=e("./index.js");t.exports={BroadcastChannel:e.BroadcastChannel,createLeaderElection:e.createLeaderElection,clearNodeFolder:e.clearNodeFolder,enforceOptions:e.enforceOptions,beLeader:e.beLeader}},{"./index.js":4}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"BroadcastChannel",{enumerable:!0,get:function(){return o.BroadcastChannel}}),Object.defineProperty(n,"OPEN_BROADCAST_CHANNELS",{enumerable:!0,get:function(){return o.OPEN_BROADCAST_CHANNELS}}),Object.defineProperty(n,"beLeader",{enumerable:!0,get:function(){return i.beLeader}}),Object.defineProperty(n,"clearNodeFolder",{enumerable:!0,get:function(){return o.clearNodeFolder}}),Object.defineProperty(n,"createLeaderElection",{enumerable:!0,get:function(){return r.createLeaderElection}}),Object.defineProperty(n,"enforceOptions",{enumerable:!0,get:function(){return o.enforceOptions}});var o=e("./broadcast-channel.js"),r=e("./leader-election.js"),i=e("./leader-election-util.js")},{"./broadcast-channel.js":1,"./leader-election-util.js":5,"./leader-election.js":7}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.beLeader=function(t){t.isLeader=!0,t._hasLeader=!0;function e(e){"leader"===e.context&&"apply"===e.action&&r(t,"tell"),"leader"!==e.context||"tell"!==e.action||t._dpLC||(t._dpLC=!0,t._dpL(),r(t,"tell"))}var n=(0,o.add)(function(){return t.die()});t._unl.push(n);return t.broadcastChannel.addEventListener("internal",e),t._lstns.push(e),r(t,"tell")},n.sendLeaderMessage=r;var o=e("unload");function r(e,t){t={context:"leader",action:t,token:e.token};return e.broadcastChannel.postInternal(t)}},{unload:20}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.LeaderElectionWebLock=void 0;var o=e("./util.js"),r=e("./leader-election-util.js");(n.LeaderElectionWebLock=function(e,t){var n=this;(this.broadcastChannel=e)._befC.push(function(){return n.die()}),this._options=t,this.isLeader=!1,this.isDead=!1,this.token=(0,o.randomToken)(),this._lstns=[],this._unl=[],this._dpL=function(){},this._dpLC=!1,this._wKMC={},this.lN="pubkey-bc||"+e.method.type+"||"+e.name}).prototype={hasLeader:function(){var t=this;return navigator.locks.query().then(function(e){e=e.held?e.held.filter(function(e){return e.name===t.lN}):[];return!!(e&&0s.token&&n(),"tell"===e.action)&&(n(),s._hasLeader=!0)}),r=i?4*s._options.responseTime:s._options.responseTime,(0,u.sendLeaderMessage)(s,"apply").then(function(){return Promise.race([(0,a.sleep)(r),e.then(function(){return Promise.reject(new Error)})])}).then(function(){return(0,u.sendLeaderMessage)(s,"apply")}).then(function(){return Promise.race([(0,a.sleep)(r),e.then(function(){return Promise.reject(new Error)})])}).catch(function(){}).then(function(){return s.broadcastChannel.removeEventListener("internal",o),!t&&(0,u.beLeader)(s).then(function(){return!0})}));var t,n,e,o,r}).then(function(){s._aplQC=s._aplQC-1}),this._aplQ.then(function(){return s.isLeader}))},awaitLeadership:function(){return this._aLP||(this._aLP=function(r){if(r.isLeader)return a.PROMISE_RESOLVED_VOID;return new Promise(function(e){var t=!1;function n(){t||(t=!0,r.broadcastChannel.removeEventListener("internal",o),e(!0))}r.applyOnce().then(function(){r.isLeader&&n()});(function e(){return(0,a.sleep)(r._options.fallbackInterval).then(function(){if(!r.isDead&&!t)return r.isLeader?void n():r.applyOnce(!0).then(function(){(r.isLeader?n:e)()})})})();var o=function(e){"leader"===e.context&&"death"===e.action&&(r._hasLeader=!1,r.applyOnce().then(function(){r.isLeader&&n()}))};r.broadcastChannel.addEventListener("internal",o),r._lstns.push(o)})}(this)),this._aLP},set onduplicate(e){this._dpL=e},die:function(){var t=this;return this._lstns.forEach(function(e){return t.broadcastChannel.removeEventListener("internal",e)}),this._lstns=[],this._unl.forEach(function(e){return e.remove()}),this._unl=[],this.isLeader&&(this._hasLeader=!1,this.isLeader=!1),this.isDead=!0,(0,u.sendLeaderMessage)(this,"death")}}},{"./leader-election-util.js":5,"./leader-election-web-lock.js":6,"./util.js":14}],8:[function(e,t,n){"use strict";e("@babel/runtime/helpers/typeof");Object.defineProperty(n,"__esModule",{value:!0}),n.chooseMethod=function(t){var e=[].concat(t.methods,s).filter(Boolean);if(t.type){if("simulate"===t.type)return i.SimulateMethod;var n=e.find(function(e){return e.type===t.type});if(n)return n;throw new Error("method-type "+t.type+" not found")}t.webWorkerSupport||(e=e.filter(function(e){return"idb"!==e.type}));n=e.find(function(e){return e.canBeUsed()});{if(n)return n;throw new Error("No usable method found in "+JSON.stringify(s.map(function(e){return e.type})))}};var n=e("./methods/native.js"),o=e("./methods/indexed-db.js"),r=e("./methods/localstorage.js"),i=e("./methods/simulate.js");var s=[n.NativeMethod,o.IndexedDBMethod,r.LocalstorageMethod]},{"./methods/indexed-db.js":9,"./methods/localstorage.js":10,"./methods/native.js":11,"./methods/simulate.js":12,"@babel/runtime/helpers/typeof":15}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.TRANSACTION_SETTINGS=n.IndexedDBMethod=void 0,n.averageResponseTime=E,n.canBeUsed=L,n.cleanOldMessages=v,n.close=g,n.commitIndexedDBTransaction=d,n.create=_,n.createDatabase=u,n.getAllMessages=function(e){var n=e.transaction(c,"readonly",l),o=n.objectStore(c),r=[];return new Promise(function(t){o.openCursor().onsuccess=function(e){e=e.target.result;e?(r.push(e.value),e.continue()):(d(n),t(r))}})},n.getIdb=a,n.getMessagesHigherThan=h,n.getOldMessages=m,n.microSeconds=void 0,n.onMessage=y,n.postMessage=w,n.removeMessagesById=p,n.type=void 0,n.writeMessage=f;var r=e("../util.js"),i=e("oblivious-set"),s=e("../options.js"),e=n.microSeconds=r.microSeconds,o="pubkey.broadcast-channel-0-",c="messages",l=n.TRANSACTION_SETTINGS={durability:"relaxed"};n.type="idb";function a(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof window){if(void 0!==window.mozIndexedDB)return window.mozIndexedDB;if(void 0!==window.webkitIndexedDB)return window.webkitIndexedDB;if(void 0!==window.msIndexedDB)return window.msIndexedDB}return!1}function d(e){e.commit&&e.commit()}function u(e){var n=a().open(o+e);return n.onupgradeneeded=function(e){e.target.result.createObjectStore(c,{keyPath:"id",autoIncrement:!0})},new Promise(function(e,t){n.onerror=function(e){return t(e)},n.onsuccess=function(){e(n.result)}})}function f(e,t,n){var o={uuid:t,time:Date.now(),data:n},r=e.transaction([c],"readwrite",l);return new Promise(function(e,t){r.oncomplete=function(){return e()},r.onerror=function(e){return t(e)},r.objectStore(c).add(o),d(r)})}function h(e,o){var r,i=e.transaction(c,"readonly",l),s=i.objectStore(c),a=[],u=IDBKeyRange.bound(o+1,1/0);return s.getAll?(r=s.getAll(u),new Promise(function(t,n){r.onerror=function(e){return n(e)},r.onsuccess=function(e){t(e.target.result)}})):new Promise(function(t,n){var e=function(){try{return u=IDBKeyRange.bound(o+1,1/0),s.openCursor(u)}catch(e){return s.openCursor()}}();e.onerror=function(e){return n(e)},e.onsuccess=function(e){e=e.target.result;e?e.value.idn.lastCursorId&&(n.lastCursorId=e.id),e}).filter(function(e){return t=n,(e=e).uuid!==t.uuid&&!(t.eMIs.has(e.id)||e.data.time{this._to=!1,o(this)},0))}clear(){this.map.clear()}},n.removeTooOldValues=o,n.now=i},{}],18:[function(e,t,n){var o,r,t=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}try{o="function"==typeof setTimeout?setTimeout:i}catch(e){o=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}function a(t){if(o===setTimeout)return setTimeout(t,0);if((o===i||!o)&&setTimeout)return(o=setTimeout)(t,0);try{return o(t,0)}catch(e){try{return o.call(null,t,0)}catch(e){return o.call(this,t,0)}}}var u,c=[],l=!1,d=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):d=-1,c.length)&&h()}function h(){if(!l){for(var e=a(f),t=(l=!0,c.length);t;){for(u=c,c=[];++d=e.time&&e.fn(t.data)})},r=i.method.microSeconds(),i._prepP?i._prepP.then(function(){i._iL=!0,i.method.onMessage(i._state,o,r)}):(i._iL=!0,i.method.onMessage(i._state,o,r)))}function f(e,t,n){e._addEL[t]=e._addEL[t].filter(function(e){return e!==n});t=e;t._iL&&!l(t)&&(t._iL=!1,e=t.method.microSeconds(),t.method.onMessage(t._state,null,e))}e._pubkey=!0,e.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return u(this,"message",e)},postInternal:function(e){return u(this,"internal",e)},set onmessage(e){var t={time:this.method.microSeconds(),fn:e};f(this,"message",this._onML),e&&"function"==typeof e?(this._onML=t,d(this,"message",t)):this._onML=null},addEventListener:function(e,t){var n=this.method.microSeconds();d(this,e,{time:n,fn:t})},removeEventListener:function(e,t){var n=this._addEL[e].find(function(e){return e.fn===t});f(this,e,n)},close:function(){var e,t=this;if(!this.closed)return a.delete(this),this.closed=!0,e=this._prepP||r.PROMISE_RESOLVED_VOID,this._onML=null,this._addEL.message=[],e.then(function(){return Promise.all(Array.from(t._uMP))}).then(function(){return Promise.all(t._befC.map(function(e){return e()}))}).then(function(){return t.method.close(t._state)})},get type(){return this.method.type},get isClosed(){return this.closed}}},{"./method-chooser.js":8,"./options.js":13,"./util.js":14}],2:[function(e,t,n){"use strict";var e=e("./index.es5.js"),o=e.BroadcastChannel,e=e.createLeaderElection;window.BroadcastChannel2=o,window.createLeaderElection=e},{"./index.es5.js":3}],3:[function(e,t,n){"use strict";e=e("./index.js");t.exports={BroadcastChannel:e.BroadcastChannel,createLeaderElection:e.createLeaderElection,clearNodeFolder:e.clearNodeFolder,enforceOptions:e.enforceOptions,beLeader:e.beLeader}},{"./index.js":4}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"BroadcastChannel",{enumerable:!0,get:function(){return o.BroadcastChannel}}),Object.defineProperty(n,"OPEN_BROADCAST_CHANNELS",{enumerable:!0,get:function(){return o.OPEN_BROADCAST_CHANNELS}}),Object.defineProperty(n,"beLeader",{enumerable:!0,get:function(){return i.beLeader}}),Object.defineProperty(n,"clearNodeFolder",{enumerable:!0,get:function(){return o.clearNodeFolder}}),Object.defineProperty(n,"createLeaderElection",{enumerable:!0,get:function(){return r.createLeaderElection}}),Object.defineProperty(n,"enforceOptions",{enumerable:!0,get:function(){return o.enforceOptions}});var o=e("./broadcast-channel.js"),r=e("./leader-election.js"),i=e("./leader-election-util.js")},{"./broadcast-channel.js":1,"./leader-election-util.js":5,"./leader-election.js":7}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.beLeader=function(t){t.isLeader=!0,t._hasLeader=!0;function e(e){"leader"===e.context&&"apply"===e.action&&r(t,"tell"),"leader"!==e.context||"tell"!==e.action||t._dpLC||(t._dpLC=!0,t._dpL(),r(t,"tell"))}var n=(0,o.add)(function(){return t.die()});t._unl.push(n);return t.broadcastChannel.addEventListener("internal",e),t._lstns.push(e),r(t,"tell")},n.sendLeaderMessage=r;var o=e("unload");function r(e,t){t={context:"leader",action:t,token:e.token};return e.broadcastChannel.postInternal(t)}},{unload:20}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.LeaderElectionWebLock=void 0;var o=e("./util.js"),r=e("./leader-election-util.js");(n.LeaderElectionWebLock=function(e,t){var n=this;(this.broadcastChannel=e)._befC.push(function(){return n.die()}),this._options=t,this.isLeader=!1,this.isDead=!1,this.token=(0,o.randomToken)(),this._lstns=[],this._unl=[],this._dpL=function(){},this._dpLC=!1,this._wKMC={},this.lN="pubkey-bc||"+e.method.type+"||"+e.name}).prototype={hasLeader:function(){var t=this;return navigator.locks.query().then(function(e){e=e.held?e.held.filter(function(e){return e.name===t.lN}):[];return!!(e&&0s.token&&n(),"tell"===e.action)&&(n(),s._hasLeader=!0)}),r=i?4*s._options.responseTime:s._options.responseTime,(0,c.sendLeaderMessage)(s,"apply").then(function(){return Promise.race([(0,a.sleep)(r),e.then(function(){return Promise.reject(new Error)})])}).then(function(){return(0,c.sendLeaderMessage)(s,"apply")}).then(function(){return Promise.race([(0,a.sleep)(r),e.then(function(){return Promise.reject(new Error)})])}).catch(function(){}).then(function(){return s.broadcastChannel.removeEventListener("internal",o),!t&&(0,c.beLeader)(s).then(function(){return!0})}));var t,n,e,o,r}).then(function(){s._aplQC=s._aplQC-1}),this._aplQ.then(function(){return s.isLeader}))},awaitLeadership:function(){return this._aLP||(this._aLP=function(r){if(r.isLeader)return a.PROMISE_RESOLVED_VOID;return new Promise(function(e){var t=!1;function n(){t||(t=!0,r.broadcastChannel.removeEventListener("internal",o),e(!0))}r.applyOnce().then(function(){r.isLeader&&n()});(function e(){return(0,a.sleep)(r._options.fallbackInterval).then(function(){if(!r.isDead&&!t)return r.isLeader?void n():r.applyOnce(!0).then(function(){(r.isLeader?n:e)()})})})();var o=function(e){"leader"===e.context&&"death"===e.action&&(r._hasLeader=!1,r.applyOnce().then(function(){r.isLeader&&n()}))};r.broadcastChannel.addEventListener("internal",o),r._lstns.push(o)})}(this)),this._aLP},set onduplicate(e){this._dpL=e},die:function(){var t=this;return this._lstns.forEach(function(e){return t.broadcastChannel.removeEventListener("internal",e)}),this._lstns=[],this._unl.forEach(function(e){return e.remove()}),this._unl=[],this.isLeader&&(this._hasLeader=!1,this.isLeader=!1),this.isDead=!0,(0,c.sendLeaderMessage)(this,"death")}}},{"./leader-election-util.js":5,"./leader-election-web-lock.js":6,"./util.js":14}],8:[function(e,t,n){"use strict";e("@babel/runtime/helpers/typeof");Object.defineProperty(n,"__esModule",{value:!0}),n.chooseMethod=function(t){var e=[].concat(t.methods,s).filter(Boolean);if(t.type){if("simulate"===t.type)return i.SimulateMethod;var n=e.find(function(e){return e.type===t.type});if(n)return n;throw new Error("method-type "+t.type+" not found")}t.webWorkerSupport||(e=e.filter(function(e){return"idb"!==e.type}));n=e.find(function(e){return e.canBeUsed()});{if(n)return n;throw new Error("No usable method found in "+JSON.stringify(s.map(function(e){return e.type})))}};var n=e("./methods/native.js"),o=e("./methods/indexed-db.js"),r=e("./methods/localstorage.js"),i=e("./methods/simulate.js");var s=[n.NativeMethod,o.IndexedDBMethod,r.LocalstorageMethod]},{"./methods/indexed-db.js":9,"./methods/localstorage.js":10,"./methods/native.js":11,"./methods/simulate.js":12,"@babel/runtime/helpers/typeof":15}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.TRANSACTION_SETTINGS=n.IndexedDBMethod=void 0,n.averageResponseTime=E,n.canBeUsed=y,n.cleanOldMessages=_,n.close=g,n.commitIndexedDBTransaction=d,n.create=v,n.createDatabase=c,n.getAllMessages=function(e){var n=e.transaction(u,"readonly",l),o=n.objectStore(u),r=[];return new Promise(function(t){o.openCursor().onsuccess=function(e){e=e.target.result;e?(r.push(e.value),e.continue()):(d(n),t(r))}})},n.getIdb=a,n.getMessagesHigherThan=h,n.getOldMessages=m,n.microSeconds=void 0,n.onMessage=L,n.postMessage=w,n.removeMessagesById=p,n.type=void 0,n.writeMessage=f;var r=e("../util.js"),i=e("oblivious-set"),s=e("../options.js"),e=n.microSeconds=r.microSeconds,o="pubkey.broadcast-channel-0-",u="messages",l=n.TRANSACTION_SETTINGS={durability:"relaxed"};n.type="idb";function a(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof window){if(void 0!==window.mozIndexedDB)return window.mozIndexedDB;if(void 0!==window.webkitIndexedDB)return window.webkitIndexedDB;if(void 0!==window.msIndexedDB)return window.msIndexedDB}return!1}function d(e){e.commit&&e.commit()}function c(e){var n=a().open(o+e);return n.onupgradeneeded=function(e){e.target.result.createObjectStore(u,{keyPath:"id",autoIncrement:!0})},new Promise(function(e,t){n.onerror=function(e){return t(e)},n.onsuccess=function(){e(n.result)}})}function f(e,t,n){var o={uuid:t,time:Date.now(),data:n},r=e.transaction([u],"readwrite",l);return new Promise(function(e,t){r.oncomplete=function(){return e()},r.onerror=function(e){return t(e)},r.objectStore(u).add(o),d(r)})}function h(e,o){var r,i=e.transaction(u,"readonly",l),s=i.objectStore(u),a=[],c=IDBKeyRange.bound(o+1,1/0);return s.getAll?(r=s.getAll(c),new Promise(function(t,n){r.onerror=function(e){return n(e)},r.onsuccess=function(e){t(e.target.result)}})):new Promise(function(t,n){var e=function(){try{return c=IDBKeyRange.bound(o+1,1/0),s.openCursor(c)}catch(e){return s.openCursor()}}();e.onerror=function(e){return n(e)},e.onsuccess=function(e){e=e.target.result;e?e.value.idn.lastCursorId&&(n.lastCursorId=e.id),e}).filter(function(e){return t=n,(e=e).uuid!==t.uuid&&!(t.eMIs.has(e.id)||e.data.time{this._to=!1,o(this)},0))}clear(){this.map.clear()}},n.removeTooOldValues=o,n.now=i},{}],18:[function(e,t,n){var o,r,t=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}try{o="function"==typeof setTimeout?setTimeout:i}catch(e){o=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}function a(t){if(o===setTimeout)return setTimeout(t,0);if((o===i||!o)&&setTimeout)return(o=setTimeout)(t,0);try{return o(t,0)}catch(e){try{return o.call(null,t,0)}catch(e){return o.call(this,t,0)}}}var c,u=[],l=!1,d=-1;function f(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length)&&h()}function h(){if(!l){for(var e=a(f),t=(l=!0,u.length);t;){for(c=u,u=[];++d 0)) {
- _context5.next = 23;
+ _context5.next = 25;
break;
}
t--;
- _context5.next = 21;
+ _context5.next = 23;
return Promise.all(new Array(perRun).fill(0).map( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
var msgId, waitForResponsePromise;
return _regenerator["default"].wrap(function _callee4$(_context4) {
@@ -24154,16 +24158,16 @@ function run() {
}
}, _callee4);
}))));
- case 21:
- _context5.next = 17;
- break;
case 23:
+ _context5.next = 19;
+ break;
+ case 25:
channel.removeEventListener('message', workerListener);
body.style.backgroundColor = 'green';
stateContainer.innerHTML = 'SUCCESS';
amountTime = new Date().getTime() - startTime;
document.getElementById('time-amount').innerHTML = amountTime + 'ms';
- case 28:
+ case 30:
case "end":
return _context5.stop();
}
diff --git a/docs/iframe.js b/docs/iframe.js
index 646f205c..d1cd6255 100644
--- a/docs/iframe.js
+++ b/docs/iframe.js
@@ -1464,7 +1464,6 @@ function create(channelName) {
name: channelName,
messagesCallback: null
};
- console.log('created channel ' + state.counter);
SIMULATE_CHANNELS.add(state);
return state;
}
diff --git a/docs/index.js b/docs/index.js
index 01d38746..b5ea0d9c 100644
--- a/docs/index.js
+++ b/docs/index.js
@@ -1464,7 +1464,6 @@ function create(channelName) {
name: channelName,
messagesCallback: null
};
- console.log('created channel ' + state.counter);
SIMULATE_CHANNELS.add(state);
return state;
}
diff --git a/docs/leader-iframe.js b/docs/leader-iframe.js
index a12c6ced..9e27c65b 100644
--- a/docs/leader-iframe.js
+++ b/docs/leader-iframe.js
@@ -1464,7 +1464,6 @@ function create(channelName) {
name: channelName,
messagesCallback: null
};
- console.log('created channel ' + state.counter);
SIMULATE_CHANNELS.add(state);
return state;
}
diff --git a/docs/worker.js b/docs/worker.js
index 7524d2e9..8266a54a 100644
--- a/docs/worker.js
+++ b/docs/worker.js
@@ -1464,7 +1464,6 @@ function create(channelName) {
name: channelName,
messagesCallback: null
};
- console.log('created channel ' + state.counter);
SIMULATE_CHANNELS.add(state);
return state;
}
diff --git a/package.json b/package.json
index 6c92bdef..3d56d2c3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "broadcast-channel",
- "version": "6.0.0",
+ "version": "7.0.0",
"description": "A BroadcastChannel that works in New Browsers, Old Browsers, WebWorkers, NodeJs, Deno and iframes",
"exports": {
".": {
From 811608603be47ca807f1b5f0a6be5517c995184c Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sun, 10 Dec 2023 08:42:23 +0000
Subject: [PATCH 57/82] chore(deps): update dependency ts-node to v10.9.2
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 3d56d2c3..1a0e102a 100644
--- a/package.json
+++ b/package.json
@@ -150,7 +150,7 @@
"rimraf": "5.0.5",
"rollup": "4.6.0",
"testcafe": "3.4.0",
- "ts-node": "10.9.1",
+ "ts-node": "10.9.2",
"typescript": "5.3.2",
"uglify-js": "3.17.4",
"watchify": "4.0.0",
From e0c02ac2c55ddbde403125c9a2ec25c45f9fde7c Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sun, 10 Dec 2023 11:02:33 +0000
Subject: [PATCH 58/82] chore(deps): update babel monorepo to v7.23.5
---
package.json | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/package.json b/package.json
index 1a0e102a..6f76904c 100644
--- a/package.json
+++ b/package.json
@@ -99,21 +99,21 @@
"lint"
],
"dependencies": {
- "@babel/runtime": "7.23.4",
+ "@babel/runtime": "7.23.5",
"oblivious-set": "1.4.0",
"p-queue": "6.6.2",
"unload": "2.4.1"
},
"devDependencies": {
"@babel/cli": "7.23.4",
- "@babel/core": "7.23.3",
+ "@babel/core": "7.23.5",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
"@babel/plugin-transform-member-expression-literals": "7.23.3",
"@babel/plugin-transform-property-literals": "7.23.3",
"@babel/plugin-transform-runtime": "7.23.4",
"@babel/polyfill": "7.12.1",
- "@babel/preset-env": "7.23.3",
- "@babel/types": "7.23.4",
+ "@babel/preset-env": "7.23.5",
+ "@babel/types": "7.23.5",
"@rollup/plugin-terser": "0.4.4",
"@types/core-js": "2.5.8",
"assert": "2.1.0",
From 0e53b70dd80f181a621db75511ca67c005905f12 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Fri, 29 Dec 2023 22:59:53 +0000
Subject: [PATCH 59/82] chore(deps): update babel monorepo
---
package.json | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 6f76904c..c66fe4a2 100644
--- a/package.json
+++ b/package.json
@@ -99,21 +99,21 @@
"lint"
],
"dependencies": {
- "@babel/runtime": "7.23.5",
+ "@babel/runtime": "7.23.7",
"oblivious-set": "1.4.0",
"p-queue": "6.6.2",
"unload": "2.4.1"
},
"devDependencies": {
"@babel/cli": "7.23.4",
- "@babel/core": "7.23.5",
+ "@babel/core": "7.23.7",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
"@babel/plugin-transform-member-expression-literals": "7.23.3",
"@babel/plugin-transform-property-literals": "7.23.3",
- "@babel/plugin-transform-runtime": "7.23.4",
+ "@babel/plugin-transform-runtime": "7.23.7",
"@babel/polyfill": "7.12.1",
- "@babel/preset-env": "7.23.5",
- "@babel/types": "7.23.5",
+ "@babel/preset-env": "7.23.7",
+ "@babel/types": "7.23.6",
"@rollup/plugin-terser": "0.4.4",
"@types/core-js": "2.5.8",
"assert": "2.1.0",
From 97c37f62cba61800c017b952da70769288c708a5 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat, 30 Dec 2023 00:16:07 +0000
Subject: [PATCH 60/82] chore(deps): update dependency eslint to v8.56.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index c66fe4a2..1edf8509 100644
--- a/package.json
+++ b/package.json
@@ -126,7 +126,7 @@
"copyfiles": "2.4.1",
"cross-env": "7.0.3",
"detect-node": "2.1.0",
- "eslint": "8.54.0",
+ "eslint": "8.56.0",
"gzip-size-cli": "5.1.0",
"http-server": "14.1.1",
"jest": "29.7.0",
From c45f7bc54996828e436ef870f2789899ab2ab2cf Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Mon, 8 Jan 2024 22:24:37 +0000
Subject: [PATCH 61/82] chore(deps): update babel monorepo to v7.23.8
---
package.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index 1edf8509..41b56774 100644
--- a/package.json
+++ b/package.json
@@ -99,7 +99,7 @@
"lint"
],
"dependencies": {
- "@babel/runtime": "7.23.7",
+ "@babel/runtime": "7.23.8",
"oblivious-set": "1.4.0",
"p-queue": "6.6.2",
"unload": "2.4.1"
@@ -112,7 +112,7 @@
"@babel/plugin-transform-property-literals": "7.23.3",
"@babel/plugin-transform-runtime": "7.23.7",
"@babel/polyfill": "7.12.1",
- "@babel/preset-env": "7.23.7",
+ "@babel/preset-env": "7.23.8",
"@babel/types": "7.23.6",
"@rollup/plugin-terser": "0.4.4",
"@types/core-js": "2.5.8",
From 45f0716bfe30ea2954b3e98ccb8fdbed37713bf9 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Tue, 9 Jan 2024 00:11:02 +0000
Subject: [PATCH 62/82] chore(deps): update dependency typescript to v5.3.3
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 41b56774..cdca1344 100644
--- a/package.json
+++ b/package.json
@@ -151,7 +151,7 @@
"rollup": "4.6.0",
"testcafe": "3.4.0",
"ts-node": "10.9.2",
- "typescript": "5.3.2",
+ "typescript": "5.3.3",
"uglify-js": "3.17.4",
"watchify": "4.0.0",
"webpack": "5.89.0",
From 8daab5b13319ecdaedd1772b3cc81803be0fe688 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 28 Feb 2024 12:23:32 +0000
Subject: [PATCH 63/82] chore(deps): update babel monorepo
---
package.json | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/package.json b/package.json
index cdca1344..b243a47e 100644
--- a/package.json
+++ b/package.json
@@ -99,21 +99,21 @@
"lint"
],
"dependencies": {
- "@babel/runtime": "7.23.8",
+ "@babel/runtime": "7.24.0",
"oblivious-set": "1.4.0",
"p-queue": "6.6.2",
"unload": "2.4.1"
},
"devDependencies": {
- "@babel/cli": "7.23.4",
- "@babel/core": "7.23.7",
+ "@babel/cli": "7.23.9",
+ "@babel/core": "7.24.0",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
"@babel/plugin-transform-member-expression-literals": "7.23.3",
"@babel/plugin-transform-property-literals": "7.23.3",
- "@babel/plugin-transform-runtime": "7.23.7",
+ "@babel/plugin-transform-runtime": "7.24.0",
"@babel/polyfill": "7.12.1",
- "@babel/preset-env": "7.23.8",
- "@babel/types": "7.23.6",
+ "@babel/preset-env": "7.24.0",
+ "@babel/types": "7.24.0",
"@rollup/plugin-terser": "0.4.4",
"@types/core-js": "2.5.8",
"assert": "2.1.0",
From 387c7ff27c0e67e00fedd158f471a00a158edb35 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 28 Feb 2024 16:08:25 +0000
Subject: [PATCH 64/82] chore(deps): update actions/setup-node action to v4.0.2
---
.github/workflows/main.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index e191f58b..28388bea 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -30,7 +30,7 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Setup Node.js environment
- uses: actions/setup-node@v4.0.0
+ uses: actions/setup-node@v4.0.2
with:
node-version-file: ".nvmrc"
@@ -102,7 +102,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
- uses: actions/setup-node@v4.0.0
+ uses: actions/setup-node@v4.0.2
with:
node-version: ${{ matrix.node }}
@@ -138,7 +138,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
- uses: actions/setup-node@v4.0.0
+ uses: actions/setup-node@v4.0.2
with:
node-version-file: ".nvmrc"
From bfceb760edd9fc7c1766887be63eecd02a8f25d3 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 20 Mar 2024 20:27:27 +0000
Subject: [PATCH 65/82] chore(deps): update dependency webpack to v5.91.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index b243a47e..71373623 100644
--- a/package.json
+++ b/package.json
@@ -154,7 +154,7 @@
"typescript": "5.3.3",
"uglify-js": "3.17.4",
"watchify": "4.0.0",
- "webpack": "5.89.0",
+ "webpack": "5.91.0",
"webpack-cli": "5.1.4"
}
}
From 2dbcd80b1d50dc73c8e9f174c5d50f4c026d0c03 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 20 Mar 2024 22:19:27 +0000
Subject: [PATCH 66/82] chore(deps): update dependency karma-firefox-launcher
to v2.1.3
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 71373623..3a30b2d1 100644
--- a/package.json
+++ b/package.json
@@ -138,7 +138,7 @@
"karma-detect-browsers": "2.3.3",
"karma-edge-launcher": "0.4.2",
"karma-env-preprocessor": "0.1.1",
- "karma-firefox-launcher": "2.1.2",
+ "karma-firefox-launcher": "2.1.3",
"karma-ie-launcher": "1.0.0",
"karma-mocha": "2.0.1",
"karma-opera-launcher": "1.0.0",
From b59667a35d7ca5b159de7a8519ea8210b7fd31f9 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 3 Apr 2024 16:06:18 +0000
Subject: [PATCH 67/82] chore(deps): update dependency node to v20.12.1
---
.nvmrc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.nvmrc b/.nvmrc
index d5a15960..bc78e9f2 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-20.10.0
+20.12.1
From b17d1434273064dcdb9a8e7500b11a8a5db75027 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 3 Apr 2024 20:06:12 +0000
Subject: [PATCH 68/82] chore(deps): update babel monorepo
---
package.json | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/package.json b/package.json
index 3a30b2d1..5627e5dd 100644
--- a/package.json
+++ b/package.json
@@ -99,20 +99,20 @@
"lint"
],
"dependencies": {
- "@babel/runtime": "7.24.0",
+ "@babel/runtime": "7.24.4",
"oblivious-set": "1.4.0",
"p-queue": "6.6.2",
"unload": "2.4.1"
},
"devDependencies": {
- "@babel/cli": "7.23.9",
- "@babel/core": "7.24.0",
+ "@babel/cli": "7.24.1",
+ "@babel/core": "7.24.4",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
- "@babel/plugin-transform-member-expression-literals": "7.23.3",
- "@babel/plugin-transform-property-literals": "7.23.3",
- "@babel/plugin-transform-runtime": "7.24.0",
+ "@babel/plugin-transform-member-expression-literals": "7.24.1",
+ "@babel/plugin-transform-property-literals": "7.24.1",
+ "@babel/plugin-transform-runtime": "7.24.3",
"@babel/polyfill": "7.12.1",
- "@babel/preset-env": "7.24.0",
+ "@babel/preset-env": "7.24.4",
"@babel/types": "7.24.0",
"@rollup/plugin-terser": "0.4.4",
"@types/core-js": "2.5.8",
From 8fe496f3f1af5cd0c54f2da693ac2008189c31bc Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 10 Apr 2024 17:07:18 +0000
Subject: [PATCH 69/82] chore(deps): update dependency typescript to v5.4.5
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 5627e5dd..f7b80bca 100644
--- a/package.json
+++ b/package.json
@@ -151,7 +151,7 @@
"rollup": "4.6.0",
"testcafe": "3.4.0",
"ts-node": "10.9.2",
- "typescript": "5.3.3",
+ "typescript": "5.4.5",
"uglify-js": "3.17.4",
"watchify": "4.0.0",
"webpack": "5.91.0",
From bb90f7a1f096866c33368450cad9e94a8d0d9ac9 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 24 Apr 2024 19:49:06 +0000
Subject: [PATCH 70/82] chore(deps): update dependency karma to v6.4.3
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index f7b80bca..a1655ed7 100644
--- a/package.json
+++ b/package.json
@@ -130,7 +130,7 @@
"gzip-size-cli": "5.1.0",
"http-server": "14.1.1",
"jest": "29.7.0",
- "karma": "6.4.2",
+ "karma": "6.4.3",
"karma-babel-preprocessor": "8.0.2",
"karma-browserify": "8.1.0",
"karma-chrome-launcher": "3.2.0",
From 181648d4badb3946bf9a013aa70c3860b2435caa Mon Sep 17 00:00:00 2001
From: Daniel Meyer <8926560+pubkey@users.noreply.github.com>
Date: Tue, 14 May 2024 01:00:33 +0200
Subject: [PATCH 71/82] Update FUNDING.yml
---
.github/FUNDING.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 2b2ef534..615a269b 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,3 +1,4 @@
# These are supported funding model platforms
github: pubkey
+custom: ["https://rxdb.info/premium", "https://rxdb.info/consulting"]
From 0b1267b53b049f41ce56256da984519fa89dd1b0 Mon Sep 17 00:00:00 2001
From: Daniel Meyer <8926560+pubkey@users.noreply.github.com>
Date: Tue, 14 May 2024 01:00:42 +0200
Subject: [PATCH 72/82] Update FUNDING.yml
---
.github/FUNDING.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 615a269b..d95a144c 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,4 +1,4 @@
# These are supported funding model platforms
github: pubkey
-custom: ["https://rxdb.info/premium", "https://rxdb.info/consulting"]
+custom: ["https://rxdb.info/consulting"]
From 6aea9bf2a6cdb38583f376dab7ceb9abb5442a47 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sun, 18 Aug 2024 07:20:13 +0000
Subject: [PATCH 73/82] chore(deps): update dependency rollup to v4.21.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index a1655ed7..1a2e68fc 100644
--- a/package.json
+++ b/package.json
@@ -148,7 +148,7 @@
"random-int": "3.0.0",
"random-token": "0.0.8",
"rimraf": "5.0.5",
- "rollup": "4.6.0",
+ "rollup": "4.21.0",
"testcafe": "3.4.0",
"ts-node": "10.9.2",
"typescript": "5.4.5",
From fe24982c4ab31fa4bfd7c5db010de1787cc3ab0b Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sun, 18 Aug 2024 09:52:56 +0000
Subject: [PATCH 74/82] chore(deps): update actions/setup-node action to v4.0.3
---
.github/workflows/main.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 28388bea..d7c61d1b 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -30,7 +30,7 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Setup Node.js environment
- uses: actions/setup-node@v4.0.2
+ uses: actions/setup-node@v4.0.3
with:
node-version-file: ".nvmrc"
@@ -102,7 +102,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
- uses: actions/setup-node@v4.0.2
+ uses: actions/setup-node@v4.0.3
with:
node-version: ${{ matrix.node }}
@@ -138,7 +138,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
- uses: actions/setup-node@v4.0.2
+ uses: actions/setup-node@v4.0.3
with:
node-version-file: ".nvmrc"
From 3dc2d3294704e7947e9dde9e2c840222be54be0c Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Mon, 16 Sep 2024 17:00:28 +0000
Subject: [PATCH 75/82] chore(deps): update dependency eslint to v8.57.1
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 1a2e68fc..6e015e2b 100644
--- a/package.json
+++ b/package.json
@@ -126,7 +126,7 @@
"copyfiles": "2.4.1",
"cross-env": "7.0.3",
"detect-node": "2.1.0",
- "eslint": "8.56.0",
+ "eslint": "8.57.1",
"gzip-size-cli": "5.1.0",
"http-server": "14.1.1",
"jest": "29.7.0",
From bbef01020eff5329f8fd792c76c9371db1e4090f Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Mon, 16 Sep 2024 19:35:03 +0000
Subject: [PATCH 76/82] chore(deps): update dependency karma to v6.4.4
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 6e015e2b..71d65d15 100644
--- a/package.json
+++ b/package.json
@@ -130,7 +130,7 @@
"gzip-size-cli": "5.1.0",
"http-server": "14.1.1",
"jest": "29.7.0",
- "karma": "6.4.3",
+ "karma": "6.4.4",
"karma-babel-preprocessor": "8.0.2",
"karma-browserify": "8.1.0",
"karma-chrome-launcher": "3.2.0",
From 36dee5d6abe15287cbdc4a308091c8497751a751 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 20 Nov 2024 19:00:36 +0000
Subject: [PATCH 77/82] chore(deps): update node.js to v20.18.1 (#1315)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
.nvmrc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.nvmrc b/.nvmrc
index bc78e9f2..d4b7699d 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-20.12.1
+20.18.1
From e32834ef38bff5673cd393819b99f10eb9a23d40 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 20 Nov 2024 22:26:38 +0000
Subject: [PATCH 78/82] chore(deps): update dependency browserify to v17.0.1
(#1325)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 71d65d15..ec37e3cd 100644
--- a/package.json
+++ b/package.json
@@ -118,7 +118,7 @@
"@types/core-js": "2.5.8",
"assert": "2.1.0",
"async-test-util": "2.2.1",
- "browserify": "17.0.0",
+ "browserify": "17.0.1",
"child-process-promise": "2.2.1",
"clone": "2.1.2",
"concurrently": "8.2.2",
From 70a64f5960f71bbe91ffcaf5f13820d36faf8278 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 4 Dec 2024 16:23:15 +0000
Subject: [PATCH 79/82] chore(deps): update babel monorepo (#1316)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
package.json | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/package.json b/package.json
index ec37e3cd..7def264d 100644
--- a/package.json
+++ b/package.json
@@ -99,21 +99,21 @@
"lint"
],
"dependencies": {
- "@babel/runtime": "7.24.4",
+ "@babel/runtime": "7.26.0",
"oblivious-set": "1.4.0",
"p-queue": "6.6.2",
"unload": "2.4.1"
},
"devDependencies": {
- "@babel/cli": "7.24.1",
- "@babel/core": "7.24.4",
+ "@babel/cli": "7.25.9",
+ "@babel/core": "7.26.0",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
- "@babel/plugin-transform-member-expression-literals": "7.24.1",
- "@babel/plugin-transform-property-literals": "7.24.1",
- "@babel/plugin-transform-runtime": "7.24.3",
+ "@babel/plugin-transform-member-expression-literals": "7.25.9",
+ "@babel/plugin-transform-property-literals": "7.25.9",
+ "@babel/plugin-transform-runtime": "7.25.9",
"@babel/polyfill": "7.12.1",
- "@babel/preset-env": "7.24.4",
- "@babel/types": "7.24.0",
+ "@babel/preset-env": "7.26.0",
+ "@babel/types": "7.26.3",
"@rollup/plugin-terser": "0.4.4",
"@types/core-js": "2.5.8",
"assert": "2.1.0",
From c3d62a990636f9ae77e7579bc54473654b4c1086 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 4 Dec 2024 20:45:41 +0000
Subject: [PATCH 80/82] chore(deps): update dependency rimraf to v5.0.10
(#1323)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 7def264d..941d520a 100644
--- a/package.json
+++ b/package.json
@@ -147,7 +147,7 @@
"pre-commit": "1.2.2",
"random-int": "3.0.0",
"random-token": "0.0.8",
- "rimraf": "5.0.5",
+ "rimraf": "5.0.10",
"rollup": "4.21.0",
"testcafe": "3.4.0",
"ts-node": "10.9.2",
From 6b11420cc03f2a71c69a7891a40fea9a183f4efa Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Fri, 20 Dec 2024 22:48:53 +0000
Subject: [PATCH 81/82] chore(deps): update dependency rollup to v4.29.0
(#1324)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 941d520a..c8930615 100644
--- a/package.json
+++ b/package.json
@@ -148,7 +148,7 @@
"random-int": "3.0.0",
"random-token": "0.0.8",
"rimraf": "5.0.10",
- "rollup": "4.21.0",
+ "rollup": "4.29.0",
"testcafe": "3.4.0",
"ts-node": "10.9.2",
"typescript": "5.4.5",
From 94e60a3968bfb316a327d4bc12e1af08809365aa Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat, 21 Dec 2024 01:19:39 +0000
Subject: [PATCH 82/82] chore(deps): update dependency @babel/cli to v7.26.4
(#1329)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index c8930615..bdb9f818 100644
--- a/package.json
+++ b/package.json
@@ -105,7 +105,7 @@
"unload": "2.4.1"
},
"devDependencies": {
- "@babel/cli": "7.25.9",
+ "@babel/cli": "7.26.4",
"@babel/core": "7.26.0",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
"@babel/plugin-transform-member-expression-literals": "7.25.9",