{“ast”:null,“code”:“'use strict';nnObject.defineProperty(exports, "__esModule", {n value: truen});nnvar _slicedToArray = function () {n function sliceIterator(arr, i) {n var _arr = [];n var _n = true;n var _d = false;n var _e = undefined;nn try {n for (var _i = arr(), _s; !(_n = (_s = _i.next()).done); _n = true) {n _arr.push(_s.value);nn if (i && _arr.length === i) break;n }n } catch (err) {n _d = true;n _e = err;n } finally {n try {n if (!_n && _i) _i();n } finally {n if (_d) throw _e;n }n }nn return _arr;n }nn return function (arr, i) {n if (Array.isArray(arr)) {n return arr;n } else if (Symbol.iterator in Object(arr)) {n return sliceIterator(arr, i);n } else {n throw new TypeError("Invalid attempt to destructure non-iterable instance");n }n };n}();n/**n * Inspect the elements' IDs and add them to the CSS Selectorn * @param {array} hierarchy. The hierarchy of elementsn * @param {object} state. The current selector state (has the stack and specificity sum)n */nnnexports = function (hierarchy, state, validateSelector, config, query) {n return hierarchy.reduce(function (selectorState, currentElem, index) {n if (!selectorState.verified) {n var _filter$filter$map = [currentElem.el.getAttribute('id')].filter(function (id) {n return (0, _validationHelpers.attr)(id);n } // make sure the ID is uniquen ).filter(function (id) {n return (0, _queryEngine.isUniqueElementID)(query, id);n }).map(function (validId) {n selectorState.stack.push('[id=\'' + validId + '\']');n selectorState.specificity += 100;nn if (selectorState.specificity >= config.specificityThreshold) {n // we have reached the minimum specificity, lets try verifying now, as this will save us having to add more IDs to the selectorn if (validateSelector(selectorState)) {n // The ID worked like a charm - mark this state as verified and move on!n selectorState.verified = true;n }n }nn if (!selectorState.verified && index === 0) {n // if the index is 0 then this is the ID of the actual element! Which means we have found our selector!n // The ID wasn't enough, this means the page, this should never happen as we tested for the ID's uniquness, but just incasen // we will pop it from the stack as it only adds noisen selectorState.stack.pop();n selectorState.specificity -= 100;n }nn return selectorState;n }),n _filter$filter$map2 = _slicedToArray(_filter$filter$map, 1),n validatedState = _filter$filter$map2;nn return validatedState || selectorState;n }nn return selectorState;n }, state);n};nnvar _queryEngine = require('../queryEngine');nnvar _validationHelpers = require('./validationHelpers');”,“map”:null,“metadata”:{},“sourceType”:“module”}