@interopio/desktop 6.1.0 → 6.2.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.
@@ -1025,12 +1025,12 @@ function createRegistry$1(options) {
1025
1025
  };
1026
1026
  }
1027
1027
  createRegistry$1.default = createRegistry$1;
1028
- var lib$1$1 = createRegistry$1;
1028
+ var lib$1 = createRegistry$1;
1029
1029
 
1030
1030
  var InProcTransport = (function () {
1031
1031
  function InProcTransport(settings, logger) {
1032
1032
  var _this = this;
1033
- this.registry = lib$1$1();
1033
+ this.registry = lib$1();
1034
1034
  this.gw = settings.facade;
1035
1035
  this.gw.connect(function (_client, message) {
1036
1036
  _this.messageHandler(message);
@@ -1086,7 +1086,7 @@ var SharedWorkerTransport = (function () {
1086
1086
  function SharedWorkerTransport(workerFile, logger) {
1087
1087
  var _this = this;
1088
1088
  this.logger = logger;
1089
- this.registry = lib$1$1();
1089
+ this.registry = lib$1();
1090
1090
  this.worker = new SharedWorker(workerFile);
1091
1091
  this.worker.port.onmessage = function (e) {
1092
1092
  _this.messageHandler(e.data);
@@ -1236,7 +1236,7 @@ var WS = (function () {
1236
1236
  function WS(settings, logger) {
1237
1237
  this.startupTimer = timer("connection");
1238
1238
  this._running = true;
1239
- this._registry = lib$1$1();
1239
+ this._registry = lib$1();
1240
1240
  this.wsRequests = [];
1241
1241
  this.settings = settings;
1242
1242
  this.logger = logger;
@@ -1427,44 +1427,44 @@ var lib$2 = {
1427
1427
  // Found this seed-based random generator somewhere
1428
1428
  // Based on The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
1429
1429
 
1430
- var seed$1 = 1;
1430
+ var seed = 1;
1431
1431
 
1432
1432
  /**
1433
1433
  * return a random number based on a seed
1434
1434
  * @param seed
1435
1435
  * @returns {number}
1436
1436
  */
1437
- function getNextValue$1() {
1438
- seed$1 = (seed$1 * 9301 + 49297) % 233280;
1439
- return seed$1/(233280.0);
1437
+ function getNextValue() {
1438
+ seed = (seed * 9301 + 49297) % 233280;
1439
+ return seed/(233280.0);
1440
1440
  }
1441
1441
 
1442
- function setSeed$1$1(_seed_) {
1443
- seed$1 = _seed_;
1442
+ function setSeed$1(_seed_) {
1443
+ seed = _seed_;
1444
1444
  }
1445
1445
 
1446
1446
  var randomFromSeed$1 = {
1447
- nextValue: getNextValue$1,
1448
- seed: setSeed$1$1
1447
+ nextValue: getNextValue,
1448
+ seed: setSeed$1
1449
1449
  };
1450
1450
 
1451
- var randomFromSeed$2 = randomFromSeed$1;
1451
+ var randomFromSeed = randomFromSeed$1;
1452
1452
 
1453
- var ORIGINAL$1 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-';
1453
+ var ORIGINAL = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-';
1454
1454
  var alphabet$2;
1455
- var previousSeed$1;
1455
+ var previousSeed;
1456
1456
 
1457
- var shuffled$1;
1457
+ var shuffled;
1458
1458
 
1459
- function reset$1() {
1460
- shuffled$1 = false;
1459
+ function reset() {
1460
+ shuffled = false;
1461
1461
  }
1462
1462
 
1463
- function setCharacters$1(_alphabet_) {
1463
+ function setCharacters(_alphabet_) {
1464
1464
  if (!_alphabet_) {
1465
- if (alphabet$2 !== ORIGINAL$1) {
1466
- alphabet$2 = ORIGINAL$1;
1467
- reset$1();
1465
+ if (alphabet$2 !== ORIGINAL) {
1466
+ alphabet$2 = ORIGINAL;
1467
+ reset();
1468
1468
  }
1469
1469
  return;
1470
1470
  }
@@ -1473,8 +1473,8 @@ function setCharacters$1(_alphabet_) {
1473
1473
  return;
1474
1474
  }
1475
1475
 
1476
- if (_alphabet_.length !== ORIGINAL$1.length) {
1477
- throw new Error('Custom alphabet for shortid must be ' + ORIGINAL$1.length + ' unique characters. You submitted ' + _alphabet_.length + ' characters: ' + _alphabet_);
1476
+ if (_alphabet_.length !== ORIGINAL.length) {
1477
+ throw new Error('Custom alphabet for shortid must be ' + ORIGINAL.length + ' unique characters. You submitted ' + _alphabet_.length + ' characters: ' + _alphabet_);
1478
1478
  }
1479
1479
 
1480
1480
  var unique = _alphabet_.split('').filter(function(item, ind, arr){
@@ -1482,50 +1482,50 @@ function setCharacters$1(_alphabet_) {
1482
1482
  });
1483
1483
 
1484
1484
  if (unique.length) {
1485
- throw new Error('Custom alphabet for shortid must be ' + ORIGINAL$1.length + ' unique characters. These characters were not unique: ' + unique.join(', '));
1485
+ throw new Error('Custom alphabet for shortid must be ' + ORIGINAL.length + ' unique characters. These characters were not unique: ' + unique.join(', '));
1486
1486
  }
1487
1487
 
1488
1488
  alphabet$2 = _alphabet_;
1489
- reset$1();
1489
+ reset();
1490
1490
  }
1491
1491
 
1492
- function characters$1(_alphabet_) {
1493
- setCharacters$1(_alphabet_);
1492
+ function characters(_alphabet_) {
1493
+ setCharacters(_alphabet_);
1494
1494
  return alphabet$2;
1495
1495
  }
1496
1496
 
1497
- function setSeed$2(seed) {
1498
- randomFromSeed$2.seed(seed);
1499
- if (previousSeed$1 !== seed) {
1500
- reset$1();
1501
- previousSeed$1 = seed;
1497
+ function setSeed(seed) {
1498
+ randomFromSeed.seed(seed);
1499
+ if (previousSeed !== seed) {
1500
+ reset();
1501
+ previousSeed = seed;
1502
1502
  }
1503
1503
  }
1504
1504
 
1505
- function shuffle$1() {
1505
+ function shuffle() {
1506
1506
  if (!alphabet$2) {
1507
- setCharacters$1(ORIGINAL$1);
1507
+ setCharacters(ORIGINAL);
1508
1508
  }
1509
1509
 
1510
1510
  var sourceArray = alphabet$2.split('');
1511
1511
  var targetArray = [];
1512
- var r = randomFromSeed$2.nextValue();
1512
+ var r = randomFromSeed.nextValue();
1513
1513
  var characterIndex;
1514
1514
 
1515
1515
  while (sourceArray.length > 0) {
1516
- r = randomFromSeed$2.nextValue();
1516
+ r = randomFromSeed.nextValue();
1517
1517
  characterIndex = Math.floor(r * sourceArray.length);
1518
1518
  targetArray.push(sourceArray.splice(characterIndex, 1)[0]);
1519
1519
  }
1520
1520
  return targetArray.join('');
1521
1521
  }
1522
1522
 
1523
- function getShuffled$1() {
1524
- if (shuffled$1) {
1525
- return shuffled$1;
1523
+ function getShuffled() {
1524
+ if (shuffled) {
1525
+ return shuffled;
1526
1526
  }
1527
- shuffled$1 = shuffle$1();
1528
- return shuffled$1;
1527
+ shuffled = shuffle();
1528
+ return shuffled;
1529
1529
  }
1530
1530
 
1531
1531
  /**
@@ -1533,29 +1533,29 @@ function getShuffled$1() {
1533
1533
  * @param index
1534
1534
  * @returns {string}
1535
1535
  */
1536
- function lookup$1(index) {
1537
- var alphabetShuffled = getShuffled$1();
1536
+ function lookup(index) {
1537
+ var alphabetShuffled = getShuffled();
1538
1538
  return alphabetShuffled[index];
1539
1539
  }
1540
1540
 
1541
1541
  function get () {
1542
- return alphabet$2 || ORIGINAL$1;
1542
+ return alphabet$2 || ORIGINAL;
1543
1543
  }
1544
1544
 
1545
- var alphabet_1$1 = {
1545
+ var alphabet_1 = {
1546
1546
  get: get,
1547
- characters: characters$1,
1548
- seed: setSeed$2,
1549
- lookup: lookup$1,
1550
- shuffled: getShuffled$1
1547
+ characters: characters,
1548
+ seed: setSeed,
1549
+ lookup: lookup,
1550
+ shuffled: getShuffled
1551
1551
  };
1552
1552
 
1553
- var crypto$1 = typeof window === 'object' && (window.crypto || window.msCrypto); // IE 11 uses window.msCrypto
1553
+ var crypto = typeof window === 'object' && (window.crypto || window.msCrypto); // IE 11 uses window.msCrypto
1554
1554
 
1555
- var randomByte$1;
1555
+ var randomByte;
1556
1556
 
1557
- if (!crypto$1 || !crypto$1.getRandomValues) {
1558
- randomByte$1 = function(size) {
1557
+ if (!crypto || !crypto.getRandomValues) {
1558
+ randomByte = function(size) {
1559
1559
  var bytes = [];
1560
1560
  for (var i = 0; i < size; i++) {
1561
1561
  bytes.push(Math.floor(Math.random() * 256));
@@ -1563,12 +1563,12 @@ if (!crypto$1 || !crypto$1.getRandomValues) {
1563
1563
  return bytes;
1564
1564
  };
1565
1565
  } else {
1566
- randomByte$1 = function(size) {
1567
- return crypto$1.getRandomValues(new Uint8Array(size));
1566
+ randomByte = function(size) {
1567
+ return crypto.getRandomValues(new Uint8Array(size));
1568
1568
  };
1569
1569
  }
1570
1570
 
1571
- var randomByteBrowser$1 = randomByte$1;
1571
+ var randomByteBrowser = randomByte;
1572
1572
 
1573
1573
  // This file replaces `format.js` in bundlers like webpack or Rollup,
1574
1574
  // according to `browser` config in `package.json`.
@@ -1611,8 +1611,8 @@ var format_browser = function (random, alphabet, size) {
1611
1611
  }
1612
1612
  };
1613
1613
 
1614
- var alphabet$1 = alphabet_1$1;
1615
- var random = randomByteBrowser$1;
1614
+ var alphabet$1 = alphabet_1;
1615
+ var random = randomByteBrowser;
1616
1616
  var format = format_browser;
1617
1617
 
1618
1618
  function generate$1(number) {
@@ -1636,65 +1636,65 @@ var generate = generate_1;
1636
1636
  // Ignore all milliseconds before a certain time to reduce the size of the date entropy without sacrificing uniqueness.
1637
1637
  // This number should be updated every year or so to keep the generated id short.
1638
1638
  // To regenerate `new Date() - 0` and bump the version. Always bump the version!
1639
- var REDUCE_TIME$1 = 1567752802062;
1639
+ var REDUCE_TIME = 1567752802062;
1640
1640
 
1641
1641
  // don't change unless we change the algos or REDUCE_TIME
1642
1642
  // must be an integer and less than 16
1643
- var version$1$1 = 7;
1643
+ var version$1 = 7;
1644
1644
 
1645
1645
  // Counter is used when shortid is called multiple times in one second.
1646
- var counter$1;
1646
+ var counter;
1647
1647
 
1648
1648
  // Remember the last time shortid was called in case counter is needed.
1649
- var previousSeconds$1;
1649
+ var previousSeconds;
1650
1650
 
1651
1651
  /**
1652
1652
  * Generate unique id
1653
1653
  * Returns string id
1654
1654
  */
1655
- function build$1(clusterWorkerId) {
1655
+ function build(clusterWorkerId) {
1656
1656
  var str = '';
1657
1657
 
1658
- var seconds = Math.floor((Date.now() - REDUCE_TIME$1) * 0.001);
1658
+ var seconds = Math.floor((Date.now() - REDUCE_TIME) * 0.001);
1659
1659
 
1660
- if (seconds === previousSeconds$1) {
1661
- counter$1++;
1660
+ if (seconds === previousSeconds) {
1661
+ counter++;
1662
1662
  } else {
1663
- counter$1 = 0;
1664
- previousSeconds$1 = seconds;
1663
+ counter = 0;
1664
+ previousSeconds = seconds;
1665
1665
  }
1666
1666
 
1667
- str = str + generate(version$1$1);
1667
+ str = str + generate(version$1);
1668
1668
  str = str + generate(clusterWorkerId);
1669
- if (counter$1 > 0) {
1670
- str = str + generate(counter$1);
1669
+ if (counter > 0) {
1670
+ str = str + generate(counter);
1671
1671
  }
1672
1672
  str = str + generate(seconds);
1673
1673
  return str;
1674
1674
  }
1675
1675
 
1676
- var build_1$1 = build$1;
1676
+ var build_1 = build;
1677
1677
 
1678
- var alphabet$3 = alphabet_1$1;
1678
+ var alphabet = alphabet_1;
1679
1679
 
1680
- function isShortId$1(id) {
1680
+ function isShortId(id) {
1681
1681
  if (!id || typeof id !== 'string' || id.length < 6 ) {
1682
1682
  return false;
1683
1683
  }
1684
1684
 
1685
1685
  var nonAlphabetic = new RegExp('[^' +
1686
- alphabet$3.get().replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&') +
1686
+ alphabet.get().replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&') +
1687
1687
  ']');
1688
1688
  return !nonAlphabetic.test(id);
1689
1689
  }
1690
1690
 
1691
- var isValid$1 = isShortId$1;
1691
+ var isValid = isShortId;
1692
1692
 
1693
1693
  (function (module) {
1694
1694
 
1695
- var alphabet = alphabet_1$1;
1696
- var build = build_1$1;
1697
- var isValid$1$1 = isValid$1;
1695
+ var alphabet = alphabet_1;
1696
+ var build = build_1;
1697
+ var isValid$1 = isValid;
1698
1698
 
1699
1699
  // if you are using cluster or multiple servers use this to make each instance
1700
1700
  // has a unique value for worker
@@ -1751,14 +1751,14 @@ var isValid$1 = isShortId$1;
1751
1751
  module.exports.seed = seed;
1752
1752
  module.exports.worker = worker;
1753
1753
  module.exports.characters = characters;
1754
- module.exports.isValid = isValid$1$1;
1754
+ module.exports.isValid = isValid$1;
1755
1755
  } (lib$2));
1756
1756
 
1757
1757
  (function (module) {
1758
1758
  module.exports = libExports;
1759
1759
  } (shortid$1));
1760
1760
 
1761
- var shortid$2 = /*@__PURE__*/getDefaultExportFromCjs(shortidExports);
1761
+ var shortid = /*@__PURE__*/getDefaultExportFromCjs(shortidExports);
1762
1762
 
1763
1763
  function domainSession (domain, connection, logger, successMessages, errorMessages) {
1764
1764
  if (domain == null) {
@@ -1770,7 +1770,7 @@ function domainSession (domain, connection, logger, successMessages, errorMessag
1770
1770
  var tryReconnecting = false;
1771
1771
  var _latestOptions;
1772
1772
  var _connectionOn = false;
1773
- var callbacks = lib$1$1();
1773
+ var callbacks = lib$1();
1774
1774
  connection.disconnected(handleConnectionDisconnected);
1775
1775
  connection.loggedIn(handleConnectionLoggedIn);
1776
1776
  connection.on("success", function (msg) { return handleSuccessMessage(msg); });
@@ -1902,7 +1902,7 @@ function domainSession (domain, connection, logger, successMessages, errorMessag
1902
1902
  entry.success(msg);
1903
1903
  }
1904
1904
  function getNextRequestId() {
1905
- return shortid$2();
1905
+ return shortid();
1906
1906
  }
1907
1907
  function send(msg, tag, options) {
1908
1908
  options = options || {};
@@ -1982,7 +1982,7 @@ var GW3ProtocolImpl = (function () {
1982
1982
  this.datePrefixLen = this.datePrefix.length;
1983
1983
  this.dateMinLen = this.datePrefixLen + 1;
1984
1984
  this.datePrefixFirstChar = this.datePrefix[0];
1985
- this.registry = lib$1$1();
1985
+ this.registry = lib$1();
1986
1986
  this._isLoggedIn = false;
1987
1987
  this.shouldTryLogin = true;
1988
1988
  this.initialLogin = true;
@@ -2412,7 +2412,7 @@ var WebPlatformTransport = (function () {
2412
2412
  this.parentPingTimeout = 5000;
2413
2413
  this.connectionRequestTimeout = 7000;
2414
2414
  this.defaultTargetString = "*";
2415
- this.registry = lib$1$1();
2415
+ this.registry = lib$1();
2416
2416
  this.messages = {
2417
2417
  connectionAccepted: { name: "connectionAccepted", handle: this.handleConnectionAccepted.bind(this) },
2418
2418
  connectionRejected: { name: "connectionRejected", handle: this.handleConnectionRejected.bind(this) },
@@ -2575,8 +2575,8 @@ var WebPlatformTransport = (function () {
2575
2575
  var _a;
2576
2576
  _this.connectionResolve = resolve;
2577
2577
  _this.connectionReject = reject;
2578
- _this.myClientId = (_a = _this.myClientId) !== null && _a !== void 0 ? _a : shortid$2();
2579
- var bridgeInstanceId = _this.getMyWindowId() || shortid$2();
2578
+ _this.myClientId = (_a = _this.myClientId) !== null && _a !== void 0 ? _a : shortid();
2579
+ var bridgeInstanceId = _this.getMyWindowId() || shortid();
2580
2580
  var request = {
2581
2581
  glue42core: {
2582
2582
  type: _this.messages.connectionRequest.name,
@@ -2700,7 +2700,7 @@ var WebPlatformTransport = (function () {
2700
2700
  this.publicWindowId = this.getMyWindowId();
2701
2701
  if (this.identity) {
2702
2702
  this.identity.windowId = this.publicWindowId;
2703
- this.identity.instance = this.identity.instance ? this.identity.instance : this.publicWindowId || shortid$2();
2703
+ this.identity.instance = this.identity.instance ? this.identity.instance : this.publicWindowId || shortid();
2704
2704
  }
2705
2705
  if (this.identity && data.appName) {
2706
2706
  this.identity.application = data.appName;
@@ -3025,7 +3025,7 @@ var WebPlatformTransport = (function () {
3025
3025
  if ((_a = window.name) === null || _a === void 0 ? void 0 : _a.includes("g42")) {
3026
3026
  return window.name;
3027
3027
  }
3028
- this.selfAssignedWindowId = this.selfAssignedWindowId || "g42-".concat(shortid$2());
3028
+ this.selfAssignedWindowId = this.selfAssignedWindowId || "g42-".concat(shortid());
3029
3029
  return this.selfAssignedWindowId;
3030
3030
  };
3031
3031
  return WebPlatformTransport;
@@ -3109,7 +3109,7 @@ var Connection = (function () {
3109
3109
  this.logger = logger;
3110
3110
  this.messageHandlers = {};
3111
3111
  this.ids = 1;
3112
- this.registry = lib$1$1();
3112
+ this.registry = lib$1();
3113
3113
  this._connected = false;
3114
3114
  this.isTrace = false;
3115
3115
  this._swapTransport = false;
@@ -3731,7 +3731,7 @@ function prepareConfig$1 (configuration, ext, glue42gd) {
3731
3731
  if (typeof window !== "undefined" && typeof window.glue42electron !== "undefined") {
3732
3732
  return window.glue42electron.application;
3733
3733
  }
3734
- var uid = shortid$2();
3734
+ var uid = shortid();
3735
3735
  if (Utils$1.isNode()) {
3736
3736
  if (nodeStartingContext) {
3737
3737
  return nodeStartingContext.applicationConfig.name;
@@ -6858,7 +6858,7 @@ var Client = (function () {
6858
6858
  timeout = additionalOptions.methodResponseTimeoutMs;
6859
6859
  additionalOptionsCopy = additionalOptions;
6860
6860
  invokePromises = serversMethodMap.map(function (serversMethodPair) {
6861
- var invId = shortid$2();
6861
+ var invId = shortid();
6862
6862
  var method = serversMethodPair.methods[0];
6863
6863
  var server = serversMethodPair.server;
6864
6864
  var invokePromise = _this.protocol.client.invoke(invId, method, argumentObj, server, additionalOptionsCopy);
@@ -7639,7 +7639,7 @@ var InstanceWrapper = (function () {
7639
7639
  });
7640
7640
  this.wrapped.user = resolvedIdentity.user;
7641
7641
  this.wrapped.instance = resolvedIdentity.instance;
7642
- this.wrapped.application = (_a = resolvedIdentity.application) !== null && _a !== void 0 ? _a : shortid$2();
7642
+ this.wrapped.application = (_a = resolvedIdentity.application) !== null && _a !== void 0 ? _a : shortid();
7643
7643
  this.wrapped.applicationName = resolvedIdentity.applicationName;
7644
7644
  this.wrapped.pid = (_c = (_b = resolvedIdentity.pid) !== null && _b !== void 0 ? _b : resolvedIdentity.process) !== null && _c !== void 0 ? _c : Math.floor(Math.random() * 10000000000);
7645
7645
  this.wrapped.machine = resolvedIdentity.machine;
@@ -7663,7 +7663,7 @@ var ClientRepository = (function () {
7663
7663
  this.API = API;
7664
7664
  this.servers = {};
7665
7665
  this.methodsCount = {};
7666
- this.callbacks = lib$1$1();
7666
+ this.callbacks = lib$1();
7667
7667
  var peerId = this.API.instance.peerId;
7668
7668
  this.myServer = {
7669
7669
  id: peerId,
@@ -7918,7 +7918,7 @@ var ServerStreaming = (function () {
7918
7918
  this.repository = repository;
7919
7919
  this.serverRepository = serverRepository;
7920
7920
  this.ERR_URI_SUBSCRIPTION_FAILED = "com.tick42.agm.errors.subscription.failure";
7921
- this.callbacks = lib$1$1();
7921
+ this.callbacks = lib$1();
7922
7922
  this.nextStreamId = 0;
7923
7923
  session.on("add-interest", function (msg) {
7924
7924
  _this.handleAddInterest(msg);
@@ -8180,7 +8180,7 @@ var ServerProtocol = (function () {
8180
8180
  this.clientRepository = clientRepository;
8181
8181
  this.serverRepository = serverRepository;
8182
8182
  this.logger = logger;
8183
- this.callbacks = lib$1$1();
8183
+ this.callbacks = lib$1();
8184
8184
  this.streaming = new ServerStreaming(session, clientRepository, serverRepository);
8185
8185
  this.session.on("invoke", function (msg) { return _this.handleInvokeMessage(msg); });
8186
8186
  }
@@ -8392,7 +8392,7 @@ var TimedCache = (function () {
8392
8392
  }
8393
8393
  TimedCache.prototype.add = function (element) {
8394
8394
  var _this = this;
8395
- var id = shortid$2();
8395
+ var id = shortid();
8396
8396
  this.cache.push({ id: id, element: element });
8397
8397
  var timeoutId = setTimeout(function () {
8398
8398
  var elementIdx = _this.cache.findIndex(function (entry) { return entry.id === id; });
@@ -9254,7 +9254,7 @@ var IOConnectCoreFactory = function (userConfig, ext) {
9254
9254
  canUpdateMetric: canUpdateMetric,
9255
9255
  system: "Glue42",
9256
9256
  service: (_c = (_b = identity === null || identity === void 0 ? void 0 : identity.service) !== null && _b !== void 0 ? _b : iodesktop === null || iodesktop === void 0 ? void 0 : iodesktop.applicationName) !== null && _c !== void 0 ? _c : internalConfig.application,
9257
- instance: (_e = (_d = identity === null || identity === void 0 ? void 0 : identity.instance) !== null && _d !== void 0 ? _d : identity === null || identity === void 0 ? void 0 : identity.windowId) !== null && _e !== void 0 ? _e : shortid$2(),
9257
+ instance: (_e = (_d = identity === null || identity === void 0 ? void 0 : identity.instance) !== null && _d !== void 0 ? _d : identity === null || identity === void 0 ? void 0 : identity.windowId) !== null && _e !== void 0 ? _e : shortid(),
9258
9258
  disableAutoAppSystem: disableAutoAppSystem,
9259
9259
  pagePerformanceMetrics: typeof config !== "boolean" ? config === null || config === void 0 ? void 0 : config.pagePerformanceMetrics : undefined
9260
9260
  });
@@ -12493,7 +12493,7 @@ function createRegistry(options) {
12493
12493
  };
12494
12494
  }
12495
12495
  createRegistry.default = createRegistry;
12496
- var lib$1 = createRegistry;
12496
+ var lib = createRegistry;
12497
12497
 
12498
12498
  function objectValues(source) {
12499
12499
  if (!source) {
@@ -12525,7 +12525,7 @@ class ApplicationImpl {
12525
12525
  this._name = _name;
12526
12526
  this._agm = _agm;
12527
12527
  this._configuration = _configuration;
12528
- this._registry = lib$1();
12528
+ this._registry = lib();
12529
12529
  _appManager.onInstanceStarted((instance) => {
12530
12530
  if (instance.application && instance.application.name !== this._name) {
12531
12531
  return;
@@ -12789,7 +12789,7 @@ class InstanceImpl {
12789
12789
  this._activities = _activities;
12790
12790
  this._windows = _windows;
12791
12791
  this._configuration = _configuration;
12792
- this._registry = lib$1();
12792
+ this._registry = lib();
12793
12793
  if (startFailed) {
12794
12794
  return;
12795
12795
  }
@@ -12973,7 +12973,7 @@ class AppManagerImpl {
12973
12973
  this._configuration = _configuration;
12974
12974
  this._apps = {};
12975
12975
  this._instances = [];
12976
- this._registry = lib$1();
12976
+ this._registry = lib();
12977
12977
  this.getConfigurations = async (apps) => {
12978
12978
  const args = {
12979
12979
  v2: {
@@ -13230,7 +13230,7 @@ function promisify(promise, successCallback, errorCallback) {
13230
13230
  class EntitlementsImpl {
13231
13231
  constructor(_agm) {
13232
13232
  this._agm = _agm;
13233
- this._registry = lib$1();
13233
+ this._registry = lib();
13234
13234
  this._isMethodRegistered = false;
13235
13235
  this.handleBranchModified = (branch) => {
13236
13236
  this._registry.execute("branchChanged", branch);
@@ -13576,309 +13576,124 @@ var AppManagerFactory = (config) => {
13576
13576
  return api;
13577
13577
  };
13578
13578
 
13579
- function createCommonjsModule(fn, module) {
13580
- return module = { exports: {} }, fn(module, module.exports), module.exports;
13581
- }
13582
-
13583
- // Found this seed-based random generator somewhere
13584
- // Based on The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
13585
-
13586
- var seed = 1;
13587
-
13588
- /**
13589
- * return a random number based on a seed
13590
- * @param seed
13591
- * @returns {number}
13592
- */
13593
- function getNextValue() {
13594
- seed = (seed * 9301 + 49297) % 233280;
13595
- return seed/(233280.0);
13596
- }
13597
-
13598
- function setSeed$1(_seed_) {
13599
- seed = _seed_;
13600
- }
13601
-
13602
- var randomFromSeed = {
13603
- nextValue: getNextValue,
13604
- seed: setSeed$1
13579
+ let urlAlphabet =
13580
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
13581
+ let nanoid = (size = 21) => {
13582
+ let id = '';
13583
+ let i = size;
13584
+ while (i--) {
13585
+ id += urlAlphabet[(Math.random() * 64) | 0];
13586
+ }
13587
+ return id
13605
13588
  };
13606
13589
 
13607
- var ORIGINAL = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-';
13608
- var alphabet;
13609
- var previousSeed;
13610
-
13611
- var shuffled;
13612
-
13613
- function reset() {
13614
- shuffled = false;
13615
- }
13616
-
13617
- function setCharacters(_alphabet_) {
13618
- if (!_alphabet_) {
13619
- if (alphabet !== ORIGINAL) {
13620
- alphabet = ORIGINAL;
13621
- reset();
13622
- }
13623
- return;
13624
- }
13625
-
13626
- if (_alphabet_ === alphabet) {
13627
- return;
13628
- }
13629
-
13630
- if (_alphabet_.length !== ORIGINAL.length) {
13631
- throw new Error('Custom alphabet for shortid must be ' + ORIGINAL.length + ' unique characters. You submitted ' + _alphabet_.length + ' characters: ' + _alphabet_);
13632
- }
13633
-
13634
- var unique = _alphabet_.split('').filter(function(item, ind, arr){
13635
- return ind !== arr.lastIndexOf(item);
13636
- });
13637
-
13638
- if (unique.length) {
13639
- throw new Error('Custom alphabet for shortid must be ' + ORIGINAL.length + ' unique characters. These characters were not unique: ' + unique.join(', '));
13640
- }
13641
-
13642
- alphabet = _alphabet_;
13643
- reset();
13644
- }
13645
-
13646
- function characters(_alphabet_) {
13647
- setCharacters(_alphabet_);
13648
- return alphabet;
13649
- }
13650
-
13651
- function setSeed(seed) {
13652
- randomFromSeed.seed(seed);
13653
- if (previousSeed !== seed) {
13654
- reset();
13655
- previousSeed = seed;
13656
- }
13657
- }
13658
-
13659
- function shuffle() {
13660
- if (!alphabet) {
13661
- setCharacters(ORIGINAL);
13662
- }
13663
-
13664
- var sourceArray = alphabet.split('');
13665
- var targetArray = [];
13666
- var r = randomFromSeed.nextValue();
13667
- var characterIndex;
13668
-
13669
- while (sourceArray.length > 0) {
13670
- r = randomFromSeed.nextValue();
13671
- characterIndex = Math.floor(r * sourceArray.length);
13672
- targetArray.push(sourceArray.splice(characterIndex, 1)[0]);
13673
- }
13674
- return targetArray.join('');
13590
+ class Utils {
13591
+ static getGDMajorVersion() {
13592
+ if (typeof window === "undefined") {
13593
+ return -1;
13594
+ }
13595
+ if (!window.glueDesktop) {
13596
+ return -1;
13597
+ }
13598
+ if (!window.glueDesktop.version) {
13599
+ return -1;
13600
+ }
13601
+ const ver = Number(window.glueDesktop.version.substr(0, 1));
13602
+ return isNaN(ver) ? -1 : ver;
13603
+ }
13604
+ static callbackifyPromise(action, successCallback, errorCallback) {
13605
+ const fail = (error) => {
13606
+ let msg = error;
13607
+ if (error instanceof Error) {
13608
+ msg = error.message;
13609
+ }
13610
+ if (typeof errorCallback === "function") {
13611
+ errorCallback(msg);
13612
+ return;
13613
+ }
13614
+ return Promise.reject(msg);
13615
+ };
13616
+ try {
13617
+ return action()
13618
+ .then((result) => {
13619
+ if (typeof successCallback === "function") {
13620
+ successCallback(result);
13621
+ }
13622
+ return result;
13623
+ })
13624
+ .catch((error) => {
13625
+ return fail(error);
13626
+ });
13627
+ }
13628
+ catch (err) {
13629
+ return fail(err);
13630
+ }
13631
+ }
13632
+ static getMonitor(bounds, displays) {
13633
+ const monitorsSortedByOverlap = displays.map((m) => {
13634
+ const { left, top, workingAreaWidth: width, workingAreaHeight: height } = m;
13635
+ const overlap = this.calculateTotalOverlap({ left, top, width, height }, bounds);
13636
+ return {
13637
+ monitor: m,
13638
+ totalOverlap: overlap
13639
+ };
13640
+ }).sort((a, b) => b.totalOverlap - a.totalOverlap);
13641
+ return monitorsSortedByOverlap[0].monitor;
13642
+ }
13643
+ static getDisplayCenterOfScreen(a, currentDisplay, primaryDisplay) {
13644
+ const physicalWidth = a.width / currentDisplay.scaleFactor;
13645
+ const physicalHeight = a.height / currentDisplay.scaleFactor;
13646
+ const physicalDisplayLeft = currentDisplay.workArea.left / primaryDisplay.scaleFactor;
13647
+ const physicalDisplayTop = currentDisplay.workArea.top / primaryDisplay.scaleFactor;
13648
+ const physicalDisplayWidth = currentDisplay.workArea.width / currentDisplay.scaleFactor;
13649
+ const physicalDisplayHeight = currentDisplay.workArea.height / currentDisplay.scaleFactor;
13650
+ const physicalHOffset = Math.max((physicalDisplayWidth - physicalWidth) / 2, 0);
13651
+ const physicalVOffset = Math.max((physicalDisplayHeight - physicalHeight) / 2, 0);
13652
+ const centeredPhysicalLeft = Math.floor(physicalDisplayLeft + physicalHOffset);
13653
+ const centeredPhysicalTop = Math.floor(physicalDisplayTop + physicalVOffset);
13654
+ const left = centeredPhysicalLeft * primaryDisplay.scaleFactor;
13655
+ const top = centeredPhysicalTop * primaryDisplay.scaleFactor;
13656
+ return {
13657
+ left,
13658
+ top,
13659
+ width: a.width,
13660
+ height: a.height
13661
+ };
13662
+ }
13663
+ static isNode() {
13664
+ if (typeof Utils._isNode !== "undefined") {
13665
+ return Utils._isNode;
13666
+ }
13667
+ if (typeof window !== "undefined") {
13668
+ Utils._isNode = false;
13669
+ return false;
13670
+ }
13671
+ try {
13672
+ Utils._isNode = Object.prototype.toString.call(global.process) === "[object process]";
13673
+ }
13674
+ catch (e) {
13675
+ Utils._isNode = false;
13676
+ }
13677
+ return Utils._isNode;
13678
+ }
13679
+ static generateId() {
13680
+ return nanoid(10);
13681
+ }
13682
+ static calculateTotalOverlap(r1, r2) {
13683
+ const r1x = r1.left;
13684
+ const r1y = r1.top;
13685
+ const r1xMax = r1x + r1.width;
13686
+ const r1yMax = r1y + r1.height;
13687
+ const r2x = r2.left;
13688
+ const r2y = r2.top;
13689
+ const r2xMax = r2x + r2.width;
13690
+ const r2yMax = r2y + r2.height;
13691
+ const xOverlap = Math.max(0, Math.min(r1xMax, r2xMax) - Math.max(r1x, r2x));
13692
+ const yOverlap = Math.max(0, Math.min(r1yMax, r2yMax) - Math.max(r1y, r2y));
13693
+ return xOverlap * yOverlap;
13694
+ }
13675
13695
  }
13676
13696
 
13677
- function getShuffled() {
13678
- if (shuffled) {
13679
- return shuffled;
13680
- }
13681
- shuffled = shuffle();
13682
- return shuffled;
13683
- }
13684
-
13685
- /**
13686
- * lookup shuffled letter
13687
- * @param index
13688
- * @returns {string}
13689
- */
13690
- function lookup(index) {
13691
- var alphabetShuffled = getShuffled();
13692
- return alphabetShuffled[index];
13693
- }
13694
-
13695
- var alphabet_1 = {
13696
- characters: characters,
13697
- seed: setSeed,
13698
- lookup: lookup,
13699
- shuffled: getShuffled
13700
- };
13701
-
13702
- var crypto = typeof window === 'object' && (window.crypto || window.msCrypto); // IE 11 uses window.msCrypto
13703
-
13704
- function randomByte() {
13705
- if (!crypto || !crypto.getRandomValues) {
13706
- return Math.floor(Math.random() * 256) & 0x30;
13707
- }
13708
- var dest = new Uint8Array(1);
13709
- crypto.getRandomValues(dest);
13710
- return dest[0] & 0x30;
13711
- }
13712
-
13713
- var randomByteBrowser = randomByte;
13714
-
13715
- function encode(lookup, number) {
13716
- var loopCounter = 0;
13717
- var done;
13718
-
13719
- var str = '';
13720
-
13721
- while (!done) {
13722
- str = str + lookup( ( (number >> (4 * loopCounter)) & 0x0f ) | randomByteBrowser() );
13723
- done = number < (Math.pow(16, loopCounter + 1 ) );
13724
- loopCounter++;
13725
- }
13726
- return str;
13727
- }
13728
-
13729
- var encode_1 = encode;
13730
-
13731
- /**
13732
- * Decode the id to get the version and worker
13733
- * Mainly for debugging and testing.
13734
- * @param id - the shortid-generated id.
13735
- */
13736
- function decode(id) {
13737
- var characters = alphabet_1.shuffled();
13738
- return {
13739
- version: characters.indexOf(id.substr(0, 1)) & 0x0f,
13740
- worker: characters.indexOf(id.substr(1, 1)) & 0x0f
13741
- };
13742
- }
13743
-
13744
- var decode_1 = decode;
13745
-
13746
- // Ignore all milliseconds before a certain time to reduce the size of the date entropy without sacrificing uniqueness.
13747
- // This number should be updated every year or so to keep the generated id short.
13748
- // To regenerate `new Date() - 0` and bump the version. Always bump the version!
13749
- var REDUCE_TIME = 1459707606518;
13750
-
13751
- // don't change unless we change the algos or REDUCE_TIME
13752
- // must be an integer and less than 16
13753
- var version$1 = 6;
13754
-
13755
- // Counter is used when shortid is called multiple times in one second.
13756
- var counter;
13757
-
13758
- // Remember the last time shortid was called in case counter is needed.
13759
- var previousSeconds;
13760
-
13761
- /**
13762
- * Generate unique id
13763
- * Returns string id
13764
- */
13765
- function build(clusterWorkerId) {
13766
-
13767
- var str = '';
13768
-
13769
- var seconds = Math.floor((Date.now() - REDUCE_TIME) * 0.001);
13770
-
13771
- if (seconds === previousSeconds) {
13772
- counter++;
13773
- } else {
13774
- counter = 0;
13775
- previousSeconds = seconds;
13776
- }
13777
-
13778
- str = str + encode_1(alphabet_1.lookup, version$1);
13779
- str = str + encode_1(alphabet_1.lookup, clusterWorkerId);
13780
- if (counter > 0) {
13781
- str = str + encode_1(alphabet_1.lookup, counter);
13782
- }
13783
- str = str + encode_1(alphabet_1.lookup, seconds);
13784
-
13785
- return str;
13786
- }
13787
-
13788
- var build_1 = build;
13789
-
13790
- function isShortId(id) {
13791
- if (!id || typeof id !== 'string' || id.length < 6 ) {
13792
- return false;
13793
- }
13794
-
13795
- var characters = alphabet_1.characters();
13796
- var len = id.length;
13797
- for(var i = 0; i < len;i++) {
13798
- if (characters.indexOf(id[i]) === -1) {
13799
- return false;
13800
- }
13801
- }
13802
- return true;
13803
- }
13804
-
13805
- var isValid = isShortId;
13806
-
13807
- var lib = createCommonjsModule(function (module) {
13808
-
13809
-
13810
-
13811
-
13812
-
13813
-
13814
-
13815
- // if you are using cluster or multiple servers use this to make each instance
13816
- // has a unique value for worker
13817
- // Note: I don't know if this is automatically set when using third
13818
- // party cluster solutions such as pm2.
13819
- var clusterWorkerId = 0;
13820
-
13821
- /**
13822
- * Set the seed.
13823
- * Highly recommended if you don't want people to try to figure out your id schema.
13824
- * exposed as shortid.seed(int)
13825
- * @param seed Integer value to seed the random alphabet. ALWAYS USE THE SAME SEED or you might get overlaps.
13826
- */
13827
- function seed(seedValue) {
13828
- alphabet_1.seed(seedValue);
13829
- return module.exports;
13830
- }
13831
-
13832
- /**
13833
- * Set the cluster worker or machine id
13834
- * exposed as shortid.worker(int)
13835
- * @param workerId worker must be positive integer. Number less than 16 is recommended.
13836
- * returns shortid module so it can be chained.
13837
- */
13838
- function worker(workerId) {
13839
- clusterWorkerId = workerId;
13840
- return module.exports;
13841
- }
13842
-
13843
- /**
13844
- *
13845
- * sets new characters to use in the alphabet
13846
- * returns the shuffled alphabet
13847
- */
13848
- function characters(newCharacters) {
13849
- if (newCharacters !== undefined) {
13850
- alphabet_1.characters(newCharacters);
13851
- }
13852
-
13853
- return alphabet_1.shuffled();
13854
- }
13855
-
13856
- /**
13857
- * Generate unique id
13858
- * Returns string id
13859
- */
13860
- function generate() {
13861
- return build_1(clusterWorkerId);
13862
- }
13863
-
13864
- // Export all other functions as properties of the generate function
13865
- module.exports = generate;
13866
- module.exports.generate = generate;
13867
- module.exports.seed = seed;
13868
- module.exports.worker = worker;
13869
- module.exports.characters = characters;
13870
- module.exports.decode = decode_1;
13871
- module.exports.isValid = isValid;
13872
- });
13873
- lib.generate;
13874
- lib.seed;
13875
- lib.worker;
13876
- lib.characters;
13877
- lib.decode;
13878
- lib.isValid;
13879
-
13880
- var shortid = lib;
13881
-
13882
13697
  const T42JumpListAction = "T42.JumpList.Action";
13883
13698
  class JumpListManager {
13884
13699
  constructor() {
@@ -13968,7 +13783,7 @@ class JumpListManager {
13968
13783
  const updateAction = {
13969
13784
  icon: action.icon,
13970
13785
  callback: action.callback,
13971
- callbackId: shortid.generate(),
13786
+ callbackId: Utils.generateId(),
13972
13787
  singleInstanceTitle: action.singleInstanceTitle,
13973
13788
  multiInstanceTitle: action.multiInstanceTitle,
13974
13789
  operation
@@ -14064,7 +13879,7 @@ class WindowStore {
14064
13879
  this._windows = {};
14065
13880
  this._pendingWindows = {};
14066
13881
  this._pendingWindowsStates = {};
14067
- this._registry = lib$1();
13882
+ this._registry = lib();
14068
13883
  }
14069
13884
  init(logger) {
14070
13885
  this._logger = logger;
@@ -14184,110 +13999,6 @@ class WindowStore {
14184
13999
  }
14185
14000
  var windowStore = new WindowStore();
14186
14001
 
14187
- class Utils {
14188
- static getGDMajorVersion() {
14189
- if (typeof window === "undefined") {
14190
- return -1;
14191
- }
14192
- if (!window.glueDesktop) {
14193
- return -1;
14194
- }
14195
- if (!window.glueDesktop.version) {
14196
- return -1;
14197
- }
14198
- const ver = Number(window.glueDesktop.version.substr(0, 1));
14199
- return isNaN(ver) ? -1 : ver;
14200
- }
14201
- static callbackifyPromise(action, successCallback, errorCallback) {
14202
- const fail = (error) => {
14203
- let msg = error;
14204
- if (error instanceof Error) {
14205
- msg = error.message;
14206
- }
14207
- if (typeof errorCallback === "function") {
14208
- errorCallback(msg);
14209
- return;
14210
- }
14211
- return Promise.reject(msg);
14212
- };
14213
- try {
14214
- return action()
14215
- .then((result) => {
14216
- if (typeof successCallback === "function") {
14217
- successCallback(result);
14218
- }
14219
- return result;
14220
- })
14221
- .catch((error) => {
14222
- return fail(error);
14223
- });
14224
- }
14225
- catch (err) {
14226
- return fail(err);
14227
- }
14228
- }
14229
- static getMonitor(bounds, displays) {
14230
- const monitorsSortedByOverlap = displays.map((m) => {
14231
- const { left, top, workingAreaWidth: width, workingAreaHeight: height } = m;
14232
- const overlap = this.calculateTotalOverlap({ left, top, width, height }, bounds);
14233
- return {
14234
- monitor: m,
14235
- totalOverlap: overlap
14236
- };
14237
- }).sort((a, b) => b.totalOverlap - a.totalOverlap);
14238
- return monitorsSortedByOverlap[0].monitor;
14239
- }
14240
- static getDisplayCenterOfScreen(a, currentDisplay, primaryDisplay) {
14241
- const physicalWidth = a.width / currentDisplay.scaleFactor;
14242
- const physicalHeight = a.height / currentDisplay.scaleFactor;
14243
- const physicalDisplayLeft = currentDisplay.workArea.left / primaryDisplay.scaleFactor;
14244
- const physicalDisplayTop = currentDisplay.workArea.top / primaryDisplay.scaleFactor;
14245
- const physicalDisplayWidth = currentDisplay.workArea.width / currentDisplay.scaleFactor;
14246
- const physicalDisplayHeight = currentDisplay.workArea.height / currentDisplay.scaleFactor;
14247
- const physicalHOffset = Math.max((physicalDisplayWidth - physicalWidth) / 2, 0);
14248
- const physicalVOffset = Math.max((physicalDisplayHeight - physicalHeight) / 2, 0);
14249
- const centeredPhysicalLeft = Math.floor(physicalDisplayLeft + physicalHOffset);
14250
- const centeredPhysicalTop = Math.floor(physicalDisplayTop + physicalVOffset);
14251
- const left = centeredPhysicalLeft * primaryDisplay.scaleFactor;
14252
- const top = centeredPhysicalTop * primaryDisplay.scaleFactor;
14253
- return {
14254
- left,
14255
- top,
14256
- width: a.width,
14257
- height: a.height
14258
- };
14259
- }
14260
- static isNode() {
14261
- if (typeof Utils._isNode !== "undefined") {
14262
- return Utils._isNode;
14263
- }
14264
- if (typeof window !== "undefined") {
14265
- Utils._isNode = false;
14266
- return false;
14267
- }
14268
- try {
14269
- Utils._isNode = Object.prototype.toString.call(global.process) === "[object process]";
14270
- }
14271
- catch (e) {
14272
- Utils._isNode = false;
14273
- }
14274
- return Utils._isNode;
14275
- }
14276
- static calculateTotalOverlap(r1, r2) {
14277
- const r1x = r1.left;
14278
- const r1y = r1.top;
14279
- const r1xMax = r1x + r1.width;
14280
- const r1yMax = r1y + r1.height;
14281
- const r2x = r2.left;
14282
- const r2y = r2.top;
14283
- const r2xMax = r2x + r2.width;
14284
- const r2yMax = r2y + r2.height;
14285
- const xOverlap = Math.max(0, Math.min(r1xMax, r2xMax) - Math.max(r1x, r2x));
14286
- const yOverlap = Math.max(0, Math.min(r1yMax, r2yMax) - Math.max(r1y, r2y));
14287
- return xOverlap * yOverlap;
14288
- }
14289
- }
14290
-
14291
14002
  class JumpListActions {
14292
14003
  constructor(windowId, configuration) {
14293
14004
  this.windowId = windowId;
@@ -14353,7 +14064,7 @@ class JumpList {
14353
14064
 
14354
14065
  var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPIGetter, channelsAPIGetter, agm) => {
14355
14066
  var _a, _b, _c, _d;
14356
- const _registry = lib$1();
14067
+ const _registry = lib();
14357
14068
  const getChannels = () => {
14358
14069
  const channels = channelsAPIGetter();
14359
14070
  if (!channels) {
@@ -14864,6 +14575,9 @@ var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPI
14864
14575
  function dock(opts) {
14865
14576
  return executor.dock(resultWindow, opts);
14866
14577
  }
14578
+ async function clone(cloneOptions) {
14579
+ return executor.clone(resultWindow, cloneOptions);
14580
+ }
14867
14581
  function onTitleChanged(callback) {
14868
14582
  if (!isFunction(callback)) {
14869
14583
  throw new Error("callback should be a function");
@@ -15597,6 +15311,7 @@ var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPI
15597
15311
  getConfiguration,
15598
15312
  getDockingPlacement,
15599
15313
  dock,
15314
+ clone,
15600
15315
  getChannel: async () => {
15601
15316
  var _a;
15602
15317
  const wins = await getChannels().getWindowsWithChannels({ windowIds: [_id] });
@@ -15763,7 +15478,7 @@ class GDExecutor {
15763
15478
  constructor() {
15764
15479
  this.GroupMethodName = "T42.Group.Execute";
15765
15480
  this.WndMethodName = "T42.Wnd.Execute";
15766
- this._registry = lib$1();
15481
+ this._registry = lib();
15767
15482
  this._finished = Promise.resolve();
15768
15483
  this.unsubCallbacks = {};
15769
15484
  }
@@ -16360,7 +16075,7 @@ class GDExecutor {
16360
16075
  }
16361
16076
  showDialog(resultWindow, options) {
16362
16077
  return new Promise((res, rej) => {
16363
- const token = shortid.generate();
16078
+ const token = Utils.generateId();
16364
16079
  const un = this._registry.add("event", (args) => {
16365
16080
  if (args.type === "DialogResult" && args.windowId === resultWindow.id && args.data.token === token) {
16366
16081
  un();
@@ -16415,6 +16130,9 @@ class GDExecutor {
16415
16130
  return this.nonWindowHandlers(callback, gdWindow.id, "OnClosing");
16416
16131
  }
16417
16132
  }
16133
+ onGroupClosing(callback, group) {
16134
+ return this.nonWindowHandlersCore(group.id, "OnClosing", true, callback);
16135
+ }
16418
16136
  onRefreshing(callback, gdWindow) {
16419
16137
  const glue42gd = typeof window !== "undefined" && window.glue42gd;
16420
16138
  if (glue42gd && gdWindow.windowType === "electron") {
@@ -16433,6 +16151,15 @@ class GDExecutor {
16433
16151
  return this.nonWindowHandlers(callback, gdWindow.id, "OnNavigating");
16434
16152
  }
16435
16153
  }
16154
+ async clone(window, cloneOptions) {
16155
+ const args = {
16156
+ windowId: window.id,
16157
+ options: cloneOptions
16158
+ };
16159
+ const result = await this.execute("clone", args);
16160
+ const win = await windowStore.waitFor(result.id);
16161
+ return win.API;
16162
+ }
16436
16163
  async goBack(resultWindow) {
16437
16164
  await this.execute("goBack", { windowId: resultWindow.id });
16438
16165
  }
@@ -16445,21 +16172,45 @@ class GDExecutor {
16445
16172
  dock(window, options) {
16446
16173
  return this.execute("dock", { windowId: window.id, options });
16447
16174
  }
16448
- nonWindowHandlers(callback, winId, type) {
16449
- const id = `${winId}-${type}`;
16175
+ clearCallbacks(id) {
16176
+ const keys = Object.keys(this.unsubCallbacks);
16177
+ keys.forEach((key) => {
16178
+ if (key.startsWith(id)) {
16179
+ delete this.unsubCallbacks[key];
16180
+ }
16181
+ });
16182
+ }
16183
+ nonWindowHandlers(callback, targetId, type) {
16184
+ return this.nonWindowHandlersCore(targetId, type, false, callback);
16185
+ }
16186
+ nonWindowHandlersCore(targetId, type, isGroup, callback) {
16187
+ const id = `${targetId}-${type}`;
16450
16188
  const unsub = () => {
16189
+ var _a;
16451
16190
  if (this.unsubCallbacks[id]) {
16452
16191
  const callbacks = this.unsubCallbacks[id];
16453
16192
  this.unsubCallbacks[id] = callbacks.filter((cb) => cb !== callback);
16193
+ if (this.unsubCallbacks[id].length === 0) {
16194
+ delete this.unsubCallbacks[id];
16195
+ }
16454
16196
  }
16455
- const cbs = this.unsubCallbacks[id];
16197
+ const cbs = (_a = this.unsubCallbacks[id]) !== null && _a !== void 0 ? _a : [];
16456
16198
  if (cbs.length === 0) {
16457
- this.execute(type, {
16458
- windowId: winId,
16459
- options: {
16460
- unsubscribe: true
16461
- }
16462
- });
16199
+ const options = {
16200
+ unsubscribe: true
16201
+ };
16202
+ if (isGroup) {
16203
+ this.executeGroup(type, {
16204
+ groupId: targetId,
16205
+ options
16206
+ });
16207
+ }
16208
+ else {
16209
+ this.execute(type, {
16210
+ windowId: targetId,
16211
+ options
16212
+ });
16213
+ }
16463
16214
  }
16464
16215
  };
16465
16216
  if (this.unsubCallbacks[id]) {
@@ -16469,10 +16220,12 @@ class GDExecutor {
16469
16220
  else {
16470
16221
  this.unsubCallbacks[id] = [callback];
16471
16222
  }
16472
- const args = {
16473
- windowId: winId
16474
- };
16475
- this.execute(type, args);
16223
+ if (isGroup) {
16224
+ this.executeGroup(type, { groupId: targetId });
16225
+ }
16226
+ else {
16227
+ this.execute(type, { windowId: targetId });
16228
+ }
16476
16229
  return unsub;
16477
16230
  }
16478
16231
  reformatFlydownOptions(windowId, options) {
@@ -16569,7 +16322,7 @@ class GDExecutor {
16569
16322
  async executeWithToken(methodName, options) {
16570
16323
  let un;
16571
16324
  try {
16572
- const token = shortid.generate();
16325
+ const token = Utils.generateId();
16573
16326
  const event = new Promise((r) => {
16574
16327
  un = this._registry.add("event", (data) => {
16575
16328
  if (data.token === token) {
@@ -16648,7 +16401,7 @@ var executor = new GDExecutor();
16648
16401
 
16649
16402
  class GDEnvironment {
16650
16403
  constructor(agm, logger, appManagerGetter, displayAPIGetter, channelsAPIGetter, wndId) {
16651
- this._registry = lib$1();
16404
+ this._registry = lib();
16652
16405
  this._waitTimeout = 10000;
16653
16406
  this._agm = agm;
16654
16407
  this._logger = logger.subLogger("gd-env");
@@ -17036,7 +16789,7 @@ var envDetector = (agm, logger, appManagerGetter, displayAPIGetter, channelsAPIG
17036
16789
  };
17037
16790
 
17038
16791
  var groupFactory = (id, executor) => {
17039
- const _registry = lib$1();
16792
+ const _registry = lib();
17040
16793
  const _windowsId = [];
17041
16794
  let _isHibernatedFlag;
17042
16795
  let _isVisible;
@@ -17142,6 +16895,21 @@ var groupFactory = (id, executor) => {
17142
16895
  }
17143
16896
  return _registry.add("group-visibility-changed", callback);
17144
16897
  }
16898
+ function onClosing(callback) {
16899
+ if (typeof callback !== "function") {
16900
+ throw new Error("callback must be a function");
16901
+ }
16902
+ const callbackWrap = (success, error, prevent) => {
16903
+ const promise = callback(prevent);
16904
+ if (promise === null || promise === void 0 ? void 0 : promise.then) {
16905
+ promise.then(success).catch(error);
16906
+ }
16907
+ else {
16908
+ success();
16909
+ }
16910
+ };
16911
+ return executor.onGroupClosing(callbackWrap, groupObject);
16912
+ }
17145
16913
  const groupObject = {
17146
16914
  id,
17147
16915
  get windows() {
@@ -17208,7 +16976,8 @@ var groupFactory = (id, executor) => {
17208
16976
  onHeaderVisibilityChanged,
17209
16977
  onWindowAdded,
17210
16978
  onWindowRemoved,
17211
- onVisibilityChanged
16979
+ onVisibilityChanged,
16980
+ onClosing,
17212
16981
  };
17213
16982
  const internal = {
17214
16983
  get windows() {
@@ -17227,7 +16996,7 @@ var groupFactory = (id, executor) => {
17227
16996
  };
17228
16997
 
17229
16998
  var groupsFactory = (environment, logger) => {
17230
- const _registry = lib$1();
16999
+ const _registry = lib();
17231
17000
  const _groups = {};
17232
17001
  let heardForWindowsCounter = -1;
17233
17002
  const windows = windowStore.list;
@@ -17399,6 +17168,7 @@ var groupsFactory = (environment, logger) => {
17399
17168
  const group = groupWrapper.groupAPI;
17400
17169
  if (group.windows.length === 0) {
17401
17170
  delete _groups[group.id];
17171
+ executor.clearCallbacks(group.id);
17402
17172
  _registry.execute("group-removed", group);
17403
17173
  }
17404
17174
  }
@@ -17478,7 +17248,7 @@ var groupsFactory = (environment, logger) => {
17478
17248
  };
17479
17249
 
17480
17250
  var WindowsFactory = (agm, logger, appManagerGetter, displayAPIGetter, channelsGetter, gdMajorVersion) => {
17481
- const _registry = lib$1();
17251
+ const _registry = lib();
17482
17252
  const _logger = logger;
17483
17253
  let groups;
17484
17254
  let environment;
@@ -18243,7 +18013,7 @@ class LayoutsAPIImpl {
18243
18013
  invokeMethodAndTrack(methodName, args, resolve, reject, skipStreamEvent) {
18244
18014
  let streamEventReceived = skipStreamEvent;
18245
18015
  let agmResult;
18246
- const token = shortid();
18016
+ const token = Utils.generateId();
18247
18017
  args.token = token;
18248
18018
  const handleResult = () => {
18249
18019
  if (streamEventReceived && agmResult) {
@@ -18485,7 +18255,7 @@ function LayoutsFactory (config) {
18485
18255
  }
18486
18256
  config.mode = config.mode || "slim";
18487
18257
  const logger = config.logger;
18488
- const callbacks = lib$1();
18258
+ const callbacks = lib();
18489
18259
  let acsStream;
18490
18260
  if (config.mode === "full" || "fullWaitSnapshot") {
18491
18261
  acsStream = new ACSStream(config.agm, callbacks);
@@ -18502,7 +18272,7 @@ class DisplayManager {
18502
18272
  constructor(_agm, _logger) {
18503
18273
  this._agm = _agm;
18504
18274
  this._logger = _logger;
18505
- this._registry = lib$1();
18275
+ this._registry = lib();
18506
18276
  this._registered = false;
18507
18277
  this.all = async () => {
18508
18278
  const displays = await this.callGD(DisplayCommand.GetAll, {});
@@ -18749,7 +18519,7 @@ class ChannelsImpl {
18749
18519
  this.subsKey = "subs";
18750
18520
  this.changedKey = "changed";
18751
18521
  this.isInitialJoin = true;
18752
- this.registry = lib$1();
18522
+ this.registry = lib();
18753
18523
  this.pendingReplays = {};
18754
18524
  this.shared.subscribe(this.handler.bind(this));
18755
18525
  if (typeof window !== "undefined" && typeof window.glue42gd !== "undefined") {
@@ -18763,7 +18533,7 @@ class ChannelsImpl {
18763
18533
  if (typeof callback !== "function") {
18764
18534
  throw new Error("Please provide the callback as a function!");
18765
18535
  }
18766
- const id = shortid();
18536
+ const id = Utils.generateId();
18767
18537
  this.pendingReplays[id] = true;
18768
18538
  if (this.lastUpdate) {
18769
18539
  let lastUpdate = Object.assign({}, this.lastUpdate);
@@ -19028,7 +18798,7 @@ const UnregisterAllCommand = "unregisterAll";
19028
18798
  class HotkeysImpl {
19029
18799
  constructor(agm) {
19030
18800
  this.agm = agm;
19031
- this.registry = lib$1();
18801
+ this.registry = lib();
19032
18802
  this.firstHotkey = true;
19033
18803
  this.hotkeys = new Map();
19034
18804
  }
@@ -19108,7 +18878,7 @@ function factory$3(agm) {
19108
18878
  };
19109
18879
  }
19110
18880
 
19111
- var version = "6.1.0";
18881
+ var version = "6.2.0";
19112
18882
 
19113
18883
  var prepareConfig = (options) => {
19114
18884
  function getLibConfig(value, defaultMode, trueMode) {
@@ -19176,7 +18946,7 @@ var prepareConfig = (options) => {
19176
18946
  class Glue42Notification {
19177
18947
  constructor(options) {
19178
18948
  this.options = options;
19179
- this.callbacks = lib$1();
18949
+ this.callbacks = lib();
19180
18950
  this.actions = options.actions;
19181
18951
  this.body = options.body;
19182
18952
  this.badge = options.badge;
@@ -19248,10 +19018,10 @@ class Notifications {
19248
19018
  this.NotificationsExecuteMethod = "T42.Notifications.Execute";
19249
19019
  this.methodsRegistered = false;
19250
19020
  this.NOTIFICATIONS_CONFIGURE_METHOD_NAME = "T42.Notifications.Configure";
19251
- this.methodNameRoot = "T42.Notifications.Handler-" + shortid();
19021
+ this.methodNameRoot = "T42.Notifications.Handler-" + Utils.generateId();
19252
19022
  this.nextId = 0;
19253
19023
  this.notifications = {};
19254
- this.registry = lib$1();
19024
+ this.registry = lib();
19255
19025
  this.subscribedForNotifications = false;
19256
19026
  this.subscribedCounterStream = false;
19257
19027
  this.subscriptionsCountForNotifications = 0;
@@ -19320,7 +19090,7 @@ class Notifications {
19320
19090
  return result.returned;
19321
19091
  }
19322
19092
  async configure(options) {
19323
- var _a, _b, _c, _d, _e, _f;
19093
+ var _a, _b, _c, _d, _e, _f, _g, _h;
19324
19094
  if (!options || Array.isArray(options)) {
19325
19095
  throw new Error("Invalid options - should be an object.");
19326
19096
  }
@@ -19354,6 +19124,15 @@ class Notifications {
19354
19124
  if (((_f = options.toasts) === null || _f === void 0 ? void 0 : _f.stackBy) && typeof options.toasts.stackBy !== "string") {
19355
19125
  throw new Error("Expected type of (options.toasts.stackBy - string.");
19356
19126
  }
19127
+ if (options.placement && typeof options.placement !== "object") {
19128
+ throw new Error("Expected type of (options.placement - object.");
19129
+ }
19130
+ if (((_g = options.placement) === null || _g === void 0 ? void 0 : _g.toasts) && typeof options.placement.toasts !== "string") {
19131
+ throw new Error("Expected type of (options.placement.toasts - string.");
19132
+ }
19133
+ if (((_h = options.placement) === null || _h === void 0 ? void 0 : _h.panel) && typeof options.placement.panel !== "string") {
19134
+ throw new Error("Expected type of (options.placement.panel - string.");
19135
+ }
19357
19136
  const result = await this.interop.invoke(this.NOTIFICATIONS_CONFIGURE_METHOD_NAME, options);
19358
19137
  return result.returned;
19359
19138
  }
@@ -19858,7 +19637,7 @@ class ThemesImpl {
19858
19637
  constructor(contexts, interop) {
19859
19638
  this.contexts = contexts;
19860
19639
  this.interop = interop;
19861
- this.registry = lib$1();
19640
+ this.registry = lib();
19862
19641
  this.isSubscribed = false;
19863
19642
  this.getConfiguration();
19864
19643
  }
@@ -19935,12 +19714,12 @@ const GLUE42_FDC3_INTENTS_METHOD_PREFIX = "Tick42.FDC3.Intents.";
19935
19714
  const INTENTS_RESOLVER_INTEROP_PREFIX = "T42.Intents.Resolver.Control";
19936
19715
  const INTENTS_RESOLVER_WIDTH = 400;
19937
19716
  const INTENTS_RESOLVER_HEIGHT = 440;
19938
- const DEFAULT_RESOLVER_RESPONSE_TIMEOUT = 60000;
19717
+ const DEFAULT_RESOLVER_RESPONSE_TIMEOUT = 60 * 1000;
19939
19718
  const INTENT_HANDLER_DEFAULT_PROPS = ["applicationName", "type"];
19940
19719
  const INTENTS_RESOLVER_APP_NAME = "intentsResolver";
19941
- const MAX_SET_TIMEOUT_DELAY = 2147483647;
19942
- const DEFAULT_METHOD_RESPONSE_TIMEOUT_MS = 60000;
19943
- const DEFAULT_RAISE_TIMEOUT_MS = 90000;
19720
+ const DEFAULT_METHOD_RESPONSE_TIMEOUT_MS = 60 * 1000;
19721
+ const DEFAULT_RAISE_TIMEOUT_MS = 90 * 1000;
19722
+ const DEFAULT_PICK_HANDLER_BY_TIMEOUT_MS = 90 * 1000;
19944
19723
 
19945
19724
  const PromisePlus = (executor, timeoutMilliseconds, timeoutMessage) => {
19946
19725
  return new Promise((resolve, reject) => {
@@ -19991,6 +19770,179 @@ const PromiseWrap = (promise, timeoutMilliseconds, timeoutMessage) => {
19991
19770
  });
19992
19771
  };
19993
19772
 
19773
+ const validateIntentHandlerAsResponse = (handler) => {
19774
+ if (typeof handler !== "object") {
19775
+ return { isValid: false, error: `Response object has invalid 'handler' key. Expected an object, got ${typeof handler}` };
19776
+ }
19777
+ const compulsoryKeysExist = INTENT_HANDLER_DEFAULT_PROPS.filter((key) => !(key in handler));
19778
+ if (compulsoryKeysExist.length) {
19779
+ return { isValid: false, error: `Handler in Response object does not provide compulsory keys: ${compulsoryKeysExist.join(", ")}` };
19780
+ }
19781
+ return { isValid: true, ok: handler };
19782
+ };
19783
+ const validateRaiseIntentsResolverResponse = (responseObj) => {
19784
+ const invalidKey = Object.keys(responseObj).some((key) => key !== "intent" && key !== "handler");
19785
+ if (invalidKey) {
19786
+ return { isValid: false, error: "Response is not a valid object. Expected { intent: string, handler: IntentHandler }" };
19787
+ }
19788
+ if (typeof responseObj.intent !== "string") {
19789
+ return { isValid: false, error: `Response object has invalid 'intent' key. Expected a string, got ${typeof responseObj.intent}` };
19790
+ }
19791
+ const { isValid, error } = validateIntentHandlerAsResponse(responseObj.handler);
19792
+ return isValid
19793
+ ? { isValid: true, ok: { intent: responseObj.intent, handler: responseObj.handler } }
19794
+ : { isValid: false, error };
19795
+ };
19796
+ const validateFilterHandlersResolverResponse = (responseObj) => {
19797
+ if (!responseObj.handler) {
19798
+ return { isValid: false, error: "Response is not a valid object. Expected { handler: IntentHandler }" };
19799
+ }
19800
+ const { isValid, error } = validateIntentHandlerAsResponse(responseObj.handler);
19801
+ return isValid
19802
+ ? { isValid: true, ok: { handler: responseObj.handler } }
19803
+ : { isValid: false, error };
19804
+ };
19805
+ const validateIntentRequestTarget = (target) => {
19806
+ if (!target) {
19807
+ return;
19808
+ }
19809
+ if (typeof target !== "string" && typeof target !== "object") {
19810
+ throw new Error(`Please provide the intent target as one of the valid values: "reuse", "startNew", { app: string }, { instance: string } `);
19811
+ }
19812
+ };
19813
+ const validateIntentRequestContext = (context) => {
19814
+ if (!context) {
19815
+ return;
19816
+ }
19817
+ if (typeof context !== "object") {
19818
+ throw new Error(`Please provide the intent context as an object`);
19819
+ }
19820
+ if (context.type && typeof context.type !== "string") {
19821
+ throw new Error(`Please provide the intent context as an object with 'type' property as string`);
19822
+ }
19823
+ if (context.data && typeof context.data !== "object") {
19824
+ throw new Error(`Please provide the intent context as an object with 'data' property as object`);
19825
+ }
19826
+ };
19827
+ const validateIntentRequestHandler = (handler) => {
19828
+ if (!handler.applicationName) {
19829
+ throw new Error(`Please provide applicationName for handler ${JSON.stringify(handler)}`);
19830
+ }
19831
+ if (!handler.type) {
19832
+ throw new Error(`Please provide type for handler ${JSON.stringify(handler)}`);
19833
+ }
19834
+ if (handler.type === "instance" && !handler.instanceId) {
19835
+ throw new Error(`Please provide instanceId for handler ${JSON.stringify(handler)}`);
19836
+ }
19837
+ };
19838
+ const validateIntentRequestTimeout = (timeout) => {
19839
+ if (!timeout) {
19840
+ return;
19841
+ }
19842
+ if (typeof timeout !== "number") {
19843
+ throw new Error(`Please provide the timeout as a number`);
19844
+ }
19845
+ if (timeout <= 0) {
19846
+ throw new Error(`Please provide the timeout as a positive number`);
19847
+ }
19848
+ };
19849
+ const validateWaitUserResponseIndefinitely = (waitUserResponseIndefinitely) => {
19850
+ if (!waitUserResponseIndefinitely) {
19851
+ return;
19852
+ }
19853
+ if (typeof waitUserResponseIndefinitely !== "boolean") {
19854
+ throw new Error("Please provide waitUserResponseIndefinitely as a boolean");
19855
+ }
19856
+ };
19857
+ const validateHandlerFilter = (handlerFilter) => {
19858
+ if (!handlerFilter) {
19859
+ throw new Error(`Provide 'handlerFilter' with at least one filter criteria of the following: 'intent' | 'contextTypes' | 'resultType' | 'applicationNames'`);
19860
+ }
19861
+ const { title, openResolver, timeout, intent, contextTypes, resultType, applicationNames } = handlerFilter;
19862
+ if (typeof title !== "undefined" && (typeof title !== "string" || !title.length)) {
19863
+ throw new Error(`Provide 'title' as a non empty string`);
19864
+ }
19865
+ if (typeof openResolver !== "undefined" && typeof openResolver !== "boolean") {
19866
+ throw new Error(`Provide 'openResolver' prop as a boolean`);
19867
+ }
19868
+ if (typeof timeout !== "undefined" && (typeof timeout !== "number" || timeout <= 0)) {
19869
+ throw new Error(`Provide 'timeout' prop as a positive number`);
19870
+ }
19871
+ if (typeof intent !== "undefined" && (typeof intent !== "string" || !intent.length)) {
19872
+ throw new Error(`Provide 'intent' as a non empty string`);
19873
+ }
19874
+ if (typeof contextTypes !== "undefined" && (!Array.isArray(contextTypes) || contextTypes.some(ctx => typeof ctx !== "string"))) {
19875
+ throw new Error(`Provide 'contextTypes' as an array of non empty strings`);
19876
+ }
19877
+ if (typeof resultType !== "undefined" && (typeof resultType !== "string" || !resultType.length)) {
19878
+ throw new Error(`Provide 'resultType' as a non empty string`);
19879
+ }
19880
+ if (typeof applicationNames !== "undefined" && (!Array.isArray(applicationNames) || applicationNames.some(appName => typeof appName !== "string"))) {
19881
+ throw new Error(`Provide 'applicationNames' as an array of non empty strings`);
19882
+ }
19883
+ const errorMsg = "Provide at least one filter criteria of the following: 'intent' | 'contextTypes' | 'resultType' | 'applicationNames'";
19884
+ if (!Object.keys(handlerFilter).length) {
19885
+ throw new Error(errorMsg);
19886
+ }
19887
+ if (!intent && !resultType && (!contextTypes || !contextTypes.length) && (!applicationNames || !applicationNames.length)) {
19888
+ throw new Error(errorMsg);
19889
+ }
19890
+ };
19891
+ const validateIntentsResolverResponse = (method, responseObj) => {
19892
+ return method === "raise" ? validateRaiseIntentsResolverResponse(responseObj) : validateFilterHandlersResolverResponse(responseObj);
19893
+ };
19894
+ const validateIntentRequest = (request) => {
19895
+ validateIntentRequestContext(request.context);
19896
+ validateIntentRequestTarget(request.target);
19897
+ validateIntentRequestTimeout(request.timeout);
19898
+ validateWaitUserResponseIndefinitely(request.waitUserResponseIndefinitely);
19899
+ if (request.handlers) {
19900
+ request.handlers.forEach((handler) => validateIntentRequestHandler(handler));
19901
+ }
19902
+ };
19903
+ const validateIntentHandler = (handler) => {
19904
+ if (typeof handler !== "object") {
19905
+ throw new Error("IntentHandler must be an object");
19906
+ }
19907
+ if (typeof handler.applicationName !== "string" || !handler.applicationName.length) {
19908
+ throw new Error(`Please provide 'applicationName' as a non-empty string`);
19909
+ }
19910
+ if (typeof handler.type !== "string" || !["app", "instance"].includes(handler.type)) {
19911
+ throw new Error(`Invalid 'type' property. Expected 'app' | 'instance' got ${handler.type}`);
19912
+ }
19913
+ if (typeof handler.applicationTitle !== "undefined" && typeof handler.applicationTitle !== "string") {
19914
+ throw new Error(`Provide 'applicationTitle' as a string`);
19915
+ }
19916
+ if (typeof handler.applicationDescription !== "undefined" && typeof handler.applicationDescription !== "string") {
19917
+ throw new Error(`Provide 'applicationDescription' as a string`);
19918
+ }
19919
+ if (typeof handler.applicationIcon !== "undefined" && typeof handler.applicationIcon !== "string") {
19920
+ throw new Error(`Provide 'applicationIcon' as a string`);
19921
+ }
19922
+ if (typeof handler.displayName !== "undefined" && typeof handler.displayName !== "string") {
19923
+ throw new Error(`Provide 'displayName' as a string`);
19924
+ }
19925
+ if (typeof handler.contextTypes !== "undefined" && (!Array.isArray(handler.contextTypes) || handler.contextTypes.some(ctx => typeof ctx !== "string"))) {
19926
+ throw new Error(`Provide 'contextTypes' as an array of non empty strings`);
19927
+ }
19928
+ if (typeof handler.instanceId !== "undefined" && typeof handler.instanceId !== "string") {
19929
+ throw new Error(`Provide 'instanceId' as a string`);
19930
+ }
19931
+ if (typeof handler.instanceTitle !== "undefined" && typeof handler.instanceTitle !== "string") {
19932
+ throw new Error(`Provide 'instanceTitle' as a string`);
19933
+ }
19934
+ if (typeof handler.resultType !== "undefined" && typeof handler.resultType !== "string") {
19935
+ throw new Error(`Provide 'resultType' as a string`);
19936
+ }
19937
+ };
19938
+ const clearNullUndefined = (obj) => {
19939
+ Object.keys(obj).forEach(key => {
19940
+ if (obj[key] === null || obj[key] === undefined) {
19941
+ delete obj[key];
19942
+ }
19943
+ });
19944
+ };
19945
+
19994
19946
  class Intents {
19995
19947
  constructor(interop, windows, logger, options, appManager) {
19996
19948
  this.interop = interop;
@@ -20035,7 +19987,7 @@ class Intents {
20035
19987
  if (typeof intentRequest === "string") {
20036
19988
  intentRequest = { intent: intentRequest };
20037
19989
  }
20038
- this.validateIntentRequest(intentRequest);
19990
+ validateIntentRequest(intentRequest);
20039
19991
  await Promise.all(this.unregisterIntentPromises);
20040
19992
  const timeout = intentRequest.timeout || DEFAULT_RAISE_TIMEOUT_MS;
20041
19993
  const resolverInstance = {};
@@ -20207,20 +20159,79 @@ class Intents {
20207
20159
  unsubscribe: () => this.unsubscribeIntent(intentName)
20208
20160
  };
20209
20161
  }
20162
+ async filterHandlers(handlerFilter) {
20163
+ var _a, _b;
20164
+ validateHandlerFilter(handlerFilter);
20165
+ if (handlerFilter.openResolver && !this.useIntentsResolverUI) {
20166
+ throw new Error("Cannot resolve 'filterHandlers' request using Intents Resolver UI because it's globally disabled");
20167
+ }
20168
+ (_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Received 'filterHandlers' command with request: ${JSON.stringify(handlerFilter)}`);
20169
+ const filteredHandlers = this.filterHandlersBy(await this.all(), handlerFilter);
20170
+ if (!filteredHandlers || !filteredHandlers.length) {
20171
+ return { handlers: [] };
20172
+ }
20173
+ const { open, reason } = this.checkIfResolverShouldBeOpenedForFilterHandlers(filteredHandlers, handlerFilter);
20174
+ if (!open) {
20175
+ (_b = this.logger) === null || _b === void 0 ? void 0 : _b.trace(`Intent Resolver UI won't be used. Reason: ${reason}`);
20176
+ return { handlers: filteredHandlers };
20177
+ }
20178
+ const resolverInstance = { instanceId: undefined };
20179
+ const timeout = handlerFilter.timeout || DEFAULT_PICK_HANDLER_BY_TIMEOUT_MS;
20180
+ const handler = await PromiseWrap(() => this.startResolverApp({ request: handlerFilter, resolverInstance, method: 'filterHandlers' }), timeout, `Timeout of ${timeout}ms hit for 'filterHandlers' request with filter: ${JSON.stringify(handlerFilter)}`);
20181
+ return { handlers: [handler] };
20182
+ }
20183
+ async getIntents(handler) {
20184
+ var _a;
20185
+ this.logger.trace(`Received 'getIntents' command with handler ${JSON.stringify(handler)}`);
20186
+ validateIntentHandler(handler);
20187
+ const intents = await this.all();
20188
+ clearNullUndefined(handler);
20189
+ (_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Extracting valid intents for the passed handler`);
20190
+ const intentsWithInfo = this.extractIntentsWithInfoByHandler(intents, handler);
20191
+ this.logger.trace(`Returning intents for handler ${JSON.stringify(handler)}`);
20192
+ return { intents: intentsWithInfo };
20193
+ }
20194
+ filterHandlersBy(intents, filter) {
20195
+ const filteredIntentsWithHandlers = intents.filter((intent) => {
20196
+ if (filter.intent && filter.intent !== intent.name) {
20197
+ return;
20198
+ }
20199
+ if (filter.resultType) {
20200
+ const filteredHandlers = intent.handlers.filter((handler) => handler.resultType && handler.resultType === filter.resultType);
20201
+ if (!filteredHandlers.length)
20202
+ return;
20203
+ intent.handlers = filteredHandlers;
20204
+ }
20205
+ if (filter.contextTypes) {
20206
+ const filteredHandlers = intent.handlers.filter((handler) => { var _a; return (_a = filter.contextTypes) === null || _a === void 0 ? void 0 : _a.every((contextType) => { var _a; return (_a = handler.contextTypes) === null || _a === void 0 ? void 0 : _a.includes(contextType); }); });
20207
+ if (!filteredHandlers.length)
20208
+ return;
20209
+ intent.handlers = filteredHandlers;
20210
+ }
20211
+ if (filter.applicationNames) {
20212
+ const filteredHandlers = intent.handlers.filter((handler) => { var _a; return (_a = filter.applicationNames) === null || _a === void 0 ? void 0 : _a.includes(handler.applicationName); });
20213
+ if (!filteredHandlers.length)
20214
+ return;
20215
+ intent.handlers = filteredHandlers;
20216
+ }
20217
+ return intent;
20218
+ });
20219
+ return filteredIntentsWithHandlers.map((intent) => intent.handlers).flat(1);
20220
+ }
20210
20221
  async coreRaiseIntent({ request, resolverInstance, timeout }) {
20211
20222
  var _a, _b;
20212
20223
  const intentDef = await this.get(request.intent);
20213
20224
  if (typeof intentDef === "undefined") {
20214
20225
  throw new Error(`Intent ${request.intent} not found.`);
20215
20226
  }
20216
- const { open, reason } = this.checkIfResolverShouldBeOpened(intentDef, request);
20227
+ const { open, reason } = this.checkIfResolverShouldBeOpenedForRaise(intentDef, request);
20217
20228
  if (!open) {
20218
20229
  this.logger.trace(`Intent Resolver UI won't be used. Reason: ${reason}`);
20219
20230
  return request.waitUserResponseIndefinitely
20220
20231
  ? PromiseWrap(() => this.raiseIntent(request, timeout), timeout, `Timeout of ${timeout}ms hit for raise to resolve`)
20221
20232
  : this.raiseIntent(request, timeout);
20222
20233
  }
20223
- const resolverHandler = await this.startResolverApp(request, resolverInstance);
20234
+ const resolverHandler = await this.startResolverApp({ request, method: "raise", resolverInstance });
20224
20235
  (_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Raising intent to target handler: ${JSON.stringify(resolverHandler)} with timeout of ${timeout}`);
20225
20236
  if (request.waitUserResponseIndefinitely) {
20226
20237
  return PromiseWrap(() => this.raiseIntentToTargetHandler(request, resolverHandler, timeout), timeout, `Timeout of ${timeout}ms hit for raise to resolve`);
@@ -20278,22 +20289,29 @@ class Intents {
20278
20289
  result: result.returned
20279
20290
  };
20280
20291
  }
20281
- async startResolverApp(intentRequest, resolverInstance) {
20292
+ async startResolverApp({ request, method, resolverInstance }) {
20282
20293
  var _a, _b, _c, _d;
20283
- (_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Intents Resolver UI with app name ${this.intentsResolverAppName} will be used`);
20284
- const responseMethodName = await this.registerIntentResolverMethod();
20294
+ (_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Intents Resolver UI with app name ${this.intentsResolverAppName} will be used for request: ${JSON.stringify(request)}`);
20295
+ const responseMethodName = await this.registerIntentResolverMethod(method);
20285
20296
  (_b = this.logger) === null || _b === void 0 ? void 0 : _b.trace(`Registered interop method ${responseMethodName}`);
20286
- const startContext = this.buildStartContext(intentRequest, responseMethodName);
20297
+ const startContext = this.buildStartContext(method, request, responseMethodName);
20287
20298
  const startOptions = await this.buildStartOptions();
20288
20299
  (_c = this.logger) === null || _c === void 0 ? void 0 : _c.trace(`Starting Intents Resolver UI with context: ${JSON.stringify(startContext)} and options: ${JSON.stringify(startOptions)}`);
20289
20300
  const instance = await this.appManager.application(this.intentsResolverAppName).start(startContext, startOptions);
20290
- if (resolverInstance) {
20291
- resolverInstance.instanceId = instance.id;
20292
- }
20301
+ resolverInstance.instanceId = instance.id;
20293
20302
  (_d = this.logger) === null || _d === void 0 ? void 0 : _d.trace(`Intents Resolver instance with id ${instance.id} opened`);
20294
- this.subscribeOnInstanceStopped(instance);
20295
- this.createResponsePromise(intentRequest, instance.id, responseMethodName);
20296
- const handler = await this.handleInstanceResponse(instance.id);
20303
+ this.subscribeOnInstanceStopped(instance, method);
20304
+ const timeout = request.timeout || method === "raise" ? DEFAULT_RAISE_TIMEOUT_MS : DEFAULT_PICK_HANDLER_BY_TIMEOUT_MS;
20305
+ this.createResponsePromise({
20306
+ intent: method === "raise" ? request.intent : undefined,
20307
+ instanceId: instance.id,
20308
+ responseMethodName,
20309
+ timeout,
20310
+ errorMsg: `Timeout of ${timeout}ms hit waiting for the user to choose a handler ${method === "raise"
20311
+ ? `for intent ${request.intent}`
20312
+ : `for '${method}' method with filter ${JSON.stringify(request)}`}`
20313
+ });
20314
+ const handler = await this.handleInstanceResponse(instance.id, method);
20297
20315
  return handler;
20298
20316
  }
20299
20317
  async windowsIdToTitle(id, windowsInfos) {
@@ -20305,43 +20323,43 @@ class Intents {
20305
20323
  const title = await (window === null || window === void 0 ? void 0 : window.getTitle());
20306
20324
  return title;
20307
20325
  }
20308
- async handleInstanceResponse(instanceId) {
20309
- var _a;
20326
+ async handleInstanceResponse(instanceId, method) {
20327
+ var _a, _b;
20310
20328
  try {
20311
- const { handler, intent } = await this.intentsResolverResponsePromises[instanceId].promise;
20312
- (_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Intent handler chosen for intent ${intent}: ${JSON.stringify(handler)}`);
20329
+ const response = await this.intentsResolverResponsePromises[instanceId].promise;
20330
+ (_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Intent handler chosen ${method === "raise" ? `for intent ${response.intent} ` : ""}: ${JSON.stringify(response.handler)}. Stopping resolver instance with id ${instanceId}`);
20313
20331
  this.stopResolverInstance(instanceId);
20314
- return handler;
20332
+ (_b = this.logger) === null || _b === void 0 ? void 0 : _b.trace(`Instance with id ${instanceId} successfully stopped`);
20333
+ return response.handler;
20315
20334
  }
20316
20335
  catch (error) {
20317
20336
  this.stopResolverInstance(instanceId);
20318
20337
  throw new Error(error);
20319
20338
  }
20320
20339
  }
20321
- async registerIntentResolverMethod() {
20322
- const methodName = INTENTS_RESOLVER_INTEROP_PREFIX + shortid();
20323
- await this.interop.register(methodName, this.resolverResponseHandler.bind(this));
20340
+ async registerIntentResolverMethod(method) {
20341
+ const methodName = INTENTS_RESOLVER_INTEROP_PREFIX + Utils.generateId();
20342
+ await this.interop.register(methodName, (args, callerId) => this.resolverResponseHandler(args, callerId, method));
20324
20343
  return methodName;
20325
20344
  }
20326
- resolverResponseHandler(args, callerId) {
20345
+ resolverResponseHandler(args, callerId, method) {
20327
20346
  const { instance } = callerId;
20328
- const isValid = this.validateIntentsResolverResponse(args);
20347
+ const isValid = validateIntentsResolverResponse(method, args);
20329
20348
  if (!isValid) {
20330
- this.logger.trace(`Intent Resolver sent invalid response. Error: ${isValid.error}`);
20349
+ this.logger.trace(`Intent Resolver instance with id ${callerId.instance} sent invalid response. Error: ${isValid.error}`);
20331
20350
  this.intentsResolverResponsePromises[instance].reject(isValid.error);
20332
20351
  this.stopResolverInstance(instance);
20352
+ return;
20333
20353
  }
20334
20354
  const validResponse = isValid.ok;
20335
20355
  this.intentsResolverResponsePromises[instance].resolve(validResponse);
20336
20356
  this.cleanUpIntentResolverPromise(instance);
20337
20357
  }
20338
- buildStartContext(request, methodName) {
20339
- const startContext = {
20340
- intent: request,
20341
- callerId: this.interop.instance.instance,
20342
- methodName
20343
- };
20344
- return startContext;
20358
+ buildStartContext(method, request, methodName) {
20359
+ const baseStartContext = { callerId: this.interop.instance.instance, methodName };
20360
+ return method === "raise"
20361
+ ? { ...baseStartContext, intent: request }
20362
+ : { ...baseStartContext, handlerFilter: request };
20345
20363
  }
20346
20364
  async buildStartOptions() {
20347
20365
  const win = this.windows.my();
@@ -20352,29 +20370,35 @@ class Intents {
20352
20370
  return {
20353
20371
  top: (bounds.height - INTENTS_RESOLVER_HEIGHT) / 2 + bounds.top,
20354
20372
  left: (bounds.width - INTENTS_RESOLVER_WIDTH) / 2 + bounds.left,
20373
+ width: INTENTS_RESOLVER_WIDTH,
20374
+ height: INTENTS_RESOLVER_HEIGHT
20355
20375
  };
20356
20376
  }
20357
- createResponsePromise(intentRequest, instanceId, methodName) {
20358
- let resolve;
20359
- let reject;
20360
- const waitResponseTimeout = intentRequest.waitUserResponseIndefinitely ? MAX_SET_TIMEOUT_DELAY : this.intentsResolverResponseTimeout;
20377
+ createResponsePromise({ instanceId, intent, responseMethodName, timeout, errorMsg }) {
20378
+ let resolve = () => { };
20379
+ let reject = () => { };
20361
20380
  const promise = PromisePlus((res, rej) => {
20362
20381
  resolve = res;
20363
20382
  reject = rej;
20364
- }, waitResponseTimeout, `Timeout of ${waitResponseTimeout}ms hit waiting for the user to choose a handler for intent ${intentRequest.intent}`);
20365
- this.intentsResolverResponsePromises[instanceId] = { intent: intentRequest.intent, resolve, reject, promise, methodName };
20383
+ }, timeout, errorMsg);
20384
+ this.intentsResolverResponsePromises[instanceId] = { intent, resolve, reject, promise, methodName: responseMethodName };
20366
20385
  }
20367
20386
  async invokeStartApp(application, context, options) {
20368
20387
  const result = await this.interop.invoke("T42.ACS.StartApplication", { Name: application, options });
20369
20388
  return result.returned.Id;
20370
20389
  }
20371
- subscribeOnInstanceStopped(instance) {
20372
- const unsub = instance.onStopped((inst) => {
20390
+ subscribeOnInstanceStopped(instance, method) {
20391
+ const { application } = instance;
20392
+ const unsub = application.onInstanceStopped((inst) => {
20393
+ if (inst.id !== instance.id) {
20394
+ return;
20395
+ }
20373
20396
  const intentPromise = this.intentsResolverResponsePromises[inst.id];
20374
20397
  if (!intentPromise) {
20375
20398
  return unsub();
20376
20399
  }
20377
- intentPromise.reject(`Cannot resolve raise intent ${intentPromise.intent} - User closed ${this.intentsResolverAppName} app without choosing an intent handler`);
20400
+ const errorMsg = `Cannot resolve ${method === "raise" ? `raised intent ${intentPromise.intent}` : `'${method}' method`} - User closed ${instance.application.name} app without choosing a handler`;
20401
+ intentPromise.reject(errorMsg);
20378
20402
  this.cleanUpIntentResolverPromise(inst.id);
20379
20403
  unsub();
20380
20404
  });
@@ -20388,23 +20412,6 @@ class Intents {
20388
20412
  unregisterPromise.catch((error) => this.logger.warn(error));
20389
20413
  delete this.intentsResolverResponsePromises[instanceId];
20390
20414
  }
20391
- validateIntentsResolverResponse(responseObj) {
20392
- const invalidKey = Object.keys(responseObj).some((key) => key !== "intent" && key !== "handler");
20393
- if (invalidKey) {
20394
- return { isValid: false, error: "Response is not a valid object. Expected { intent: string, handler: IntentHandler }" };
20395
- }
20396
- if (typeof responseObj.intent !== "string") {
20397
- return { isValid: false, error: `Response object has invalid 'intent' key. Expected a string, got ${typeof responseObj.intent}` };
20398
- }
20399
- if (typeof responseObj.handler !== "object") {
20400
- return { isValid: false, error: `Response object has invalid 'handler' key. Expected an object, got ${typeof responseObj.handler}` };
20401
- }
20402
- const compulsoryKeysExist = INTENT_HANDLER_DEFAULT_PROPS.filter((key) => !(key in responseObj.handler));
20403
- if (compulsoryKeysExist.length) {
20404
- return { isValid: false, error: `Handler in Response object does not provide compulsory keys: ${compulsoryKeysExist.join(", ")}` };
20405
- }
20406
- return { isValid: true, ok: { intent: responseObj.intent, handler: { ...responseObj.handler } } };
20407
- }
20408
20415
  handleRaiseOnError(instanceId) {
20409
20416
  if (!instanceId) {
20410
20417
  return;
@@ -20427,18 +20434,34 @@ class Intents {
20427
20434
  this.intentsResolverAppName = (_c = (_b = options.intents) === null || _b === void 0 ? void 0 : _b.intentsResolverAppName) !== null && _c !== void 0 ? _c : INTENTS_RESOLVER_APP_NAME;
20428
20435
  this.intentsResolverResponseTimeout = (_e = (_d = options.intents) === null || _d === void 0 ? void 0 : _d.methodResponseTimeoutMs) !== null && _e !== void 0 ? _e : DEFAULT_RESOLVER_RESPONSE_TIMEOUT;
20429
20436
  }
20430
- checkIfResolverShouldBeOpened(intent, request) {
20437
+ checkIfResolverShouldBeOpenedForRaise(intent, request) {
20438
+ const checkOpen = this.checkIfIntentsResolverShouldBeOpened();
20439
+ if (!checkOpen.open) {
20440
+ return checkOpen;
20441
+ }
20442
+ const hasMoreThanOneHandler = this.checkIfIntentHasMoreThanOneHandler(intent, request);
20443
+ if (!hasMoreThanOneHandler) {
20444
+ return { open: false, reason: `Raised intent ${intent.name} has only one handler` };
20445
+ }
20446
+ return { open: true };
20447
+ }
20448
+ checkIfResolverShouldBeOpenedForFilterHandlers(handlers, filter) {
20449
+ if (handlers.length === 1) {
20450
+ return { open: false, reason: `There's only one valid intent handler for filter ${JSON.stringify(filter)}` };
20451
+ }
20452
+ if (typeof (filter === null || filter === void 0 ? void 0 : filter.openResolver) === "boolean" && !filter.openResolver) {
20453
+ return { open: false, reason: "Intents resolver is disabled by IntentHandler filter" };
20454
+ }
20455
+ return this.checkIfIntentsResolverShouldBeOpened();
20456
+ }
20457
+ checkIfIntentsResolverShouldBeOpened() {
20431
20458
  if (!this.useIntentsResolverUI) {
20432
- return { open: false, reason: `Intent Resolver is disabled. Raising intent to first found handler` };
20459
+ return { open: false, reason: `Intent Resolver is disabled. Resolving to first found handler` };
20433
20460
  }
20434
20461
  const intentsResolverApp = this.appManager.application(this.intentsResolverAppName);
20435
20462
  if (!intentsResolverApp) {
20436
20463
  return { open: false, reason: `Intent Resolver Application with name ${this.intentsResolverAppName} not found.` };
20437
20464
  }
20438
- const hasMoreThanOneHandler = this.checkIfIntentHasMoreThanOneHandler(intent, request);
20439
- if (!hasMoreThanOneHandler) {
20440
- return { open: false, reason: `Raised intent ${intent.name} has only one handler` };
20441
- }
20442
20465
  return { open: true };
20443
20466
  }
20444
20467
  checkIfIntentHasMoreThanOneHandler(intent, request) {
@@ -20482,67 +20505,6 @@ class Intents {
20482
20505
  this.clearUnregistrationPromise(unregisterPromise);
20483
20506
  });
20484
20507
  }
20485
- validateIntentRequest(request) {
20486
- this.validateIntentRequestContext(request.context);
20487
- this.validateIntentRequestTarget(request.target);
20488
- this.validateIntentRequestTimeout(request.timeout);
20489
- this.validateWaitUserResponseIndefinitely(request.waitUserResponseIndefinitely);
20490
- if (request.handlers) {
20491
- request.handlers.forEach((handler) => this.validateIntentRequestHandler(handler));
20492
- }
20493
- }
20494
- validateIntentRequestTarget(target) {
20495
- if (!target) {
20496
- return;
20497
- }
20498
- if (typeof target !== "string" && typeof target !== "object") {
20499
- throw new Error(`Please provide the intent target as one of the valid values: "reuse", "startNew", { app: string }, { instance: string } `);
20500
- }
20501
- }
20502
- validateIntentRequestContext(context) {
20503
- if (!context) {
20504
- return;
20505
- }
20506
- if (typeof context !== "object") {
20507
- throw new Error(`Please provide the intent context as an object`);
20508
- }
20509
- if (context.type && typeof context.type !== "string") {
20510
- throw new Error(`Please provide the intent context as an object with 'type' property as string`);
20511
- }
20512
- if (context.data && typeof context.data !== "object") {
20513
- throw new Error(`Please provide the intent context as an object with 'data' property as object`);
20514
- }
20515
- }
20516
- validateIntentRequestHandler(handler) {
20517
- if (!handler.applicationName) {
20518
- throw new Error(`Please provide applicationName for handler ${JSON.stringify(handler)}`);
20519
- }
20520
- if (!handler.type) {
20521
- throw new Error(`Please provide type for handler ${JSON.stringify(handler)}`);
20522
- }
20523
- if (handler.type === "instance" && !handler.instanceId) {
20524
- throw new Error(`Please provide instanceId for handler ${JSON.stringify(handler)}`);
20525
- }
20526
- }
20527
- validateIntentRequestTimeout(timeout) {
20528
- if (!timeout) {
20529
- return;
20530
- }
20531
- if (typeof timeout !== "number") {
20532
- throw new Error(`Please provide the timeout as a number`);
20533
- }
20534
- if (timeout <= 0) {
20535
- throw new Error(`Please provide the timeout as a positive number`);
20536
- }
20537
- }
20538
- validateWaitUserResponseIndefinitely(waitUserResponseIndefinitely) {
20539
- if (!waitUserResponseIndefinitely) {
20540
- return;
20541
- }
20542
- if (typeof waitUserResponseIndefinitely !== "boolean") {
20543
- throw new Error("Please provide waitUserResponseIndefinitely as a boolean");
20544
- }
20545
- }
20546
20508
  findHandlerByFilter(handlers, filter) {
20547
20509
  if (filter.type) {
20548
20510
  return handlers.find((handler) => handler.type === filter.type);
@@ -20556,6 +20518,32 @@ class Intents {
20556
20518
  return handlers.find((handler) => handler.applicationName === filter.app);
20557
20519
  }
20558
20520
  }
20521
+ extractIntentsWithInfoByHandler(intents, handler) {
20522
+ const intentsWithInfo = intents.reduce((validIntentsWithInfo, intent) => {
20523
+ intent.handlers.forEach((currentHandler) => {
20524
+ const isValid = Object.keys(handler).every((key) => {
20525
+ var _a;
20526
+ return key === "contextTypes"
20527
+ ? (_a = handler.contextTypes) === null || _a === void 0 ? void 0 : _a.every((contextType) => { var _a; return (_a = currentHandler.contextTypes) === null || _a === void 0 ? void 0 : _a.includes(contextType); })
20528
+ : currentHandler[key] === handler[key];
20529
+ });
20530
+ if (!isValid) {
20531
+ return;
20532
+ }
20533
+ const intentWithInfo = {
20534
+ intent: intent.name,
20535
+ contextTypes: currentHandler.contextTypes,
20536
+ description: currentHandler.applicationDescription,
20537
+ displayName: currentHandler.displayName,
20538
+ icon: currentHandler.applicationIcon,
20539
+ resultType: currentHandler.resultType
20540
+ };
20541
+ validIntentsWithInfo.push(intentWithInfo);
20542
+ });
20543
+ return validIntentsWithInfo;
20544
+ }, []);
20545
+ return intentsWithInfo;
20546
+ }
20559
20547
  }
20560
20548
 
20561
20549
  class FactoryCallInfo {
@@ -20588,7 +20576,7 @@ class Prefs {
20588
20576
  constructor(appName, interop) {
20589
20577
  this.appName = appName;
20590
20578
  this.interop = interop;
20591
- this.registry = lib$1();
20579
+ this.registry = lib();
20592
20580
  this.interopMethodRegistered = false;
20593
20581
  }
20594
20582
  async get(app) {