@jupyterlab/galata 4.2.2 → 4.3.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,8 +35,7 @@ module.exports = require('@jupyterlab/galata/lib/playwright-config');
35
35
  Create `ui-tests/foo.spec.ts` to define your test.
36
36
 
37
37
  ```typescript
38
- import { test } from '@jupyterlab/galata';
39
- import { expect } from '@playwright/test';
38
+ import { expect, test } from '@jupyterlab/galata';
40
39
 
41
40
  test.describe('Notebook Tests', () => {
42
41
  test('Create New Notebook', async ({ page, tmpPath }) => {
package/lib/index.d.ts CHANGED
@@ -2,6 +2,10 @@
2
2
  * @packageDocumentation
3
3
  * @module galata
4
4
  */
5
+ /**
6
+ * Export expect from playwright to simplify the import in tests
7
+ */
8
+ export { expect } from '@playwright/test';
5
9
  export * from './benchmarkReporter';
6
10
  export * from './galata';
7
11
  export * from './global';
package/lib/index.js CHANGED
@@ -17,6 +17,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
17
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.expect = void 0;
21
+ /**
22
+ * Export expect from playwright to simplify the import in tests
23
+ */
24
+ var test_1 = require("@playwright/test");
25
+ Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return test_1.expect; } });
20
26
  __exportStar(require("./benchmarkReporter"), exports);
21
27
  __exportStar(require("./galata"), exports);
22
28
  __exportStar(require("./global"), exports);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,sCAAsC;AACtC,2DAA2D;AAC3D;;;GAGG;;;;;;;;;;;;AAEH,sDAAoC;AACpC,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC;AAChC,6CAA2B;AAC3B,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,sCAAsC;AACtC,2DAA2D;AAC3D;;;GAGG;;;;;;;;;;;;;AAEH;;GAEG;AACH,yCAA0C;AAAjC,8FAAA,MAAM,OAAA;AAEf,sDAAoC;AACpC,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC;AAChC,6CAA2B;AAC3B,mDAAiC"}
@@ -130,7 +130,7 @@ var ArrayExt;
130
130
  }
131
131
  var span;
132
132
  if (stop < start) {
133
- span = (stop + 1) + (n - start);
133
+ span = stop + 1 + (n - start);
134
134
  }
135
135
  else {
136
136
  span = stop - start + 1;
@@ -205,7 +205,7 @@ var ArrayExt;
205
205
  }
206
206
  var span;
207
207
  if (start < stop) {
208
- span = (start + 1) + (n - stop);
208
+ span = start + 1 + (n - stop);
209
209
  }
210
210
  else {
211
211
  span = start - stop + 1;
@@ -284,7 +284,7 @@ var ArrayExt;
284
284
  }
285
285
  var span;
286
286
  if (stop < start) {
287
- span = (stop + 1) + (n - start);
287
+ span = stop + 1 + (n - start);
288
288
  }
289
289
  else {
290
290
  span = stop - start + 1;
@@ -363,7 +363,7 @@ var ArrayExt;
363
363
  }
364
364
  var d;
365
365
  if (start < stop) {
366
- d = (start + 1) + (n - stop);
366
+ d = start + 1 + (n - stop);
367
367
  }
368
368
  else {
369
369
  d = start - stop + 1;
@@ -1030,7 +1030,7 @@ var ArrayExt;
1030
1030
  }
1031
1031
  var span;
1032
1032
  if (stop < start) {
1033
- span = (stop + 1) + (n - start);
1033
+ span = stop + 1 + (n - start);
1034
1034
  }
1035
1035
  else {
1036
1036
  span = stop - start + 1;
@@ -1272,10 +1272,12 @@ var ArrayExt;
1272
1272
  }
1273
1273
  var count = 0;
1274
1274
  for (var i = 0; i < n; ++i) {
1275
- if (start <= stop && (i >= start && i <= stop) && array[i] === value) {
1275
+ if (start <= stop && i >= start && i <= stop && array[i] === value) {
1276
1276
  count++;
1277
1277
  }
1278
- else if (stop < start && (i <= stop || i >= start) && array[i] === value) {
1278
+ else if (stop < start &&
1279
+ (i <= stop || i >= start) &&
1280
+ array[i] === value) {
1279
1281
  count++;
1280
1282
  }
1281
1283
  else if (count > 0) {
@@ -1448,7 +1450,7 @@ var ArrayExt;
1448
1450
  }
1449
1451
  var count = 0;
1450
1452
  for (var i = 0; i < n; ++i) {
1451
- if (start <= stop && (i >= start && i <= stop) && fn(array[i], i)) {
1453
+ if (start <= stop && i >= start && i <= stop && fn(array[i], i)) {
1452
1454
  count++;
1453
1455
  }
1454
1456
  else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {
@@ -2102,9 +2104,6 @@ function empty() {
2102
2104
  * An iterator which is always empty.
2103
2105
  */
2104
2106
  var EmptyIterator = /** @class */ (function () {
2105
- /**
2106
- * Construct a new empty iterator.
2107
- */
2108
2107
  function EmptyIterator() {
2109
2108
  }
2110
2109
  /**
@@ -2921,7 +2920,9 @@ function topologicSort(edges) {
2921
2920
  // Add the edges to the graph.
2922
2921
  each(edges, addEdge);
2923
2922
  // Visit each node in the graph.
2924
- graph.forEach(function (v, k) { visit(k); });
2923
+ graph.forEach(function (v, k) {
2924
+ visit(k);
2925
+ });
2925
2926
  // Return the sorted results.
2926
2927
  return sorted;
2927
2928
  // Add an edge to the graph.
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/array.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/iter.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/chain.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/empty.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/enumerate.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/filter.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/find.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/map.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/range.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/reduce.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/repeat.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/retro.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/sort.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/stride.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/string.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/take.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/zip.ts","webpack://@jupyterlab/galata/./src/inpage/tokens.ts","webpack://@jupyterlab/galata/webpack/bootstrap","webpack://@jupyterlab/galata/webpack/runtime/define property getters","webpack://@jupyterlab/galata/webpack/runtime/hasOwnProperty shorthand","webpack://@jupyterlab/galata/webpack/runtime/make namespace object","webpack://@jupyterlab/galata/./src/inpage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;;;;;;;AASA;;;IAIU,SAw3CT;AAz3CD,WACU,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyChB,SACS,YAAY,CAAI,KAAmB,EAAE,KAAQ,EAAE,KAAS,EAAE,IAAS;QAApB,iCAAS;QAAE,+BAAQ,CAAC;QAC1E,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,EAAE;YACX,OAAO,CAAC,CAAC,CAAC;SACX;QACD,IAAI,KAAK,GAAG,CAAC,EAAE;YACb,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;SAChC;aAAM;YACL,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KA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;;;;;OAKG;IACH,2BAA2B,CAAC,QAAgB;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAA8B,CAAC;QAC/D,MAAM,KAAK,GAAG,mBAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAE/C,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,gBAAgB,CAAC,EAAe;QAC9B,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,YAAY,IAAI,EAAE,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC;IAC7E,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,SAAiB;QAC9B,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,uBAAuB,EAAE;YACxD,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;YAC5B,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CAGF;AA1lBD,yCA0lBC;AAED,MAAM,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC","file":"inpage.js","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/**\n * The namespace for array-specific algorithms.\n */\nexport\nnamespace ArrayExt {\n /**\n * Find the index of the first occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.firstIndexOf(data, 'red'); // -1\n * ArrayExt.firstIndexOf(data, 'one'); // 0\n * ArrayExt.firstIndexOf(data, 'one', 1); // 4\n * ArrayExt.firstIndexOf(data, 'two', 2); // -1\n * ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1\n * ```\n */\n export\n function firstIndexOf<T>(array: ArrayLike<T>, value: T, start = 0, stop = -1): number {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let span: number;\n if (stop < start) {\n span = (stop + 1) + (n - start);\n } else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n\n /**\n * Find the index of the last occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.lastIndexOf(data, 'red'); // -1\n * ArrayExt.lastIndexOf(data, 'one'); // 4\n * ArrayExt.lastIndexOf(data, 'one', 1); // 0\n * ArrayExt.lastIndexOf(data, 'two', 0); // -1\n * ArrayExt.lastIndexOf(data, 'two', 0, 1); // 1\n * ```\n */\n export\n function lastIndexOf<T>(array: ArrayLike<T>, value: T, start = -1, stop = 0): number {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let span: number;\n if (start < stop) {\n span = (start + 1) + (n - stop);\n } else {\n span = start - stop + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start - i + n) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n\n /**\n * Find the index of the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstIndex(data, isEven); // 1\n * ArrayExt.findFirstIndex(data, isEven, 4); // 5\n * ArrayExt.findFirstIndex(data, isEven, 6); // -1\n * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1\n * ```\n */\n export\n function findFirstIndex<T>(array: ArrayLike<T>, fn: (value: T, index: number) => boolean, start = 0, stop = -1): number {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let span: number;\n if (stop < start) {\n span = (stop + 1) + (n - start);\n } else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n\n /**\n * Find the index of the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastIndex(data, isEven); // 5\n * ArrayExt.findLastIndex(data, isEven, 4); // 3\n * ArrayExt.findLastIndex(data, isEven, 0); // -1\n * ArrayExt.findLastIndex(data, isEven, 0, 1); // 5\n * ```\n */\n export\n function findLastIndex<T>(array: ArrayLike<T>, fn: (value: T, index: number) => boolean, start = -1, stop = 0): number {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let d: number;\n if (start < stop) {\n d = (start + 1) + (n - stop);\n } else {\n d = start - stop + 1;\n }\n for (let i = 0; i < d; ++i) {\n let j = (start - i + n) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n\n /**\n * Find the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstValue(data, isEven); // 2\n * ArrayExt.findFirstValue(data, isEven, 2); // 4\n * ArrayExt.findFirstValue(data, isEven, 6); // undefined\n * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2\n * ```\n */\n export\n function findFirstValue<T>(array: ArrayLike<T>, fn: (value: T, index: number) => boolean, start = 0, stop = -1): T | undefined {\n let index = findFirstIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n\n /**\n * Find the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The last matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastValue(data, isEven); // 2\n * ArrayExt.findLastValue(data, isEven, 4); // 4\n * ArrayExt.findLastValue(data, isEven, 0); // undefined\n * ArrayExt.findLastValue(data, isEven, 0, 1); // 2\n * ```\n */\n export\n function findLastValue<T>(array: ArrayLike<T>, fn: (value: T, index: number) => boolean, start = -1, stop = 0): T | undefined {\n let index = findLastIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n\n /**\n * Find the index of the first element which compares `>=` to a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>=` to the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.lowerBound(data, 0, numberCmp); // 0\n * ArrayExt.lowerBound(data, 6, numberCmp); // 3\n * ArrayExt.lowerBound(data, 7, numberCmp); // 3\n * ArrayExt.lowerBound(data, -1, numberCmp); // 0\n * ArrayExt.lowerBound(data, 10, numberCmp); // 6\n * ```\n */\n export\n function lowerBound<T, U>(array: ArrayLike<T>, value: U, fn: (element: T, value: U) => number, start = 0, stop = -1): number {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) < 0) {\n begin = middle + 1;\n span -= half + 1;\n } else {\n span = half;\n }\n }\n return begin;\n }\n\n /**\n * Find the index of the first element which compares `>` than a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>` than the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.upperBound(data, 0, numberCmp); // 1\n * ArrayExt.upperBound(data, 6, numberCmp); // 3\n * ArrayExt.upperBound(data, 7, numberCmp); // 5\n * ArrayExt.upperBound(data, -1, numberCmp); // 0\n * ArrayExt.upperBound(data, 10, numberCmp); // 6\n * ```\n */\n export\n function upperBound<T, U>(array: ArrayLike<T>, value: U, fn: (element: T, value: U) => number, start = 0, stop = -1): number {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) > 0) {\n span = half;\n } else {\n begin = middle + 1;\n span -= half + 1;\n }\n }\n return begin;\n }\n\n /**\n * Test whether two arrays are shallowly equal.\n *\n * @param a - The first array-like object to compare.\n *\n * @param b - The second array-like object to compare.\n *\n * @param fn - The comparison function to apply to the elements. It\n * should return `true` if the elements are \"equal\". The default\n * compares elements using strict `===` equality.\n *\n * @returns Whether the two arrays are shallowly equal.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * Modifying the length of the arrays while comparing.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let d1 = [0, 3, 4, 7, 7, 9];\n * let d2 = [0, 3, 4, 7, 7, 9];\n * let d3 = [42];\n * ArrayExt.shallowEqual(d1, d2); // true\n * ArrayExt.shallowEqual(d2, d3); // false\n * ```\n */\n export\n function shallowEqual<T>(a: ArrayLike<T>, b: ArrayLike<T>, fn?: (a: T, b: T) => boolean): boolean {\n // Check for object identity first.\n if (a === b) {\n return true;\n }\n\n // Bail early if the lengths are different.\n if (a.length !== b.length) {\n return false;\n }\n\n // Compare each element for equality.\n for (let i = 0, n = a.length; i < n; ++i) {\n if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {\n return false;\n }\n }\n\n // The array are shallowly equal.\n return true;\n }\n\n /**\n * Create a slice of an array subject to an optional step.\n *\n * @param array - The array-like object of interest.\n *\n * @param options - The options for configuring the slice.\n *\n * @returns A new array with the specified values.\n *\n * @throws An exception if the slice `step` is `0`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start`, `stop`, or `step` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]\n * ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]\n * ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]\n * ```\n */\n export\n function slice<T>(array: ArrayLike<T>, options: slice.IOptions = {}): T[] {\n // Extract the options.\n let { start, stop, step } = options;\n\n // Set up the `step` value.\n if (step === undefined) {\n step = 1;\n }\n\n // Validate the step size.\n if (step === 0) {\n throw new Error('Slice `step` cannot be zero.');\n }\n\n // Look up the length of the array.\n let n = array.length;\n\n // Set up the `start` value.\n if (start === undefined) {\n start = step < 0 ? n - 1 : 0;\n } else if (start < 0) {\n start = Math.max(start + n, step < 0 ? -1 : 0);\n } else if (start >= n) {\n start = step < 0 ? n - 1 : n;\n }\n\n // Set up the `stop` value.\n if (stop === undefined) {\n stop = step < 0 ? -1 : n;\n } else if (stop < 0) {\n stop = Math.max(stop + n, step < 0 ? -1 : 0);\n } else if (stop >= n) {\n stop = step < 0 ? n - 1 : n;\n }\n\n // Compute the slice length.\n let length;\n if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {\n length = 0;\n } else if (step < 0) {\n length = Math.floor((stop - start + 1) / step + 1);\n } else {\n length = Math.floor((stop - start - 1) / step + 1);\n }\n\n // Compute the sliced result.\n let result: T[] = [];\n for (let i = 0; i < length; ++i) {\n result[i] = array[start + i * step];\n }\n\n // Return the result.\n return result;\n }\n\n /**\n * The namespace for the `slice` function statics.\n */\n export\n namespace slice {\n /**\n * The options for the `slice` function.\n */\n export\n interface IOptions {\n /**\n * The starting index of the slice, inclusive.\n *\n * Negative values are taken as an offset from the end\n * of the array.\n *\n * The default is `0` if `step > 0` else `n - 1`.\n */\n start?: number;\n\n /**\n * The stopping index of the slice, exclusive.\n *\n * Negative values are taken as an offset from the end\n * of the array.\n *\n * The default is `n` if `step > 0` else `-n - 1`.\n */\n stop?: number;\n\n /**\n * The step value for the slice.\n *\n * This must not be `0`.\n *\n * The default is `1`.\n */\n step?: number;\n }\n }\n\n /**\n * An array-like object which supports item assignment.\n */\n export\n type MutableArrayLike<T> = {\n readonly length: number;\n [index: number]: T;\n };\n\n /**\n * Move an element in an array from one index to another.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param fromIndex - The index of the element to move. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param toIndex - The target index of the element. Negative\n * values are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `fromIndex` or `toIndex` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.move(data, 1, 2); // [0, 2, 1, 3, 4]\n * ArrayExt.move(data, 4, 2); // [0, 2, 4, 1, 3]\n * ```\n */\n export\n function move<T>(array: MutableArrayLike<T>, fromIndex: number, toIndex: number): void {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (fromIndex < 0) {\n fromIndex = Math.max(0, fromIndex + n);\n } else {\n fromIndex = Math.min(fromIndex, n - 1);\n }\n if (toIndex < 0) {\n toIndex = Math.max(0, toIndex + n);\n } else {\n toIndex = Math.min(toIndex, n - 1);\n }\n if (fromIndex === toIndex) {\n return\n }\n let value = array[fromIndex];\n let d = fromIndex < toIndex ? 1 : -1;\n for (let i = fromIndex; i !== toIndex; i += d) {\n array[i] = array[i + d];\n }\n array[toIndex] = value;\n }\n\n /**\n * Reverse an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param start - The index of the first element in the range to be\n * reversed, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * reversed, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` index which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.reverse(data, 1, 3); // [0, 3, 2, 1, 4]\n * ArrayExt.reverse(data, 3); // [0, 3, 2, 4, 1]\n * ArrayExt.reverse(data); // [1, 4, 2, 3, 0]\n * ```\n */\n export\n function reverse<T>(array: MutableArrayLike<T>, start = 0, stop = -1): void {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n while (start < stop) {\n let a = array[start];\n let b = array[stop];\n array[start++] = b;\n array[stop--] = a;\n }\n }\n\n /**\n * Rotate the elements of an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param delta - The amount of rotation to apply to the elements. A\n * positive value will rotate the elements to the left. A negative\n * value will rotate the elements to the right.\n *\n * @param start - The index of the first element in the range to be\n * rotated, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * rotated, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `delta`, `start`, or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]\n * ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]\n * ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]\n * ```\n */\n export\n function rotate<T>(array: MutableArrayLike<T>, delta: number, start = 0, stop = -1): void {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n if (start >= stop) {\n return;\n }\n let length = stop - start + 1;\n if (delta > 0) {\n delta = delta % length;\n } else if (delta < 0) {\n delta = ((delta % length) + length) % length;\n }\n if (delta === 0) {\n return;\n }\n let pivot = start + delta;\n reverse(array, start, pivot - 1);\n reverse(array, pivot, stop);\n reverse(array, start, stop);\n }\n\n /**\n * Fill an array with a static value.\n *\n * @param array - The mutable array-like object to fill.\n *\n * @param value - The static value to use to fill the array.\n *\n * @param start - The index of the first element in the range to be\n * filled, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * filled, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Notes\n * If `stop < start` the fill will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four'];\n * ArrayExt.fill(data, 'r'); // ['r', 'r', 'r', 'r']\n * ArrayExt.fill(data, 'g', 1); // ['r', 'g', 'g', 'g']\n * ArrayExt.fill(data, 'b', 2, 3); // ['r', 'g', 'b', 'b']\n * ArrayExt.fill(data, 'z', 3, 1); // ['z', 'z', 'b', 'z']\n * ```\n */\n export\n function fill<T>(array: MutableArrayLike<T>, value: T, start = 0, stop = -1): void {\n let n = array.length;\n if (n === 0) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let span: number;\n if (stop < start) {\n span = (stop + 1) + (n - start);\n } else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n array[(start + i) % n] = value;\n }\n }\n\n /**\n * Insert a value into an array at a specific index.\n *\n * @param array - The array of interest.\n *\n * @param index - The index at which to insert the value. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2];\n * ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]\n * ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]\n * ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]\n * ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]\n * ```\n */\n export\n function insert<T>(array: Array<T>, index: number, value: T): void {\n let n = array.length;\n if (index < 0) {\n index = Math.max(0, index + n);\n } else {\n index = Math.min(index, n);\n }\n for (let i = n; i > index; --i) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n }\n\n /**\n * Remove and return a value at a specific index in an array.\n *\n * @param array - The array of interest.\n *\n * @param index - The index of the value to remove. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeAt(data, 2); // 23\n * ArrayExt.removeAt(data, -2); // 12\n * ArrayExt.removeAt(data, 10); // undefined;\n * ```\n */\n export\n function removeAt<T>(array: Array<T>, index: number): T | undefined {\n let n = array.length;\n if (index < 0) {\n index += n;\n }\n if (index < 0 || index >= n) {\n return undefined;\n }\n let value = array[index];\n for (let i = index + 1; i < n; ++i) {\n array[i - 1] = array[i];\n }\n array.length = n - 1;\n return value;\n }\n\n /**\n * Remove the first occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstOf(data, 12); // 1\n * ArrayExt.removeFirstOf(data, 17); // -1\n * ArrayExt.removeFirstOf(data, 39, 3); // -1\n * ArrayExt.removeFirstOf(data, 39, 3, 2); // 2\n * ```\n */\n export\n function removeFirstOf<T>(array: Array<T>, value: T, start = 0, stop = -1): number {\n let index = firstIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n\n /**\n * Remove the last occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastOf(data, 12); // 5\n * ArrayExt.removeLastOf(data, 17); // -1\n * ArrayExt.removeLastOf(data, 39, 2); // -1\n * ArrayExt.removeLastOf(data, 39, 2, 3); // 3\n * ```\n */\n export\n function removeLastOf<T>(array: Array<T>, value: T, start = -1, stop = 0): number {\n let index = lastIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n\n /**\n * Remove all occurrences of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [14, 12, 23, 39, 14, 12, 19, 14];\n * ArrayExt.removeAllOf(data, 12); // 2\n * ArrayExt.removeAllOf(data, 17); // 0\n * ArrayExt.removeAllOf(data, 14, 1, 4); // 1\n * ```\n */\n export\n function removeAllOf<T>(array: Array<T>, value: T, start = 0, stop = -1): number {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && (i >= start && i <= stop) && array[i] === value) {\n count++;\n } else if (stop < start && (i <= stop || i >= start) && array[i] === value) {\n count++;\n } else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n\n /**\n * Remove the first occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstWhere(data, isEven); // { index: 0, value: 0 }\n * ArrayExt.removeFirstWhere(data, isEven, 2); // { index: 3, value: 14 }\n * ArrayExt.removeFirstWhere(data, isEven, 4); // { index: -1, value: undefined }\n * ```\n */\n export\n function removeFirstWhere<T>(array: Array<T>, fn: (value: T, index: number) => boolean, start = 0, stop = -1): { index: number, value: T | undefined } {\n let value: T | undefined;\n let index = findFirstIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n\n /**\n * Remove the last occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastWhere(data, isEven); // { index: 5, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2); // { index: 1, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2, 1); // { index: -1, value: undefined }\n * ```\n */\n export\n function removeLastWhere<T>(array: Array<T>, fn: (value: T, index: number) => boolean, start = -1, stop = 0): { index: number, value: T | undefined } {\n let value: T | undefined;\n let index = findLastIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n\n /**\n * Remove all occurrences of values which match a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * function isNegative(value: number): boolean {\n * return value < 0;\n * }\n *\n * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];\n * ArrayExt.removeAllWhere(data, isEven); // 4\n * ArrayExt.removeAllWhere(data, isNegative, 0, 3); // 2\n * ```\n */\n export\n function removeAllWhere<T>(array: Array<T>, fn: (value: T, index: number) => boolean, start = 0, stop = -1): number {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && (i >= start && i <= stop) && fn(array[i], i)) {\n count++;\n } else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {\n count++;\n } else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/**\n * An object which can produce an iterator over its values.\n */\nexport\ninterface IIterable<T> {\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n *\n * #### Notes\n * Depending on the iterable, the returned iterator may or may not be\n * a new object. A collection or other container-like object should\n * typically return a new iterator, while an iterator itself should\n * normally return `this`.\n */\n iter(): IIterator<T>;\n}\n\n\n/**\n * An object which traverses a collection of values.\n *\n * #### Notes\n * An `IIterator` is itself an `IIterable`. Most implementations of\n * `IIterator` should simply return `this` from the `iter()` method.\n */\nexport\ninterface IIterator<T> extends IIterable<T> {\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n *\n * #### Notes\n * The cloned iterator can be consumed independently of the current\n * iterator. In essence, it is a copy of the iterator value stream\n * which starts at the current location.\n *\n * This can be useful for lookahead and stream duplication.\n */\n clone(): IIterator<T>;\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n *\n * #### Notes\n * The `undefined` value is used to signal the end of iteration and\n * should therefore not be used as a value in a collection.\n *\n * The use of the `undefined` sentinel is an explicit design choice\n * which favors performance over purity. The ES6 iterator design of\n * returning a `{ value, done }` pair is suboptimal, as it requires\n * an object allocation on each iteration; and an `isDone()` method\n * would increase implementation and runtime complexity.\n */\n next(): T | undefined;\n}\n\n\n/**\n * A type alias for an iterable or builtin array-like object.\n */\nexport\ntype IterableOrArrayLike<T> = IIterable<T> | ArrayLike<T>;\n\n\n/**\n * Create an iterator for an iterable object.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @returns A new iterator for the given object.\n *\n * #### Notes\n * This function allows iteration algorithms to operate on user-defined\n * iterable types and builtin array-like objects in a uniform fashion.\n */\nexport\nfunction iter<T>(object: IterableOrArrayLike<T>): IIterator<T> {\n let it: IIterator<T>;\n if (typeof (object as any).iter === 'function') {\n it = (object as IIterable<T>).iter();\n } else {\n it = new ArrayIterator<T>(object as ArrayLike<T>);\n }\n return it;\n}\n\n\n/**\n * Create an iterator for the keys in an object.\n *\n * @param object - The object of interest.\n *\n * @returns A new iterator for the keys in the given object.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each, keys } from '@lumino/algorithm';\n *\n * let data = { one: 1, two: 2, three: 3 };\n *\n * each(keys(data), key => { console.log(key); }); // 'one', 'two', 'three'\n * ```\n */\nexport\nfunction iterKeys<T>(object: { readonly [key: string]: T }): IIterator<string> {\n return new KeyIterator(object);\n}\n\n\n/**\n * Create an iterator for the values in an object.\n *\n * @param object - The object of interest.\n *\n * @returns A new iterator for the values in the given object.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each, values } from '@lumino/algorithm';\n *\n * let data = { one: 1, two: 2, three: 3 };\n *\n * each(values(data), value => { console.log(value); }); // 1, 2, 3\n * ```\n */\nexport\nfunction iterValues<T>(object: { readonly [key: string]: T }): IIterator<T> {\n return new ValueIterator<T>(object);\n}\n\n\n/**\n * Create an iterator for the items in an object.\n *\n * @param object - The object of interest.\n *\n * @returns A new iterator for the items in the given object.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each, items } from '@lumino/algorithm';\n *\n * let data = { one: 1, two: 2, three: 3 };\n *\n * each(items(data), value => { console.log(value); }); // ['one', 1], ['two', 2], ['three', 3]\n * ```\n */\nexport\nfunction iterItems<T>(object: { readonly [key: string]: T }): IIterator<[string, T]> {\n return new ItemIterator<T>(object);\n}\n\n\n/**\n * Create an iterator for an iterator-like function.\n *\n * @param fn - A function which behaves like an iterator `next` method.\n *\n * @returns A new iterator for the given function.\n *\n * #### Notes\n * The returned iterator **cannot** be cloned.\n *\n * #### Example\n * ```typescript\n * import { each, iterFn } from '@lumino/algorithm';\n *\n * let it = iterFn((() => {\n * let i = 0;\n * return () => i > 3 ? undefined : i++;\n * })());\n *\n * each(it, v => { console.log(v); }); // 0, 1, 2, 3\n * ```\n */\nexport\nfunction iterFn<T>(fn: () => T | undefined): IIterator<T> {\n return new FnIterator<T>(fn);\n}\n\n\n/**\n * Invoke a function for each value in an iterable.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The callback function to invoke for each value.\n *\n * #### Notes\n * Iteration can be terminated early by returning `false` from the\n * callback function.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each } from '@lumino/algorithm';\n *\n * let data = [5, 7, 0, -2, 9];\n *\n * each(data, value => { console.log(value); });\n * ```\n */\nexport\nfunction each<T>(object: IterableOrArrayLike<T>, fn: (value: T, index: number) => boolean | void): void {\n let index = 0;\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++) === false) {\n return;\n }\n }\n}\n\n\n/**\n * Test whether all values in an iterable satisfy a predicate.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if all values pass the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `false` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { every } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * every(data, value => value % 2 === 0); // false\n * every(data, value => value % 2 === 1); // true\n * ```\n */\nexport\nfunction every<T>(object: IterableOrArrayLike<T>, fn: (value: T, index: number) => boolean): boolean {\n let index = 0;\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (!fn(value, index++)) {\n return false;\n }\n }\n return true;\n}\n\n\n/**\n * Test whether any value in an iterable satisfies a predicate.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if any value passes the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `true` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { some } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * some(data, value => value === 7); // true\n * some(data, value => value === 3); // false\n * ```\n */\nexport\nfunction some<T>(object: IterableOrArrayLike<T>, fn: (value: T, index: number) => boolean): boolean {\n let index = 0;\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++)) {\n return true;\n }\n }\n return false;\n}\n\n\n/**\n * Create an array from an iterable of values.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @returns A new array of values from the given object.\n *\n * #### Example\n * ```typescript\n * import { iter, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = iter(data);\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6];\n * ```\n */\nexport\nfunction toArray<T>(object: IterableOrArrayLike<T>): T[] {\n let index = 0;\n let result: T[] = [];\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n result[index++] = value;\n }\n return result;\n}\n\n\n/**\n * Create an object from an iterable of key/value pairs.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @returns A new object mapping keys to values.\n *\n * #### Example\n * ```typescript\n * import { toObject } from '@lumino/algorithm';\n *\n * let data = [['one', 1], ['two', 2], ['three', 3]];\n *\n * toObject(data); // { one: 1, two: 2, three: 3 }\n * ```\n */\nexport\nfunction toObject<T>(object: IterableOrArrayLike<[string, T]>): { [key: string]: T } {\n let it = iter(object);\n let pair: [string, T] | undefined;\n let result: { [key: string]: T } = {};\n while ((pair = it.next()) !== undefined) {\n result[pair[0]] = pair[1];\n }\n return result;\n}\n\n\n/**\n * An iterator for an array-like object.\n *\n * #### Notes\n * This iterator can be used for any builtin JS array-like object.\n */\nexport\nclass ArrayIterator<T> implements IIterator<T> {\n /**\n * Construct a new array iterator.\n *\n * @param source - The array-like object of interest.\n */\n constructor(source: ArrayLike<T>) {\n this._source = source;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n let result = new ArrayIterator<T>(this._source);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._index >= this._source.length) {\n return undefined;\n }\n return this._source[this._index++];\n }\n\n private _index = 0;\n private _source: ArrayLike<T>;\n}\n\n\n/**\n * An iterator for the keys in an object.\n *\n * #### Notes\n * This iterator can be used for any JS object.\n */\nexport\nclass KeyIterator implements IIterator<string> {\n /**\n * Construct a new key iterator.\n *\n * @param source - The object of interest.\n *\n * @param keys - The keys to iterate, if known.\n */\n constructor(source: { readonly [key: string]: any }, keys = Object.keys(source)) {\n this._source = source;\n this._keys = keys;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<string> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<string> {\n let result = new KeyIterator(this._source, this._keys);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): string | undefined {\n if (this._index >= this._keys.length) {\n return undefined;\n }\n let key = this._keys[this._index++];\n if (key in this._source) {\n return key;\n }\n return this.next();\n }\n\n private _index = 0;\n private _keys: string[];\n private _source: { readonly [key: string]: any };\n}\n\n\n/**\n * An iterator for the values in an object.\n *\n * #### Notes\n * This iterator can be used for any JS object.\n */\nexport\nclass ValueIterator<T> implements IIterator<T> {\n /**\n * Construct a new value iterator.\n *\n * @param source - The object of interest.\n *\n * @param keys - The keys to iterate, if known.\n */\n constructor(source: { readonly [key: string]: T }, keys = Object.keys(source)) {\n this._source = source;\n this._keys = keys;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n let result = new ValueIterator<T>(this._source, this._keys);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._index >= this._keys.length) {\n return undefined;\n }\n let key = this._keys[this._index++];\n if (key in this._source) {\n return this._source[key];\n }\n return this.next();\n }\n\n private _index = 0;\n private _keys: string[];\n private _source: { readonly [key: string]: T };\n}\n\n\n/**\n * An iterator for the items in an object.\n *\n * #### Notes\n * This iterator can be used for any JS object.\n */\nexport\nclass ItemIterator<T> implements IIterator<[string, T]> {\n /**\n * Construct a new item iterator.\n *\n * @param source - The object of interest.\n *\n * @param keys - The keys to iterate, if known.\n */\n constructor(source: { readonly [key: string]: T }, keys = Object.keys(source)) {\n this._source = source;\n this._keys = keys;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<[string, T]> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<[string, T]> {\n let result = new ItemIterator<T>(this._source, this._keys);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): [string, T] | undefined {\n if (this._index >= this._keys.length) {\n return undefined;\n }\n let key = this._keys[this._index++];\n if (key in this._source) {\n return [key, this._source[key]];\n }\n return this.next();\n }\n\n private _index = 0;\n private _keys: string[];\n private _source: { readonly [key: string]: T };\n}\n\n\n/**\n * An iterator for an iterator-like function.\n */\nexport\nclass FnIterator<T> implements IIterator<T> {\n /**\n * Construct a new function iterator.\n *\n * @param fn - The iterator-like function of interest.\n */\n constructor(fn: () => T | undefined) {\n this._fn = fn;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n throw new Error('An `FnIterator` cannot be cloned.');\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n return this._fn.call(undefined);\n }\n\n private _fn: () => T | undefined;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator, IterableOrArrayLike, iter\n} from './iter';\n\n\n/**\n * Chain together several iterables.\n *\n * @param objects - The iterable or array-like objects of interest.\n *\n * @returns An iterator which yields the values of the iterables\n * in the order in which they are supplied.\n *\n * #### Example\n * ```typescript\n * import { chain, toArray } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = chain(data1, data2);\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6]\n * ```\n */\nexport\nfunction chain<T>(...objects: IterableOrArrayLike<T>[]): IIterator<T> {\n return new ChainIterator<T>(iter(objects.map(iter)));\n}\n\n\n/**\n * An iterator which chains together several iterators.\n */\nexport\nclass ChainIterator<T> implements IIterator<T> {\n /**\n * Construct a new chain iterator.\n *\n * @param source - The iterator of iterators of interest.\n */\n constructor(source: IIterator<IIterator<T>>) {\n this._source = source;\n this._active = undefined;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n let result = new ChainIterator<T>(this._source.clone());\n result._active = this._active && this._active.clone();\n result._cloned = true;\n this._cloned = true;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._active === undefined) {\n let active = this._source.next();\n if (active === undefined) {\n return undefined;\n }\n this._active = this._cloned ? active.clone() : active;\n }\n let value = this._active.next();\n if (value !== undefined) {\n return value;\n }\n this._active = undefined;\n return this.next();\n }\n\n private _source: IIterator<IIterator<T>>;\n private _active: IIterator<T> | undefined;\n private _cloned = false;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator\n} from './iter';\n\n\n/**\n * Create an empty iterator.\n *\n * @returns A new iterator which yields nothing.\n *\n * #### Example\n * ```typescript\n * import { empty, toArray } from '@lumino/algorithm';\n *\n * let stream = empty<number>();\n *\n * toArray(stream); // []\n * ```\n */\nexport\nfunction empty<T>(): IIterator<T> {\n return new EmptyIterator<T>();\n}\n\n\n/**\n * An iterator which is always empty.\n */\nexport\nclass EmptyIterator<T> implements IIterator<T> {\n /**\n * Construct a new empty iterator.\n */\n constructor() { }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n return new EmptyIterator<T>();\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n return undefined;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator, IterableOrArrayLike, iter\n} from './iter';\n\n\n/**\n * Enumerate an iterable object.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param start - The starting enum value. The default is `0`.\n *\n * @returns An iterator which yields the enumerated values.\n *\n * #### Example\n * ```typescript\n * import { enumerate, toArray } from '@lumino/algorithm';\n *\n * let data = ['foo', 'bar', 'baz'];\n *\n * let stream = enumerate(data, 1);\n *\n * toArray(stream); // [[1, 'foo'], [2, 'bar'], [3, 'baz']]\n * ```\n */\nexport\nfunction enumerate<T>(object: IterableOrArrayLike<T>, start = 0): IIterator<[number, T]> {\n return new EnumerateIterator<T>(iter(object), start);\n}\n\n\n/**\n * An iterator which enumerates the source values.\n */\nexport\nclass EnumerateIterator<T> implements IIterator<[number, T]> {\n /**\n * Construct a new enumerate iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param start - The starting enum value.\n */\n constructor(source: IIterator<T>, start: number) {\n this._source = source;\n this._index = start;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<[number, T]> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<[number, T]> {\n return new EnumerateIterator<T>(this._source.clone(), this._index);\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): [number, T] | undefined {\n let value = this._source.next();\n if (value === undefined) {\n return undefined;\n }\n return [this._index++, value];\n }\n\n private _source: IIterator<T>;\n private _index: number;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator, IterableOrArrayLike, iter\n} from './iter';\n\n\n/**\n * Filter an iterable for values which pass a test.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns An iterator which yields the values which pass the test.\n *\n * #### Example\n * ```typescript\n * import { filter, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = filter(data, value => value % 2 === 0);\n *\n * toArray(stream); // [2, 4, 6]\n * ```\n */\nexport\nfunction filter<T>(object: IterableOrArrayLike<T>, fn: (value: T, index: number) => boolean): IIterator<T> {\n return new FilterIterator<T>(iter(object), fn);\n}\n\n\n/**\n * An iterator which yields values which pass a test.\n */\nexport\nclass FilterIterator<T> implements IIterator<T> {\n /**\n * Construct a new filter iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n */\n constructor(source: IIterator<T>, fn: (value: T, index: number) => boolean) {\n this._source = source;\n this._fn = fn;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n let result = new FilterIterator<T>(this._source.clone(), this._fn);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n let fn = this._fn;\n let it = this._source;\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (fn(value, this._index++)) {\n return value;\n }\n }\n return undefined;\n }\n\n private _index = 0;\n private _source: IIterator<T>;\n private _fn: (value: T, index: number) => boolean;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IterableOrArrayLike, iter\n} from './iter';\n\n\n/**\n * Find the first value in an iterable which matches a predicate.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { find } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * find(data, isCat).name; // 'fluffy'\n * ```\n */\nexport\nfunction find<T>(object: IterableOrArrayLike<T>, fn: (value: T, index: number) => boolean): T | undefined {\n let index = 0;\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++)) {\n return value;\n }\n }\n return undefined;\n}\n\n\n/**\n * Find the index of the first value which matches a predicate.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { findIndex } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * findIndex(data, isCat); // 1\n * ```\n */\nexport\nfunction findIndex<T>(object: IterableOrArrayLike<T>, fn: (value: T, index: number) => boolean): number {\n let index = 0;\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++)) {\n return index - 1;\n }\n }\n return -1;\n}\n\n\n/**\n * Find the minimum value in an iterable.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The minimum value in the iterable. If multiple values are\n * equivalent to the minimum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { min } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * min([7, 4, 0, 3, 9, 4], numberCmp); // 0\n * ```\n */\nexport\nfunction min<T>(object: IterableOrArrayLike<T>, fn: (first: T, second: T) => number): T | undefined {\n let it = iter(object);\n let value = it.next();\n if (value === undefined) {\n return undefined;\n }\n let result = value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, result) < 0) {\n result = value;\n }\n }\n return result;\n}\n\n\n/**\n * Find the maximum value in an iterable.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The maximum value in the iterable. If multiple values are\n * equivalent to the maximum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { max } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * max([7, 4, 0, 3, 9, 4], numberCmp); // 9\n * ```\n */\nexport\nfunction max<T>(object: IterableOrArrayLike<T>, fn: (first: T, second: T) => number): T | undefined {\n let it = iter(object);\n let value = it.next();\n if (value === undefined) {\n return undefined;\n }\n let result = value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, result) > 0) {\n result = value;\n }\n }\n return result;\n}\n\n\n/**\n * Find the minimum and maximum values in an iterable.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns A 2-tuple of the `[min, max]` values in the iterable. If\n * multiple values are equivalent, the left-most values are returned.\n * If the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { minmax } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * minmax([7, 4, 0, 3, 9, 4], numberCmp); // [0, 9]\n * ```\n */\nexport\nfunction minmax<T>(object: IterableOrArrayLike<T>, fn: (first: T, second: T) => number): [T, T] | undefined {\n let it = iter(object);\n let value = it.next();\n if (value === undefined) {\n return undefined;\n }\n let vmin = value;\n let vmax = value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, vmin) < 0) {\n vmin = value;\n } else if (fn(value, vmax) > 0) {\n vmax = value;\n }\n }\n return [vmin, vmax];\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator, IterableOrArrayLike, iter\n} from './iter';\n\n\n/**\n * Transform the values of an iterable with a mapping function.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n *\n * @returns An iterator which yields the transformed values.\n *\n * #### Example\n * ```typescript\n * import { map, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3];\n *\n * let stream = map(data, value => value * 2);\n *\n * toArray(stream); // [2, 4, 6]\n * ```\n */\nexport\nfunction map<T, U>(object: IterableOrArrayLike<T>, fn: (value: T, index: number) => U): IIterator<U> {\n return new MapIterator<T, U>(iter(object), fn);\n}\n\n\n/**\n * An iterator which transforms values using a mapping function.\n */\nexport\nclass MapIterator<T, U> implements IIterator<U> {\n /**\n * Construct a new map iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n */\n constructor(source: IIterator<T>, fn: (value: T, index: number) => U) {\n this._source = source;\n this._fn = fn;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<U> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<U> {\n let result = new MapIterator<T, U>(this._source.clone(), this._fn);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): U | undefined {\n let value = this._source.next();\n if (value === undefined) {\n return undefined;\n }\n return this._fn.call(undefined, value, this._index++);\n }\n\n private _index = 0;\n private _source: IIterator<T>;\n private _fn: (value: T, index: number) => U;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator\n} from './iter';\n\n\n/**\n * Create an iterator of evenly spaced values.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns An iterator which produces evenly spaced values.\n *\n * #### Notes\n * In the single argument form of `range(stop)`, `start` defaults to\n * `0` and `step` defaults to `1`.\n *\n * In the two argument form of `range(start, stop)`, `step` defaults\n * to `1`.\n */\nexport\nfunction range(start: number, stop?: number, step?: number): IIterator<number> {\n if (stop === undefined) {\n return new RangeIterator(0, start, 1);\n }\n if (step === undefined) {\n return new RangeIterator(start, stop, 1);\n }\n return new RangeIterator(start, stop, step);\n}\n\n\n/**\n * An iterator which produces a range of evenly spaced values.\n */\nexport\nclass RangeIterator implements IIterator<number> {\n /**\n * Construct a new range iterator.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n */\n constructor(start: number, stop: number, step: number) {\n this._start = start;\n this._stop = stop;\n this._step = step;\n this._length = Private.rangeLength(start, stop, step);\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<number> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<number> {\n let result = new RangeIterator(this._start, this._stop, this._step);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): number | undefined {\n if (this._index >= this._length) {\n return undefined;\n }\n return this._start + this._step * this._index++;\n }\n\n private _index = 0;\n private _length: number;\n private _start: number;\n private _stop: number;\n private _step: number;\n}\n\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Compute the effective length of a range.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns The number of steps need to traverse the range.\n */\n export\n function rangeLength(start: number, stop: number, step: number): number {\n if (step === 0) {\n return Infinity;\n }\n if (start > stop && step > 0) {\n return 0;\n }\n if (start < stop && step < 0) {\n return 0;\n }\n return Math.ceil((stop - start) / step);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IterableOrArrayLike, iter\n} from './iter';\n\n\n/**\n * Summarize all values in an iterable using a reducer function.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The reducer function to invoke for each value.\n *\n * @param initial - The initial value to start accumulation.\n *\n * @returns The final accumulated value.\n *\n * #### Notes\n * The `reduce` function follows the conventions of `Array#reduce`.\n *\n * If the iterator is empty, an initial value is required. That value\n * will be used as the return value. If no initial value is provided,\n * an error will be thrown.\n *\n * If the iterator contains a single item and no initial value is\n * provided, the single item is used as the return value.\n *\n * Otherwise, the reducer is invoked for each element in the iterable.\n * If an initial value is not provided, the first element will be used\n * as the initial accumulated value.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { reduce } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5];\n *\n * let sum = reduce(data, (a, value) => a + value); // 15\n * ```\n */\nexport\nfunction reduce<T>(object: IterableOrArrayLike<T>, fn: (accumulator: T, value: T, index: number) => T): T;\nexport\nfunction reduce<T, U>(object: IterableOrArrayLike<T>, fn: (accumulator: U, value: T, index: number) => U, initial: U): U;\nexport\nfunction reduce<T>(object: IterableOrArrayLike<T>, fn: (accumulator: any, value: T, index: number) => any, initial?: any): any {\n // Setup the iterator and fetch the first value.\n let index = 0;\n let it = iter(object);\n let first = it.next();\n\n // An empty iterator and no initial value is an error.\n if (first === undefined && initial === undefined) {\n throw new TypeError('Reduce of empty iterable with no initial value.');\n }\n\n // If the iterator is empty, return the initial value.\n if (first === undefined) {\n return initial;\n }\n\n // If the iterator has a single item and no initial value, the\n // reducer is not invoked and the first item is the return value.\n let second = it.next();\n if (second === undefined && initial === undefined) {\n return first;\n }\n\n // If iterator has a single item and an initial value is provided,\n // the reducer is invoked and that result is the return value.\n if (second === undefined) {\n return fn(initial, first, index++);\n }\n\n // Setup the initial accumlated value.\n let accumulator: any;\n if (initial === undefined) {\n accumulator = fn(first, second, index++);\n } else {\n accumulator = fn(fn(initial, first, index++), second, index++);\n }\n\n // Iterate the rest of the values, updating the accumulator.\n let next: T | undefined;\n while ((next = it.next()) !== undefined) {\n accumulator = fn(accumulator, next, index++);\n }\n\n // Return the final accumulated value.\n return accumulator;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator\n} from './iter';\n\n\n/**\n * Create an iterator which repeats a value a number of times.\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n *\n * @returns A new iterator which repeats the specified value.\n *\n * #### Example\n * ```typescript\n * import { repeat, toArray } from '@lumino/algorithm';\n *\n * let stream = repeat(7, 3);\n *\n * toArray(stream); // [7, 7, 7]\n * ```\n */\nexport\nfunction repeat<T>(value: T, count: number): IIterator<T> {\n return new RepeatIterator<T>(value, count);\n}\n\n\n/**\n * Create an iterator which yields a value a single time.\n *\n * @param value - The value to wrap in an iterator.\n *\n * @returns A new iterator which yields the value a single time.\n *\n * #### Example\n * ```typescript\n * import { once, toArray } from '@lumino/algorithm';\n *\n * let stream = once(7);\n *\n * toArray(stream); // [7]\n * ```\n */\nexport\nfunction once<T>(value: T): IIterator<T> {\n return new RepeatIterator<T>(value, 1);\n}\n\n\n/**\n * An iterator which repeats a value a specified number of times.\n */\nexport\nclass RepeatIterator<T> implements IIterator<T> {\n /**\n * Construct a new repeat iterator.\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n */\n constructor(value: T, count: number) {\n this._value = value;\n this._count = count;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n return new RepeatIterator<T>(this._value, this._count);\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._count <= 0) {\n return undefined;\n }\n this._count--;\n return this._value;\n }\n\n private _value: T;\n private _count: number;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator\n} from './iter';\n\n\n/**\n * An object which can produce a reverse iterator over its values.\n */\nexport\ninterface IRetroable<T> {\n /**\n * Get a reverse iterator over the object's values.\n *\n * @returns An iterator which yields the object's values in reverse.\n */\n retro(): IIterator<T>;\n}\n\n\n/**\n * A type alias for a retroable or builtin array-like object.\n */\nexport\ntype RetroableOrArrayLike<T> = IRetroable<T> | ArrayLike<T>;\n\n\n/**\n * Create an iterator for a retroable object.\n *\n * @param object - The retroable or array-like object of interest.\n *\n * @returns An iterator which traverses the object's values in reverse.\n *\n * #### Example\n * ```typescript\n * import { retro, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = retro(data);\n *\n * toArray(stream); // [6, 5, 4, 3, 2, 1]\n * ```\n */\nexport\nfunction retro<T>(object: RetroableOrArrayLike<T>): IIterator<T> {\n let it: IIterator<T>;\n if (typeof (object as any).retro === 'function') {\n it = (object as IRetroable<T>).retro();\n } else {\n it = new RetroArrayIterator<T>(object as ArrayLike<T>);\n }\n return it;\n}\n\n\n/**\n * An iterator which traverses an array-like object in reverse.\n *\n * #### Notes\n * This iterator can be used for any builtin JS array-like object.\n */\nexport\nclass RetroArrayIterator<T> implements IIterator<T> {\n /**\n * Construct a new retro iterator.\n *\n * @param source - The array-like object of interest.\n */\n constructor(source: ArrayLike<T>) {\n this._source = source;\n this._index = source.length - 1;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n let result = new RetroArrayIterator<T>(this._source);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._index < 0 || this._index >= this._source.length) {\n return undefined;\n }\n return this._source[this._index--];\n }\n\n private _index: number;\n private _source: ArrayLike<T>;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IterableOrArrayLike, each\n} from './iter';\n\n\n/**\n * Topologically sort an iterable of edges.\n *\n * @param edges - The iterable or array-like object of edges to sort.\n * An edge is represented as a 2-tuple of `[fromNode, toNode]`.\n *\n * @returns The topologically sorted array of nodes.\n *\n * #### Notes\n * If a cycle is present in the graph, the cycle will be ignored and\n * the return value will be only approximately sorted.\n *\n * #### Example\n * ```typescript\n * import { topologicSort } from '@lumino/algorithm';\n *\n * let data = [\n * ['d', 'e'],\n * ['c', 'd'],\n * ['a', 'b'],\n * ['b', 'c']\n * ];\n *\n * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']\n * ```\n */\nexport\nfunction topologicSort<T>(edges: IterableOrArrayLike<[T, T]>): T[] {\n // Setup the shared sorting state.\n let sorted: T[] = [];\n let visited = new Set<T>();\n let graph = new Map<T, T[]>();\n\n // Add the edges to the graph.\n each(edges, addEdge);\n\n // Visit each node in the graph.\n graph.forEach((v, k) => { visit(k); });\n\n // Return the sorted results.\n return sorted;\n\n // Add an edge to the graph.\n function addEdge(edge: [T, T]): void {\n let [fromNode, toNode] = edge;\n let children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n } else {\n graph.set(toNode, [fromNode]);\n }\n }\n\n // Recursively visit the node.\n function visit(node: T): void {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n let children = graph.get(node);\n if (children) {\n children.forEach(visit);\n }\n sorted.push(node);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator, IterableOrArrayLike, iter\n} from './iter';\n\n\n/**\n * Iterate over an iterable using a stepped increment.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n *\n * @returns An iterator which traverses the iterable step-wise.\n *\n * #### Example\n * ```typescript\n * import { stride, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = stride(data, 2);\n *\n * toArray(stream); // [1, 3, 5];\n * ```\n */\nexport\nfunction stride<T>(object: IterableOrArrayLike<T>, step: number): IIterator<T> {\n return new StrideIterator<T>(iter(object), step);\n}\n\n\n/**\n * An iterator which traverses a source iterator step-wise.\n */\nexport\nclass StrideIterator<T> implements IIterator<T> {\n /**\n * Construct a new stride iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n */\n constructor(source: IIterator<T>, step: number) {\n this._source = source;\n this._step = step;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n return new StrideIterator<T>(this._source.clone(), this._step);\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n let value = this._source.next();\n for (let n = this._step - 1; n > 0; --n) {\n this._source.next();\n }\n return value;\n }\n\n private _source: IIterator<T>;\n private _step: number;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/**\n * The namespace for string-specific algorithms.\n */\nexport\nnamespace StringExt {\n /**\n * Find the indices of characters in a source text.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The matched indices, or `null` if there is no match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * In order for there to be a match, all of the characters in `query`\n * **must** appear in `source` in the order given by `query`.\n *\n * Characters are matched using strict `===` equality.\n */\n export\n function findIndices(source: string, query: string, start = 0): number[] | null {\n let indices = new Array<number>(query.length);\n for (let i = 0, j = start, n = query.length; i < n; ++i, ++j) {\n j = source.indexOf(query[i], j);\n if (j === -1) {\n return null;\n }\n indices[i] = j;\n }\n return indices;\n }\n\n /**\n * The result of a string match function.\n */\n export\n interface IMatchResult {\n /**\n * A score which indicates the strength of the match.\n *\n * The documentation of a given match function should specify\n * whether a lower or higher score is a stronger match.\n */\n score: number;\n\n /**\n * The indices of the matched characters in the source text.\n *\n * The indices will appear in increasing order.\n */\n indices: number[];\n }\n\n /**\n * A string matcher which uses a sum-of-squares algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-squares approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The index of each\n * matching character is squared and added to the score. This means\n * that early and consecutive character matches are preferred, while\n * late matches are heavily penalized.\n */\n export\n function matchSumOfSquares(source: string, query: string, start = 0): IMatchResult | null {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i] - start;\n score += j * j;\n }\n return { score, indices };\n }\n\n /**\n * A string matcher which uses a sum-of-deltas algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-deltas approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The delta between\n * the indices are summed to create the score. This means that groups\n * of matched characters are preferred, while fragmented matches are\n * penalized.\n */\n export\n function matchSumOfDeltas(source: string, query: string, start = 0): IMatchResult | null {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n let last = start - 1;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i];\n score += j - last - 1;\n last = j;\n }\n return { score, indices };\n }\n\n /**\n * Highlight the matched characters of a source text.\n *\n * @param source - The text which should be highlighted.\n *\n * @param indices - The indices of the matched characters. They must\n * appear in increasing order and must be in bounds of the source.\n *\n * @param fn - The function to apply to the matched chunks.\n *\n * @returns An array of unmatched and highlighted chunks.\n */\n export\n function highlight<T>(source: string, indices: ReadonlyArray<number>, fn: (chunk: string) => T): Array<string | T> {\n // Set up the result array.\n let result: Array<string |T> = [];\n\n // Set up the counter variables.\n let k = 0;\n let last = 0;\n let n = indices.length;\n\n // Iterator over each index.\n while (k < n) {\n // Set up the chunk indices.\n let i = indices[k];\n let j = indices[k];\n\n // Advance the right chunk index until it's non-contiguous.\n while (++k < n && indices[k] === j + 1) {\n j++;\n }\n\n // Extract the unmatched text.\n if (last < i) {\n result.push(source.slice(last, i));\n }\n\n // Extract and highlight the matched text.\n if (i < j + 1) {\n result.push(fn(source.slice(i, j + 1)));\n }\n\n // Update the last visited index.\n last = j + 1;\n }\n\n // Extract any remaining unmatched text.\n if (last < source.length) {\n result.push(source.slice(last));\n }\n\n // Return the highlighted result.\n return result;\n }\n\n /**\n * A 3-way string comparison function.\n * \n * @param a - The first string of interest.\n * \n * @param b - The second string of interest.\n * \n * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.\n */\n export\n function cmp(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator, IterableOrArrayLike, iter\n} from './iter';\n\n\n/**\n * Take a fixed number of items from an iterable.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param count - The number of items to take from the iterable.\n *\n * @returns An iterator which yields the specified number of items\n * from the source iterable.\n *\n * #### Notes\n * The returned iterator will exhaust early if the source iterable\n * contains an insufficient number of items.\n */\nexport\nfunction take<T>(object: IterableOrArrayLike<T>, count: number): IIterator<T> {\n return new TakeIterator<T>(iter(object), count);\n}\n\n\n/**\n * An iterator which takes a fixed number of items from a source.\n */\nexport\nclass TakeIterator<T> implements IIterator<T> {\n /**\n * Construct a new take iterator.\n *\n * @param source - The iterator of interest.\n *\n * @param count - The number of items to take from the source.\n */\n constructor(source: IIterator<T>, count: number) {\n this._source = source;\n this._count = count;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n return new TakeIterator<T>(this._source.clone(), this._count);\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._count <= 0) {\n return undefined;\n }\n let value = this._source.next();\n if (value === undefined) {\n return undefined;\n }\n this._count--;\n return value;\n }\n\n private _count: number;\n private _source: IIterator<T>;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport {\n IIterator, IterableOrArrayLike, iter\n} from './iter';\n\n\n/**\n * Iterate several iterables in lockstep.\n *\n * @param objects - The iterable or array-like objects of interest.\n *\n * @returns An iterator which yields successive tuples of values where\n * each value is taken in turn from the provided iterables. It will\n * be as long as the shortest provided iterable.\n *\n * #### Example\n * ```typescript\n * import { zip, toArray } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = zip(data1, data2);\n *\n * toArray(stream); // [[1, 4], [2, 5], [3, 6]]\n * ```\n */\nexport\nfunction zip<T>(...objects: IterableOrArrayLike<T>[]): IIterator<T[]> {\n return new ZipIterator<T>(objects.map(iter));\n}\n\n\n/**\n * An iterator which iterates several sources in lockstep.\n */\nexport\nclass ZipIterator<T> implements IIterator<T[]> {\n /**\n * Construct a new zip iterator.\n *\n * @param source - The iterators of interest.\n */\n constructor(source: IIterator<T>[]) {\n this._source = source;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T[]> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T[]> {\n return new ZipIterator<T>(this._source.map(it => it.clone()));\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T[] | undefined {\n let result = new Array<T>(this._source.length);\n for (let i = 0, n = this._source.length; i < n; ++i) {\n let value = this._source[i].next();\n if (value === undefined) {\n return undefined;\n }\n result[i] = value;\n }\n return result;\n }\n\n private _source: IIterator<T>[];\n}\n","// Copyright (c) Bloomberg Finance LP.\n// Distributed under the terms of the Modified BSD License.\n\nimport { IRouter, JupyterFrontEnd } from '@jupyterlab/application';\nimport { IDocumentManager } from '@jupyterlab/docmanager';\nimport { ISettingRegistry } from '@jupyterlab/settingregistry';\n\n/**\n * Cell execution callbacks interface\n */\nexport interface INotebookRunCallback {\n /**\n * Callback before scrolling to the cell\n */\n onBeforeScroll?: () => Promise<void>;\n /**\n * Callback after scrolling to teh cell\n */\n onAfterScroll?: () => Promise<void>;\n /**\n * Callback after cell execution\n */\n onAfterCellRun?: (cellIndex: number) => Promise<void>;\n}\n\n/**\n * waitForSelector options\n */\nexport interface IWaitForSelectorOptions {\n /**\n * Test for the element to be hidden.\n */\n hidden?: boolean;\n}\n\nexport const PLUGIN_ID_ROUTER = '@jupyterlab/application-extension:router';\nexport const PLUGIN_ID_DOC_MANAGER = '@jupyterlab/docmanager-extension:plugin';\nexport const PLUGIN_ID_SETTINGS = '@jupyterlab/apputils-extension:settings';\n\nexport interface IPluginNameToInterfaceMap {\n [PLUGIN_ID_ROUTER]: IRouter;\n [PLUGIN_ID_DOC_MANAGER]: IDocumentManager;\n [PLUGIN_ID_SETTINGS]: ISettingRegistry;\n}\n\n/**\n * Galata In-Page interface\n */\nexport interface IGalataInpage {\n /**\n * Delete all cells of the active notebook\n */\n deleteNotebookCells(): Promise<void>;\n\n /**\n * Get the index of a toolbar item\n *\n * @param itemName Item name\n * @returns Index\n */\n getNotebookToolbarItemIndex(itemName: string): number;\n\n /**\n * Get an application plugin\n *\n * @param pluginId Plugin ID\n * @returns Application plugin\n */\n getPlugin<K extends keyof IPluginNameToInterfaceMap>(\n pluginId: K\n ): Promise<IPluginNameToInterfaceMap[K] | undefined>;\n\n /**\n * Test if a cell is selected in the active notebook\n *\n * @param cellIndex Cell index\n * @returns Whether the cell is selected or not\n */\n isNotebookCellSelected(cellIndex: number): boolean;\n\n /**\n * Test if a element is visible or not\n *\n * @param el Element\n * @returns Test result\n */\n isElementVisible(el: HTMLElement): boolean;\n\n /**\n * Save the active notebook\n */\n saveActiveNotebook(): Promise<void>;\n\n /**\n * Set the application theme\n *\n * @param themeName Theme name\n */\n setTheme(themeName: string): Promise<void>;\n\n /**\n * Run the active notebook\n */\n runActiveNotebook(): Promise<void>;\n\n /**\n * Run the active notebook cell by cell\n * and execute the callback after each cell execution\n *\n * @param callback Callback\n */\n runActiveNotebookCellByCell(callback?: INotebookRunCallback): Promise<void>;\n\n /**\n * Wait for the route to be on path and close all documents\n *\n * @param path Path to monitor\n */\n waitForLaunch(path?: string): Promise<void>;\n\n /**\n * Wait for the route to be on path and close all documents\n *\n * @param path Path to monitor\n */\n waitForNotebookRun(): Promise<void>;\n\n /**\n * Wait for an element to be found from a CSS selector\n *\n * @param selector CSS selector\n * @param node Element\n * @param options Options\n * @returns Selected element\n */\n waitForSelector(\n selector: string,\n node?: Element,\n options?: IWaitForSelectorOptions\n ): Promise<Node | null>;\n\n /**\n * Waits for the given `timeout` in milliseconds.\n *\n * @param timeout A timeout to wait for\n */\n waitForTimeout(duration: number): Promise<void>;\n\n /**\n * Wait for an element to be found from a XPath\n *\n * @param selector CSS selector\n * @param node Element\n * @param options Options\n * @returns Selected element\n */\n waitForXPath(\n selector: string,\n node?: Element,\n options?: IWaitForSelectorOptions\n ): Promise<Node | null>;\n\n /**\n * Application object\n */\n readonly app: JupyterFrontEnd;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/* eslint-disable @typescript-eslint/ban-types */\n// Copyright (c) Bloomberg Finance LP.\n// Distributed under the terms of the Modified BSD License.\n\nimport type { IRouter, JupyterFrontEnd } from '@jupyterlab/application';\nimport type { Cell, MarkdownCell } from '@jupyterlab/cells';\nimport type * as nbformat from '@jupyterlab/nbformat';\nimport type { Notebook, NotebookPanel } from '@jupyterlab/notebook';\nimport { toArray } from '@lumino/algorithm';\nimport {\n IGalataInpage,\n INotebookRunCallback,\n IPluginNameToInterfaceMap,\n IWaitForSelectorOptions,\n PLUGIN_ID_DOC_MANAGER,\n PLUGIN_ID_ROUTER\n} from './tokens';\n\n/**\n * Factory for element containing a given class xpath\n *\n * @param className Class name\n * @returns The selector\n */\nfunction xpContainsClass(className: string): string {\n return `contains(concat(\" \", normalize-space(@class), \" \"), \" ${className} \")`;\n}\n\n/**\n * In-Page Galata helpers\n */\nexport class GalataInpage implements IGalataInpage {\n constructor() {\n this._app = window.jupyterlab ?? window.jupyterapp;\n }\n\n /**\n * Get an application plugin\n *\n * @param pluginId Plugin ID\n * @returns Application plugin\n */\n async getPlugin<K extends keyof IPluginNameToInterfaceMap>(\n pluginId: K\n ): Promise<IPluginNameToInterfaceMap[K] | undefined> {\n return new Promise((resolve, reject) => {\n const app = this._app;\n const hasPlugin = app.hasPlugin(pluginId);\n\n if (hasPlugin) {\n try {\n const appAny = app as any;\n const plugin: any = appAny._pluginMap\n ? appAny._pluginMap[pluginId]\n : undefined;\n if (plugin.activated) {\n resolve(plugin.service);\n } else {\n void app.activatePlugin(pluginId).then(response => {\n resolve(plugin.service);\n });\n }\n } catch (error) {\n console.error('Failed to get plugin', error);\n }\n }\n });\n }\n\n /**\n * Wait for a function to finish for max. timeout milliseconds\n *\n * @param fn Function\n * @param timeout Timeout\n */\n async waitForFunction(fn: Function, timeout?: number): Promise<void> {\n return new Promise((resolve, reject) => {\n let checkTimer: number | null = null;\n let timeoutTimer: number | null = null;\n const check = async () => {\n checkTimer = null;\n if (await Promise.resolve(fn())) {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer);\n }\n resolve();\n } else {\n checkTimer = window.setTimeout(check, 200);\n }\n };\n\n void check();\n\n if (timeout) {\n timeoutTimer = window.setTimeout(() => {\n timeoutTimer = null;\n if (checkTimer) {\n clearTimeout(checkTimer);\n }\n reject(new Error('Timed out waiting for condition to be fulfilled.'));\n }, timeout);\n }\n });\n }\n\n /**\n * Waits for the given `timeout` in milliseconds.\n *\n * @param timeout A timeout to wait for\n */\n async waitForTimeout(timeout: number): Promise<void> {\n return new Promise(resolve => {\n setTimeout(() => {\n resolve();\n }, timeout);\n });\n }\n\n /**\n * Wait for a condition to fulfill or for a certain time\n *\n * @param condition Condition or timeout to wait for\n * @param timeout Timeout\n */\n async waitFor(condition: Function | number, timeout?: number): Promise<void> {\n const conditionType = typeof condition;\n\n if (conditionType === 'function') {\n return this.waitForFunction(condition as Function, timeout);\n } else if (conditionType === 'number') {\n return this.waitForTimeout(condition as number);\n }\n }\n\n /**\n * Wait for the route to be on path and close all documents\n *\n * @param path Path to monitor\n */\n async waitForLaunch(path = '/lab'): Promise<void> {\n let resolver: () => void;\n const delegate = new Promise<void>(resolve => {\n resolver = resolve;\n });\n const router = await this.getPlugin(PLUGIN_ID_ROUTER);\n const docManager = await this.getPlugin(PLUGIN_ID_DOC_MANAGER);\n\n const listener = async (sender: IRouter, args: IRouter.ILocation) => {\n if (args.path === path) {\n router?.routed.disconnect(listener);\n await docManager?.closeAll();\n resolver();\n }\n };\n\n router?.routed.connect(listener);\n return delegate;\n }\n\n /**\n * Wait for an element to be found from a CSS selector\n *\n * @param selector CSS selector\n * @param node Element\n * @param options Options\n * @returns Selected element\n */\n async waitForSelector(\n selector: string,\n node?: Element,\n options?: IWaitForSelectorOptions\n ): Promise<Node | null> {\n const waitForHidden = options && options.hidden;\n\n return new Promise((resolve, reject) => {\n const timer = setInterval(() => {\n const parent = node || document;\n const found = parent.querySelector(selector);\n if (waitForHidden) {\n if (!found) {\n clearInterval(timer);\n resolve(null);\n }\n } else if (found) {\n clearInterval(timer);\n resolve(found);\n }\n }, 200);\n });\n }\n\n /**\n * Wait for an element to be found from a XPath\n *\n * @param selector CSS selector\n * @param node Element\n * @param options Options\n * @returns Selected element\n */\n async waitForXPath(\n selector: string,\n node?: Element,\n options?: IWaitForSelectorOptions\n ): Promise<Node | null> {\n const waitForHidden = options && options.hidden;\n\n return new Promise((resolve, reject) => {\n const timer = setInterval(() => {\n const parent = node || document;\n const iterator = document.evaluate(\n selector,\n parent,\n null,\n XPathResult.UNORDERED_NODE_ITERATOR_TYPE,\n null\n );\n const found = iterator && iterator.iterateNext();\n if (waitForHidden) {\n if (!found) {\n clearInterval(timer);\n resolve(null);\n }\n } else if (found) {\n clearInterval(timer);\n resolve(found);\n }\n }, 200);\n });\n }\n\n /**\n * Delete all cells of the active notebook\n */\n async deleteNotebookCells(): Promise<void> {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const nb = nbPanel.content;\n\n void this._app.commands.execute('notebook:delete-cell');\n\n nb.update();\n }\n /**\n * Add a cell to the active notebook\n *\n * @param cellType Cell type\n * @param source Cell input source\n * @returns Action success result\n */\n addNotebookCell(cellType: nbformat.CellType, source: string): boolean {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const nb = nbPanel.content;\n\n if (nb !== null) {\n void this._app.commands.execute('notebook:insert-cell-below');\n\n const numCells = nb.widgets.length;\n\n if (nb.model) {\n nb.model.cells.beginCompoundOperation();\n nb.model.cells.set(\n numCells - 1,\n nb.model.contentFactory.createCell(cellType, {\n cell: {\n cell_type: cellType,\n source: source,\n metadata: {}\n }\n })\n );\n nb.model.cells.endCompoundOperation();\n }\n nb.update();\n } else {\n return false;\n }\n\n return true;\n }\n\n /**\n * Set the type and content of a cell in the active notebook\n *\n * @param cellIndex Cell index\n * @param cellType Cell type\n * @param source Cell input source\n * @returns Action success status\n */\n setNotebookCell(\n cellIndex: number,\n cellType: nbformat.CellType,\n source: string\n ): boolean {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const nb = nbPanel.content;\n\n if (nb) {\n const numCells = nb.widgets.length;\n if (cellIndex < 0 || cellIndex >= numCells) {\n return false;\n }\n\n if (nb.model) {\n nb.model.cells.beginCompoundOperation();\n nb.model.cells.set(\n cellIndex,\n nb.model.contentFactory.createCell(cellType, {\n cell: {\n cell_type: cellType,\n source: source,\n metadata: {}\n }\n })\n );\n nb.model.cells.endCompoundOperation();\n }\n nb.update();\n } else {\n return false;\n }\n\n return true;\n }\n\n /**\n * Test if a cell is selected in the active notebook\n *\n * @param cellIndex Cell index\n * @returns Whether the cell is selected or not\n */\n isNotebookCellSelected(cellIndex: number): boolean {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const nb = nbPanel.content;\n\n const numCells = nb.widgets.length;\n if (cellIndex < 0 || cellIndex >= numCells) {\n return false;\n }\n\n return nb.isSelected(nb.widgets[cellIndex]);\n }\n\n /**\n * Save the active notebook\n */\n async saveActiveNotebook(): Promise<void> {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n await nbPanel.context.save();\n }\n\n /**\n * Run the active notebook\n */\n async runActiveNotebook(): Promise<void> {\n await this._app.commands.execute('notebook:run-all-cells');\n }\n\n /**\n * Wait for the active notebook to be run\n */\n async waitForNotebookRun(): Promise<void> {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const notebook = nbPanel.content;\n if (!notebook.widgets) {\n console.error('NOTEBOOK CELL PROBLEM', notebook);\n }\n const numCells = notebook.widgets.length;\n\n if (numCells === 0) {\n return;\n }\n\n const promises: Promise<Node | null>[] = [];\n\n for (let i = 0; i < numCells; ++i) {\n const cell = notebook.widgets[i];\n promises.push(this.waitForCellRun(cell));\n }\n\n await Promise.all(promises);\n }\n\n /**\n * Wait for a Markdown cell to be rendered\n *\n * @param cell Cell\n */\n async waitForMarkdownCellRendered(cell: MarkdownCell): Promise<void> {\n await cell.ready;\n\n let resolver: (value: void | PromiseLike<void>) => void;\n const delegate = new Promise<void>(resolve => {\n resolver = resolve;\n });\n let timer: number | null = window.setInterval(() => {\n if (cell.rendered) {\n if (timer) {\n clearInterval(timer);\n }\n timer = null;\n resolver();\n }\n }, 200);\n\n return delegate;\n }\n\n /**\n * Wait for a cell to be run and return its output element\n *\n * @param cell Cell\n * @param timeout Timeout\n * @returns Output element\n */\n async waitForCellRun(cell: Cell, timeout = 2000): Promise<Node | null> {\n const model = cell.model;\n const code = model.value.text;\n if (!code.trim()) {\n return null;\n }\n\n const emptyPrompt = '[ ]:';\n const runningPrompt = '[*]:';\n\n await this.waitForXPath(\n `.//div[${xpContainsClass(\n 'jp-InputArea-prompt'\n )} and text()=\"${emptyPrompt}\"]`,\n cell.node,\n { hidden: true }\n );\n await this.waitForXPath(\n `.//div[${xpContainsClass(\n 'jp-InputArea-prompt'\n )} and text()=\"${runningPrompt}\"]`,\n cell.node,\n { hidden: true }\n );\n\n const cellType = cell.model.type;\n if (cellType === 'markdown') {\n await this.waitForMarkdownCellRendered(cell as MarkdownCell);\n return null;\n } else if (cellType === 'raw') {\n return null;\n } else {\n // 'code'\n let resolver: (value: Node | null) => void;\n const delegate = new Promise<Node | null>(resolve => {\n resolver = resolve;\n });\n\n let numTries = 0;\n let timer: any = null;\n let timeoutTimer: any = null;\n\n const clearAndResolve = (output: Node | null) => {\n clearInterval(timer);\n timer = null;\n clearTimeout(timeoutTimer);\n timeoutTimer = null;\n resolver(output);\n };\n\n const startTimeout = () => {\n if (!timeoutTimer) {\n timeoutTimer = setTimeout(() => {\n clearAndResolve(null);\n }, timeout);\n }\n };\n\n const checkIfDone = () => {\n const output = cell.node.querySelector(\n '.jp-Cell-outputArea .jp-OutputArea-output'\n );\n\n if (output) {\n if (output.textContent === 'Loading widget...') {\n startTimeout();\n } else {\n clearAndResolve(output);\n }\n } else {\n if (numTries > 0) {\n clearAndResolve(null);\n }\n }\n numTries++;\n };\n\n checkIfDone();\n\n timer = setInterval(() => {\n checkIfDone();\n }, 200);\n return delegate;\n }\n }\n\n /**\n * Whether the given notebook will scroll or not\n *\n * @param notebook Notebook\n * @param position Position\n * @param threshold Threshold\n * @returns Test result\n */\n notebookWillScroll(\n notebook: Notebook,\n position: number,\n threshold = 25\n ): boolean {\n const node = notebook.node;\n const ar = node.getBoundingClientRect();\n const delta = position - ar.top - ar.height / 2;\n return Math.abs(delta) > (ar.height * threshold) / 100;\n }\n\n /**\n * Run the active notebook cell by cell\n * and execute the callback after each cell execution\n *\n * @param callback Callback\n */\n async runActiveNotebookCellByCell(\n callback?: INotebookRunCallback\n ): Promise<void> {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const notebook = nbPanel.content;\n if (!notebook.widgets) {\n console.error('NOTEBOOK CELL PROBLEM', notebook);\n }\n const numCells = notebook.widgets.length;\n\n if (numCells === 0) {\n return;\n }\n\n void this._app.commands.execute('notebook:deselect-all');\n\n for (let i = 0; i < numCells; ++i) {\n const cell = notebook.widgets[i];\n notebook.activeCellIndex = i;\n notebook.select(cell);\n\n await this._app.commands.execute('notebook:run-cell');\n\n const output = await this.waitForCellRun(cell);\n\n if (callback && callback.onAfterCellRun) {\n await callback.onAfterCellRun(i);\n }\n\n const rectNode = output\n ? cell.node.querySelector('.jp-Cell-outputArea')\n : cell.inputArea.node;\n const rect = rectNode?.getBoundingClientRect();\n\n const scrollThreshold = 45;\n let prevScroll = notebook.node.scrollTop;\n let willScroll = false;\n if (rect) {\n willScroll = this.notebookWillScroll(\n notebook,\n rect.bottom,\n scrollThreshold\n );\n if (willScroll && callback && callback.onBeforeScroll) {\n await callback.onBeforeScroll();\n }\n\n prevScroll = notebook.node.scrollTop;\n notebook.scrollToPosition(rect.bottom, scrollThreshold);\n }\n notebook.update();\n\n if (willScroll && callback && callback.onAfterScroll) {\n const newScroll = notebook.node.scrollTop;\n if (newScroll !== prevScroll) {\n console.error('Notebook scroll mispredicted!');\n }\n\n await callback.onAfterScroll();\n }\n }\n }\n\n /**\n * Get the index of a toolbar item\n *\n * @param itemName Item name\n * @returns Index\n */\n getNotebookToolbarItemIndex(itemName: string): number {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const names = toArray(nbPanel.toolbar.names());\n\n return names.indexOf(itemName);\n }\n\n /**\n * Test if a element is visible or not\n *\n * @param el Element\n * @returns Test result\n */\n isElementVisible(el: HTMLElement): boolean {\n return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length);\n }\n\n /**\n * Set the application theme\n *\n * @param themeName Theme name\n */\n async setTheme(themeName: string): Promise<void> {\n await this._app.commands.execute('apputils:change-theme', {\n theme: themeName\n });\n\n await this.waitFor(async () => {\n return document.body.dataset.jpThemeName === themeName;\n });\n }\n\n /**\n * Application object\n */\n get app(): JupyterFrontEnd {\n return this._app;\n }\n\n private _app: JupyterFrontEnd;\n}\n\nwindow.galataip = new GalataInpage();\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/array.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/iter.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/chain.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/empty.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/enumerate.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/filter.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/find.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/map.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/range.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/reduce.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/repeat.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/retro.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/sort.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/stride.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/string.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/take.ts","webpack://@jupyterlab/galata/../node_modules/@lumino/algorithm/src/zip.ts","webpack://@jupyterlab/galata/./src/inpage/tokens.ts","webpack://@jupyterlab/galata/webpack/bootstrap","webpack://@jupyterlab/galata/webpack/runtime/define property getters","webpack://@jupyterlab/galata/webpack/runtime/hasOwnProperty shorthand","webpack://@jupyterlab/galata/webpack/runtime/make namespace object","webpack://@jupyterlab/galata/./src/inpage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;;;;;;;AAQA;;;IAGiB,SAo8ChB;AAp8CD,WAAiB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyCvB,SAAgB,YAAY,CAC1B,KAAmB,EACnB,KAAQ,EACR,KAAS,EACT,IAAS;QADT,iCAAS;QACT,+BAAQ,CAAC;QAET,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,EAAE;YACX,OAAO,CAAC,CAAC,CAAC;SACX;QACD,IAAI,KAAK,GAAG,CAAC,EAAE;YACb,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;SAChC;aAAM;YACL,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;SAChC;QACD,IAAI,IAAI,GAAG,CAAC,EAAE;YACZ,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC;SAC9B;aAAM;YACL,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;SAC9B;QACD,IAAI,IAAY,CAAC;QACjB,IAAI,IAAI,GAAG,KAAK,EAAE;YAChB,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;SAC/B;aAAM;YACL,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC;SACzB;QACD,KAAK,IAAI,CAAC,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K,EAAE,SAAS;SACjB,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;YAC5B,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CAGF;AA1lBD,yCA0lBC;AAED,MAAM,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC","file":"inpage.js","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * The namespace for array-specific algorithms.\n */\nexport namespace ArrayExt {\n /**\n * Find the index of the first occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.firstIndexOf(data, 'red'); // -1\n * ArrayExt.firstIndexOf(data, 'one'); // 0\n * ArrayExt.firstIndexOf(data, 'one', 1); // 4\n * ArrayExt.firstIndexOf(data, 'two', 2); // -1\n * ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1\n * ```\n */\n export function firstIndexOf<T>(\n array: ArrayLike<T>,\n value: T,\n start = 0,\n stop = -1\n ): number {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let span: number;\n if (stop < start) {\n span = stop + 1 + (n - start);\n } else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n\n /**\n * Find the index of the last occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.lastIndexOf(data, 'red'); // -1\n * ArrayExt.lastIndexOf(data, 'one'); // 4\n * ArrayExt.lastIndexOf(data, 'one', 1); // 0\n * ArrayExt.lastIndexOf(data, 'two', 0); // -1\n * ArrayExt.lastIndexOf(data, 'two', 0, 1); // 1\n * ```\n */\n export function lastIndexOf<T>(\n array: ArrayLike<T>,\n value: T,\n start = -1,\n stop = 0\n ): number {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let span: number;\n if (start < stop) {\n span = start + 1 + (n - stop);\n } else {\n span = start - stop + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start - i + n) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n\n /**\n * Find the index of the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstIndex(data, isEven); // 1\n * ArrayExt.findFirstIndex(data, isEven, 4); // 5\n * ArrayExt.findFirstIndex(data, isEven, 6); // -1\n * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1\n * ```\n */\n export function findFirstIndex<T>(\n array: ArrayLike<T>,\n fn: (value: T, index: number) => boolean,\n start = 0,\n stop = -1\n ): number {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let span: number;\n if (stop < start) {\n span = stop + 1 + (n - start);\n } else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n\n /**\n * Find the index of the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastIndex(data, isEven); // 5\n * ArrayExt.findLastIndex(data, isEven, 4); // 3\n * ArrayExt.findLastIndex(data, isEven, 0); // -1\n * ArrayExt.findLastIndex(data, isEven, 0, 1); // 5\n * ```\n */\n export function findLastIndex<T>(\n array: ArrayLike<T>,\n fn: (value: T, index: number) => boolean,\n start = -1,\n stop = 0\n ): number {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let d: number;\n if (start < stop) {\n d = start + 1 + (n - stop);\n } else {\n d = start - stop + 1;\n }\n for (let i = 0; i < d; ++i) {\n let j = (start - i + n) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n\n /**\n * Find the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstValue(data, isEven); // 2\n * ArrayExt.findFirstValue(data, isEven, 2); // 4\n * ArrayExt.findFirstValue(data, isEven, 6); // undefined\n * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2\n * ```\n */\n export function findFirstValue<T>(\n array: ArrayLike<T>,\n fn: (value: T, index: number) => boolean,\n start = 0,\n stop = -1\n ): T | undefined {\n let index = findFirstIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n\n /**\n * Find the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The last matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastValue(data, isEven); // 2\n * ArrayExt.findLastValue(data, isEven, 4); // 4\n * ArrayExt.findLastValue(data, isEven, 0); // undefined\n * ArrayExt.findLastValue(data, isEven, 0, 1); // 2\n * ```\n */\n export function findLastValue<T>(\n array: ArrayLike<T>,\n fn: (value: T, index: number) => boolean,\n start = -1,\n stop = 0\n ): T | undefined {\n let index = findLastIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n\n /**\n * Find the index of the first element which compares `>=` to a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>=` to the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.lowerBound(data, 0, numberCmp); // 0\n * ArrayExt.lowerBound(data, 6, numberCmp); // 3\n * ArrayExt.lowerBound(data, 7, numberCmp); // 3\n * ArrayExt.lowerBound(data, -1, numberCmp); // 0\n * ArrayExt.lowerBound(data, 10, numberCmp); // 6\n * ```\n */\n export function lowerBound<T, U>(\n array: ArrayLike<T>,\n value: U,\n fn: (element: T, value: U) => number,\n start = 0,\n stop = -1\n ): number {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) < 0) {\n begin = middle + 1;\n span -= half + 1;\n } else {\n span = half;\n }\n }\n return begin;\n }\n\n /**\n * Find the index of the first element which compares `>` than a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>` than the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.upperBound(data, 0, numberCmp); // 1\n * ArrayExt.upperBound(data, 6, numberCmp); // 3\n * ArrayExt.upperBound(data, 7, numberCmp); // 5\n * ArrayExt.upperBound(data, -1, numberCmp); // 0\n * ArrayExt.upperBound(data, 10, numberCmp); // 6\n * ```\n */\n export function upperBound<T, U>(\n array: ArrayLike<T>,\n value: U,\n fn: (element: T, value: U) => number,\n start = 0,\n stop = -1\n ): number {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) > 0) {\n span = half;\n } else {\n begin = middle + 1;\n span -= half + 1;\n }\n }\n return begin;\n }\n\n /**\n * Test whether two arrays are shallowly equal.\n *\n * @param a - The first array-like object to compare.\n *\n * @param b - The second array-like object to compare.\n *\n * @param fn - The comparison function to apply to the elements. It\n * should return `true` if the elements are \"equal\". The default\n * compares elements using strict `===` equality.\n *\n * @returns Whether the two arrays are shallowly equal.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * Modifying the length of the arrays while comparing.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let d1 = [0, 3, 4, 7, 7, 9];\n * let d2 = [0, 3, 4, 7, 7, 9];\n * let d3 = [42];\n * ArrayExt.shallowEqual(d1, d2); // true\n * ArrayExt.shallowEqual(d2, d3); // false\n * ```\n */\n export function shallowEqual<T>(\n a: ArrayLike<T>,\n b: ArrayLike<T>,\n fn?: (a: T, b: T) => boolean\n ): boolean {\n // Check for object identity first.\n if (a === b) {\n return true;\n }\n\n // Bail early if the lengths are different.\n if (a.length !== b.length) {\n return false;\n }\n\n // Compare each element for equality.\n for (let i = 0, n = a.length; i < n; ++i) {\n if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {\n return false;\n }\n }\n\n // The array are shallowly equal.\n return true;\n }\n\n /**\n * Create a slice of an array subject to an optional step.\n *\n * @param array - The array-like object of interest.\n *\n * @param options - The options for configuring the slice.\n *\n * @returns A new array with the specified values.\n *\n * @throws An exception if the slice `step` is `0`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start`, `stop`, or `step` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]\n * ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]\n * ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]\n * ```\n */\n export function slice<T>(\n array: ArrayLike<T>,\n options: slice.IOptions = {}\n ): T[] {\n // Extract the options.\n let { start, stop, step } = options;\n\n // Set up the `step` value.\n if (step === undefined) {\n step = 1;\n }\n\n // Validate the step size.\n if (step === 0) {\n throw new Error('Slice `step` cannot be zero.');\n }\n\n // Look up the length of the array.\n let n = array.length;\n\n // Set up the `start` value.\n if (start === undefined) {\n start = step < 0 ? n - 1 : 0;\n } else if (start < 0) {\n start = Math.max(start + n, step < 0 ? -1 : 0);\n } else if (start >= n) {\n start = step < 0 ? n - 1 : n;\n }\n\n // Set up the `stop` value.\n if (stop === undefined) {\n stop = step < 0 ? -1 : n;\n } else if (stop < 0) {\n stop = Math.max(stop + n, step < 0 ? -1 : 0);\n } else if (stop >= n) {\n stop = step < 0 ? n - 1 : n;\n }\n\n // Compute the slice length.\n let length;\n if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {\n length = 0;\n } else if (step < 0) {\n length = Math.floor((stop - start + 1) / step + 1);\n } else {\n length = Math.floor((stop - start - 1) / step + 1);\n }\n\n // Compute the sliced result.\n let result: T[] = [];\n for (let i = 0; i < length; ++i) {\n result[i] = array[start + i * step];\n }\n\n // Return the result.\n return result;\n }\n\n /**\n * The namespace for the `slice` function statics.\n */\n export namespace slice {\n /**\n * The options for the `slice` function.\n */\n export interface IOptions {\n /**\n * The starting index of the slice, inclusive.\n *\n * Negative values are taken as an offset from the end\n * of the array.\n *\n * The default is `0` if `step > 0` else `n - 1`.\n */\n start?: number;\n\n /**\n * The stopping index of the slice, exclusive.\n *\n * Negative values are taken as an offset from the end\n * of the array.\n *\n * The default is `n` if `step > 0` else `-n - 1`.\n */\n stop?: number;\n\n /**\n * The step value for the slice.\n *\n * This must not be `0`.\n *\n * The default is `1`.\n */\n step?: number;\n }\n }\n\n /**\n * An array-like object which supports item assignment.\n */\n export type MutableArrayLike<T> = {\n readonly length: number;\n [index: number]: T;\n };\n\n /**\n * Move an element in an array from one index to another.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param fromIndex - The index of the element to move. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param toIndex - The target index of the element. Negative\n * values are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `fromIndex` or `toIndex` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.move(data, 1, 2); // [0, 2, 1, 3, 4]\n * ArrayExt.move(data, 4, 2); // [0, 2, 4, 1, 3]\n * ```\n */\n export function move<T>(\n array: MutableArrayLike<T>,\n fromIndex: number,\n toIndex: number\n ): void {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (fromIndex < 0) {\n fromIndex = Math.max(0, fromIndex + n);\n } else {\n fromIndex = Math.min(fromIndex, n - 1);\n }\n if (toIndex < 0) {\n toIndex = Math.max(0, toIndex + n);\n } else {\n toIndex = Math.min(toIndex, n - 1);\n }\n if (fromIndex === toIndex) {\n return;\n }\n let value = array[fromIndex];\n let d = fromIndex < toIndex ? 1 : -1;\n for (let i = fromIndex; i !== toIndex; i += d) {\n array[i] = array[i + d];\n }\n array[toIndex] = value;\n }\n\n /**\n * Reverse an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param start - The index of the first element in the range to be\n * reversed, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * reversed, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` index which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.reverse(data, 1, 3); // [0, 3, 2, 1, 4]\n * ArrayExt.reverse(data, 3); // [0, 3, 2, 4, 1]\n * ArrayExt.reverse(data); // [1, 4, 2, 3, 0]\n * ```\n */\n export function reverse<T>(\n array: MutableArrayLike<T>,\n start = 0,\n stop = -1\n ): void {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n while (start < stop) {\n let a = array[start];\n let b = array[stop];\n array[start++] = b;\n array[stop--] = a;\n }\n }\n\n /**\n * Rotate the elements of an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param delta - The amount of rotation to apply to the elements. A\n * positive value will rotate the elements to the left. A negative\n * value will rotate the elements to the right.\n *\n * @param start - The index of the first element in the range to be\n * rotated, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * rotated, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `delta`, `start`, or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]\n * ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]\n * ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]\n * ```\n */\n export function rotate<T>(\n array: MutableArrayLike<T>,\n delta: number,\n start = 0,\n stop = -1\n ): void {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n if (start >= stop) {\n return;\n }\n let length = stop - start + 1;\n if (delta > 0) {\n delta = delta % length;\n } else if (delta < 0) {\n delta = ((delta % length) + length) % length;\n }\n if (delta === 0) {\n return;\n }\n let pivot = start + delta;\n reverse(array, start, pivot - 1);\n reverse(array, pivot, stop);\n reverse(array, start, stop);\n }\n\n /**\n * Fill an array with a static value.\n *\n * @param array - The mutable array-like object to fill.\n *\n * @param value - The static value to use to fill the array.\n *\n * @param start - The index of the first element in the range to be\n * filled, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * filled, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Notes\n * If `stop < start` the fill will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four'];\n * ArrayExt.fill(data, 'r'); // ['r', 'r', 'r', 'r']\n * ArrayExt.fill(data, 'g', 1); // ['r', 'g', 'g', 'g']\n * ArrayExt.fill(data, 'b', 2, 3); // ['r', 'g', 'b', 'b']\n * ArrayExt.fill(data, 'z', 3, 1); // ['z', 'z', 'b', 'z']\n * ```\n */\n export function fill<T>(\n array: MutableArrayLike<T>,\n value: T,\n start = 0,\n stop = -1\n ): void {\n let n = array.length;\n if (n === 0) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let span: number;\n if (stop < start) {\n span = stop + 1 + (n - start);\n } else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n array[(start + i) % n] = value;\n }\n }\n\n /**\n * Insert a value into an array at a specific index.\n *\n * @param array - The array of interest.\n *\n * @param index - The index at which to insert the value. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2];\n * ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]\n * ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]\n * ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]\n * ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]\n * ```\n */\n export function insert<T>(array: Array<T>, index: number, value: T): void {\n let n = array.length;\n if (index < 0) {\n index = Math.max(0, index + n);\n } else {\n index = Math.min(index, n);\n }\n for (let i = n; i > index; --i) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n }\n\n /**\n * Remove and return a value at a specific index in an array.\n *\n * @param array - The array of interest.\n *\n * @param index - The index of the value to remove. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeAt(data, 2); // 23\n * ArrayExt.removeAt(data, -2); // 12\n * ArrayExt.removeAt(data, 10); // undefined;\n * ```\n */\n export function removeAt<T>(array: Array<T>, index: number): T | undefined {\n let n = array.length;\n if (index < 0) {\n index += n;\n }\n if (index < 0 || index >= n) {\n return undefined;\n }\n let value = array[index];\n for (let i = index + 1; i < n; ++i) {\n array[i - 1] = array[i];\n }\n array.length = n - 1;\n return value;\n }\n\n /**\n * Remove the first occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstOf(data, 12); // 1\n * ArrayExt.removeFirstOf(data, 17); // -1\n * ArrayExt.removeFirstOf(data, 39, 3); // -1\n * ArrayExt.removeFirstOf(data, 39, 3, 2); // 2\n * ```\n */\n export function removeFirstOf<T>(\n array: Array<T>,\n value: T,\n start = 0,\n stop = -1\n ): number {\n let index = firstIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n\n /**\n * Remove the last occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastOf(data, 12); // 5\n * ArrayExt.removeLastOf(data, 17); // -1\n * ArrayExt.removeLastOf(data, 39, 2); // -1\n * ArrayExt.removeLastOf(data, 39, 2, 3); // 3\n * ```\n */\n export function removeLastOf<T>(\n array: Array<T>,\n value: T,\n start = -1,\n stop = 0\n ): number {\n let index = lastIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n\n /**\n * Remove all occurrences of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [14, 12, 23, 39, 14, 12, 19, 14];\n * ArrayExt.removeAllOf(data, 12); // 2\n * ArrayExt.removeAllOf(data, 17); // 0\n * ArrayExt.removeAllOf(data, 14, 1, 4); // 1\n * ```\n */\n export function removeAllOf<T>(\n array: Array<T>,\n value: T,\n start = 0,\n stop = -1\n ): number {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && array[i] === value) {\n count++;\n } else if (\n stop < start &&\n (i <= stop || i >= start) &&\n array[i] === value\n ) {\n count++;\n } else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n\n /**\n * Remove the first occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstWhere(data, isEven); // { index: 0, value: 0 }\n * ArrayExt.removeFirstWhere(data, isEven, 2); // { index: 3, value: 14 }\n * ArrayExt.removeFirstWhere(data, isEven, 4); // { index: -1, value: undefined }\n * ```\n */\n export function removeFirstWhere<T>(\n array: Array<T>,\n fn: (value: T, index: number) => boolean,\n start = 0,\n stop = -1\n ): { index: number; value: T | undefined } {\n let value: T | undefined;\n let index = findFirstIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n\n /**\n * Remove the last occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastWhere(data, isEven); // { index: 5, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2); // { index: 1, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2, 1); // { index: -1, value: undefined }\n * ```\n */\n export function removeLastWhere<T>(\n array: Array<T>,\n fn: (value: T, index: number) => boolean,\n start = -1,\n stop = 0\n ): { index: number; value: T | undefined } {\n let value: T | undefined;\n let index = findLastIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n\n /**\n * Remove all occurrences of values which match a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * function isNegative(value: number): boolean {\n * return value < 0;\n * }\n *\n * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];\n * ArrayExt.removeAllWhere(data, isEven); // 4\n * ArrayExt.removeAllWhere(data, isNegative, 0, 3); // 2\n * ```\n */\n export function removeAllWhere<T>(\n array: Array<T>,\n fn: (value: T, index: number) => boolean,\n start = 0,\n stop = -1\n ): number {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n } else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n } else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && fn(array[i], i)) {\n count++;\n } else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {\n count++;\n } else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * An object which can produce an iterator over its values.\n */\nexport interface IIterable<T> {\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n *\n * #### Notes\n * Depending on the iterable, the returned iterator may or may not be\n * a new object. A collection or other container-like object should\n * typically return a new iterator, while an iterator itself should\n * normally return `this`.\n */\n iter(): IIterator<T>;\n}\n\n/**\n * An object which traverses a collection of values.\n *\n * #### Notes\n * An `IIterator` is itself an `IIterable`. Most implementations of\n * `IIterator` should simply return `this` from the `iter()` method.\n */\nexport interface IIterator<T> extends IIterable<T> {\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n *\n * #### Notes\n * The cloned iterator can be consumed independently of the current\n * iterator. In essence, it is a copy of the iterator value stream\n * which starts at the current location.\n *\n * This can be useful for lookahead and stream duplication.\n */\n clone(): IIterator<T>;\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n *\n * #### Notes\n * The `undefined` value is used to signal the end of iteration and\n * should therefore not be used as a value in a collection.\n *\n * The use of the `undefined` sentinel is an explicit design choice\n * which favors performance over purity. The ES6 iterator design of\n * returning a `{ value, done }` pair is suboptimal, as it requires\n * an object allocation on each iteration; and an `isDone()` method\n * would increase implementation and runtime complexity.\n */\n next(): T | undefined;\n}\n\n/**\n * A type alias for an iterable or builtin array-like object.\n */\nexport type IterableOrArrayLike<T> = IIterable<T> | ArrayLike<T>;\n\n/**\n * Create an iterator for an iterable object.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @returns A new iterator for the given object.\n *\n * #### Notes\n * This function allows iteration algorithms to operate on user-defined\n * iterable types and builtin array-like objects in a uniform fashion.\n */\nexport function iter<T>(object: IterableOrArrayLike<T>): IIterator<T> {\n let it: IIterator<T>;\n if (typeof (object as any).iter === 'function') {\n it = (object as IIterable<T>).iter();\n } else {\n it = new ArrayIterator<T>(object as ArrayLike<T>);\n }\n return it;\n}\n\n/**\n * Create an iterator for the keys in an object.\n *\n * @param object - The object of interest.\n *\n * @returns A new iterator for the keys in the given object.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each, keys } from '@lumino/algorithm';\n *\n * let data = { one: 1, two: 2, three: 3 };\n *\n * each(keys(data), key => { console.log(key); }); // 'one', 'two', 'three'\n * ```\n */\nexport function iterKeys<T>(object: {\n readonly [key: string]: T;\n}): IIterator<string> {\n return new KeyIterator(object);\n}\n\n/**\n * Create an iterator for the values in an object.\n *\n * @param object - The object of interest.\n *\n * @returns A new iterator for the values in the given object.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each, values } from '@lumino/algorithm';\n *\n * let data = { one: 1, two: 2, three: 3 };\n *\n * each(values(data), value => { console.log(value); }); // 1, 2, 3\n * ```\n */\nexport function iterValues<T>(object: {\n readonly [key: string]: T;\n}): IIterator<T> {\n return new ValueIterator<T>(object);\n}\n\n/**\n * Create an iterator for the items in an object.\n *\n * @param object - The object of interest.\n *\n * @returns A new iterator for the items in the given object.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each, items } from '@lumino/algorithm';\n *\n * let data = { one: 1, two: 2, three: 3 };\n *\n * each(items(data), value => { console.log(value); }); // ['one', 1], ['two', 2], ['three', 3]\n * ```\n */\nexport function iterItems<T>(object: {\n readonly [key: string]: T;\n}): IIterator<[string, T]> {\n return new ItemIterator<T>(object);\n}\n\n/**\n * Create an iterator for an iterator-like function.\n *\n * @param fn - A function which behaves like an iterator `next` method.\n *\n * @returns A new iterator for the given function.\n *\n * #### Notes\n * The returned iterator **cannot** be cloned.\n *\n * #### Example\n * ```typescript\n * import { each, iterFn } from '@lumino/algorithm';\n *\n * let it = iterFn((() => {\n * let i = 0;\n * return () => i > 3 ? undefined : i++;\n * })());\n *\n * each(it, v => { console.log(v); }); // 0, 1, 2, 3\n * ```\n */\nexport function iterFn<T>(fn: () => T | undefined): IIterator<T> {\n return new FnIterator<T>(fn);\n}\n\n/**\n * Invoke a function for each value in an iterable.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The callback function to invoke for each value.\n *\n * #### Notes\n * Iteration can be terminated early by returning `false` from the\n * callback function.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each } from '@lumino/algorithm';\n *\n * let data = [5, 7, 0, -2, 9];\n *\n * each(data, value => { console.log(value); });\n * ```\n */\nexport function each<T>(\n object: IterableOrArrayLike<T>,\n fn: (value: T, index: number) => boolean | void\n): void {\n let index = 0;\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++) === false) {\n return;\n }\n }\n}\n\n/**\n * Test whether all values in an iterable satisfy a predicate.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if all values pass the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `false` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { every } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * every(data, value => value % 2 === 0); // false\n * every(data, value => value % 2 === 1); // true\n * ```\n */\nexport function every<T>(\n object: IterableOrArrayLike<T>,\n fn: (value: T, index: number) => boolean\n): boolean {\n let index = 0;\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (!fn(value, index++)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Test whether any value in an iterable satisfies a predicate.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if any value passes the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `true` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { some } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * some(data, value => value === 7); // true\n * some(data, value => value === 3); // false\n * ```\n */\nexport function some<T>(\n object: IterableOrArrayLike<T>,\n fn: (value: T, index: number) => boolean\n): boolean {\n let index = 0;\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Create an array from an iterable of values.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @returns A new array of values from the given object.\n *\n * #### Example\n * ```typescript\n * import { iter, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = iter(data);\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6];\n * ```\n */\nexport function toArray<T>(object: IterableOrArrayLike<T>): T[] {\n let index = 0;\n let result: T[] = [];\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n result[index++] = value;\n }\n return result;\n}\n\n/**\n * Create an object from an iterable of key/value pairs.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @returns A new object mapping keys to values.\n *\n * #### Example\n * ```typescript\n * import { toObject } from '@lumino/algorithm';\n *\n * let data = [['one', 1], ['two', 2], ['three', 3]];\n *\n * toObject(data); // { one: 1, two: 2, three: 3 }\n * ```\n */\nexport function toObject<T>(\n object: IterableOrArrayLike<[string, T]>\n): { [key: string]: T } {\n let it = iter(object);\n let pair: [string, T] | undefined;\n let result: { [key: string]: T } = {};\n while ((pair = it.next()) !== undefined) {\n result[pair[0]] = pair[1];\n }\n return result;\n}\n\n/**\n * An iterator for an array-like object.\n *\n * #### Notes\n * This iterator can be used for any builtin JS array-like object.\n */\nexport class ArrayIterator<T> implements IIterator<T> {\n /**\n * Construct a new array iterator.\n *\n * @param source - The array-like object of interest.\n */\n constructor(source: ArrayLike<T>) {\n this._source = source;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n let result = new ArrayIterator<T>(this._source);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._index >= this._source.length) {\n return undefined;\n }\n return this._source[this._index++];\n }\n\n private _index = 0;\n private _source: ArrayLike<T>;\n}\n\n/**\n * An iterator for the keys in an object.\n *\n * #### Notes\n * This iterator can be used for any JS object.\n */\nexport class KeyIterator implements IIterator<string> {\n /**\n * Construct a new key iterator.\n *\n * @param source - The object of interest.\n *\n * @param keys - The keys to iterate, if known.\n */\n constructor(\n source: { readonly [key: string]: any },\n keys = Object.keys(source)\n ) {\n this._source = source;\n this._keys = keys;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<string> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<string> {\n let result = new KeyIterator(this._source, this._keys);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): string | undefined {\n if (this._index >= this._keys.length) {\n return undefined;\n }\n let key = this._keys[this._index++];\n if (key in this._source) {\n return key;\n }\n return this.next();\n }\n\n private _index = 0;\n private _keys: string[];\n private _source: { readonly [key: string]: any };\n}\n\n/**\n * An iterator for the values in an object.\n *\n * #### Notes\n * This iterator can be used for any JS object.\n */\nexport class ValueIterator<T> implements IIterator<T> {\n /**\n * Construct a new value iterator.\n *\n * @param source - The object of interest.\n *\n * @param keys - The keys to iterate, if known.\n */\n constructor(\n source: { readonly [key: string]: T },\n keys = Object.keys(source)\n ) {\n this._source = source;\n this._keys = keys;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n let result = new ValueIterator<T>(this._source, this._keys);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._index >= this._keys.length) {\n return undefined;\n }\n let key = this._keys[this._index++];\n if (key in this._source) {\n return this._source[key];\n }\n return this.next();\n }\n\n private _index = 0;\n private _keys: string[];\n private _source: { readonly [key: string]: T };\n}\n\n/**\n * An iterator for the items in an object.\n *\n * #### Notes\n * This iterator can be used for any JS object.\n */\nexport class ItemIterator<T> implements IIterator<[string, T]> {\n /**\n * Construct a new item iterator.\n *\n * @param source - The object of interest.\n *\n * @param keys - The keys to iterate, if known.\n */\n constructor(\n source: { readonly [key: string]: T },\n keys = Object.keys(source)\n ) {\n this._source = source;\n this._keys = keys;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<[string, T]> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<[string, T]> {\n let result = new ItemIterator<T>(this._source, this._keys);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): [string, T] | undefined {\n if (this._index >= this._keys.length) {\n return undefined;\n }\n let key = this._keys[this._index++];\n if (key in this._source) {\n return [key, this._source[key]];\n }\n return this.next();\n }\n\n private _index = 0;\n private _keys: string[];\n private _source: { readonly [key: string]: T };\n}\n\n/**\n * An iterator for an iterator-like function.\n */\nexport class FnIterator<T> implements IIterator<T> {\n /**\n * Construct a new function iterator.\n *\n * @param fn - The iterator-like function of interest.\n */\n constructor(fn: () => T | undefined) {\n this._fn = fn;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n throw new Error('An `FnIterator` cannot be cloned.');\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n return this._fn.call(undefined);\n }\n\n private _fn: () => T | undefined;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator, iter, IterableOrArrayLike } from './iter';\n\n/**\n * Chain together several iterables.\n *\n * @param objects - The iterable or array-like objects of interest.\n *\n * @returns An iterator which yields the values of the iterables\n * in the order in which they are supplied.\n *\n * #### Example\n * ```typescript\n * import { chain, toArray } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = chain(data1, data2);\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6]\n * ```\n */\nexport function chain<T>(...objects: IterableOrArrayLike<T>[]): IIterator<T> {\n return new ChainIterator<T>(iter(objects.map(iter)));\n}\n\n/**\n * An iterator which chains together several iterators.\n */\nexport class ChainIterator<T> implements IIterator<T> {\n /**\n * Construct a new chain iterator.\n *\n * @param source - The iterator of iterators of interest.\n */\n constructor(source: IIterator<IIterator<T>>) {\n this._source = source;\n this._active = undefined;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n let result = new ChainIterator<T>(this._source.clone());\n result._active = this._active && this._active.clone();\n result._cloned = true;\n this._cloned = true;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._active === undefined) {\n let active = this._source.next();\n if (active === undefined) {\n return undefined;\n }\n this._active = this._cloned ? active.clone() : active;\n }\n let value = this._active.next();\n if (value !== undefined) {\n return value;\n }\n this._active = undefined;\n return this.next();\n }\n\n private _source: IIterator<IIterator<T>>;\n private _active: IIterator<T> | undefined;\n private _cloned = false;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator } from './iter';\n\n/**\n * Create an empty iterator.\n *\n * @returns A new iterator which yields nothing.\n *\n * #### Example\n * ```typescript\n * import { empty, toArray } from '@lumino/algorithm';\n *\n * let stream = empty<number>();\n *\n * toArray(stream); // []\n * ```\n */\nexport function empty<T>(): IIterator<T> {\n return new EmptyIterator<T>();\n}\n\n/**\n * An iterator which is always empty.\n */\nexport class EmptyIterator<T> implements IIterator<T> {\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n return new EmptyIterator<T>();\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n return undefined;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator, iter, IterableOrArrayLike } from './iter';\n\n/**\n * Enumerate an iterable object.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param start - The starting enum value. The default is `0`.\n *\n * @returns An iterator which yields the enumerated values.\n *\n * #### Example\n * ```typescript\n * import { enumerate, toArray } from '@lumino/algorithm';\n *\n * let data = ['foo', 'bar', 'baz'];\n *\n * let stream = enumerate(data, 1);\n *\n * toArray(stream); // [[1, 'foo'], [2, 'bar'], [3, 'baz']]\n * ```\n */\nexport function enumerate<T>(\n object: IterableOrArrayLike<T>,\n start = 0\n): IIterator<[number, T]> {\n return new EnumerateIterator<T>(iter(object), start);\n}\n\n/**\n * An iterator which enumerates the source values.\n */\nexport class EnumerateIterator<T> implements IIterator<[number, T]> {\n /**\n * Construct a new enumerate iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param start - The starting enum value.\n */\n constructor(source: IIterator<T>, start: number) {\n this._source = source;\n this._index = start;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<[number, T]> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<[number, T]> {\n return new EnumerateIterator<T>(this._source.clone(), this._index);\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): [number, T] | undefined {\n let value = this._source.next();\n if (value === undefined) {\n return undefined;\n }\n return [this._index++, value];\n }\n\n private _source: IIterator<T>;\n private _index: number;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator, iter, IterableOrArrayLike } from './iter';\n\n/**\n * Filter an iterable for values which pass a test.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns An iterator which yields the values which pass the test.\n *\n * #### Example\n * ```typescript\n * import { filter, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = filter(data, value => value % 2 === 0);\n *\n * toArray(stream); // [2, 4, 6]\n * ```\n */\nexport function filter<T>(\n object: IterableOrArrayLike<T>,\n fn: (value: T, index: number) => boolean\n): IIterator<T> {\n return new FilterIterator<T>(iter(object), fn);\n}\n\n/**\n * An iterator which yields values which pass a test.\n */\nexport class FilterIterator<T> implements IIterator<T> {\n /**\n * Construct a new filter iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n */\n constructor(source: IIterator<T>, fn: (value: T, index: number) => boolean) {\n this._source = source;\n this._fn = fn;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n let result = new FilterIterator<T>(this._source.clone(), this._fn);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n let fn = this._fn;\n let it = this._source;\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (fn(value, this._index++)) {\n return value;\n }\n }\n return undefined;\n }\n\n private _index = 0;\n private _source: IIterator<T>;\n private _fn: (value: T, index: number) => boolean;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { iter, IterableOrArrayLike } from './iter';\n\n/**\n * Find the first value in an iterable which matches a predicate.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { find } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * find(data, isCat).name; // 'fluffy'\n * ```\n */\nexport function find<T>(\n object: IterableOrArrayLike<T>,\n fn: (value: T, index: number) => boolean\n): T | undefined {\n let index = 0;\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++)) {\n return value;\n }\n }\n return undefined;\n}\n\n/**\n * Find the index of the first value which matches a predicate.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { findIndex } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * findIndex(data, isCat); // 1\n * ```\n */\nexport function findIndex<T>(\n object: IterableOrArrayLike<T>,\n fn: (value: T, index: number) => boolean\n): number {\n let index = 0;\n let it = iter(object);\n let value: T | undefined;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++)) {\n return index - 1;\n }\n }\n return -1;\n}\n\n/**\n * Find the minimum value in an iterable.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The minimum value in the iterable. If multiple values are\n * equivalent to the minimum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { min } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * min([7, 4, 0, 3, 9, 4], numberCmp); // 0\n * ```\n */\nexport function min<T>(\n object: IterableOrArrayLike<T>,\n fn: (first: T, second: T) => number\n): T | undefined {\n let it = iter(object);\n let value = it.next();\n if (value === undefined) {\n return undefined;\n }\n let result = value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, result) < 0) {\n result = value;\n }\n }\n return result;\n}\n\n/**\n * Find the maximum value in an iterable.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The maximum value in the iterable. If multiple values are\n * equivalent to the maximum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { max } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * max([7, 4, 0, 3, 9, 4], numberCmp); // 9\n * ```\n */\nexport function max<T>(\n object: IterableOrArrayLike<T>,\n fn: (first: T, second: T) => number\n): T | undefined {\n let it = iter(object);\n let value = it.next();\n if (value === undefined) {\n return undefined;\n }\n let result = value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, result) > 0) {\n result = value;\n }\n }\n return result;\n}\n\n/**\n * Find the minimum and maximum values in an iterable.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns A 2-tuple of the `[min, max]` values in the iterable. If\n * multiple values are equivalent, the left-most values are returned.\n * If the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { minmax } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * minmax([7, 4, 0, 3, 9, 4], numberCmp); // [0, 9]\n * ```\n */\nexport function minmax<T>(\n object: IterableOrArrayLike<T>,\n fn: (first: T, second: T) => number\n): [T, T] | undefined {\n let it = iter(object);\n let value = it.next();\n if (value === undefined) {\n return undefined;\n }\n let vmin = value;\n let vmax = value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, vmin) < 0) {\n vmin = value;\n } else if (fn(value, vmax) > 0) {\n vmax = value;\n }\n }\n return [vmin, vmax];\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator, iter, IterableOrArrayLike } from './iter';\n\n/**\n * Transform the values of an iterable with a mapping function.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n *\n * @returns An iterator which yields the transformed values.\n *\n * #### Example\n * ```typescript\n * import { map, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3];\n *\n * let stream = map(data, value => value * 2);\n *\n * toArray(stream); // [2, 4, 6]\n * ```\n */\nexport function map<T, U>(\n object: IterableOrArrayLike<T>,\n fn: (value: T, index: number) => U\n): IIterator<U> {\n return new MapIterator<T, U>(iter(object), fn);\n}\n\n/**\n * An iterator which transforms values using a mapping function.\n */\nexport class MapIterator<T, U> implements IIterator<U> {\n /**\n * Construct a new map iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n */\n constructor(source: IIterator<T>, fn: (value: T, index: number) => U) {\n this._source = source;\n this._fn = fn;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<U> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<U> {\n let result = new MapIterator<T, U>(this._source.clone(), this._fn);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): U | undefined {\n let value = this._source.next();\n if (value === undefined) {\n return undefined;\n }\n return this._fn.call(undefined, value, this._index++);\n }\n\n private _index = 0;\n private _source: IIterator<T>;\n private _fn: (value: T, index: number) => U;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator } from './iter';\n\n/**\n * Create an iterator of evenly spaced values.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns An iterator which produces evenly spaced values.\n *\n * #### Notes\n * In the single argument form of `range(stop)`, `start` defaults to\n * `0` and `step` defaults to `1`.\n *\n * In the two argument form of `range(start, stop)`, `step` defaults\n * to `1`.\n */\nexport function range(\n start: number,\n stop?: number,\n step?: number\n): IIterator<number> {\n if (stop === undefined) {\n return new RangeIterator(0, start, 1);\n }\n if (step === undefined) {\n return new RangeIterator(start, stop, 1);\n }\n return new RangeIterator(start, stop, step);\n}\n\n/**\n * An iterator which produces a range of evenly spaced values.\n */\nexport class RangeIterator implements IIterator<number> {\n /**\n * Construct a new range iterator.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n */\n constructor(start: number, stop: number, step: number) {\n this._start = start;\n this._stop = stop;\n this._step = step;\n this._length = Private.rangeLength(start, stop, step);\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<number> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<number> {\n let result = new RangeIterator(this._start, this._stop, this._step);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): number | undefined {\n if (this._index >= this._length) {\n return undefined;\n }\n return this._start + this._step * this._index++;\n }\n\n private _index = 0;\n private _length: number;\n private _start: number;\n private _stop: number;\n private _step: number;\n}\n\n/**\n * The namespace for the module implementation details.\n */\nnamespace Private {\n /**\n * Compute the effective length of a range.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns The number of steps need to traverse the range.\n */\n export function rangeLength(\n start: number,\n stop: number,\n step: number\n ): number {\n if (step === 0) {\n return Infinity;\n }\n if (start > stop && step > 0) {\n return 0;\n }\n if (start < stop && step < 0) {\n return 0;\n }\n return Math.ceil((stop - start) / step);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { iter, IterableOrArrayLike } from './iter';\n\n/**\n * Summarize all values in an iterable using a reducer function.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The reducer function to invoke for each value.\n *\n * @param initial - The initial value to start accumulation.\n *\n * @returns The final accumulated value.\n *\n * #### Notes\n * The `reduce` function follows the conventions of `Array#reduce`.\n *\n * If the iterator is empty, an initial value is required. That value\n * will be used as the return value. If no initial value is provided,\n * an error will be thrown.\n *\n * If the iterator contains a single item and no initial value is\n * provided, the single item is used as the return value.\n *\n * Otherwise, the reducer is invoked for each element in the iterable.\n * If an initial value is not provided, the first element will be used\n * as the initial accumulated value.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { reduce } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5];\n *\n * let sum = reduce(data, (a, value) => a + value); // 15\n * ```\n */\nexport function reduce<T>(\n object: IterableOrArrayLike<T>,\n fn: (accumulator: T, value: T, index: number) => T\n): T;\nexport function reduce<T, U>(\n object: IterableOrArrayLike<T>,\n fn: (accumulator: U, value: T, index: number) => U,\n initial: U\n): U;\nexport function reduce<T>(\n object: IterableOrArrayLike<T>,\n fn: (accumulator: any, value: T, index: number) => any,\n initial?: any\n): any {\n // Setup the iterator and fetch the first value.\n let index = 0;\n let it = iter(object);\n let first = it.next();\n\n // An empty iterator and no initial value is an error.\n if (first === undefined && initial === undefined) {\n throw new TypeError('Reduce of empty iterable with no initial value.');\n }\n\n // If the iterator is empty, return the initial value.\n if (first === undefined) {\n return initial;\n }\n\n // If the iterator has a single item and no initial value, the\n // reducer is not invoked and the first item is the return value.\n let second = it.next();\n if (second === undefined && initial === undefined) {\n return first;\n }\n\n // If iterator has a single item and an initial value is provided,\n // the reducer is invoked and that result is the return value.\n if (second === undefined) {\n return fn(initial, first, index++);\n }\n\n // Setup the initial accumlated value.\n let accumulator: any;\n if (initial === undefined) {\n accumulator = fn(first, second, index++);\n } else {\n accumulator = fn(fn(initial, first, index++), second, index++);\n }\n\n // Iterate the rest of the values, updating the accumulator.\n let next: T | undefined;\n while ((next = it.next()) !== undefined) {\n accumulator = fn(accumulator, next, index++);\n }\n\n // Return the final accumulated value.\n return accumulator;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator } from './iter';\n\n/**\n * Create an iterator which repeats a value a number of times.\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n *\n * @returns A new iterator which repeats the specified value.\n *\n * #### Example\n * ```typescript\n * import { repeat, toArray } from '@lumino/algorithm';\n *\n * let stream = repeat(7, 3);\n *\n * toArray(stream); // [7, 7, 7]\n * ```\n */\nexport function repeat<T>(value: T, count: number): IIterator<T> {\n return new RepeatIterator<T>(value, count);\n}\n\n/**\n * Create an iterator which yields a value a single time.\n *\n * @param value - The value to wrap in an iterator.\n *\n * @returns A new iterator which yields the value a single time.\n *\n * #### Example\n * ```typescript\n * import { once, toArray } from '@lumino/algorithm';\n *\n * let stream = once(7);\n *\n * toArray(stream); // [7]\n * ```\n */\nexport function once<T>(value: T): IIterator<T> {\n return new RepeatIterator<T>(value, 1);\n}\n\n/**\n * An iterator which repeats a value a specified number of times.\n */\nexport class RepeatIterator<T> implements IIterator<T> {\n /**\n * Construct a new repeat iterator.\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n */\n constructor(value: T, count: number) {\n this._value = value;\n this._count = count;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n return new RepeatIterator<T>(this._value, this._count);\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._count <= 0) {\n return undefined;\n }\n this._count--;\n return this._value;\n }\n\n private _value: T;\n private _count: number;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator } from './iter';\n\n/**\n * An object which can produce a reverse iterator over its values.\n */\nexport interface IRetroable<T> {\n /**\n * Get a reverse iterator over the object's values.\n *\n * @returns An iterator which yields the object's values in reverse.\n */\n retro(): IIterator<T>;\n}\n\n/**\n * A type alias for a retroable or builtin array-like object.\n */\nexport type RetroableOrArrayLike<T> = IRetroable<T> | ArrayLike<T>;\n\n/**\n * Create an iterator for a retroable object.\n *\n * @param object - The retroable or array-like object of interest.\n *\n * @returns An iterator which traverses the object's values in reverse.\n *\n * #### Example\n * ```typescript\n * import { retro, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = retro(data);\n *\n * toArray(stream); // [6, 5, 4, 3, 2, 1]\n * ```\n */\nexport function retro<T>(object: RetroableOrArrayLike<T>): IIterator<T> {\n let it: IIterator<T>;\n if (typeof (object as any).retro === 'function') {\n it = (object as IRetroable<T>).retro();\n } else {\n it = new RetroArrayIterator<T>(object as ArrayLike<T>);\n }\n return it;\n}\n\n/**\n * An iterator which traverses an array-like object in reverse.\n *\n * #### Notes\n * This iterator can be used for any builtin JS array-like object.\n */\nexport class RetroArrayIterator<T> implements IIterator<T> {\n /**\n * Construct a new retro iterator.\n *\n * @param source - The array-like object of interest.\n */\n constructor(source: ArrayLike<T>) {\n this._source = source;\n this._index = source.length - 1;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n let result = new RetroArrayIterator<T>(this._source);\n result._index = this._index;\n return result;\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._index < 0 || this._index >= this._source.length) {\n return undefined;\n }\n return this._source[this._index--];\n }\n\n private _index: number;\n private _source: ArrayLike<T>;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { each, IterableOrArrayLike } from './iter';\n\n/**\n * Topologically sort an iterable of edges.\n *\n * @param edges - The iterable or array-like object of edges to sort.\n * An edge is represented as a 2-tuple of `[fromNode, toNode]`.\n *\n * @returns The topologically sorted array of nodes.\n *\n * #### Notes\n * If a cycle is present in the graph, the cycle will be ignored and\n * the return value will be only approximately sorted.\n *\n * #### Example\n * ```typescript\n * import { topologicSort } from '@lumino/algorithm';\n *\n * let data = [\n * ['d', 'e'],\n * ['c', 'd'],\n * ['a', 'b'],\n * ['b', 'c']\n * ];\n *\n * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']\n * ```\n */\nexport function topologicSort<T>(edges: IterableOrArrayLike<[T, T]>): T[] {\n // Setup the shared sorting state.\n let sorted: T[] = [];\n let visited = new Set<T>();\n let graph = new Map<T, T[]>();\n\n // Add the edges to the graph.\n each(edges, addEdge);\n\n // Visit each node in the graph.\n graph.forEach((v, k) => {\n visit(k);\n });\n\n // Return the sorted results.\n return sorted;\n\n // Add an edge to the graph.\n function addEdge(edge: [T, T]): void {\n let [fromNode, toNode] = edge;\n let children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n } else {\n graph.set(toNode, [fromNode]);\n }\n }\n\n // Recursively visit the node.\n function visit(node: T): void {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n let children = graph.get(node);\n if (children) {\n children.forEach(visit);\n }\n sorted.push(node);\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator, iter, IterableOrArrayLike } from './iter';\n\n/**\n * Iterate over an iterable using a stepped increment.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n *\n * @returns An iterator which traverses the iterable step-wise.\n *\n * #### Example\n * ```typescript\n * import { stride, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = stride(data, 2);\n *\n * toArray(stream); // [1, 3, 5];\n * ```\n */\nexport function stride<T>(\n object: IterableOrArrayLike<T>,\n step: number\n): IIterator<T> {\n return new StrideIterator<T>(iter(object), step);\n}\n\n/**\n * An iterator which traverses a source iterator step-wise.\n */\nexport class StrideIterator<T> implements IIterator<T> {\n /**\n * Construct a new stride iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n */\n constructor(source: IIterator<T>, step: number) {\n this._source = source;\n this._step = step;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n return new StrideIterator<T>(this._source.clone(), this._step);\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n let value = this._source.next();\n for (let n = this._step - 1; n > 0; --n) {\n this._source.next();\n }\n return value;\n }\n\n private _source: IIterator<T>;\n private _step: number;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n/**\n * The namespace for string-specific algorithms.\n */\nexport namespace StringExt {\n /**\n * Find the indices of characters in a source text.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The matched indices, or `null` if there is no match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * In order for there to be a match, all of the characters in `query`\n * **must** appear in `source` in the order given by `query`.\n *\n * Characters are matched using strict `===` equality.\n */\n export function findIndices(\n source: string,\n query: string,\n start = 0\n ): number[] | null {\n let indices = new Array<number>(query.length);\n for (let i = 0, j = start, n = query.length; i < n; ++i, ++j) {\n j = source.indexOf(query[i], j);\n if (j === -1) {\n return null;\n }\n indices[i] = j;\n }\n return indices;\n }\n\n /**\n * The result of a string match function.\n */\n export interface IMatchResult {\n /**\n * A score which indicates the strength of the match.\n *\n * The documentation of a given match function should specify\n * whether a lower or higher score is a stronger match.\n */\n score: number;\n\n /**\n * The indices of the matched characters in the source text.\n *\n * The indices will appear in increasing order.\n */\n indices: number[];\n }\n\n /**\n * A string matcher which uses a sum-of-squares algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-squares approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The index of each\n * matching character is squared and added to the score. This means\n * that early and consecutive character matches are preferred, while\n * late matches are heavily penalized.\n */\n export function matchSumOfSquares(\n source: string,\n query: string,\n start = 0\n ): IMatchResult | null {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i] - start;\n score += j * j;\n }\n return { score, indices };\n }\n\n /**\n * A string matcher which uses a sum-of-deltas algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-deltas approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The delta between\n * the indices are summed to create the score. This means that groups\n * of matched characters are preferred, while fragmented matches are\n * penalized.\n */\n export function matchSumOfDeltas(\n source: string,\n query: string,\n start = 0\n ): IMatchResult | null {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n let last = start - 1;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i];\n score += j - last - 1;\n last = j;\n }\n return { score, indices };\n }\n\n /**\n * Highlight the matched characters of a source text.\n *\n * @param source - The text which should be highlighted.\n *\n * @param indices - The indices of the matched characters. They must\n * appear in increasing order and must be in bounds of the source.\n *\n * @param fn - The function to apply to the matched chunks.\n *\n * @returns An array of unmatched and highlighted chunks.\n */\n export function highlight<T>(\n source: string,\n indices: ReadonlyArray<number>,\n fn: (chunk: string) => T\n ): Array<string | T> {\n // Set up the result array.\n let result: Array<string | T> = [];\n\n // Set up the counter variables.\n let k = 0;\n let last = 0;\n let n = indices.length;\n\n // Iterator over each index.\n while (k < n) {\n // Set up the chunk indices.\n let i = indices[k];\n let j = indices[k];\n\n // Advance the right chunk index until it's non-contiguous.\n while (++k < n && indices[k] === j + 1) {\n j++;\n }\n\n // Extract the unmatched text.\n if (last < i) {\n result.push(source.slice(last, i));\n }\n\n // Extract and highlight the matched text.\n if (i < j + 1) {\n result.push(fn(source.slice(i, j + 1)));\n }\n\n // Update the last visited index.\n last = j + 1;\n }\n\n // Extract any remaining unmatched text.\n if (last < source.length) {\n result.push(source.slice(last));\n }\n\n // Return the highlighted result.\n return result;\n }\n\n /**\n * A 3-way string comparison function.\n *\n * @param a - The first string of interest.\n *\n * @param b - The second string of interest.\n *\n * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.\n */\n export function cmp(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator, iter, IterableOrArrayLike } from './iter';\n\n/**\n * Take a fixed number of items from an iterable.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param count - The number of items to take from the iterable.\n *\n * @returns An iterator which yields the specified number of items\n * from the source iterable.\n *\n * #### Notes\n * The returned iterator will exhaust early if the source iterable\n * contains an insufficient number of items.\n */\nexport function take<T>(\n object: IterableOrArrayLike<T>,\n count: number\n): IIterator<T> {\n return new TakeIterator<T>(iter(object), count);\n}\n\n/**\n * An iterator which takes a fixed number of items from a source.\n */\nexport class TakeIterator<T> implements IIterator<T> {\n /**\n * Construct a new take iterator.\n *\n * @param source - The iterator of interest.\n *\n * @param count - The number of items to take from the source.\n */\n constructor(source: IIterator<T>, count: number) {\n this._source = source;\n this._count = count;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T> {\n return new TakeIterator<T>(this._source.clone(), this._count);\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T | undefined {\n if (this._count <= 0) {\n return undefined;\n }\n let value = this._source.next();\n if (value === undefined) {\n return undefined;\n }\n this._count--;\n return value;\n }\n\n private _count: number;\n private _source: IIterator<T>;\n}\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nimport { IIterator, iter, IterableOrArrayLike } from './iter';\n\n/**\n * Iterate several iterables in lockstep.\n *\n * @param objects - The iterable or array-like objects of interest.\n *\n * @returns An iterator which yields successive tuples of values where\n * each value is taken in turn from the provided iterables. It will\n * be as long as the shortest provided iterable.\n *\n * #### Example\n * ```typescript\n * import { zip, toArray } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = zip(data1, data2);\n *\n * toArray(stream); // [[1, 4], [2, 5], [3, 6]]\n * ```\n */\nexport function zip<T>(...objects: IterableOrArrayLike<T>[]): IIterator<T[]> {\n return new ZipIterator<T>(objects.map(iter));\n}\n\n/**\n * An iterator which iterates several sources in lockstep.\n */\nexport class ZipIterator<T> implements IIterator<T[]> {\n /**\n * Construct a new zip iterator.\n *\n * @param source - The iterators of interest.\n */\n constructor(source: IIterator<T>[]) {\n this._source = source;\n }\n\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n iter(): IIterator<T[]> {\n return this;\n }\n\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n clone(): IIterator<T[]> {\n return new ZipIterator<T>(this._source.map(it => it.clone()));\n }\n\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n next(): T[] | undefined {\n let result = new Array<T>(this._source.length);\n for (let i = 0, n = this._source.length; i < n; ++i) {\n let value = this._source[i].next();\n if (value === undefined) {\n return undefined;\n }\n result[i] = value;\n }\n return result;\n }\n\n private _source: IIterator<T>[];\n}\n","// Copyright (c) Bloomberg Finance LP.\n// Distributed under the terms of the Modified BSD License.\n\nimport { IRouter, JupyterFrontEnd } from '@jupyterlab/application';\nimport { IDocumentManager } from '@jupyterlab/docmanager';\nimport { ISettingRegistry } from '@jupyterlab/settingregistry';\n\n/**\n * Cell execution callbacks interface\n */\nexport interface INotebookRunCallback {\n /**\n * Callback before scrolling to the cell\n */\n onBeforeScroll?: () => Promise<void>;\n /**\n * Callback after scrolling to teh cell\n */\n onAfterScroll?: () => Promise<void>;\n /**\n * Callback after cell execution\n */\n onAfterCellRun?: (cellIndex: number) => Promise<void>;\n}\n\n/**\n * waitForSelector options\n */\nexport interface IWaitForSelectorOptions {\n /**\n * Test for the element to be hidden.\n */\n hidden?: boolean;\n}\n\nexport const PLUGIN_ID_ROUTER = '@jupyterlab/application-extension:router';\nexport const PLUGIN_ID_DOC_MANAGER = '@jupyterlab/docmanager-extension:plugin';\nexport const PLUGIN_ID_SETTINGS = '@jupyterlab/apputils-extension:settings';\n\nexport interface IPluginNameToInterfaceMap {\n [PLUGIN_ID_ROUTER]: IRouter;\n [PLUGIN_ID_DOC_MANAGER]: IDocumentManager;\n [PLUGIN_ID_SETTINGS]: ISettingRegistry;\n}\n\n/**\n * Galata In-Page interface\n */\nexport interface IGalataInpage {\n /**\n * Delete all cells of the active notebook\n */\n deleteNotebookCells(): Promise<void>;\n\n /**\n * Get the index of a toolbar item\n *\n * @param itemName Item name\n * @returns Index\n */\n getNotebookToolbarItemIndex(itemName: string): number;\n\n /**\n * Get an application plugin\n *\n * @param pluginId Plugin ID\n * @returns Application plugin\n */\n getPlugin<K extends keyof IPluginNameToInterfaceMap>(\n pluginId: K\n ): Promise<IPluginNameToInterfaceMap[K] | undefined>;\n\n /**\n * Test if a cell is selected in the active notebook\n *\n * @param cellIndex Cell index\n * @returns Whether the cell is selected or not\n */\n isNotebookCellSelected(cellIndex: number): boolean;\n\n /**\n * Test if a element is visible or not\n *\n * @param el Element\n * @returns Test result\n */\n isElementVisible(el: HTMLElement): boolean;\n\n /**\n * Save the active notebook\n */\n saveActiveNotebook(): Promise<void>;\n\n /**\n * Set the application theme\n *\n * @param themeName Theme name\n */\n setTheme(themeName: string): Promise<void>;\n\n /**\n * Run the active notebook\n */\n runActiveNotebook(): Promise<void>;\n\n /**\n * Run the active notebook cell by cell\n * and execute the callback after each cell execution\n *\n * @param callback Callback\n */\n runActiveNotebookCellByCell(callback?: INotebookRunCallback): Promise<void>;\n\n /**\n * Wait for the route to be on path and close all documents\n *\n * @param path Path to monitor\n */\n waitForLaunch(path?: string): Promise<void>;\n\n /**\n * Wait for the route to be on path and close all documents\n *\n * @param path Path to monitor\n */\n waitForNotebookRun(): Promise<void>;\n\n /**\n * Wait for an element to be found from a CSS selector\n *\n * @param selector CSS selector\n * @param node Element\n * @param options Options\n * @returns Selected element\n */\n waitForSelector(\n selector: string,\n node?: Element,\n options?: IWaitForSelectorOptions\n ): Promise<Node | null>;\n\n /**\n * Waits for the given `timeout` in milliseconds.\n *\n * @param timeout A timeout to wait for\n */\n waitForTimeout(duration: number): Promise<void>;\n\n /**\n * Wait for an element to be found from a XPath\n *\n * @param selector CSS selector\n * @param node Element\n * @param options Options\n * @returns Selected element\n */\n waitForXPath(\n selector: string,\n node?: Element,\n options?: IWaitForSelectorOptions\n ): Promise<Node | null>;\n\n /**\n * Application object\n */\n readonly app: JupyterFrontEnd;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/* eslint-disable @typescript-eslint/ban-types */\n// Copyright (c) Bloomberg Finance LP.\n// Distributed under the terms of the Modified BSD License.\n\nimport type { IRouter, JupyterFrontEnd } from '@jupyterlab/application';\nimport type { Cell, MarkdownCell } from '@jupyterlab/cells';\nimport type * as nbformat from '@jupyterlab/nbformat';\nimport type { Notebook, NotebookPanel } from '@jupyterlab/notebook';\nimport { toArray } from '@lumino/algorithm';\nimport {\n IGalataInpage,\n INotebookRunCallback,\n IPluginNameToInterfaceMap,\n IWaitForSelectorOptions,\n PLUGIN_ID_DOC_MANAGER,\n PLUGIN_ID_ROUTER\n} from './tokens';\n\n/**\n * Factory for element containing a given class xpath\n *\n * @param className Class name\n * @returns The selector\n */\nfunction xpContainsClass(className: string): string {\n return `contains(concat(\" \", normalize-space(@class), \" \"), \" ${className} \")`;\n}\n\n/**\n * In-Page Galata helpers\n */\nexport class GalataInpage implements IGalataInpage {\n constructor() {\n this._app = window.jupyterlab ?? window.jupyterapp;\n }\n\n /**\n * Get an application plugin\n *\n * @param pluginId Plugin ID\n * @returns Application plugin\n */\n async getPlugin<K extends keyof IPluginNameToInterfaceMap>(\n pluginId: K\n ): Promise<IPluginNameToInterfaceMap[K] | undefined> {\n return new Promise((resolve, reject) => {\n const app = this._app;\n const hasPlugin = app.hasPlugin(pluginId);\n\n if (hasPlugin) {\n try {\n const appAny = app as any;\n const plugin: any = appAny._pluginMap\n ? appAny._pluginMap[pluginId]\n : undefined;\n if (plugin.activated) {\n resolve(plugin.service);\n } else {\n void app.activatePlugin(pluginId).then(response => {\n resolve(plugin.service);\n });\n }\n } catch (error) {\n console.error('Failed to get plugin', error);\n }\n }\n });\n }\n\n /**\n * Wait for a function to finish for max. timeout milliseconds\n *\n * @param fn Function\n * @param timeout Timeout\n */\n async waitForFunction(fn: Function, timeout?: number): Promise<void> {\n return new Promise((resolve, reject) => {\n let checkTimer: number | null = null;\n let timeoutTimer: number | null = null;\n const check = async () => {\n checkTimer = null;\n if (await Promise.resolve(fn())) {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer);\n }\n resolve();\n } else {\n checkTimer = window.setTimeout(check, 200);\n }\n };\n\n void check();\n\n if (timeout) {\n timeoutTimer = window.setTimeout(() => {\n timeoutTimer = null;\n if (checkTimer) {\n clearTimeout(checkTimer);\n }\n reject(new Error('Timed out waiting for condition to be fulfilled.'));\n }, timeout);\n }\n });\n }\n\n /**\n * Waits for the given `timeout` in milliseconds.\n *\n * @param timeout A timeout to wait for\n */\n async waitForTimeout(timeout: number): Promise<void> {\n return new Promise(resolve => {\n setTimeout(() => {\n resolve();\n }, timeout);\n });\n }\n\n /**\n * Wait for a condition to fulfill or for a certain time\n *\n * @param condition Condition or timeout to wait for\n * @param timeout Timeout\n */\n async waitFor(condition: Function | number, timeout?: number): Promise<void> {\n const conditionType = typeof condition;\n\n if (conditionType === 'function') {\n return this.waitForFunction(condition as Function, timeout);\n } else if (conditionType === 'number') {\n return this.waitForTimeout(condition as number);\n }\n }\n\n /**\n * Wait for the route to be on path and close all documents\n *\n * @param path Path to monitor\n */\n async waitForLaunch(path = '/lab'): Promise<void> {\n let resolver: () => void;\n const delegate = new Promise<void>(resolve => {\n resolver = resolve;\n });\n const router = await this.getPlugin(PLUGIN_ID_ROUTER);\n const docManager = await this.getPlugin(PLUGIN_ID_DOC_MANAGER);\n\n const listener = async (sender: IRouter, args: IRouter.ILocation) => {\n if (args.path === path) {\n router?.routed.disconnect(listener);\n await docManager?.closeAll();\n resolver();\n }\n };\n\n router?.routed.connect(listener);\n return delegate;\n }\n\n /**\n * Wait for an element to be found from a CSS selector\n *\n * @param selector CSS selector\n * @param node Element\n * @param options Options\n * @returns Selected element\n */\n async waitForSelector(\n selector: string,\n node?: Element,\n options?: IWaitForSelectorOptions\n ): Promise<Node | null> {\n const waitForHidden = options && options.hidden;\n\n return new Promise((resolve, reject) => {\n const timer = setInterval(() => {\n const parent = node || document;\n const found = parent.querySelector(selector);\n if (waitForHidden) {\n if (!found) {\n clearInterval(timer);\n resolve(null);\n }\n } else if (found) {\n clearInterval(timer);\n resolve(found);\n }\n }, 200);\n });\n }\n\n /**\n * Wait for an element to be found from a XPath\n *\n * @param selector CSS selector\n * @param node Element\n * @param options Options\n * @returns Selected element\n */\n async waitForXPath(\n selector: string,\n node?: Element,\n options?: IWaitForSelectorOptions\n ): Promise<Node | null> {\n const waitForHidden = options && options.hidden;\n\n return new Promise((resolve, reject) => {\n const timer = setInterval(() => {\n const parent = node || document;\n const iterator = document.evaluate(\n selector,\n parent,\n null,\n XPathResult.UNORDERED_NODE_ITERATOR_TYPE,\n null\n );\n const found = iterator && iterator.iterateNext();\n if (waitForHidden) {\n if (!found) {\n clearInterval(timer);\n resolve(null);\n }\n } else if (found) {\n clearInterval(timer);\n resolve(found);\n }\n }, 200);\n });\n }\n\n /**\n * Delete all cells of the active notebook\n */\n async deleteNotebookCells(): Promise<void> {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const nb = nbPanel.content;\n\n void this._app.commands.execute('notebook:delete-cell');\n\n nb.update();\n }\n /**\n * Add a cell to the active notebook\n *\n * @param cellType Cell type\n * @param source Cell input source\n * @returns Action success result\n */\n addNotebookCell(cellType: nbformat.CellType, source: string): boolean {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const nb = nbPanel.content;\n\n if (nb !== null) {\n void this._app.commands.execute('notebook:insert-cell-below');\n\n const numCells = nb.widgets.length;\n\n if (nb.model) {\n nb.model.cells.beginCompoundOperation();\n nb.model.cells.set(\n numCells - 1,\n nb.model.contentFactory.createCell(cellType, {\n cell: {\n cell_type: cellType,\n source: source,\n metadata: {}\n }\n })\n );\n nb.model.cells.endCompoundOperation();\n }\n nb.update();\n } else {\n return false;\n }\n\n return true;\n }\n\n /**\n * Set the type and content of a cell in the active notebook\n *\n * @param cellIndex Cell index\n * @param cellType Cell type\n * @param source Cell input source\n * @returns Action success status\n */\n setNotebookCell(\n cellIndex: number,\n cellType: nbformat.CellType,\n source: string\n ): boolean {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const nb = nbPanel.content;\n\n if (nb) {\n const numCells = nb.widgets.length;\n if (cellIndex < 0 || cellIndex >= numCells) {\n return false;\n }\n\n if (nb.model) {\n nb.model.cells.beginCompoundOperation();\n nb.model.cells.set(\n cellIndex,\n nb.model.contentFactory.createCell(cellType, {\n cell: {\n cell_type: cellType,\n source: source,\n metadata: {}\n }\n })\n );\n nb.model.cells.endCompoundOperation();\n }\n nb.update();\n } else {\n return false;\n }\n\n return true;\n }\n\n /**\n * Test if a cell is selected in the active notebook\n *\n * @param cellIndex Cell index\n * @returns Whether the cell is selected or not\n */\n isNotebookCellSelected(cellIndex: number): boolean {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const nb = nbPanel.content;\n\n const numCells = nb.widgets.length;\n if (cellIndex < 0 || cellIndex >= numCells) {\n return false;\n }\n\n return nb.isSelected(nb.widgets[cellIndex]);\n }\n\n /**\n * Save the active notebook\n */\n async saveActiveNotebook(): Promise<void> {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n await nbPanel.context.save();\n }\n\n /**\n * Run the active notebook\n */\n async runActiveNotebook(): Promise<void> {\n await this._app.commands.execute('notebook:run-all-cells');\n }\n\n /**\n * Wait for the active notebook to be run\n */\n async waitForNotebookRun(): Promise<void> {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const notebook = nbPanel.content;\n if (!notebook.widgets) {\n console.error('NOTEBOOK CELL PROBLEM', notebook);\n }\n const numCells = notebook.widgets.length;\n\n if (numCells === 0) {\n return;\n }\n\n const promises: Promise<Node | null>[] = [];\n\n for (let i = 0; i < numCells; ++i) {\n const cell = notebook.widgets[i];\n promises.push(this.waitForCellRun(cell));\n }\n\n await Promise.all(promises);\n }\n\n /**\n * Wait for a Markdown cell to be rendered\n *\n * @param cell Cell\n */\n async waitForMarkdownCellRendered(cell: MarkdownCell): Promise<void> {\n await cell.ready;\n\n let resolver: (value: void | PromiseLike<void>) => void;\n const delegate = new Promise<void>(resolve => {\n resolver = resolve;\n });\n let timer: number | null = window.setInterval(() => {\n if (cell.rendered) {\n if (timer) {\n clearInterval(timer);\n }\n timer = null;\n resolver();\n }\n }, 200);\n\n return delegate;\n }\n\n /**\n * Wait for a cell to be run and return its output element\n *\n * @param cell Cell\n * @param timeout Timeout\n * @returns Output element\n */\n async waitForCellRun(cell: Cell, timeout = 2000): Promise<Node | null> {\n const model = cell.model;\n const code = model.value.text;\n if (!code.trim()) {\n return null;\n }\n\n const emptyPrompt = '[ ]:';\n const runningPrompt = '[*]:';\n\n await this.waitForXPath(\n `.//div[${xpContainsClass(\n 'jp-InputArea-prompt'\n )} and text()=\"${emptyPrompt}\"]`,\n cell.node,\n { hidden: true }\n );\n await this.waitForXPath(\n `.//div[${xpContainsClass(\n 'jp-InputArea-prompt'\n )} and text()=\"${runningPrompt}\"]`,\n cell.node,\n { hidden: true }\n );\n\n const cellType = cell.model.type;\n if (cellType === 'markdown') {\n await this.waitForMarkdownCellRendered(cell as MarkdownCell);\n return null;\n } else if (cellType === 'raw') {\n return null;\n } else {\n // 'code'\n let resolver: (value: Node | null) => void;\n const delegate = new Promise<Node | null>(resolve => {\n resolver = resolve;\n });\n\n let numTries = 0;\n let timer: any = null;\n let timeoutTimer: any = null;\n\n const clearAndResolve = (output: Node | null) => {\n clearInterval(timer);\n timer = null;\n clearTimeout(timeoutTimer);\n timeoutTimer = null;\n resolver(output);\n };\n\n const startTimeout = () => {\n if (!timeoutTimer) {\n timeoutTimer = setTimeout(() => {\n clearAndResolve(null);\n }, timeout);\n }\n };\n\n const checkIfDone = () => {\n const output = cell.node.querySelector(\n '.jp-Cell-outputArea .jp-OutputArea-output'\n );\n\n if (output) {\n if (output.textContent === 'Loading widget...') {\n startTimeout();\n } else {\n clearAndResolve(output);\n }\n } else {\n if (numTries > 0) {\n clearAndResolve(null);\n }\n }\n numTries++;\n };\n\n checkIfDone();\n\n timer = setInterval(() => {\n checkIfDone();\n }, 200);\n return delegate;\n }\n }\n\n /**\n * Whether the given notebook will scroll or not\n *\n * @param notebook Notebook\n * @param position Position\n * @param threshold Threshold\n * @returns Test result\n */\n notebookWillScroll(\n notebook: Notebook,\n position: number,\n threshold = 25\n ): boolean {\n const node = notebook.node;\n const ar = node.getBoundingClientRect();\n const delta = position - ar.top - ar.height / 2;\n return Math.abs(delta) > (ar.height * threshold) / 100;\n }\n\n /**\n * Run the active notebook cell by cell\n * and execute the callback after each cell execution\n *\n * @param callback Callback\n */\n async runActiveNotebookCellByCell(\n callback?: INotebookRunCallback\n ): Promise<void> {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const notebook = nbPanel.content;\n if (!notebook.widgets) {\n console.error('NOTEBOOK CELL PROBLEM', notebook);\n }\n const numCells = notebook.widgets.length;\n\n if (numCells === 0) {\n return;\n }\n\n void this._app.commands.execute('notebook:deselect-all');\n\n for (let i = 0; i < numCells; ++i) {\n const cell = notebook.widgets[i];\n notebook.activeCellIndex = i;\n notebook.select(cell);\n\n await this._app.commands.execute('notebook:run-cell');\n\n const output = await this.waitForCellRun(cell);\n\n if (callback && callback.onAfterCellRun) {\n await callback.onAfterCellRun(i);\n }\n\n const rectNode = output\n ? cell.node.querySelector('.jp-Cell-outputArea')\n : cell.inputArea.node;\n const rect = rectNode?.getBoundingClientRect();\n\n const scrollThreshold = 45;\n let prevScroll = notebook.node.scrollTop;\n let willScroll = false;\n if (rect) {\n willScroll = this.notebookWillScroll(\n notebook,\n rect.bottom,\n scrollThreshold\n );\n if (willScroll && callback && callback.onBeforeScroll) {\n await callback.onBeforeScroll();\n }\n\n prevScroll = notebook.node.scrollTop;\n notebook.scrollToPosition(rect.bottom, scrollThreshold);\n }\n notebook.update();\n\n if (willScroll && callback && callback.onAfterScroll) {\n const newScroll = notebook.node.scrollTop;\n if (newScroll !== prevScroll) {\n console.error('Notebook scroll mispredicted!');\n }\n\n await callback.onAfterScroll();\n }\n }\n }\n\n /**\n * Get the index of a toolbar item\n *\n * @param itemName Item name\n * @returns Index\n */\n getNotebookToolbarItemIndex(itemName: string): number {\n const nbPanel = this._app.shell.currentWidget as NotebookPanel;\n const names = toArray(nbPanel.toolbar.names());\n\n return names.indexOf(itemName);\n }\n\n /**\n * Test if a element is visible or not\n *\n * @param el Element\n * @returns Test result\n */\n isElementVisible(el: HTMLElement): boolean {\n return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length);\n }\n\n /**\n * Set the application theme\n *\n * @param themeName Theme name\n */\n async setTheme(themeName: string): Promise<void> {\n await this._app.commands.execute('apputils:change-theme', {\n theme: themeName\n });\n\n await this.waitFor(async () => {\n return document.body.dataset.jpThemeName === themeName;\n });\n }\n\n /**\n * Application object\n */\n get app(): JupyterFrontEnd {\n return this._app;\n }\n\n private _app: JupyterFrontEnd;\n}\n\nwindow.galataip = new GalataInpage();\n"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/galata",
3
- "version": "4.2.2",
3
+ "version": "4.3.0-alpha.0",
4
4
  "description": "JupyterLab UI Testing Framework",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -38,21 +38,22 @@
38
38
  "start:detached": "(jlpm run start&)",
39
39
  "test": "playwright test",
40
40
  "test:benchmark": "jlpm run test -c playwright-benchmark.config.js",
41
+ "test:benchmark:update": "BENCHMARK_NUMBER_SAMPLES=1 jlpm run test -c playwright-benchmark.config.js --update-snapshots",
41
42
  "test:debug": "PWDEBUG=1 playwright test",
42
43
  "test:report": "http-server ./playwright-report -a localhost -o",
43
- "test:update": "playwright test --update-snapshots"
44
+ "test:update": "playwright test --update-snapshots && jlpm test:benchmark:update"
44
45
  },
45
46
  "dependencies": {
46
- "@jupyterlab/application": "^3.3.2",
47
- "@jupyterlab/cells": "^3.3.2",
48
- "@jupyterlab/coreutils": "^5.3.2",
49
- "@jupyterlab/docmanager": "^3.3.2",
50
- "@jupyterlab/nbformat": "^3.3.2",
51
- "@jupyterlab/notebook": "^3.3.2",
52
- "@jupyterlab/services": "^6.3.2",
53
- "@jupyterlab/settingregistry": "^3.3.2",
54
- "@lumino/algorithm": "^1.3.3",
55
- "@lumino/coreutils": "^1.5.3",
47
+ "@jupyterlab/application": "^3.4.0-alpha.0",
48
+ "@jupyterlab/cells": "^3.4.0-alpha.0",
49
+ "@jupyterlab/coreutils": "^5.4.0-alpha.0",
50
+ "@jupyterlab/docmanager": "^3.4.0-alpha.0",
51
+ "@jupyterlab/nbformat": "^3.4.0-alpha.0",
52
+ "@jupyterlab/notebook": "^3.4.0-alpha.0",
53
+ "@jupyterlab/services": "^6.4.0-alpha.0",
54
+ "@jupyterlab/settingregistry": "^3.4.0-alpha.0",
55
+ "@lumino/algorithm": "^1.9.0",
56
+ "@lumino/coreutils": "^1.11.0",
56
57
  "@playwright/test": "^1.16.2",
57
58
  "@stdlib/stats": "^0.0.13",
58
59
  "canvas": "^2.6.1",