elementAXObjectMap.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports["default"] = void 0;
  6. var _AXObjectsMap = _interopRequireDefault(require("./AXObjectsMap"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
  9. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
  10. function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  11. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  12. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
  13. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
  14. function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
  15. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
  16. var axObjectNames = _toConsumableArray(_AXObjectsMap["default"].keys());
  17. var elementAXObjectMap = new Map([]);
  18. var _iteratorNormalCompletion = true;
  19. var _didIteratorError = false;
  20. var _iteratorError = undefined;
  21. try {
  22. var _loop = function _loop() {
  23. var _step$value = _slicedToArray(_step.value, 2),
  24. name = _step$value[0],
  25. def = _step$value[1];
  26. var relatedConcepts = def.relatedConcepts;
  27. if (Array.isArray(relatedConcepts)) {
  28. relatedConcepts.forEach(function (relation) {
  29. if (relation.module === 'HTML') {
  30. var concept = relation.concept;
  31. if (concept) {
  32. var conceptStr = JSON.stringify(concept);
  33. var axObjects = (_toConsumableArray(elementAXObjectMap.entries()).find(function (_ref) {
  34. var _ref2 = _slicedToArray(_ref, 2),
  35. key = _ref2[0],
  36. value = _ref2[1];
  37. return JSON.stringify(key) === conceptStr;
  38. }) || [])[1];
  39. if (!axObjects) {
  40. axObjects = new Set([]);
  41. }
  42. axObjects.add(name);
  43. elementAXObjectMap.set(concept, axObjects);
  44. }
  45. }
  46. });
  47. }
  48. };
  49. for (var _iterator = _AXObjectsMap["default"][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  50. _loop();
  51. }
  52. } catch (err) {
  53. _didIteratorError = true;
  54. _iteratorError = err;
  55. } finally {
  56. try {
  57. if (!_iteratorNormalCompletion && _iterator["return"] != null) {
  58. _iterator["return"]();
  59. }
  60. } finally {
  61. if (_didIteratorError) {
  62. throw _iteratorError;
  63. }
  64. }
  65. }
  66. var _default = elementAXObjectMap;
  67. exports["default"] = _default;